@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=Manrope:wght@400;500;600;700&family=DM+Serif+Display&family=DM+Sans:wght@400;500;600;700&display=swap');

/* =================================================================
   THEME TOKENS
   Dark = Midnight Stage (default).  Light = Vintage Vinyl.
   ================================================================= */
:root, [data-theme="dark"] {
  --bg: #0b0b12;
  --surface: #14141d;
  --surface-2: #1b1b27;
  --surface-3: #20202c;
  --hover: rgba(255,255,255,.045);
  --ink: #f1f1f6;
  --muted: #8c8c9c;
  --line: #2a2a37;
  --line-soft: #22222e;
  --accent: #22d3ee;
  --accent-ink: #7fe3f5;
  --accent-2: #f72585;
  --ok: #2ec27e;
  --err: #ff6b6b;
  --today-bg: #22d3ee;
  --today-ink: #04141a;
  --bar-ink: #ffffff;
  --event-bg: #1f9d57;
  --event-ink: #ffffff;
  --event-border: #ffffff;
  --chip-dot: #c8f5da;
  --allfree-bg: color-mix(in srgb, #2ec27e 16%, var(--surface));
  --allfree-badge: color-mix(in srgb, #2ec27e 30%, var(--surface));
  --allfree-ink: #5ee2a0;
  --busyday-bg: color-mix(in srgb, #000000 26%, var(--surface));
  --hatch-l: rgba(255,255,255,.085);
  --hatch-d: rgba(0,0,0,.17);
  --topbar-bg: rgba(18,18,26,.72);
  --auth-bg: radial-gradient(1100px 520px at 50% -12%, #16314f 0%, transparent 60%),
             radial-gradient(900px 500px at 12% 110%, #2a103a 0%, transparent 55%), #0b0b12;
  --modal-backdrop: rgba(0,0,0,.55);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 18px 50px rgba(0,0,0,.5);
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display-weight: 700;
  --page-bg-image: var(--auth-bg);
}

[data-theme="light"] {
  --bg: #ead9bd;
  --surface: #f6ecd8;
  --surface-2: #fbf4e6;
  --surface-3: #f0e3c8;
  --hover: rgba(80,55,20,.04);
  --ink: #3a2e22;
  --muted: #8a755a;
  --line: #e0cda8;
  --line-soft: #ece0c8;
  --accent: #c2410c;
  --accent-ink: #a8350a;
  --accent-2: #b08423;
  --ok: #1f7a5a;
  --err: #b5392f;
  --today-bg: #c2410c;
  --today-ink: #fff5e6;
  --bar-ink: #fff8ec;
  --event-bg: #1f7a5a;
  --event-ink: #fdf7ec;
  --event-border: #000000;
  --chip-dot: #bdeccf;
  --allfree-bg: color-mix(in srgb, #1f7a5a 14%, var(--surface));
  --allfree-badge: color-mix(in srgb, #1f7a5a 24%, var(--surface));
  --allfree-ink: #1f7a5a;
  --busyday-bg: color-mix(in srgb, var(--muted) 18%, var(--surface));
  --hatch-l: rgba(255,255,255,.32);
  --hatch-d: rgba(60,40,15,.13);
  --topbar-bg: rgba(246,236,216,.82);
  --auth-bg: radial-gradient(1100px 520px at 50% -10%, #f3e6cd 0%, transparent 60%), #ead9bd;
  --shadow: 0 1px 2px rgba(90,60,20,.06), 0 18px 50px rgba(90,60,20,.18);
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "DM Serif Display", Georgia, serif;
  --display-weight: 400;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  background: var(--bg); font-size: 16px; line-height: 1.4;
  transition: background .35s ease, color .2s ease;
}
[data-theme="dark"] body {
  background:
    radial-gradient(1100px 520px at 80% -12%, #16314f 0%, transparent 60%),
    radial-gradient(900px 540px at 4% 6%, #2a103a 0%, transparent 55%),
    #0b0b12;
  background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }

/* admin dev bar (intentionally dark in both themes) */
.devbar { position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: 36px;
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: #111114; color: #e6e6ea; font-size: 12.5px; border-bottom: 1px solid #2a2a30;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.devbar-tag { font-weight: 800; letter-spacing: .1em; font-size: 10px; color: #111114;
  background: #f5a623; padding: 2px 6px; border-radius: 4px; }
.devbar-repo { color: #9a9aa3; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.devbar-status { font-size: 12px; color: #c9c9d0; }
.devbar-status.ok { color: #6ee7a8; }
.devbar-status.err { color: #ff8b80; }
.devbar-btn { margin-left: auto; border: 1px solid #3a3a42; background: #1d1d22; color: #fff;
  font: inherit; font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.devbar-btn:hover { background: #2a2a31; border-color: #4a4a52; }
body.has-devbar { padding-top: 36px; }
body.has-devbar .topbar { top: 36px; }

/* brand mark */
.brand-mark { width: 14px; height: 14px; border-radius: 5px; display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--topbar-bg);
  backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1040px; margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; padding: 8px 20px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; font-size: 17px;
  font-family: var(--font-display); font-weight: var(--display-weight); }
.who { display: flex; align-items: center; gap: 12px; }
.who-name { color: var(--muted); font-size: 14px; }
.theme-toggle { width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 9px; font-size: 15px; line-height: 1; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent-ink); }

/* buttons */
.btn { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 550; padding: 9px 15px; border-radius: 10px;
  cursor: pointer; transition: transform .04s ease, background .15s, border-color .15s; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--today-ink); font-weight: 650; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }

/* layout */
.wrap { max-width: 1040px; margin: 0 auto; padding: 22px 20px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 18px; }
.page-head h2 { margin: 0; font-size: 22px; font-family: var(--font-display); font-weight: var(--display-weight); }
.head-actions { display: flex; align-items: center; gap: 10px; }
h2, h3 { letter-spacing: -.01em; }

.flash { border-radius: 10px; padding: 11px 14px; margin: 0 0 16px; font-size: 14px; }
.flash.ok  { background: var(--allfree-bg); color: var(--ok); }
.flash.err { background: color-mix(in srgb, var(--err) 16%, var(--surface)); color: var(--err); }
.muted { color: var(--muted); }

/* bands list */
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 34px; text-align: center; }
.empty p { margin: 4px 0; }
.band-list { list-style: none; margin: 0 0 26px; padding: 0; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); background: var(--surface); border: 1px solid var(--line); }
.band-list li + li { border-top: 1px solid var(--line-soft); }
.band-row { display: flex; align-items: center; gap: 13px; padding: 16px 18px; }
.band-row:hover { background: var(--hover); }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c, var(--muted)); flex: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.band-name { font-weight: 600; font-size: 16px; }
.band-meta { color: var(--muted); font-size: 13px; margin-left: auto; }
.band-meta code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
.chev { color: var(--muted); opacity: .6; font-size: 22px; margin-left: 4px; }
.join-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.join-card h3 { margin: 0 0 12px; font-size: 16px; }
.row-form { display: flex; gap: 10px; }
.code-input { text-transform: uppercase; letter-spacing: .14em; }

/* forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 550; }
input, textarea { font: inherit; font-size: 15px; color: var(--ink); padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface-2); width: 100%; }
textarea { resize: vertical; min-height: 44px; font-family: var(--font); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.field-hint { font-weight: 450; color: var(--muted); font-size: 12px; }

/* auth pages */
.auth-body { display: grid; place-items: center; min-height: 100dvh; padding: 24px; background: var(--auth-bg); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 30px 28px; box-shadow: var(--shadow); }
.auth-card .brand { text-align: center; margin-bottom: 20px; }
.auth-card .brand h1 { margin: 10px 0 2px; font-size: 26px; font-family: var(--font-display); font-weight: var(--display-weight); }
.brand-sub { margin: 0; color: var(--muted); font-size: 14px; }
.auth-card .brand-mark { width: 28px; height: 28px; border-radius: 9px; }
.seg { display: flex; background: var(--surface-3); border-radius: 11px; padding: 3px; margin-bottom: 18px; }
.seg-btn { flex: 1; text-align: center; padding: 8px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg-btn.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.2); }

/* modals */
.modal { border: none; border-radius: 16px; padding: 22px; width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px); overflow: auto; background: var(--surface); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal::backdrop { background: var(--modal-backdrop); backdrop-filter: blur(2px); }
.modal h3 { margin: 0 0 14px; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* calendar header */
.cal-wrap { max-width: 1040px; }
.cal-sticky { position: sticky; top: var(--cal-top, 58px); z-index: 4;
  margin: 0 -20px 14px; padding: 14px 20px 8px; background: var(--topbar-bg);
  backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.cal-sticky .cal-head { margin-bottom: 10px; }
.cal-sticky .legend { margin-bottom: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-title h2 { margin: 0; font-size: 24px; font-family: var(--font-display); font-weight: var(--display-weight); }
.code-pill { border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 999px; cursor: pointer; }
.code-pill:hover { color: var(--ink); border-color: var(--accent); }
.color-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); font: inherit; font-size: 12px; padding: 5px 11px;
  border-radius: 999px; cursor: pointer; }
.color-btn:hover { color: var(--ink); border-color: var(--accent); }
.invite-btn { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); font-weight: 600; }
.invite-btn:hover { color: var(--accent-ink); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: var(--accent); }
.chat-btn { color: var(--ink); }

/* scheduling chat */
.chat-modal { width: min(460px, calc(100vw - 32px)); padding: 0; flex-direction: column; max-height: calc(100dvh - 48px); }
.chat-modal[open] { display: flex; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; }
.chat-head h3 { margin: 0; font-size: 18px; }
.chat-x { border: none; background: transparent; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.chat-x:hover { color: var(--ink); }
.chat-banner { margin: 0 18px 12px; padding: 9px 12px; border-radius: 10px; font-size: 12px; font-weight: 700;
  color: var(--err); background: color-mix(in srgb, var(--err) 15%, var(--surface)); border: 1px solid color-mix(in srgb, var(--err) 35%, var(--surface)); }
.chat-log { flex: 1; overflow-y: auto; padding: 4px 18px; min-height: 260px; max-height: 52vh; display: flex; flex-direction: column; gap: 8px; }
.chat-empty { color: var(--muted); font-size: 13.5px; text-align: center; margin: auto 0; padding: 30px 10px; }
.chat-day { align-self: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; background: var(--surface-3); padding: 2px 10px; border-radius: 999px; margin: 6px 0 2px; }
.msg { max-width: 84%; align-self: flex-start; background: var(--surface-2); border-radius: 12px; padding: 7px 11px; }
.msg.mine { align-self: flex-end; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.msg-head { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.msg-head .dot { width: 9px; height: 9px; }
.msg-name { font-size: 12px; font-weight: 700; }
.msg-time { font-size: 11px; color: var(--muted); margin-left: 4px; }
.msg-body { font-size: 14px; line-height: 1.35; word-break: break-word; }
.chat-input { display: flex; gap: 8px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); }
.chat-input input { flex: 1; }
.chat-input .btn { flex: none; }

/* color picker */
.color-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 4px; }
.swatch { width: 100%; aspect-ratio: 1; border-radius: 50%; border: none; cursor: pointer; background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); transition: transform .06s ease; position: relative; }
.swatch:hover:not(.taken) { transform: scale(1.1); }
.swatch.selected { box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 0 0 0 3px var(--ink); }
.swatch.taken { cursor: not-allowed; opacity: .28; }
.swatch.taken::after { content: ""; position: absolute; inset: 38% 18%; height: 2px; background: var(--surface);
  transform: rotate(-45deg); box-shadow: 0 0 0 1px rgba(0,0,0,.25); }

/* month nav */
.month-nav { display: flex; align-items: center; gap: 8px; }
.nav-btn { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: 18px; color: var(--ink); }
.nav-btn:hover { background: var(--surface-3); }
.today-btn { font-size: 13px; font-weight: 600; }
.month-label { font-size: 16px; font-weight: 650; min-width: 132px; text-align: center; font-family: var(--font-display); font-weight: var(--display-weight); }

/* legend */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.leg-chip { display: inline-flex; align-items: center; gap: 6px; }

/* calendar grid */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.dow-cell { padding: 9px 0; text-align: center; font-size: 12px; font-weight: 650; color: var(--muted); letter-spacing: .03em; text-transform: uppercase; }
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(128px, auto); }
.cell { position: relative; min-width: 0; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  padding: 6px 6px 8px; cursor: pointer; transition: background .12s; min-height: 0; }
.cell:nth-child(7n) { border-right: none; }
.cell:hover { background-color: var(--hover); }
.cell-num { font-size: 13px; font-weight: 600; color: var(--ink); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cell.today .cell-num { background: var(--today-bg); color: var(--today-ink); }
.cell.busy-day { background-color: var(--busyday-bg); }
.cell.all-clear { background-color: var(--allfree-bg); }
.cell.past .bars, .cell.busy-day .bars { opacity: .58; }
.cell.past::before, .cell.busy-day::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background-image:
    repeating-linear-gradient(45deg, var(--hatch-d) 0 1px, var(--hatch-l) 1px 2px, transparent 2px 10px),
    repeating-linear-gradient(-45deg, var(--hatch-d) 0 1px, var(--hatch-l) 1px 2px, transparent 2px 10px);
}
.cell.all-clear::after { content: "all free"; position: absolute; top: 7px; right: 7px; font-size: 10px;
  font-weight: 700; color: var(--allfree-ink); background: var(--allfree-badge); padding: 2px 6px; border-radius: 999px; letter-spacing: .02em; }

.events { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.event-chip { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; line-height: 1.2;
  padding: 3px 7px; border-radius: 6px; background: var(--event-bg); color: var(--event-ink); cursor: pointer;
  border: 1.5px solid var(--event-border); box-shadow: 0 1px 3px rgba(0,0,0,.35);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--chip-dot); flex: none; }

.bars { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; }
.bar { font-size: 11px; font-weight: 600; line-height: 1.15; padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar.avail { background: var(--c); color: var(--bar-ink); }
.bar.busy { background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: var(--c);
  text-decoration: line-through; text-decoration-thickness: 1px; box-shadow: inset 2px 0 0 var(--c); }
.bar.mine { box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.bar.busy.mine { box-shadow: inset 2px 0 0 var(--c), inset 0 0 0 2px rgba(255,255,255,.2); }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 16px 0 0; }

#ptr { position: fixed; top: 0; left: 0; right: 0; z-index: 70; display: flex; justify-content: center;
  padding: 10px; font-size: 13px; font-weight: 600; color: var(--accent-ink);
  opacity: 0; pointer-events: none; transition: opacity .15s ease; }

/* day editor */
.day-editor h3 { margin-bottom: 14px; }
.ed-step[hidden] { display: none; }
.ed-choose { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choose-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 18px 16px;
  cursor: pointer; transition: transform .1s ease, border-color .12s, background .12s; }
.choose-btn:hover { border-color: var(--accent); background: var(--surface-3); transform: translateY(-1px); }
.choose-btn:active { transform: translateY(0); }
.choose-ico { font-size: 24px; line-height: 1; }
.choose-lbl { font-size: 16px; font-weight: 700; color: var(--ink); }
.choose-sub { font-size: 12.5px; color: var(--muted); }

/* day overview (landing step) */
.day-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.choose-btn.day-act { flex-direction: row; align-items: center; justify-content: center; gap: 8px; padding: 14px 12px; }
.day-act-ico { font-size: 18px; line-height: 1; }
.day-act-lbl { font-size: 15px; font-weight: 700; color: var(--ink); }

.day-overview { display: flex; flex-direction: column; gap: 18px; }
.ov-section { display: flex; flex-direction: column; gap: 8px; }
.ov-h { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ov-empty { font-size: 14px; color: var(--muted); padding: 2px 0; }

.ov-events { display: flex; flex-direction: column; gap: 8px; }
.ov-event { display: flex; align-items: flex-start; gap: 12px; text-align: left; width: 100%;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 12px 14px;
  cursor: pointer; transition: border-color .12s, background .12s; }
.ov-event:hover { border-color: var(--accent); background: var(--surface-3); }
.ov-ev-when { font-size: 14px; font-weight: 700; color: var(--accent-ink); flex: none; min-width: 56px; padding-top: 1px; }
.ov-ev-main { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.ov-ev-title { font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.25; }
.ov-ev-sub { font-size: 13px; color: var(--muted); }
.ov-ev-times { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.ov-ev-time { font-size: 12.5px; font-weight: 600; color: var(--ink); background: var(--surface-3); border-radius: 6px; padding: 2px 7px; }
.ov-ev-go { font-size: 13px; font-weight: 600; color: var(--accent-ink); flex: none; align-self: center; }

.ov-avail { display: flex; flex-direction: column; }
.ov-member { padding: 7px 0; border-top: 1px solid var(--line-soft); }
.ov-member:first-child { border-top: none; padding-top: 0; }
.ov-avail-row { display: flex; align-items: center; gap: 9px; }
.ov-editable .ov-avail-row { cursor: pointer; }
.ov-edit-ico { flex: none; font-size: 13px; color: var(--muted); opacity: .65; }
.ov-editable:hover .ov-edit-ico { opacity: 1; color: var(--ink); }
.ov-edit { display: flex; gap: 6px; margin-top: 8px; }
.ov-set { flex: 1; font-size: 13px; font-weight: 700; padding: 7px 4px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; }
.ov-set:hover { background: var(--surface-3); }
.ov-set.s-avail { color: var(--ok); }
.ov-set.s-busy { color: var(--err); }
.ov-set:disabled { opacity: .5; cursor: default; }
.ov-name { font-size: 15px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-pill { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; flex: none; }
.ov-pill.avail { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); }
.ov-pill.busy  { background: color-mix(in srgb, var(--err) 18%, var(--surface)); color: var(--err); }
.ov-pill.none  { background: var(--surface-3); color: var(--muted); }
.ov-member.ov-busy .ov-name { color: var(--muted); opacity: .55; }
.ov-member.ov-busy .dot { opacity: .4; }
.ov-member.ov-none .ov-name { opacity: .65; }
.ov-note { font-size: 13px; color: var(--muted); margin: 3px 0 0 21px; }
.ed-back { border: none; background: transparent; color: var(--accent-ink); font: inherit; font-weight: 600;
  font-size: 14px; cursor: pointer; padding: 0 0 12px; margin: 0; }
.ed-back:hover { text-decoration: underline; }
.ed-sub { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.ed-sub strong { color: var(--ink); }
.status-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.status-btn { font: inherit; font-size: 14px; font-weight: 600; padding: 12px 0; border-radius: 11px;
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; }
.status-btn:hover { background: var(--surface-3); }
.s-avail.selected { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); border-color: var(--ok); color: var(--ok); }
.s-busy.selected  { background: color-mix(in srgb, var(--err) 16%, var(--surface)); border-color: var(--err); color: var(--err); }
.s-clear.selected { background: var(--surface-3); border-color: var(--muted); color: var(--ink); }
.note-lbl { margin-top: 14px; }
.others { margin-top: 16px; }
.others-h { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.other-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 4px 0; }
.other-name { font-weight: 600; }
.other-status { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.other-status.avail { background: color-mix(in srgb, var(--ok) 18%, var(--surface)); color: var(--ok); }
.other-status.busy { background: color-mix(in srgb, var(--err) 18%, var(--surface)); color: var(--err); }
.other-row.busy .other-name { color: var(--muted); opacity: .55; }
.other-row.busy .dot { opacity: .4; }
.other-note { color: var(--muted); font-size: 12.5px; }

/* band schedule */
.sched-h { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.ev-list { display: flex; flex-direction: column; gap: 4px; }
.ev-empty { color: var(--muted); font-size: 13px; padding: 2px 0 6px; }
.ev-row { display: flex; align-items: center; gap: 9px; font-size: 14px; padding: 9px 11px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.ev-row:hover { border-color: var(--accent); }
.ev-time { font-weight: 700; color: var(--accent-ink); min-width: 58px; font-variant-numeric: tabular-nums; }
.ev-title { font-weight: 600; }
.ev-sub { color: var(--muted); font-size: 12.5px; }
.ev-go { margin-left: auto; color: var(--muted); font-size: 20px; }
.ev-loc { color: var(--muted); font-size: 12.5px; }

.ev-add-btn { margin-top: 10px; width: 100%; border: 1px dashed var(--line); background: transparent;
  color: var(--accent-ink); font: inherit; font-weight: 600; font-size: 13px; padding: 9px; border-radius: 10px; cursor: pointer; }
.ev-add-btn:hover { border-color: var(--accent); background: var(--hover); }

.ev-form { display: flex; flex-direction: column; gap: 9px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.ev-form[hidden] { display: none; }
.ev-agenda-h { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.ev-items { display: flex; flex-direction: column; gap: 7px; }
.ev-item-row { display: flex; align-items: center; gap: 7px; }
.ev-it-time { flex: 0 0 116px; }
.ev-it-label { flex: 1; }
.ev-it-del { flex: none; border: none; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.ev-it-del:hover { color: var(--err); }
.ev-add-time { align-self: flex-start; border: none; background: transparent; color: var(--accent-ink);
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; padding: 2px 0; }
.ev-add-time:hover { text-decoration: underline; }
.ev-form-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.ev-spacer { flex: 1; }
.ev-danger { color: var(--err); }
.ev-danger:hover { background: color-mix(in srgb, var(--err) 14%, var(--surface)); color: var(--err); }

/* responsive */
@media (max-width: 640px) {
  .modal { width: 100%; max-width: none; margin: 0 auto; top: auto; bottom: 0; left: 0; right: 0;
    border-radius: 18px 18px 0 0; max-height: 88dvh; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  .ed-choose { grid-template-columns: 1fr; gap: 10px; }
  .choose-btn { padding: 18px 16px; }
  .status-btn { padding: 15px 0; font-size: 15px; }
  .grid { grid-auto-rows: minmax(104px, auto); }
  .cell { padding: 4px 3px 5px; }
  .cell-num { font-size: 12px; width: 21px; height: 21px; }
  .bar { font-size: 9.5px; padding: 2px 5px; border-radius: 5px; }
  .event-chip { font-size: 9.5px; padding: 2px 5px; }
  .cell.all-clear::after { font-size: 8px; padding: 1px 4px; }
  .dow-cell { font-size: 10px; }
  .topbar-in { padding: 6px 16px; }
  .logo { font-size: 16px; }
  .who { gap: 8px; }
  .cal-controls { width: 100%; gap: 6px; }
  .cal-controls .ctl-txt { display: none; }
  .cal-controls .color-btn { padding: 6px 10px; font-size: 12px; }
  .cal-controls .month-nav { margin-left: auto; gap: 5px; }
  .cal-controls .nav-btn { min-width: 30px; height: 30px; padding: 0 8px; font-size: 16px; }
  .month-label { min-width: 0; font-size: 13.5px; }
  .legend { font-size: 12px; }
}

/* ------------------------------------------------------ day availability */
.cell.blocked { background: var(--blocked-bg, rgba(120,120,140,.10)); cursor: default; }
/* Single-diagonal hash for closed days — denser + embossed so it's clearly
   visible, but one direction only so past/busy crosshatch stays distinct.
   Past days keep their own crosshatch (this doesn't touch .past cells). */
.cell.blocked:not(.past)::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background-image: repeating-linear-gradient(45deg, var(--hatch-d) 0 1px, var(--hatch-l) 1px 2px, transparent 2px 8px);
  opacity: .9; }
.cell.blocked .cell-num { opacity: .45; }
.cell.blocked .bars, .cell.blocked .events { opacity: .35; }
.cell.blocked::after { content: "closed"; position: absolute; top: 7px; right: 7px; font-size: 10px;
  color: var(--muted); border: 1px solid var(--line-soft); border-radius: 999px; padding: 1px 6px; }
.cell.blocked:hover { background: var(--blocked-bg, rgba(120,120,140,.10)); }
body.day-edit .cell { cursor: pointer; outline: 1px dashed var(--line-soft); outline-offset: -3px; }
body.day-edit .cell:hover { background: var(--hover); }
.cell.day-busywait { opacity: .55; pointer-events: none; }
.dayedit-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 60;
  background: var(--card, #14141f); color: var(--ink); border: 1px solid var(--line-soft);
  border-radius: 999px; padding: 8px 10px 8px 16px; display: flex; align-items: center; gap: 12px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.radio-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.radio-row input { margin-top: 3px; }
.radio-row .muted { font-size: 13px; }
.thr-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 0; font-size: 14px; }
.thr-row input { width: 64px; text-align: center; padding: 6px; border-radius: 8px;
  border: 1px solid var(--line-soft); background: transparent; color: var(--ink); }

/* --------------------------------------------------------- my schedule */
.sched-chip { display: block; text-decoration: none; color: inherit;
  border-left: 3px solid var(--c, #999); padding-left: 4px; }
.sched-chip:hover { filter: brightness(1.2); }
.sched-link { padding: 6px 9px; }
.leg-link { text-decoration: none; color: inherit; }
.leg-link:hover { text-decoration: underline; }
.med-groups-h { display: flex; justify-content: space-between; align-items: center;
  margin-top: 14px; font-size: 13px; color: var(--muted); }
.med-sel { background: none; border: none; color: var(--accent, #22d3ee);
  font-size: 13px; cursor: pointer; padding: 2px; }
.med-groups { margin-top: 6px; display: flex; flex-direction: column; gap: 2px;
  max-height: 40vh; overflow-y: auto; }
.med-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px;
  border-radius: 8px; cursor: pointer; font-size: 15px; }
.med-row:hover { background: var(--hover); }
.med-row.med-blocked { opacity: .5; cursor: default; }
.med-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.med-cur { font-size: 12px; color: var(--muted); }
.med-cur.busy { color: #fa5252; }
.med-cur.available { color: #37b24d; }
.med-result { margin-top: 10px; font-size: 13px; color: #f5a623; }

/* ------------------------------------------------------ weekday rules */
.dowlist { display: flex; flex-direction: column; gap: 4px; }
.dow-row { display: flex; align-items: center; gap: 8px; }
.dow-tog { width: 46px; flex: none; font-size: 13px; font-weight: 700; padding: 5px 0; text-align: center;
  border-radius: 8px; cursor: pointer; border: 1px solid var(--line-soft);
  background: transparent; color: var(--muted); }
.dow-tog.on { background: var(--accent, #22d3ee); border-color: var(--accent, #22d3ee); color: #06202a; }
.dow-occ { display: flex; gap: 4px; flex: 1; min-width: 0; }
.dow-row.off .dow-occ { visibility: hidden; }
.occ-pill { flex: 1; min-width: 0; font-size: 11px; padding: 5px 0; text-align: center; border-radius: 8px;
  cursor: pointer; border: 1px solid var(--line-soft); background: transparent; color: var(--muted); }
.occ-pill.sel { background: var(--hover); border-color: var(--accent, #22d3ee); color: var(--ink); font-weight: 700; }
.days-edit-btn { font-size: 13px; padding: 6px 10px; align-self: flex-start; }

/* -------------------------------------------------------- calendar link */
.slug-row { display: flex; align-items: center; gap: 0; margin-top: 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  overflow: hidden; }
.slug-row:focus-within { border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.slug-host { flex: 0 0 auto; padding: 11px 4px 11px 13px; color: var(--muted);
  font-size: 14px; white-space: nowrap; }
.slug-row input { flex: 1 1 auto; min-width: 0; border: none; background: transparent;
  padding-left: 0; border-radius: 0; }
.slug-row input:focus { outline: none; box-shadow: none; border-color: transparent; }
.slug-msg.err { color: var(--danger, #e8453c); }
/* The link can be long; let it wrap instead of stretching the settings row. */
#set-link-sub { overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- money */
.mny-note { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.mny-summary { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2);
  padding: 14px 16px; margin-bottom: 14px; }
.mny-bal-lbl { font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; }
.mny-bal { font-family: var(--font-display); font-weight: var(--display-weight);
  font-size: 30px; line-height: 1.15; margin-top: 2px; font-variant-numeric: tabular-nums; }
.mny-bal.neg { color: var(--err); }
.mny-splits { display: flex; gap: 16px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.mny-splits b { font-variant-numeric: tabular-nums; }
.mny-in b { color: var(--ok); }
.mny-out b { color: var(--err); }

.mny-list { max-height: 42vh; overflow-y: auto; }
.mny-item { align-items: baseline; gap: 10px; }
.mny-item.mny-ro { cursor: default; }
.mny-item.mny-ro:hover { border-color: var(--line); }
.mny-when { flex: none; font-size: 11.5px; color: var(--muted); min-width: 74px; }
.mny-what { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mny-amt { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.mny-amt.in { color: var(--ok); }
.mny-amt.out { color: var(--err); }

.mny-seg { margin-bottom: 2px; }
.mny-seg .seg-btn { cursor: pointer; border: none; background: transparent; font: inherit;
  font-size: 14px; font-weight: 600; color: var(--muted); }
.mny-seg .seg-btn.is-on { background: var(--surface); color: var(--ink); }
.mny-row { display: flex; gap: 8px; }
.mny-amt-wrap { position: relative; flex: 1; min-width: 0; }
.mny-amt-wrap .mny-cur { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 15px; pointer-events: none; }
.mny-amt-wrap input { width: 100%; padding-left: 25px; font-variant-numeric: tabular-nums; }
.mny-row input[type="date"] { flex: 0 0 150px; min-width: 0; }

@media (max-width: 640px) {
  .mny-row { flex-direction: column; }
  .mny-row input[type="date"] { flex: none; }
  .mny-when { min-width: 62px; }
}

/* ------------------------------------------------------------- settings */
.color-btn[hidden] { display: none; }
.set-list { display: flex; flex-direction: column; gap: 8px; }
.set-row { display: flex; flex-direction: row; align-items: center; gap: 12px; width: 100%;
  text-align: left; box-sizing: border-box; min-height: 62px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
  padding: 12px 14px; margin: 0; font: inherit; font-size: 15px; font-weight: 400; color: var(--ink);
  cursor: pointer; transition: border-color .12s, background .12s; }
.set-row:hover { border-color: var(--accent); background: var(--surface-3); }
.set-ico { font-size: 18px; line-height: 1; flex: none; }
.set-main { align-self: center; }
.set-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.set-lbl { font-size: 15px; font-weight: 700; }
.set-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.set-go { color: var(--muted); font-size: 20px; flex: none; }
.set-check input { width: 19px; height: 19px; flex: none; padding: 0; accent-color: var(--accent); cursor: pointer; }
.set-ico { display: flex; align-items: center; justify-content: center; width: 22px; }
.set-ico .dot { width: 16px; height: 16px; }
.money-btn #money-amt { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.money-btn #money-amt.neg { color: var(--err); }

/* invite block at the top of Cal Settings */
.set-invite { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.set-invite-h { font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.set-invite-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-invite-row .code-pill { flex: none; }

/* uniform settings rows: fixed icon column, one control on the right */
.set-ico { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; flex: none; font-size: 17px; }
.set-ico .dot { width: 15px; height: 15px; }
.set-go { line-height: 1; margin-left: 2px; }
.set-check { cursor: pointer; }
.set-check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.mem-step[hidden] { display: none; }
.mem-you { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-soft);
  border-radius: 999px; padding: 1px 6px; margin-left: 4px; vertical-align: middle; }
#mem-colors { margin-top: 6px; }
#members .ev-form-actions { margin-top: 18px; }
