/* Crew schedule — mobile-first. Dark by default (it's backstage), light when the device asks. */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.260c81a4759b.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-ext.1ad231aac0a8.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #101218;
  --bg-glow: radial-gradient(1200px 500px at 15% -10%, rgba(255, 181, 71, .07), transparent 60%),
             radial-gradient(900px 400px at 100% 0%, rgba(79, 124, 255, .06), transparent 60%);
  --surface: #181b23;
  --surface-2: #20242e;
  --surface-3: #2a2f3b;
  --border: #2c313d;
  --border-strong: #3a4050;
  --text: #eceef3;
  --muted: #959cad;
  --accent: #ffb547;
  --accent-strong: #ffc46b;
  --accent-text: #1d1300;
  --accent-soft: rgba(255, 181, 71, .14);
  --danger: #ff6b6b;
  --warning: #ffcc4d;
  --success: #4ed29a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 6px 24px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, .55);
  --ring: 0 0 0 3px rgba(255, 181, 71, .35);
  --topbar-h: 56px;
  --tabbar-h: 62px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  font-feature-settings: "cv11", "ss01";
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f6f9;
    --bg-glow: radial-gradient(1200px 500px at 15% -10%, rgba(255, 170, 40, .12), transparent 60%),
               radial-gradient(900px 400px at 100% 0%, rgba(79, 124, 255, .08), transparent 60%);
    --surface: #ffffff;
    --surface-2: #f1f3f7;
    --surface-3: #e7eaf0;
    --border: #e1e5ec;
    --border-strong: #cfd5df;
    --text: #171a21;
    --muted: #616879;
    --accent: #d27d00;
    --accent-strong: #e08a0a;
    --accent-text: #ffffff;
    --accent-soft: rgba(210, 125, 0, .12);
    --danger: #d23b3b;
    --warning: #9a6a00;
    --success: #198754;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 6px 24px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
    --shadow-lg: 0 18px 60px rgba(16, 24, 40, .18);
    --ring: 0 0 0 3px rgba(210, 125, 0, .25);
    color-scheme: light;
  }
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  background: var(--bg-glow), var(--bg); background-attachment: fixed;
  overflow-x: hidden;
}
body.has-nav { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1 { font-size: 1.55rem; line-height: 1.2; margin: .2rem 0 .75rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .6rem; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; font-weight: 650; }
p { margin: .5rem 0; }
svg { flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { margin-left: auto; }
ul.plain { list-style: none; margin: 0; padding: 0; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* -------------------------------------------------------------- layout */

.container { max-width: 780px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.container.wide { max-width: 1440px; }
.container.narrow { max-width: 420px; }
.container.login { padding-top: 12vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  min-height: var(--topbar-h); padding: env(safe-area-inset-top) 1rem 0;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--text); letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; padding: 5px; border-radius: 9px; color: var(--accent-text);
  background: linear-gradient(145deg, var(--accent-strong), var(--accent));
  box-shadow: 0 4px 14px rgba(255, 181, 71, .25);
}
.mainnav { display: none; gap: .2rem; }
.mainnav a { padding: .45rem .8rem; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: .95rem; white-space: nowrap; transition: background .15s, color .15s; }
.mainnav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.mainnav a[aria-current="page"] { color: var(--text); background: var(--surface-3); }

.menu { margin-left: auto; position: relative; }
.menu summary {
  list-style: none; display: flex; align-items: center; gap: .5rem; cursor: pointer;
  padding: .25rem .5rem .25rem .25rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: .9rem; font-weight: 500;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { border-color: var(--border-strong); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem;
}
.menu-name { display: none; }
.chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.menu[open] .chev { transform: rotate(180deg); }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: .4rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); display: grid; animation: pop .14s ease-out;
}
.menu-pop a, .menu-pop button {
  display: block; text-align: left; padding: .55rem .7rem; border-radius: var(--radius-sm);
  color: var(--text); font: inherit; font-size: .95rem; background: none; border: 0; cursor: pointer; width: 100%;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); text-decoration: none; }
.menu-pop form { margin: 0; }
.menu-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .6rem .7rem .25rem; }
.menu-label:not(:first-child) { border-top: 1px solid var(--border); margin-top: .3rem; }

