/* Crew. Rebrand by editing the tokens in :root. Mobile first; desktop rules are at the bottom. */
:root {
  --ink: #111113; --muted: #6c6c70; --paper: #ffffff; --surface: #f5f5f3; --line: #e6e6e2;
  --accent: #111113; --on-accent: #ffffff;          /* buttons, today, selected */
  --open: #b45309; --open-soft: #fff4e0;            /* a shift that needs a coach */
  --mine: #1d6f5c; --mine-soft: #e8f3ef;            /* your own shifts */
  --danger: #b3261e; --radius: 14px; --tabbar: 62px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--paper); font-size: 16px; line-height: 1.45; font-synthesis: none;
  -webkit-text-size-adjust: 100%; color-scheme: light;
}
/* Dark tokens. Used when the device is dark (unless the person picked Light) or when they picked Dark. Keep both blocks identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) { color-scheme: dark; --ink: #f3f3f1; --muted: #9c9ca1; --paper: #0f0f10; --surface: #1b1b1d; --line: #2b2b2e; --accent: #f3f3f1; --on-accent: #0f0f10;
    --open: #f5a84b; --open-soft: #3a2a12; --mine: #6fd0b8; --mine-soft: #15302a; --danger: #ff8a80; }
}
:root[data-theme=dark] { color-scheme: dark; --ink: #f3f3f1; --muted: #9c9ca1; --paper: #0f0f10; --surface: #1b1b1d; --line: #2b2b2e; --accent: #f3f3f1; --on-accent: #0f0f10;
  --open: #f5a84b; --open-soft: #3a2a12; --mine: #6fd0b8; --mine-soft: #15302a; --danger: #ff8a80; }
* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-height: 100dvh; overscroll-behavior-y: none; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: 26px; letter-spacing: -.6px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 19px; letter-spacing: -.3px; }
h3 { font-size: 16px; font-weight: 650; }
a { color: inherit; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Controls */
button, .button { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; min-height: 44px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none; transition: transform .1s, background .15s; }
button:active, .button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: wait; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.danger { color: var(--danger); }
button.block { width: 100%; min-height: 50px; }
.icon-button { width: 44px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; }
.chip { min-height: 36px; padding: 6px 14px; border-radius: 999px; font-size: 14px; }
input, select, textarea { width: 100%; min-height: 48px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font-size: 16px; }
textarea { min-height: 88px; resize: vertical; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; margin: 14px 0; }
fieldset { border: 0; padding: 0; margin: 14px 0; } legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 8px; }
.error { color: var(--danger); font-size: 14px; margin: 8px 0; min-height: 1px; }
.pill { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--surface); white-space: nowrap; }
.pill.open, .pill.cover { background: var(--open-soft); color: var(--open); }

