:root {
  --bg: #f4f6f9;
  --surface: rgba(255, 255, 255, .86);
  --surface-2: rgba(248, 250, 252, .8);
  --ink: #1b2430;
  --muted: #5d6b7c;
  --line: #dde3ea;
  --accent: #1f4e79;
  --accent-ink: #ffffff;
  --accent-soft: #e6eef7;
  --good: #1d7a46;
  --good-soft: #e5f4ec;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --bad: #b3261e;
  --bad-soft: #fde8e7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.55rem; margin: 1.2rem 0 .8rem; }
h2 { font-size: 1.1rem; margin: 0 0 .7rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }
code { background: var(--accent-soft); padding: 0 .3em; border-radius: 4px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }

/* Club logo watermark behind every page */
body::before {
  content: ""; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: -1; pointer-events: none;
  background: url("watermark.png") no-repeat center 60% / min(78vw, 640px) auto;
  opacity: .13;
}

/* Top bar */
.topbar { background: var(--accent); color: var(--accent-ink); }
.topbar-inner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; min-height: 56px; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.1rem; letter-spacing: .2px; display: flex; align-items: center; gap: .5rem; }
.brand img { display: block; height: 48px; width: auto; margin: 4px 0; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
.hero-logo { display: block; margin: 0 auto .5rem; width: 214px; max-width: 60%; height: auto; }
.login h1 { text-align: center; }
.statement-logo { height: 57px; width: auto; }
.statement-title { flex: 1; }
.mainnav { display: flex; gap: .2rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.mainnav a, .usermenu a {
  color: rgba(255, 255, 255, .88); text-decoration: none; padding: .45rem .7rem; border-radius: 8px; white-space: nowrap;
}
.mainnav a:hover, .usermenu a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.mainnav a.active { background: rgba(255, 255, 255, .2); color: #fff; font-weight: 600; }
.usermenu { display: flex; gap: .2rem; font-size: .9rem; }

@media (max-width: 1180px) {
  .topbar-inner { padding-top: .4rem; padding-bottom: .4rem; gap: .3rem; }
  .mainnav { order: 3; flex-basis: 100%; }
  .usermenu { margin-left: auto; }
}

/* Cards and layout */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 1rem; }
.grid > .card { margin-bottom: 0; }
.grid-wide { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
@media (max-width: 900px) { .grid-wide { grid-template-columns: 1fr; } }

.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pagehead h1 { margin-bottom: .6rem; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .8rem; }
.qnav { display: flex; align-items: center; gap: .5rem; }
.inline { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .6rem 0; }

.stat .big { font-size: 2rem; font-weight: 700; margin: .2rem 0; line-height: 1.1; }
.stat .unit { font-size: .95rem; font-weight: 500; color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.todo { list-style: none; padding: 0; margin: 0; }
.todo li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.todo li:last-child { border-bottom: 0; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-block; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: .55rem 1rem; border-radius: 8px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  line-height: 1.2;
}
.btn:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.btn-danger { background: #fff; color: var(--bad); border-color: #f0b8b4; }
.btn-big { font-size: 1.05rem; padding: .85rem 1.3rem; }
.btn-wide { width: 100%; padding: .8rem; font-size: 1.05rem; }
.danger-zone { margin: 1rem 0 2rem; }

/* Forms */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .75rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; font: inherit; font-weight: 400; color: var(--ink);
  border: 1px solid #c5cfda; border-radius: 8px; padding: .55rem .65rem; background: #fff;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 3px solid rgba(31, 78, 121, .35); outline-offset: 1px; border-color: var(--accent);
}
.inline select { width: auto; margin: 0; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
label.check input { width: auto; margin: 0; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }
p.hint { margin: -.3rem 0 .8rem; }
.row2, .row3 { display: grid; gap: 0 .8rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
input[type=date], input[type=time] { min-width: 0; -webkit-appearance: none; appearance: none; min-height: 2.6em; }
@media (max-width: 480px) { .row3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.big-inputs input, .big-inputs select { font-size: 1.1rem; padding: .7rem .75rem; }
.form-grid.sub { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .5rem; }
.login { margin-top: 3rem; }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; background: var(--surface); font-variant-numeric: tabular-nums; }
.table th, .table td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.table .num { text-align: right; }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-bottom: 0; }
.table.compact th, .table.compact td { padding: .38rem .5rem; }
.table .sel { width: 1%; }
.table .sel input { width: auto; margin: 0; }
.table .empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.table tr.row-warn td { background: #fffaf0; }
.table tr.row-correction td { background: var(--accent-soft); }
.table tr.inactive td { color: var(--muted); }
.table.flights { min-width: 980px; }
.table.flights td.flags { min-width: 220px; }
.remark { max-width: 320px; }
.table .notes { min-width: 200px; }
@media (max-width: 600px) { .hide-sm { display: none; } }
.card > .table-scroll, .card > .table { margin: 0 -.2rem; }

/* Tags and flags */
.flag, .ok-tag {
  display: inline-block; font-size: .78rem; padding: .1rem .45rem; border-radius: 999px; margin: 0 .25rem .2rem 0; line-height: 1.4;
}
.flag-warn { background: var(--warn-soft); color: var(--warn); border: 1px solid #f2d39b; font-weight: 600; }
.flag-done { background: #eef1f4; color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .25); }
.flag-info { background: #eef1f4; color: var(--muted); }
.ok-tag { background: var(--good-soft); color: var(--good); font-weight: 600; }

/* Messages */
.flash { padding: .7rem .9rem; border-radius: 8px; margin: .8rem 0; border: 1px solid; }
.flash-ok { background: var(--good-soft); border-color: #b9e0c9; color: #12512e; }
.flash-error { background: var(--bad-soft); border-color: #f3c0bc; color: #7d1a14; }
.flash-warn { background: var(--warn-soft); border-color: #f2d39b; color: #6b3f00; }
.flash-info { background: var(--accent-soft); border-color: #c9d9ea; color: #17395a; }

.checklist { list-style: none; padding: 0; }
.checklist .pass { color: var(--good); }
.checklist .fail { color: var(--bad); font-weight: 600; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* Statement */
.statement-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.statement-head h2 { margin: .1rem 0; }
.big-name { font-size: 1.3rem; font-weight: 700; }
.totals { display: flex; justify-content: flex-end; margin: 1rem 0; }
.totals dl { display: grid; grid-template-columns: auto auto; gap: .25rem 1.5rem; margin: 0; min-width: 260px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; color: var(--ink); border-top: 1px solid var(--line); padding-top: .3rem; }

.footer { color: var(--muted); font-size: .8rem; padding: 2rem 16px; }

@media print {
  body { background: #fff; font-size: 11pt; }
  body::before { display: none; }
  .topbar, .footer, .no-print, .toolbar, .pagehead .actions { display: none !important; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .table th { background: none; }
  .table-scroll { overflow: visible; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Booking calendar ---------- */
:root {
  --own: #1f4e79;
  --own-soft: #dbe8f6;
  --other: #5d6b7c;
  --other-soft: #eceff3;
  --maint: #9a5b00;
  --maint-soft: #fff1d6;
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg a { padding: .45rem .9rem; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem; }
.seg a.on { background: var(--accent); color: #fff; }

.weekgrid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.wg-head, .wg-body { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); }
.wg-head { border-bottom: 1px solid var(--line); background: #f8fafc; }
.wg-dayhead { padding: .5rem .4rem; font-size: .82rem; color: var(--muted); text-align: center; border-left: 1px solid var(--line); }
.wg-dayhead strong { display: block; color: var(--ink); font-size: .95rem; }
.wg-dayhead.today strong { color: var(--accent); }
.wg-times div { font-size: .72rem; color: var(--muted); text-align: right; padding: 0 .4rem; transform: translateY(-.55em); }
.wg-times div:first-child { transform: none; }
.wg-col {
  position: relative; border-left: 1px solid var(--line); cursor: copy;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 43px, var(--line) 43px, var(--line) 44px);
}
.wg-col.past { background-color: #f6f7f9; cursor: default; }
.wg-col.today { background-color: #f7fbff; }
.wg-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--bad); z-index: 2; pointer-events: none; }
.bk {
  position: absolute; left: 3px; right: 3px; z-index: 1; overflow: hidden; border-radius: 6px; padding: .2rem .35rem;
  font-size: .76rem; line-height: 1.25; text-decoration: none; border-left: 4px solid; cursor: pointer;
}
.bk strong, .bk span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-own { background: var(--own-soft); color: var(--own); border-color: var(--own); }
.bk-other { background: var(--other-soft); color: #2d3742; border-color: var(--other); }
.bk-maint { background: repeating-linear-gradient(45deg, var(--maint-soft), var(--maint-soft) 6px, #ffe6b3 6px, #ffe6b3 12px); color: #6b3f00; border-color: var(--maint); }
.bk:hover { filter: brightness(.97); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.bk-purpose { opacity: .85; }

.agenda { display: none; }
.ag-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; margin-bottom: .5rem; }
.ag-day.today { border-color: var(--accent); }
.ag-date { font-weight: 700; margin-bottom: .3rem; display: flex; justify-content: space-between; align-items: baseline; }
.ag-item { display: block; text-decoration: none; border-left: 4px solid; border-radius: 6px; padding: .4rem .55rem; margin-top: .35rem; }
.ag-time { display: inline-block; min-width: 6.5em; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .weekgrid { display: none; }
  .agenda { display: block; }
}

.monthgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.mg-head { padding: .4rem; text-align: center; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fafc; border-bottom: 1px solid var(--line); }
.mg-cell { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .25rem .3rem; overflow: hidden; }
.mg-cell:nth-child(7n) { border-right: 0; }
.mg-cell.other { background: #fafbfc; }
.mg-cell.other .mg-date { color: #a0aab5; }
.mg-cell.past { background-color: #f7f8fa; }
.mg-cell.today .mg-date { background: var(--accent); color: #fff; }
.mg-date { display: inline-block; min-width: 1.7em; text-align: center; border-radius: 999px; font-weight: 700; font-size: .85rem; text-decoration: none; color: var(--ink); margin-bottom: .15rem; }
.chip {
  display: block; font-size: .74rem; line-height: 1.3; padding: .08rem .35rem; margin-bottom: .15rem; border-radius: 4px; border-left: 3px solid;
  text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip.more { border: 0; color: var(--muted); }
.legend .chip { display: inline-block; margin-right: .3rem; }
@media (max-width: 600px) {
  .mg-cell { min-height: 64px; padding: .15rem; }
  .chip { font-size: .66rem; padding: .05rem .2rem; }
}

.banner { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.banner-actions { display: flex; gap: .4rem; }
.flash-good { background: var(--good-soft); border-color: #9fd4b5; color: #12512e; }
.conflicts ul { margin: 0; padding-left: 1.2rem; }
.copyrow { display: flex; gap: .5rem; align-items: center; margin-top: .3rem; }
.copyrow input { margin: 0; font-size: .85rem; }
.queue { margin: 0; padding-left: 1.3rem; }
.upcoming li { padding: .3rem 0; border-bottom: 1px solid var(--line); list-style: none; }
.upcoming { padding: 0; margin: 0 0 .6rem; }

/* Booking length buttons */
.field { margin-bottom: .75rem; }
.field-label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .35rem; }
.durations { display: flex; flex-wrap: wrap; gap: .4rem; }
.dur {
  font: inherit; font-size: .95rem; font-weight: 600; padding: .5rem .8rem; border-radius: 999px; cursor: pointer;
  border: 1px solid #c5cfda; background: #fff; color: var(--accent);
}
.dur:hover { background: var(--accent-soft); }
.dur.on { background: var(--accent); border-color: var(--accent); color: #fff; }