/* Bottom tab bar on phones */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
  color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .01em;
}
.tabbar a:hover { text-decoration: none; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar svg .fill { fill: currentColor; stroke: none; }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tabbar a[aria-current="page"] svg { filter: drop-shadow(0 2px 8px rgba(255, 181, 71, .35)); }

@media (min-width: 860px) {
  .mainnav { display: flex; }
  .menu-name { display: inline; }
  .tabbar { display: none; }
  body.has-nav { padding-bottom: 0; }
  .container { padding: 1.5rem 1.5rem 3rem; }
}

.pagehead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin: .25rem 0 1rem; }
.pagehead h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.datenav { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.datetitle { min-width: 0; }
.datetitle .sub { color: var(--muted); font-size: .9rem; }
.today-label { color: var(--accent); font-weight: 600; }
.datechip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 3.1rem; height: 3.3rem; border-radius: 12px; overflow: hidden; flex: none;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.dc-month { width: 100%; text-align: center; font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .15rem 0; background: var(--surface-3); color: var(--muted); }
.dc-day { font-size: 1.35rem; font-weight: 700; line-height: 1.6; font-variant-numeric: tabular-nums; }
.datechip.is-today .dc-month { background: var(--accent); color: var(--accent-text); }
.dayhead .actions { margin-left: auto; }
.date-btn { position: relative; width: 2.6rem; padding: 0; overflow: hidden; }
.date-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.date-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; padding: 0; border: 0; }
.date-btn input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
@media (max-width: 600px) {
  .hide-phone { display: none !important; }
  .dayhead { gap: .6rem; }
  .dayhead .datenav { width: 100%; }
  .dayhead .datetitle { flex: 1; }
  .dayhead .actions { width: 100%; }
  .dayhead .actions .primary { flex: 1; }
  h1 { font-size: 1.35rem; }
}

/* ------------------------------------------------------------- buttons */

.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 2.6rem; padding: .5rem .95rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 550; font-size: .95rem; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent)); border-color: transparent;
  color: var(--accent-text); font-weight: 650; box-shadow: 0 6px 18px rgba(255, 181, 71, .22);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--danger) 60%, transparent); color: var(--danger); box-shadow: none; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { min-height: 2rem; padding: .25rem .65rem; font-size: .85rem; border-radius: 8px; }
.btn.icon { width: 2.6rem; padding: 0; font-size: 1.35rem; line-height: 1; }
.btn.wide { width: 100%; }
button.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }

/* --------------------------------------------------------------- forms */

.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: .25rem; }
.field { display: grid; gap: .35rem; margin-bottom: .8rem; min-width: 0; align-content: start; }
.field label, .field legend { font-weight: 600; font-size: .85rem; color: var(--muted); }
.field-check label { font-weight: 500; display: flex; gap: .5rem; align-items: center; color: var(--text); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date],
input[type=time], input[type=tel], input[type=url], select, textarea {
  display: block; width: 100%; min-width: 0; max-width: 100%;
  padding: .6rem .75rem; border-radius: 10px; border: 1px solid var(--border);
  background-color: var(--surface); color: var(--text); font: inherit; font-size: 16px; min-height: 2.75rem;
  transition: border-color .15s, box-shadow .15s;
}
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23959cad' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 16px;
}
textarea { min-height: 5rem; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[type=color] { width: 4rem; height: 2.75rem; padding: 3px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); margin: 0; flex: none; }
.help { font-size: .8rem; color: var(--muted); }
.help ul { margin: .2rem 0; padding-left: 1.1rem; }
.error { color: var(--danger); font-size: .85rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.checkgrid { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .75rem; min-height: 2.4rem;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  font-weight: 500 !important; font-size: .92rem; color: var(--text) !important;
  transition: border-color .15s, background .15s; -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--border-strong); }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.formactions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; margin-top: .6rem; }