/* Chrome */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { font-size: 20px; font-weight: 800; letter-spacing: -.8px; text-decoration: none; }
.location-picker { margin: 0; }
.location-picker select { min-height: 38px; width: auto; max-width: 58vw; padding: 6px 30px 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--surface); border-color: transparent; text-overflow: ellipsis; }
.location-picker select:disabled { opacity: 1; padding-right: 14px; appearance: none; -webkit-appearance: none; }
main { padding: 16px 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 84px); max-width: 720px; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); background: var(--paper); border-top: 1px solid var(--line); }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 9px 4px 7px; min-height: var(--tabbar); color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; }
.tabbar a[aria-current=page] { color: var(--ink); }
.tab-icon { position: relative; display: grid; }
.badge-count { position: absolute; top: -5px; left: 14px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--open); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
#offline { background: var(--open-soft); color: var(--open); padding: 10px 16px; font-size: 14px; }
#message { position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 14px); transform: translateX(-50%); z-index: 30; width: max-content; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: var(--paper); font-size: 14px; font-weight: 500; box-shadow: 0 6px 24px #0003; }
.skip { position: absolute; top: -80px; left: 16px; z-index: 40; padding: 12px; background: var(--paper); } .skip:focus { top: 10px; }
.empty { padding: 56px 12px; text-align: center; color: var(--muted); } .empty strong { color: var(--ink); } .empty p { margin-bottom: 6px; }
.page-heading { margin-bottom: 18px; }
.page-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.page-title p { margin-top: 4px; font-size: 14px; text-transform: none; }
.back { display: inline-block; padding: 6px 0 10px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.section-title { margin: 26px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 650; }
.hint { margin-top: 22px; font-size: 13px; color: var(--muted); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Calendar */
.year { color: var(--muted); font-weight: 500; }
.cal-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.range-control { display: flex; align-items: center; gap: 6px; }
.range-control .icon-button { width: 38px; min-height: 38px; }
.cal-tools { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 14px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); }
.segmented button { min-height: 34px; padding: 4px 16px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; color: var(--muted); }
.segmented button[aria-pressed=true] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px #0000001f; }
.open-link { display: inline-flex; align-items: center; gap: 7px; padding: 8px 2px; font-size: 14px; font-weight: 650; color: var(--open); text-decoration: none; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .55; }
.dot.open { background: var(--open); opacity: 1; } .dot.mine { background: var(--mine); opacity: 1; }
.dots { display: flex; gap: 3px; justify-content: center; height: 6px; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 0 -4px 18px; }
.day-pill { display: grid; gap: 3px; justify-items: center; min-height: 68px; padding: 8px 0 7px; border: 0; border-radius: 14px; background: transparent; font-weight: 500; }
.day-pill span:first-child { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.day-pill b { font-size: 18px; font-weight: 650; }
.day-pill.today b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.day-pill[aria-pressed=true] { background: var(--accent); color: var(--on-accent); }
.day-pill[aria-pressed=true] span:first-child { color: inherit; opacity: .7; }
.day-pill[aria-pressed=true] .dot { background: var(--on-accent); opacity: .9; }
.day-column { display: none; } .day-column.selected { display: block; }
.day-heading { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 10px; }
.empty-day { padding: 28px 0; color: var(--muted); text-align: center; }
.shift { display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 12px; width: 100%; min-height: 68px; margin-bottom: 8px; padding: 12px 14px; text-align: left; font-weight: 400; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.shift .time { display: grid; font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; } .shift .time small { font-size: 12px; font-weight: 400; color: var(--muted); }
.shift-main { display: grid; min-width: 0; } .shift-main strong { font-size: 16px; font-weight: 650; overflow-wrap: anywhere; }
.shift .meta { font-size: 13px; color: var(--muted); text-transform: capitalize; }
.shift .who { font-size: 14px; font-weight: 600; text-align: right; max-width: 34vw; overflow-wrap: anywhere; }
.shift.mine { background: var(--mine-soft); border-color: transparent; } .shift.mine .who { color: var(--mine); }
.shift.open, .shift.cover { border-style: dashed; border-color: var(--open); background: var(--open-soft); }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin: 0 -4px; }
.month-label { padding: 6px 0; text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; } .month-label span { display: none; }
.month-day { display: grid; align-content: start; justify-items: center; gap: 4px; min-height: 58px; padding: 8px 0 6px; border: 0; border-radius: 12px; background: transparent; font-weight: 500; }
.month-day b { font-size: 15px; font-weight: 600; } .month-day small { display: none; }
.month-day.outside b { color: var(--muted); opacity: .5; }
.month-day.today { background: var(--accent); color: var(--on-accent); } .month-day.today .dot { background: var(--on-accent); opacity: .9; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; font-size: 12px; color: var(--muted); } .legend .dot { margin-left: 8px; }
.fab { position: fixed; right: 18px; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px); z-index: 7; width: 56px; height: 56px; padding: 0 0 3px; border-radius: 50%; font-size: 30px; font-weight: 400; box-shadow: 0 6px 20px #00000038; }

/* Lists */
.card { display: grid; gap: 12px; padding: 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.card.fits { border-color: var(--open); background: var(--open-soft); }
.card-kicker { font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 2px; }
.card-main p { font-size: 14px; text-transform: none; } .card-main .muted::first-letter { text-transform: uppercase; }
.fit { color: var(--open); font-weight: 650; }
.card-actions { display: flex; gap: 8px; } .card-actions > * { flex: 1; }
.note { padding: 14px 0 14px 14px; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; }
.note.unread { border-left-color: var(--open); } .note p { font-size: 14px; margin-top: 2px; }
.menu { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 12px 16px; text-decoration: none; border-bottom: 1px solid var(--line); }
.menu-row:last-child { border-bottom: 0; } .menu-row span:first-child { display: grid; } .menu-row small { color: var(--muted); font-size: 13px; }
.menu-row > span:last-child { color: var(--muted); font-size: 22px; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; margin-bottom: 16px; border-radius: var(--radius); background: var(--open-soft); font-size: 14px; }
.avail-row { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 10px; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.avail-windows { display: flex; flex-wrap: wrap; gap: 6px; }
.window { display: inline-flex; align-items: center; gap: 2px; padding-left: 12px; border-radius: 999px; background: var(--mine-soft); color: var(--mine); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.window-remove { min-height: 36px; width: 36px; padding: 0; border: 0; background: transparent; color: inherit; font-size: 12px; }
.day-checks { display: flex; flex-wrap: wrap; gap: 6px; } .day-checks legend { width: 100%; }
.check { display: inline-flex; margin: 0; cursor: pointer; } .check input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.check span { display: inline-grid; place-items: center; min-width: 44px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.check input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.check input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.settings section { padding: 20px 0; border-bottom: 1px solid var(--line); } .settings section:first-child { padding-top: 0; }
.settings p { color: var(--muted); font-size: 14px; margin: 6px 0 12px; } .settings strong { color: var(--ink); }

/* Sheets (dialogs slide up from the bottom on phones) */
dialog { width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; padding: 8px 18px calc(env(safe-area-inset-bottom) + 18px); border: 0; border-radius: 22px 22px 0 0; background: var(--paper); color: var(--ink); overflow-y: auto; }
dialog::backdrop { background: #00000066; }
dialog[open] { animation: sheet-in .22s cubic-bezier(.2, .8, .2, 1); }
.sheet-grip { width: 38px; height: 4px; margin: 2px auto 10px; border-radius: 2px; background: var(--line); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.dialog-heading .icon-button { border: 0; background: var(--surface); width: 36px; min-height: 36px; font-size: 14px; }
.details > div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.details dt { font-size: 12px; color: var(--muted); text-transform: capitalize; margin-bottom: 2px; }
.sheet-actions { display: grid; gap: 8px; margin-top: 18px; } .sheet-actions button { min-height: 50px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; } .form-grid .full { grid-column: 1 / -1; }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; } .form-actions button { min-height: 50px; }
#dialog-body > form > p { font-size: 15px; }

/* Sign in */
.login-view { display: grid; place-items: center; min-height: 92dvh; padding: 24px; }
.login-form { width: 100%; max-width: 380px; } .login-form h1 { margin-bottom: 8px; }
.login-brand { font-size: 30px; margin-bottom: 56px; }
.login-form .block { margin-top: 10px; }

@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (hover: hover) { button:hover, .button:hover, .menu-row:hover { background: var(--surface); } button.primary:hover, .button.primary:hover, .day-pill[aria-pressed=true]:hover, .month-day.today:hover { background: var(--accent); opacity: .88; } .shift.mine:hover { background: var(--mine-soft); } .shift.open:hover, .shift.cover:hover { background: var(--open-soft); } }

/* Desktop: full week in columns, centered dialogs, tabs move to the top bar. */
@media (min-width: 900px) {
  :root { --tabbar: 0px; }
  .topbar { padding: 12px 32px; }
  .tabbar { position: fixed; top: 0; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); z-index: 8; display: flex; gap: 4px; padding: 9px 0; border: 0; background: transparent; }
  .tabbar a { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border-radius: 999px; font-size: 14px; }
  .tabbar a[aria-current=page] { background: var(--surface); }
  main { max-width: 1240px; padding: 28px 32px 80px; }
  main:has(.page-heading) { max-width: 760px; }
  .week-strip { display: none; }
  .week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
  .day-column, .day-column.selected { display: block; }
  .day-column.today .day-heading { color: var(--ink); }
  .day-heading { font-size: 12px; min-height: 32px; }
  .shift { grid-template-columns: 1fr; gap: 4px; padding: 10px 12px; } .shift .time { display: flex; gap: 6px; align-items: baseline; font-size: 13px; } .shift .who { text-align: left; max-width: none; } .shift-main strong { font-size: 14px; }
  .month-day { min-height: 92px; border: 1px solid var(--line); border-radius: 10px; } .month-day small { display: block; font-size: 12px; color: var(--muted); } .month-day.today small { color: inherit; } .month-label span { display: inline; }
  .card { grid-template-columns: 1fr auto; align-items: center; } .card-actions > * { flex: 0 0 auto; }
  dialog { width: 480px; margin: auto; border-radius: 20px; padding: 20px 24px 24px; } .sheet-grip { display: none; }
  .fab { right: 32px; bottom: 32px; } #message { bottom: 28px; }
}

/* Day sheet (month view) and theme picker */
.day-sheet { display: grid; gap: 8px; margin: 6px 0 4px; }
.day-sheet-count { color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.sheet-back { margin-bottom: 12px; }
.month-day[aria-pressed=true]:not(.today) { background: var(--surface); }
.settings .segmented { display: flex; max-width: 340px; } .settings .segmented button { flex: 1; }

/* Automatic fill card (Usual week) */
.auto-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.auto-card p { margin-top: 2px; }
.switch { flex: none; width: 52px; min-height: 32px; height: 32px; padding: 3px; border: 0; border-radius: 999px; background: var(--line); display: flex; align-items: center; }
.switch i { width: 26px; height: 26px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 3px #0000003d; transition: transform .15s; }
.switch[aria-checked=true] { background: var(--accent); } .switch[aria-checked=true] i { transform: translateX(20px); background: var(--on-accent); }
