:root {
  --navy: #14284b;
  --navy-2: #1f3a66;
  --rust: #c0582f;
  --rust-soft: #f6e3d8;
  --lake: #2f6f8f;
  --lake-soft: #e1eef3;
  --sand: #f6f1ea;
  --sand-2: #ece3d6;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #687082;
  --line: #e4dccf;
  --ok: #2e7d4f;
  --ok-soft: #e2f2e8;
  --warn: #a8690b;
  --warn-soft: #fbefd9;
  --bad: #b3261e;
  --bad-soft: #fbe3e1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 40, 75, .06), 0 4px 14px rgba(20, 40, 75, .05);
  --font: "Manrope", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--sand); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--lake); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 8px; }
.boot { padding: 40vh 0; text-align: center; color: var(--muted); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #d8e0ee; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; color: #fff; }
.brand .mark { width: 36px; height: 36px; }
.brand b { display: block; font-size: 17px; letter-spacing: .12em; }
.brand small { display: block; font-size: 11px; color: #9fb0cc; letter-spacing: .02em; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: #d8e0ee; font-weight: 600; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav a.on { background: #fff; color: var(--navy); }
.nav .sep { height: 1px; background: rgba(255,255,255,.1); margin: 8px 6px; }
.side .me { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.side .me a { color: #9fb0cc; }
.main { min-width: 0; }
.topbar { display: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 28px 28px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(10,20,40,.45); }
  .topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40; background: var(--navy); color: #fff; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar b { letter-spacing: .12em; }
  .topbar button { background: none; border: 0; color: #fff; padding: 6px; display: flex; }
  .page { padding: 20px 16px 80px; }
  h1 { font-size: 22px; }
}

/* ---------- cards & grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > * + * { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; border-radius: 16px; color: #fff; padding: 26px 26px 92px; margin-bottom: 20px;
  background: linear-gradient(180deg, #1b3561 0%, #3f5f8a 45%, #e19a62 82%, #f2c48d 100%); }
.hero svg.mesa { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 110px; }
.hero h1 { font-size: 28px; }
.hero p { color: #e6ecf6; margin: 6px 0 0; max-width: 620px; }
.hero .status { position: relative; z-index: 1; display: inline-flex; gap: 8px; align-items: center; margin-top: 14px; background: rgba(10,20,40,.35); padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; backdrop-filter: blur(4px); }
.hero > * { position: relative; z-index: 1; }

/* ---------- stats ---------- */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat .v { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.stat .s { font-size: 13px; color: var(--muted); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #cbbfae; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.accent { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--lake); padding: 6px 8px; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 700; color: #3a4252; }
label.f .lt { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
label.f .hint { font-weight: 500; color: var(--muted); font-size: 12px; }
input, select, textarea { font: inherit; font-size: 15px; color: var(--text); background: #fff; border: 1px solid #d6ccbd; border-radius: 9px; padding: 9px 11px; width: 100%; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid rgba(47,111,143,.25); border-color: var(--lake); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--navy); }
.check { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; cursor: pointer; }
.form { display: grid; gap: 14px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .form .two, .form .three { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 14px; margin: 0; }
legend { font-weight: 800; font-size: 13px; padding: 0 6px; color: var(--navy); }
.seg { display: inline-flex; background: var(--sand-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: transparent; font: inherit; font-weight: 700; font-size: 13px; padding: 6px 12px; border-radius: 8px; color: #4a5263; cursor: pointer; }
.seg .on { background: #fff; color: var(--navy); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg a:hover { text-decoration: none; }

/* ---------- pills, dots ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--sand-2); color: #4a5263; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.lake { background: var(--lake-soft); color: var(--lake); }
.pill.navy { background: var(--navy); color: #fff; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.owner-chip { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }

/* ---------- tables & lists ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #efe8dd; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fbf8f3; }
tr.mine td { background: #fdf3ec; }
tr.now td { background: var(--lake-soft); }
.list { display: flex; flex-direction: column; }
.list .li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid #efe8dd; }
.list .li:last-child { border-bottom: 0; }
a.li { color: inherit; }
a.li:hover { text-decoration: none; background: #fbf8f3; }

/* ---------- season strip ---------- */
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.strip .b { height: 40px; border-radius: 6px; background: var(--sand-2); position: relative; display: flex; align-items: flex-end; justify-content: center; font-size: 10px; font-weight: 800; color: rgba(255,255,255,.95); padding-bottom: 3px; cursor: pointer; border: 2px solid transparent; }
.strip .b.free { color: #8b8373; }
.strip .b.today { border-color: var(--navy); }
.strip .b.mine { box-shadow: inset 0 0 0 2px #fff; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }

/* ---------- picks ---------- */
.pick { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.pick + .pick { margin-top: 6px; }
.pick .n { font-weight: 800; font-size: 18px; color: var(--navy); text-align: center; }
.pick.clock { border-color: var(--rust); box-shadow: 0 0 0 3px var(--rust-soft); }
.pick.done { background: #fbf8f3; }
.weekgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.wk { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; text-align: left; font: inherit; cursor: default; }
.wk:disabled { color: inherit; opacity: 1; }
.wk.free { cursor: pointer; border-style: dashed; border-color: #b9ad9a; }
.wk.free:hover { border-color: var(--rust); border-style: solid; background: #fffaf6; }
.wk .d { font-weight: 800; font-size: 14px; }
.wk .o { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 6px; margin-top: 3px; }

/* ---------- people ---------- */
.person { display: flex; gap: 12px; align-items: flex-start; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px; flex: none; }
.contact-lines { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.contact-lines a { display: inline-flex; align-items: center; gap: 6px; }
.contact-lines svg.i { width: 14px; height: 14px; }

/* ---------- misc ---------- */
.notice { border-radius: 10px; padding: 12px 14px; background: var(--lake-soft); color: #1d4b61; font-size: 14px; }
.notice.warn { background: var(--warn-soft); color: #6b4507; }
.notice.bad { background: var(--bad-soft); color: #7c1a14; }
.notice.ok { background: var(--ok-soft); color: #1d5536; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 6px; } }
.hours { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hours .h { background: var(--sand); border-radius: 10px; padding: 10px 12px; }
.hours .h b { display: block; font-size: 18px; }
.comment { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; }
.comment + .comment { margin-top: 12px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.agenda { margin: 0; padding-left: 20px; }
.agenda li { padding: 4px 0; }
.votebar { display: flex; gap: 4px; }
.votebar button.on.yes { background: var(--ok); border-color: var(--ok); color: #fff; }
.votebar button.on.no { background: var(--bad); border-color: var(--bad); color: #fff; }
.votebar button.on.abstain { background: #7a7f8c; border-color: #7a7f8c; color: #fff; }
.handbook h3 { margin-bottom: 4px; }
.handbook .sec + .sec { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(180deg, #14284b 0%, #2c4a78 40%, #d98a55 85%, #f0c08a 100%); position: relative; overflow: hidden; }
.login svg.mesa { position: absolute; bottom: 0; left: 0; width: 100%; height: 200px; }
.login .box { position: relative; z-index: 1; background: #fff; border-radius: 16px; padding: 30px 28px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(10,20,40,.35); }
.login .box h1 { font-size: 30px; letter-spacing: .1em; color: var(--navy); }
.login .box .sub { color: var(--muted); margin: 4px 0 20px; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,20,40,.5); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px 14px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 760px; }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal .mb { padding: 18px 20px; }
.modal .mf { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fbf8f3; border-radius: 0 0 14px 14px; }
.modal .x { background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px; display: flex; }
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 90vw; }
.toast.err { background: var(--bad); }
@media print { .side, .topbar, .actions, .btn { display: none !important; } .shell { display: block; } }

@media (max-width: 640px) { .first-mobile { order: -1; } }
.preview-bar { background: var(--warn-soft); color: #6b4507; font-size: 13px; font-weight: 700; text-align: center; padding: 7px 12px; border-bottom: 1px solid #efd9ad; }