.danger-zone { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.danger-zone form { margin: 0; }

/* Assignment form: date on its own row, start and end side by side. */
.row3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 .6rem; }
.row3 .field:first-child { grid-column: 1 / -1; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 .6rem; }
@media (min-width: 520px) {
  .row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (min-width: 1100px) {
  main .row3 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); }
  main .row3 .field:first-child { grid-column: auto; }
}
.row3 .field, .row2 .field { margin-bottom: .5rem; }
.row3 button.link { justify-self: start; font-size: .8rem; }
.end-help { margin: 0 0 .9rem; }
.group-picks { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .6rem; }
.group-chip { font: inherit; font-size: .85rem; min-height: 2.1rem; padding: .3rem .75rem; }
.group-chip:hover { border-color: var(--accent); }
.group-chip.ghost { color: var(--muted) !important; background: transparent; }
.people-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .4rem; }
.person-pick { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.person-pick .chip { width: 100%; border-radius: 10px; flex-wrap: wrap; row-gap: 0; }
.person-pick .chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .busy-note { color: var(--warning); font-size: .72rem; flex-basis: 100%; padding-left: 1.55rem; }
.chip .busy-note:empty { display: none; }
.chip.is-busy { border-style: dashed; border-color: var(--warning); }
.position-select { min-height: 2.1rem !important; padding: .2rem 2rem .2rem .6rem !important; font-size: .85rem !important; border-radius: 8px !important; }
.person-pick:not(:has(input:checked)) .position-select { display: none; }
.tag-picks { display: flex; flex-wrap: wrap; gap: .4rem; margin: .25rem 0 1rem; }

/* ------------------------------------------------------------ messages */

.messages { display: grid; gap: .5rem; margin-bottom: 1rem; }
.msg {
  padding: .7rem .9rem .7rem 2.4rem; border-radius: var(--radius); position: relative; font-size: .93rem;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); animation: pop .2s ease-out;
}
.msg::before { content: "i"; position: absolute; left: .8rem; top: .78rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 800; background: var(--muted); color: var(--surface); }
.msg-success { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.msg-success::before { content: "✓"; background: var(--success); }
.msg-error { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.msg-error::before { content: "!"; background: var(--danger); }
.msg-warning { border-color: color-mix(in srgb, var(--warning) 45%, var(--border)); background: color-mix(in srgb, var(--warning) 7%, var(--surface)); }
.msg-warning::before { content: "!"; background: var(--warning); color: #1d1300; }

/* --------------------------------------------------------- components */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.15rem; box-shadow: var(--shadow-sm); }
.login .card { padding: 1.75rem; box-shadow: var(--shadow-lg); }
.tag { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: var(--surface-2); font-size: .8rem; border: 1px solid var(--border); }
.tag-warn { border-color: var(--warning); color: var(--warning); }
.warn { color: var(--warning); }
.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.wp-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; background: var(--wp, var(--muted)); margin-right: .45rem; flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--wp, var(--muted)) 22%, transparent); }

.tabs { display: inline-flex; gap: .2rem; padding: .25rem; margin: .25rem 0 1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; }
.tabs a { padding: .4rem .9rem; color: var(--muted); border-radius: 9px; white-space: nowrap; font-weight: 550; font-size: .9rem; }
.tabs a[aria-current="page"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.tabs a:hover { text-decoration: none; color: var(--text); }

.daynote { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: var(--radius); padding: .65rem .95rem; margin-bottom: .85rem; }
.daynote p { margin: 0 0 .25rem; font-weight: 600; }
.daynote.empty { background: transparent; border-style: dashed; border-color: var(--border-strong); }
.daynote.small { padding: .45rem .75rem; font-size: .9rem; }
details summary { cursor: pointer; color: var(--muted); font-size: .9rem; font-weight: 500; }
details summary:hover { color: var(--text); }
details.tools { margin-top: 1.5rem; }

.badge {
  display: inline-block; font-size: .66rem; font-weight: 700; padding: .12rem .45rem; border-radius: 5px;
  margin-right: .25rem; letter-spacing: .04em; text-transform: uppercase; line-height: 1.4; vertical-align: middle;
  background: var(--tag, var(--surface-3)); color: var(--tag-text, var(--text));
}
.badge-tentative { background: transparent; border: 1px dashed var(--warning); color: var(--warning); }
.badge-departure { background: var(--surface-3); color: var(--text); text-transform: none; letter-spacing: 0; }
.note-mark { opacity: .7; font-weight: 400; }
.pos { font-weight: 600; }
.off-badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .12rem .55rem; border-radius: 6px; background: var(--surface-3); color: var(--muted); margin-bottom: .3rem; }

/* ------------------------------------------------------- day timeline */

.timeline { --hour-h: 3.4rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow-x: auto; box-shadow: var(--shadow-sm); }
.tl-head, .tl-body { display: grid; grid-template-columns: 3.6rem repeat(var(--cols), minmax(160px, 1fr)); min-width: max-content; }
.tl-head { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 2; }
.tl-colhead { padding: .65rem .6rem; font-weight: 650; font-size: .88rem; border-left: 1px solid var(--border); display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-body { position: relative; }
.tl-gutter { position: relative; }
.tl-hour { position: absolute; right: .5rem; transform: translateY(-50%); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-hour:first-child { transform: none; }
.tl-col { position: relative; border-left: 1px solid var(--border); }
.tl-col:nth-child(even) { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.tl-col.clickable { cursor: copy; }
.tl-line { position: absolute; left: 0; right: 0; border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent); }
.tl-now { position: absolute; left: 3.6rem; right: 0; z-index: 5; border-top: 2px solid var(--danger); pointer-events: none; }
.tl-now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.tl-now span { position: absolute; left: -3.45rem; top: -.62rem; font-size: .68rem; font-weight: 700; color: #fff; background: var(--danger); padding: 0 .3rem; border-radius: 4px; }
.block {
  position: absolute; padding: .3rem .45rem; overflow: hidden; color: var(--text);
  background: color-mix(in srgb, var(--wp) 20%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--wp) 35%, transparent); border-left: 4px solid var(--wp);
  border-radius: 8px; font-size: .8rem; line-height: 1.3; display: flex; flex-direction: column; gap: .12rem;
  cursor: pointer; transition: box-shadow .15s, transform .15s;
}
.block:hover, .block:focus { text-decoration: none; z-index: 4; min-height: fit-content; box-shadow: var(--shadow); transform: translateY(-1px); }
.block .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.block .title { font-weight: 600; }
.block .people { color: var(--muted); }
.block .badges:empty { display: none; }
.block.conflict { border-color: color-mix(in srgb, var(--warning) 70%, transparent); border-left-color: var(--wp); }
.block.open-ended {
  border-bottom-color: transparent; border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent); mask-image: linear-gradient(to bottom, #000 60%, transparent);
}
.block.open-ended:hover, .block.open-ended:focus { -webkit-mask-image: none; mask-image: none; }
.block.ghost {
  z-index: 6; pointer-events: none; border-color: var(--accent); border-style: dashed; border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, var(--surface)); box-shadow: var(--shadow);
}
.block.is-editing { opacity: .3; }
.block.tentative, .item.tentative, .wslot.tentative {
  background-image: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--warning) 7%, transparent) 8px 16px);
}

/* Day list */
.wp-section { margin-bottom: 1.25rem; }
.wp-section h2 { display: flex; align-items: center; margin: .5rem 0 .6rem; }
.item {
  display: flex; gap: .85rem; align-items: flex-start; padding: .8rem .9rem; margin-bottom: .55rem;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--wp, var(--border));
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.wp-section .item { --wp: inherit; }
.item .time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 6.2rem; }
.item .body { flex: 1; display: grid; gap: .3rem; min-width: 0; }
.item .body > div:empty { display: none; }
.item .title { font-weight: 600; display: flex; align-items: center; flex-wrap: wrap; gap: .2rem; }
.item .notes { font-size: .88rem; color: var(--muted); }
.item .people .tag { margin: 0 .15rem .2rem 0; }
.item.conflict { border-color: color-mix(in srgb, var(--warning) 60%, var(--border)); border-left-color: var(--wp, var(--border)); }
a.item-link { color: var(--text); transition: transform .12s, box-shadow .15s; }
a.item-link:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-1px); }

.day-views .daylist { display: none; }
.day-views.mode-list .timeline { display: none; }
.day-views.mode-list .daylist { display: block; }
@media (max-width: 700px) {
  .day-views.mode-timeline .timeline { display: none; }
  .day-views.mode-timeline .daylist { display: block; }
  .item { flex-direction: column; gap: .3rem; position: relative; }
  .item .time { min-width: 0; font-size: 1.05rem; }
  .item > .btn { position: absolute; top: .6rem; right: .6rem; }
}

/* Day by person */
.people-day { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.person-card { padding: .95rem 1.05rem; }
.person-card h2 { margin: 0 0 .45rem; }
.slot { padding: .4rem 0; border-top: 1px solid var(--border); }
.slot:first-child { border-top: 0; }
.slot .time { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: .4rem; }
.slot-link { color: var(--text); display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.slot-link:hover { text-decoration: none; color: var(--accent); }
.free { margin-top: 1rem; }
.free .tag { margin: 0 .2rem .3rem 0; }

/* Day extras: to-dos and days off */
.day-extras { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); margin-top: 1.5rem; }
.day-extras h2 { margin-top: 0; }
.todo-list { list-style: none; padding: 0; margin: 0 0 .5rem; }
.todo-list li { display: flex; align-items: flex-start; gap: .65rem; padding: .55rem 0; border-top: 1px solid var(--border); }
.todo-list li:first-child { border-top: 0; }
.todo-list li.done .todo-text { text-decoration: line-through; color: var(--muted); }
.todo-body { flex: 1; min-width: 0; }
.todo-toggle { margin: 0; }
.check {
  width: 1.65rem; height: 1.65rem; border-radius: 8px; border: 2px solid var(--border-strong); background: var(--surface);
  color: #fff; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none;
  transition: background .15s, border-color .15s; padding: 0;
}
.check:hover { border-color: var(--success); }
.check.static { cursor: default; }
li.done .check { border-color: var(--success); background: var(--success); }
.off-list li { display: flex; align-items: center; justify-content: space-between; padding: .4rem 0; border-top: 1px solid var(--border); }
.off-list li:first-child { border-top: 0; }
.off-list form { margin: 0; }
.day-text-link { margin-top: 1rem; }
textarea.day-text { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .88rem; line-height: 1.5; }

/* --------------------------------------------------------------- week */

.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { border-collapse: collapse; width: 100%; }
table.week { min-width: 940px; table-layout: fixed; }
table.week th, table.week td { border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); padding: .45rem; vertical-align: top; text-align: left; font-size: .83rem; }
table.week thead th { background: var(--surface-2); font-weight: 650; }
table.week thead th a { color: var(--text); }
table.week th.is-today { background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent); }
table.week .rowhead { width: 9.5rem; position: sticky; left: 0; background: var(--surface); z-index: 1; border-left: 0; font-weight: 600; }
table.week thead .rowhead { background: var(--surface-2); }
table.week .sub { color: var(--muted); font-weight: 500; }
.weeknote { font-weight: 500; font-size: .72rem; color: var(--accent); margin-top: .25rem; }
.wslot {
  display: grid; gap: .05rem; padding: .3rem .4rem; margin-bottom: .3rem; border-left: 3px solid var(--wp);
  background: color-mix(in srgb, var(--wp) 13%, var(--surface)); border-radius: 6px; line-height: 1.3;
}
.wslot .time { font-weight: 700; font-variant-numeric: tabular-nums; }
a.wslot { color: var(--text); transition: filter .15s; }
a.wslot:hover { text-decoration: none; filter: brightness(1.12); }
tr.unstaffed th, tr.unstaffed td { background: color-mix(in srgb, var(--warning) 6%, var(--surface)); }
@media (max-width: 700px) {
  table.week .rowhead { width: 6.5rem; }
}

/* -------------------------------------------------- my schedule & show */

.my-day { margin-bottom: 1.25rem; }
.my-day h2 a, .my-day h3 a { color: var(--text); }
.my-day.is-today h2 a { color: var(--accent); }
.my-tasks li { padding: .2rem 0; }
.my-tasks li.done { color: var(--muted); text-decoration: line-through; }

/* ---------------------------------------------------- admin lists */

ul.rows { list-style: none; padding: 0; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
ul.rows li { border-top: 1px solid var(--border); }
ul.rows li:first-child { border-top: 0; }
ul.rows li > a, ul.rows li.muted { display: flex; align-items: center; gap: .55rem; padding: .85rem 1rem; color: var(--text); flex-wrap: wrap; }
ul.rows li > a:hover { background: var(--surface-2); text-decoration: none; }
.inactive { opacity: .55; }
table.list th, table.list td { padding: .65rem .85rem; border-bottom: 1px solid var(--border); text-align: left; }
table.list tr:last-child td { border-bottom: 0; }
table.list th { font-size: .78rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.role { font-size: .78rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.role-sysadmin { border-color: var(--danger); color: var(--danger); }
.role-editor { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------- side panel / sheet */

.panel {
  position: fixed; z-index: 50; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  left: 0; right: 0; bottom: 0; max-height: 90vh; border-radius: 18px 18px 0 0;
  padding-bottom: env(safe-area-inset-bottom); animation: sheet-up .22s cubic-bezier(.2, .8, .2, 1);
}
.panel::before { content: ""; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--border-strong); }
.panel[hidden] { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem .6rem .5rem 1.1rem; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 1.05rem; }
.panel-body { overflow-y: auto; overflow-x: hidden; padding: 1rem 1.1rem 1.5rem; overscroll-behavior: contain; }
.panel .danger-zone { margin-top: 1rem; }
.panel-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .5); animation: fade .2s; }
.panel-backdrop[hidden] { display: none; }
@media (min-width: 701px) {
  .panel {
    top: var(--topbar-h); bottom: 0; left: auto; right: 0; width: 440px; max-height: none;
    border-radius: 0; border-width: 0 0 0 1px; animation: slide-in .22s cubic-bezier(.2, .8, .2, 1);
  }
  .panel::before { display: none; }
  .panel-backdrop { display: none !important; }
  body.panel-open main.container { margin-right: 440px; }
}

/* Details */
.detail { border-left: 4px solid var(--wp); padding-left: 1rem; }
.detail-time { font-size: 1.75rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.detail-sub { color: var(--muted); }
.detail h2 { display: flex; align-items: center; margin-top: .85rem; }
.detail-title { font-weight: 600; margin: .25rem 0; }
.detail-people li { padding: .45rem 0; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: .5rem; }
.detail-people li:first-child { border-top: 0; }
.detail-notes { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem .95rem; }

/* ---------------------------------------------------------- motion */

@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Activity log */
.log-filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin: .8rem 0 1rem; }
.log-filters label { display: grid; gap: .2rem; font-size: .85rem; color: var(--muted); }
.log-filters select, .log-filters input { min-width: 9rem; }
.log td { vertical-align: top; }
.log-changes { font-size: .85rem; color: var(--muted); margin-top: .2rem; }
.log-login_failed strong, .log-deleted strong { color: var(--danger); }
.log-pager { display: flex; gap: .8rem; align-items: center; justify-content: center; margin-top: 1rem; }

/* "View as user" mode */
.viewmode-bar { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: center; justify-content: space-between; padding: .55rem .9rem; margin-bottom: .85rem; border-radius: var(--radius); border: 1px dashed var(--border-strong); background: var(--surface-2); font-size: .9rem; }

/* Day off for everyone */
.closedday { display: flex; flex-wrap: wrap; gap: .35rem .8rem; align-items: center; padding: .7rem .95rem; margin-bottom: .85rem; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 10px, var(--surface-3) 10px 20px); }
.closedday strong { font-size: 1.05rem; }
.closedday form { margin-left: auto; }
table.week td.closed, table.week th.closed { background: repeating-linear-gradient(135deg, transparent 0 8px, var(--surface-3) 8px 16px); }
.closed-badge { margin-top: .3rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

/* Server page */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .85rem; margin-bottom: .85rem; }
.sys-card h2, .card > h2 { margin: 0 0 .4rem; font-size: 1rem; }
.sys-card p { margin: .35rem 0 0; font-size: .88rem; }
.sys-big { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.meter { height: .45rem; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: .4rem; }
.meter span { display: block; height: 100%; background: var(--accent); }
.meter.hot span { background: var(--danger); }
.sys-services li { padding: .3rem 0; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--success); }
.dot.bad { background: var(--danger); }
.sys-actions { display: flex; gap: .35rem; justify-content: flex-end; }
.sys-actions form { margin: 0; }
section.card + section.card { margin-top: .85rem; }
