/* Roll Mill Calendar (Crew Vacation & Coverage) — styles
   Layout: sidebar on wide screens; header + bottom tab bar on phones.
   Colors are tokens so light and dark mode stay in sync. */

:root {
  color-scheme: light;
  --primary: #17503f;
  --primary-hover: #1d6550;
  --on-primary: #ffffff;
  --link: #17694f;
  --brand-soft: #e6f2eb;
  --brand-soft-ink: #155a43;
  --hero-1: #134437;
  --hero-2: #1d6650;

  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-2: #f7f9f8;
  --surface-3: #edf2ef;
  --ink: #14251e;
  --ink-2: #33473e;
  --muted: #5f7067;
  --faint: #8a9a91;
  --line: #e1e8e4;
  --line-strong: #cbd7d0;
  --focus: #2f7de1;

  --red: #b3261e;
  --red-soft: #fdecea;
  --amber: #8a5300;
  --amber-soft: #fff2d6;
  --green: #16683f;
  --green-soft: #e1f3e8;
  --blue: #2457a0;
  --blue-soft: #e7eefb;
  --purple: #6a3fa0;
  --purple-soft: #f1e9fb;
  --orange: #a3500c;
  --orange-soft: #fdeddb;
  --gray: #56635d;
  --gray-soft: #edf1ef;

  --crew-A: #c2414d;
  --crew-B: #2f6db3;
  --crew-C: #2b8653;
  --crew-D: #b3850c;

  --side-bg: #0f2a22;
  --side-ink: #d3e3da;
  --side-muted: #8fae9f;
  --side-hover: #173a2f;
  --side-active: #22513f;

  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgb(15 35 28 / 0.05);
  --shadow-2: 0 1px 2px rgb(15 35 28 / 0.04), 0 8px 24px rgb(15 35 28 / 0.06);
  --shadow-3: 0 24px 60px rgb(10 25 20 / 0.25);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 62px;
  --side-w: 264px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --primary: #24805c;
    --primary-hover: #2c9169;
    --link: #7fd3ac;
    --brand-soft: #173a2e;
    --brand-soft-ink: #9fe3c2;
    --hero-1: #123a2f;
    --hero-2: #1a5543;
    --bg: #0b1411;
    --surface: #121e1a;
    --surface-2: #162621;
    --surface-3: #1c2f28;
    --ink: #e4eee9;
    --ink-2: #c3d3cb;
    --muted: #94a89e;
    --faint: #6d8378;
    --line: #22362e;
    --line-strong: #2f483e;
    --red: #ff8f86;
    --red-soft: #3b1a18;
    --amber: #f3c46e;
    --amber-soft: #352912;
    --green: #7fd8a6;
    --green-soft: #14352a;
    --blue: #93b9f3;
    --blue-soft: #172a45;
    --purple: #c9a8f6;
    --purple-soft: #2a1f3e;
    --orange: #f3ab6c;
    --orange-soft: #3a2715;
    --gray: #a9b7b0;
    --gray-soft: #1d2b26;
    --crew-A: #f0838c;
    --crew-B: #7cb0f1;
    --crew-C: #6fd09a;
    --crew-D: #e8c35c;
    --side-bg: #08120f;
    --side-hover: #12261f;
    --side-active: #1b3d31;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-2: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #24805c;
  --primary-hover: #2c9169;
  --link: #7fd3ac;
  --brand-soft: #173a2e;
  --brand-soft-ink: #9fe3c2;
  --hero-1: #123a2f;
  --hero-2: #1a5543;
  --bg: #0b1411;
  --surface: #121e1a;
  --surface-2: #162621;
  --surface-3: #1c2f28;
  --ink: #e4eee9;
  --ink-2: #c3d3cb;
  --muted: #94a89e;
  --faint: #6d8378;
  --line: #22362e;
  --line-strong: #2f483e;
  --red: #ff8f86;
  --red-soft: #3b1a18;
  --amber: #f3c46e;
  --amber-soft: #352912;
  --green: #7fd8a6;
  --green-soft: #14352a;
  --blue: #93b9f3;
  --blue-soft: #172a45;
  --purple: #c9a8f6;
  --purple-soft: #2a1f3e;
  --orange: #f3ab6c;
  --orange-soft: #3a2715;
  --gray: #a9b7b0;
  --gray-soft: #1d2b26;
  --crew-A: #f0838c;
  --crew-B: #7cb0f1;
  --crew-C: #6fd09a;
  --crew-D: #e8c35c;
  --side-bg: #08120f;
  --side-hover: #12261f;
  --side-active: #1b3d31;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.3);
  --shadow-2: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
h1 {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
}
h2 {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.01em;
}
h3 {
  font-size: 15px;
  font-weight: 650;
}
p {
  color: var(--muted);
}
a {
  color: var(--link);
}
small,
.small {
  font-size: 13px;
}
b,
strong {
  font-weight: 650;
}
[hidden] {
  display: none !important;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
svg {
  flex: none;
  width: 20px;
  height: 20px;
  vertical-align: middle;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--surface);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}
.skip:focus {
  top: 12px;
}
.muted {
  color: var(--muted);
}
.nowrap {
  white-space: nowrap;
}
.mt {
  margin-top: 14px;
}
.mt-lg {
  margin-top: 24px;
}

/* ---------- Boot spinner ---------- */
.boot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover {
  background: var(--surface-3);
}
.btn:active {
  transform: translateY(1px);
}
.btn svg {
  width: 18px;
  height: 18px;
}
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.btn.primary:hover {
  background: var(--primary-hover);
}
.btn.danger {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 35%, var(--line));
}
.btn.danger:hover {
  background: var(--red-soft);
}
.btn.danger.solid {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--link);
}
.btn.ghost:hover {
  background: var(--brand-soft);
}
.btn.small {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 14px;
}
.btn.block {
  width: 100%;
}
.btn.light {
  background: rgb(255 255 255 / 0.14);
  border-color: rgb(255 255 255 / 0.25);
  color: #fff;
}
.btn.light:hover {
  background: rgb(255 255 255 / 0.22);
}
.btn.white {
  background: #fff;
  border-color: #fff;
  color: #123d31;
}
.btn.white:hover {
  background: #eef6f2;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: inherit;
}
.icon-btn:hover {
  background: var(--surface-3);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--link);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
body.busy {
  cursor: progress;
}

/* ---------- App frame ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side-w);
  background: var(--side-bg);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  padding: calc(22px + var(--safe-t)) 14px calc(14px + var(--safe-b));
  z-index: 50;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 18px;
  color: #fff;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2c8a64, #17503f);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);
  flex: none;
}
.brand-mark svg {
  width: 22px;
  height: 22px;
  color: #fff;
}
.brand-name {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
}
.brand-name small {
  display: block;
  font-weight: 450;
  font-size: 12.5px;
  color: var(--side-muted);
  margin-top: 2px;
}
.nav-group {
  padding: 16px 12px 6px;
  color: var(--side-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-btn {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 9px 12px;
  margin: 1px 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--side-ink);
  text-align: left;
  font-size: 14.5px;
}
.nav-btn svg {
  width: 19px;
  height: 19px;
  opacity: 0.85;
}
.nav-btn:hover {
  background: var(--side-hover);
  color: #fff;
}
.nav-btn.active {
  background: var(--side-active);
  color: #fff;
  font-weight: 600;
}
.nav-btn.active svg {
  opacity: 1;
}
.nav-count {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 99px;
  background: #f1b53d;
  color: #2d1d00;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.side-foot {
  margin-top: auto;
  padding-top: 18px;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgb(255 255 255 / 0.05);
}
.user-card .avatar {
  background: #2c6e57;
  color: #fff;
}
.user-card b {
  display: block;
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-card small {
  color: var(--side-muted);
  font-size: 12px;
}
.user-card > div {
  min-width: 0;
  flex: 1;
}
.user-card .icon-btn {
  color: var(--side-muted);
  width: 38px;
  height: 38px;
}
.user-card .icon-btn:hover {
  background: var(--side-hover);
  color: #fff;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  background: var(--brand-soft);
  color: var(--brand-soft-ink);
  flex: none;
}
.avatar.lg {
  width: 52px;
  height: 52px;
  font-size: 18px;
}

.shell {
  margin-left: var(--side-w);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.demo-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 16px;
  background: var(--amber-soft);
  color: var(--amber);
  border-bottom: 1px solid color-mix(in srgb, var(--amber) 25%, transparent);
  font-size: 13.5px;
}
.demo-bar b {
  color: var(--amber);
}
.demo-bar select {
  min-height: 34px;
  padding: 4px 30px 4px 10px;
  font-size: 14px;
  border-radius: 8px;
  width: auto;
}
.demo-bar .btn {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 13.5px;
}
.demo-bar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.topbar {
  display: none;
}
main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 36px 48px;
  min-width: 0;
}
main:focus {
  outline: none;
}
.scrim {
  display: none;
}
.tabbar {
  display: none;
}

/* ---------- Page header ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head .lead {
  margin-top: 6px;
  font-size: 15px;
  max-width: 62ch;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
}
.card-head p {
  font-size: 13.5px;
  margin-top: 2px;
}
.card-body {
  padding: 4px 20px 20px;
}
.card-body.flush {
  padding: 0;
}
.grid {
  display: grid;
  gap: 18px;
}
.grid.two {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}
.grid.halves {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stack {
  display: grid;
  gap: 18px;
  align-content: start;
  min-width: 0;
}

/* ---------- Hero (dashboard) ---------- */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 26px 28px;
  margin-bottom: 18px;
  border-radius: 20px;
  color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, var(--hero-2) 0%, var(--hero-1) 60%);
  box-shadow: var(--shadow-2);
}
.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 40px solid rgb(255 255 255 / 0.05);
  pointer-events: none;
}
.hero h1 {
  color: #fff;
  font-size: 30px;
}
.hero p {
  color: #cfe5da;
}
.hero-date {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a9cfbf !important;
  margin-bottom: 6px;
}
.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 7px 12px;
  border-radius: 99px;
  background: rgb(255 255 255 / 0.12);
  color: #fff !important;
  font-size: 14px;
  font-weight: 550;
}
.hero-status svg {
  width: 17px;
  height: 17px;
}
.hero .actions {
  position: relative;
  z-index: 1;
}

/* ---------- Tiles / stats ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  min-width: 0;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  color: inherit;
}
button.tile:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2);
}
.tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 550;
}
.tile-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-soft-ink);
}
.tile-icon svg {
  width: 18px;
  height: 18px;
}
.tile.warn .tile-icon {
  background: var(--red-soft);
  color: var(--red);
}
.tile.amber .tile-icon {
  background: var(--amber-soft);
  color: var(--amber);
}
.tile-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}
.tile-value small {
  font-size: 14px;
  font-weight: 550;
  color: var(--muted);
  margin-left: 3px;
}
.tile-foot {
  font-size: 13px;
  color: var(--muted);
}
.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  margin-top: 6px;
}
.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}
.bar.warn > span {
  background: var(--red);
}
.bar.ok > span {
  background: var(--green);
}

/* ---------- Pills, chips ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--gray-soft);
  color: var(--gray);
}
.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.pill.plain::before {
  display: none;
}
.pill.green {
  background: var(--green-soft);
  color: var(--green);
}
.pill.amber {
  background: var(--amber-soft);
  color: var(--amber);
}
.pill.red {
  background: var(--red-soft);
  color: var(--red);
}
.pill.blue {
  background: var(--blue-soft);
  color: var(--blue);
}
.pill.purple {
  background: var(--purple-soft);
  color: var(--purple);
}
.pill.orange {
  background: var(--orange-soft);
  color: var(--orange);
}
.crew-A {
  --crew: var(--crew-A);
}
.crew-B {
  --crew: var(--crew-B);
}
.crew-C {
  --crew: var(--crew-C);
}
.crew-D {
  --crew: var(--crew-D);
}
.crew-chip {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-weight: 750;
  font-size: 14px;
  color: var(--crew);
  background: color-mix(in srgb, var(--crew) 14%, var(--surface));
  flex: none;
}
.crew-chip.sm {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 12px;
}
.crew-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--crew);
  background: color-mix(in srgb, var(--crew) 13%, var(--surface));
  white-space: nowrap;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 12.5px;
  margin: 2px 4px 2px 0;
  white-space: nowrap;
}

/* ---------- Notices ---------- */
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  background: var(--blue-soft);
  color: var(--ink-2);
  font-size: 14.5px;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, transparent);
}
.notice svg {
  width: 20px;
  height: 20px;
  color: var(--blue);
  margin-top: 1px;
}
.notice.warn {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 22%, transparent);
}
.notice.warn svg {
  color: var(--amber);
}
.notice.bad {
  background: var(--red-soft);
  border-color: color-mix(in srgb, var(--red) 22%, transparent);
}
.notice.bad svg {
  color: var(--red);
}
.notice.good {
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 22%, transparent);
}
.notice.good svg {
  color: var(--green);
}
.notice p {
  color: inherit;
}
.notice > div {
  min-width: 0;
}

/* ---------- Lists ---------- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  min-width: 0;
}
.row:first-child {
  border-top: 0;
}
.row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.row-main > div {
  min-width: 0;
}
.row b {
  display: block;
}
.row p {
  font-size: 13.5px;
}
.row-end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.datebox {
  width: 46px;
  flex: none;
  text-align: center;
  line-height: 1.1;
  padding: 6px 0;
  border-radius: 10px;
  background: var(--surface-3);
}
.datebox small {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.datebox b {
  font-size: 19px;
}
.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
}
.empty svg {
  width: 28px;
  height: 28px;
  color: var(--faint);
}

/* ---------- Attention list (supervisor dashboard) ---------- */
.attention .row {
  padding: 14px 20px;
}
.dot-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--brand-soft);
  color: var(--brand-soft-ink);
}
.dot-icon svg {
  width: 19px;
  height: 19px;
}
.dot-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}
.dot-icon.red {
  background: var(--red-soft);
  color: var(--red);
}
.dot-icon.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

/* ---------- How it works ---------- */
.howto {
  padding: 20px;
  margin-bottom: 18px;
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0 6px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.steps li::before {
  content: counter(step);
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  font-size: 14px;
}
.steps b {
  display: block;
  margin-bottom: 2px;
}
.steps p {
  font-size: 14px;
}

/* ---------- Week strip (next 7 days) ---------- */
.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  padding: 0 20px 20px;
}
.day-pill {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  text-align: center;
  min-width: 0;
}
.day-pill small {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.day-pill b {
  font-size: 18px;
  line-height: 1.2;
}
.day-pill svg {
  width: 18px;
  height: 18px;
  margin: 2px 0;
}
.day-pill span {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.day-pill.day {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 25%, transparent);
}
.day-pill.day svg,
.day-pill.day span {
  color: var(--amber);
}
.day-pill.night {
  background: var(--blue-soft);
  border-color: color-mix(in srgb, var(--blue) 25%, transparent);
}
.day-pill.night svg,
.day-pill.night span {
  color: var(--blue);
}
.day-pill.vac {
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 25%, transparent);
}
.day-pill.vac svg,
.day-pill.vac span {
  color: var(--green);
}
.day-pill.off svg {
  color: var(--faint);
}
.day-pill.today {
  box-shadow: 0 0 0 2px var(--primary);
}

/* ---------- Forms ---------- */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field > label,
.label {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-2);
}
.field .hint,
.hint {
  font-size: 13px;
  color: var(--muted);
}
input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px; /* 16px stops iPhone zooming in on focus */
}
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  display: block;
  line-height: 1.4;
}
input::-webkit-date-and-time-value {
  text-align: left;
}
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23738a80' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
textarea {
  min-height: 90px;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  accent-color: var(--primary);
  flex: none;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-grid .wide {
  grid-column: 1 / -1;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.form-error {
  color: var(--red);
  font-weight: 600;
  font-size: 14px;
  margin-top: 12px;
}
.form-error:empty {
  display: none;
}
.step-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  font-size: 15px;
  font-weight: 650;
}
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-soft-ink);
  font-size: 13px;
  font-weight: 750;
  flex: none;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
  border: 0;
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  margin-bottom: 8px;
  scrollbar-width: thin;
}
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 14px;
  font-weight: 550;
}
.chip svg {
  width: 15px;
  height: 15px;
}
.chip.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.estimate {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  font-size: 14.5px;
  color: var(--ink-2);
}
.estimate ul {
  margin: 8px 0 0;
  padding-left: 18px;
}
.estimate li {
  margin: 2px 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 14.5px;
}
.checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 16px;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 0;
  min-width: 0;
}
legend {
  font-weight: 600;
  font-size: 14px;
  padding: 0 6px;
}
.pw {
  position: relative;
}
.pw input {
  padding-right: 52px;
}
.pw .icon-btn {
  position: absolute;
  right: 2px;
  top: 1px;
  color: var(--muted);
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  margin-top: 18px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.switch {
  -webkit-appearance: none;
  appearance: none;
  width: 52px !important;
  height: 30px !important;
  min-height: 0;
  padding: 0;
  border-radius: 99px;
  background: var(--line-strong);
  position: relative;
  border: 0;
  flex: none;
  cursor: pointer;
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.15s;
}
.switch:checked {
  background: var(--primary);
}
.switch:checked::after {
  transform: translateX(22px);
}
.switch:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Toolbars & segmented controls ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.toolbar h2 {
  font-size: 18px;
  min-width: 150px;
  text-align: center;
}
.navgroup {
  display: flex;
  align-items: center;
  gap: 8px;
}
.navgroup .btn {
  padding: 8px 12px;
}
.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border-radius: 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  max-width: 100%;
  overflow-x: auto;
}
.segmented button {
  min-height: 36px;
  padding: 6px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.segmented button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}
.legend {
  margin-bottom: 14px;
}
.legend summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--link);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}
.legend summary::-webkit-details-marker {
  display: none;
}
.legend summary svg {
  width: 17px;
  height: 17px;
}
.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 10px 0 2px;
}
.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

/* ---------- Weekly matrix (desktop) ---------- */
.matrix-card {
  margin-bottom: 18px;
  overflow: hidden;
}
.shift-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px;
  font-weight: 650;
  background: var(--amber-soft);
  color: var(--amber);
}
.shift-band.night {
  background: var(--blue-soft);
  color: var(--blue);
}
.shift-band span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.shift-band svg {
  width: 18px;
  height: 18px;
}
.shift-band small {
  font-weight: 550;
}
.matrix-wrap {
  overflow-x: auto;
}
.matrix {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 980px;
}
.matrix th,
.matrix td {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  padding: 6px;
  vertical-align: top;
}
.matrix thead th {
  padding: 10px 8px;
  text-align: left;
  font-size: 13.5px;
  font-weight: 650;
  background: var(--surface-2);
}
.matrix thead th small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
}
.matrix thead th.today-col {
  box-shadow: inset 0 -3px 0 var(--primary);
}
.matrix .pos {
  width: 150px;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  border-left: 0;
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
}
.matrix thead .pos {
  background: var(--surface-2);
}
.cell {
  width: 100%;
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 7px 9px;
  border: 0;
  border-left: 3px solid var(--crew, var(--line-strong));
  border-radius: 8px;
  background: color-mix(in srgb, var(--crew, var(--gray)) 9%, var(--surface));
  text-align: left;
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
}
.cell b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell small {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell:hover {
  filter: brightness(0.97);
}
.cell.is-needed {
  --crew: var(--red);
  background: var(--red-soft);
  color: var(--red);
}
.cell.is-needed small {
  color: var(--red);
}
.cell.is-cover {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--green) 55%, transparent);
}
.cell.is-emg {
  box-shadow: inset 0 0 0 1.5px var(--purple);
}
.cell.is-sixth {
  box-shadow: inset 0 0 0 1.5px var(--orange);
}
.cell.is-relief {
  box-shadow: inset 0 0 0 1.5px var(--blue);
}
.cell.is-me {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.me-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 10.5px;
  font-weight: 700;
  vertical-align: 1px;
}

/* ---------- Weekly day view (phones) ---------- */
.day-view {
  display: none;
}
.day-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}
.day-tab {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 8px 0;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  min-width: 0;
}
.day-tab small {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.day-tab b {
  font-size: 17px;
}
.day-tab.on {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.day-tab.on small {
  color: inherit;
  opacity: 0.85;
}
.day-tab.today:not(.on) {
  border-color: var(--primary);
}
.day-tab .flag {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}
.shift-block {
  margin-bottom: 14px;
  overflow: hidden;
}
.slot-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
}
.slot-row:first-of-type {
  border-top: 0;
}
.slot-row .pos-name {
  width: 42%;
  flex: none;
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 550;
}
.slot-row .who {
  flex: 1;
  min-width: 0;
  display: grid;
}
.slot-row .who b {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-row .who small {
  color: var(--muted);
  font-size: 12.5px;
}
.slot-row .bar-mark {
  width: 4px;
  align-self: stretch;
  border-radius: 4px;
  background: var(--crew, var(--line-strong));
  flex: none;
}
.slot-row.is-needed {
  background: var(--red-soft);
}
.slot-row.is-needed .who b,
.slot-row.is-needed .who small {
  color: var(--red);
}
.slot-row.is-needed .bar-mark {
  background: var(--red);
}
.slot-row.is-me {
  background: var(--brand-soft);
}

/* ---------- Calendar ---------- */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
.cal-head {
  padding: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.cal-day {
  min-height: 112px;
  padding: 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.cal-day:nth-child(7n) {
  border-right: 0;
}
.cal-day.muted-day {
  background: var(--surface-2);
}
.cal-day.muted-day .cal-num {
  color: var(--faint);
}
.cal-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13.5px;
  font-weight: 650;
}
.cal-day.today .cal-num {
  background: var(--primary);
  color: var(--on-primary);
}
.cal-event {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 5px 7px;
  border: 0;
  border-left: 3px solid var(--crew);
  border-radius: 6px;
  background: color-mix(in srgb, var(--crew) 12%, var(--surface));
  text-align: left;
  font-size: 12.5px;
  line-height: 1.3;
  font-weight: 600;
  overflow: hidden;
}
.cal-event span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event.pending {
  border-left-style: dashed;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--crew) 10%, var(--surface)) 0 6px, color-mix(in srgb, var(--crew) 5%, var(--surface)) 6px 12px);
}
.cal-dots {
  display: none;
  gap: 3px;
  justify-content: center;
  margin-top: 3px;
  flex-wrap: wrap;
}
.cal-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--crew);
}
.agenda {
  display: none;
}
.agenda-day {
  padding: 10px 16px 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}
.agenda-day:first-child {
  border-top: 0;
}

/* ---------- Shift (coverage) cards ---------- */
.shift-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.shift-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-top: 4px solid var(--crew);
}
.shift-card-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.date-badge {
  width: 54px;
  flex: none;
  text-align: center;
  border-radius: 12px;
  background: var(--surface-3);
  padding: 6px 0;
  line-height: 1.1;
}
.date-badge small {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}
.date-badge b {
  display: block;
  font-size: 22px;
}
.shift-card h3 {
  font-size: 16px;
}
.shift-card .meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
.shift-card .meta svg {
  width: 16px;
  height: 16px;
}
.shift-card .why {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
}
.shift-card .why svg {
  width: 17px;
  height: 17px;
  margin-top: 2px;
}
.shift-card .why.ok {
  background: var(--green-soft);
  color: var(--green);
  font-weight: 600;
}
.shift-card .actions {
  margin-top: auto;
}

/* ---------- Request + review cards ---------- */
.req-card {
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}
.req-card:first-child {
  border-top: 0;
}
.req-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.req-top h3 {
  font-size: 16.5px;
}
.req-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}
.cover-progress {
  margin-top: 12px;
  max-width: 360px;
}
.cover-progress .label-row {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-2);
}
.review-card {
  padding: 20px;
}
.review-card + .review-card {
  border-top: 1px solid var(--line);
}
.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.facts > div {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  min-width: 0;
}
.facts small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.facts b {
  font-size: 15px;
}
.shift-lines {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.shift-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  flex-wrap: wrap;
}
.shift-line:first-child {
  border-top: 0;
}
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}
.detail-row:last-child {
  border-bottom: 0;
}
.detail-row > span:first-child {
  color: var(--muted);
}
.detail-row > :last-child {
  text-align: right;
}

/* ---------- Responsive tables ---------- */
.table-wrap {
  overflow-x: auto;
}
.rtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
.rtable th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.rtable td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.rtable tr:last-child td {
  border-bottom: 0;
}
.rtable td small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}
.crew-tabs {
  margin-bottom: 14px;
}

/* ---------- Dialog ---------- */
dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
dialog[open] {
  display: flex;
  flex-direction: column;
  animation: pop 0.16s ease-out;
}
dialog::backdrop {
  background: rgb(8 20 16 / 0.5);
  backdrop-filter: blur(2px);
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 12px 8px 22px;
}
.dialog-head h2 {
  font-size: 19px;
}
.dialog-body {
  padding: 4px 22px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dialog-body > p:first-child {
  margin-bottom: 4px;
}
.sheet-grip {
  display: none;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(480px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 14px;
  background: #13261f;
  color: #fff;
  font-weight: 550;
  font-size: 14.5px;
  box-shadow: var(--shadow-3);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast svg {
  width: 19px;
  height: 19px;
  color: #7fe0ab;
}
.toast.error svg {
  color: #ff9d94;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Help page ---------- */
.faq details {
  border-top: 1px solid var(--line);
}
.faq details:first-of-type {
  border-top: 0;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  font-weight: 600;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 0.15s;
}
.faq details[open] summary svg {
  transform: rotate(90deg);
}
.faq .answer {
  padding: 0 20px 16px;
  color: var(--ink-2);
  font-size: 14.5px;
}
.faq .answer p {
  color: inherit;
  margin-bottom: 8px;
}
.faq .answer ol,
.faq .answer ul {
  margin: 6px 0;
  padding-left: 20px;
}
.rotation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 8px;
}
.rotation-table th,
.rotation-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.rotation-table th {
  color: var(--muted);
  font-size: 12.5px;
  text-transform: uppercase;
}

/* ---------- Invite box ---------- */
.copy-row {
  display: flex;
  gap: 8px;
}
.copy-row input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
}

/* ---------- Sign-in / sign-up ---------- */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.auth-side {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  color: #fff;
  background: radial-gradient(130% 120% at 0% 0%, #1e6b54 0%, #0f2f26 65%);
}
.auth-side h2 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #fff;
  max-width: 14ch;
}
.auth-side ul {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 16px;
}
.auth-side li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: #d2e6dc;
  font-size: 15.5px;
}
.auth-side li svg {
  width: 22px;
  height: 22px;
  color: #8be0b5;
  margin-top: 1px;
}
.auth-side .brand {
  padding: 0;
}
.auth-side small {
  color: #9cc3b2;
}
.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(32px + var(--safe-t)) 20px calc(32px + var(--safe-b));
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 30px 28px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}
.auth-card h1 {
  font-size: 25px;
}
.auth-card > p {
  margin: 6px 0 20px;
}
.auth-card form {
  display: grid;
  gap: 14px;
}
.auth-card .btn.primary {
  margin-top: 4px;
}
.auth-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-weight: 700;
  font-size: 17px;
}
.auth-switch {
  margin-top: 18px;
  text-align: center;
  font-size: 14.5px;
  color: var(--muted);
}
.auth-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.auth-foot {
  margin-top: 18px;
  font-size: 14px;
  text-align: center;
}
.status-hero {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 10px;
}
.status-hero .big-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-soft-ink);
  margin-bottom: 6px;
}
.status-hero .big-icon svg {
  width: 30px;
  height: 30px;
}
.status-hero .big-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}
.status-hero .big-icon.red {
  background: var(--red-soft);
  color: var(--red);
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 1200px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 1100px) {
  :root {
    --side-w: 236px;
  }
  main {
    padding: 24px 24px 44px;
  }
  .grid.two,
  .grid.three {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Phones and small tablets: drawer + top header + bottom tabs */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    width: min(300px, 86vw);
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0s linear 0.22s;
  }
  .sidebar.open {
    transform: none;
    visibility: visible;
    box-shadow: var(--shadow-3);
    transition: transform 0.22s ease, visibility 0s;
  }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    border: 0;
    background: rgb(8 20 16 / 0.5);
  }
  .scrim[hidden] {
    display: none !important;
  }
  .shell {
    margin-left: 0;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(8px + var(--safe-t)) 10px 8px 14px;
    background: #123d31;
    color: #fff;
    box-shadow: 0 1px 0 rgb(0 0 0 / 0.08);
  }
  .topbar .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .topbar .brand-mark svg {
    width: 19px;
    height: 19px;
  }
  .topbar-title {
    flex: 1;
    min-width: 0;
    font-weight: 650;
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar .icon-btn:hover {
    background: rgb(255 255 255 / 0.1);
  }
  .topbar .avatar {
    width: 34px;
    height: 34px;
    font-size: 13px;
    background: #2c6e57;
    color: #fff;
  }
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 4px calc(6px + var(--safe-b));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--line);
  }
  .tab {
    position: relative;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 2px;
    min-height: 50px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
  }
  .tab svg {
    width: 23px;
    height: 23px;
  }
  .tab.on {
    color: var(--link);
  }
  .tab.big .tab-plus {
    width: 46px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: var(--on-primary);
  }
  .tab .badge-dot {
    position: absolute;
    top: 2px;
    left: calc(50% + 6px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 99px;
    background: #e5484d;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
  }
  main {
    padding: 20px 16px calc(var(--tabbar-h) + 28px + var(--safe-b));
  }
  .toast {
    bottom: calc(var(--tabbar-h) + 14px + var(--safe-b));
  }
  .demo-bar {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    padding: calc(6px + var(--safe-t)) 12px 6px;
  }
  .demo-note,
  .demo-bar .btn {
    display: none;
  }
  .demo-bar select {
    min-height: 32px;
    font-size: 14px;
  }
  .page-head {
    margin-bottom: 16px;
  }
  .page-head .page-actions {
    width: 100%;
  }
  .matrix-view {
    display: none;
  }
  .day-view {
    display: block;
  }
  .auth {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-side {
    display: none;
  }
  .auth-mobile-brand {
    display: flex;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }
  h1 {
    font-size: 24px;
  }
  .hero {
    padding: 20px;
    border-radius: 18px;
  }
  .hero h1 {
    font-size: 25px;
  }
  .hero .actions {
    width: 100%;
  }
  .hero .actions .btn {
    flex: 1;
  }
  .tiles {
    gap: 10px;
  }
  .tile {
    padding: 14px;
  }
  .tile-value {
    font-size: 25px;
  }
  .tile-top {
    font-size: 13px;
  }
  .tile-icon {
    width: 30px;
    height: 30px;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid.halves {
    grid-template-columns: minmax(0, 1fr);
  }
  .week-strip {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0 16px 16px;
  }
  .week-strip .day-pill {
    flex: 0 0 74px;
    scroll-snap-align: start;
  }
  .card-head {
    padding: 16px 16px 12px;
  }
  .card-body {
    padding: 4px 16px 16px;
  }
  .row {
    padding: 12px 16px;
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .checks {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-actions .btn {
    flex: 1 1 auto;
  }
  .page-actions .btn {
    flex: 1;
  }
  .facts {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .facts > div:first-child {
    grid-column: 1 / -1;
  }
  .shift-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .toolbar {
    justify-content: center;
  }
  .toolbar h2 {
    min-width: 0;
    flex: 1;
    font-size: 16.5px;
  }
  .navgroup {
    width: 100%;
  }
  .toolbar > .actions {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: center;
  }
  .toolbar > .actions .segmented {
    flex: 1;
    width: auto;
  }
  .toolbar > .actions input[type="date"] {
    flex: 1;
    width: auto !important;
  }
  .segmented {
    width: 100%;
  }
  .segmented button {
    flex: 1;
  }

  /* calendar: dots in grid, details in list below */
  .cal-head {
    padding: 8px 0;
    text-align: center;
    font-size: 11px;
  }
  .cal-day {
    min-height: 54px;
    padding: 4px 2px;
    text-align: center;
  }
  .cal-num {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }
  .cal-event {
    display: none;
  }
  .cal-dots {
    display: flex;
  }
  .agenda {
    display: block;
  }

  /* tables become stacked cards */
  .rtable thead {
    display: none;
  }
  .rtable,
  .rtable tbody,
  .rtable tr,
  .rtable td {
    display: block;
    width: 100%;
  }
  .rtable tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }
  .rtable tr:last-child {
    border-bottom: 0;
  }
  .rtable td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 5px 0;
    border: 0;
    text-align: right;
  }
  .rtable td::before {
    content: attr(data-label);
    flex: none;
    max-width: 45%;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
  }
  .rtable td.cell-title {
    display: block;
    text-align: left;
    padding-bottom: 6px;
  }
  .rtable td.cell-title::before {
    display: none;
  }
  .rtable td.cell-actions {
    justify-content: flex-start;
    padding-top: 10px;
  }
  .rtable td.cell-actions::before {
    display: none;
  }
  .rtable td > div,
  .rtable td > span:not(.pill):not(.crew-pill) {
    min-width: 0;
  }

  /* dialogs become bottom sheets */
  dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
  }
  dialog[open] {
    animation: sheet 0.22s ease-out;
  }
  .sheet-grip {
    display: block;
    width: 40px;
    height: 5px;
    border-radius: 99px;
    background: var(--line-strong);
    margin: 8px auto 0;
  }
  .dialog-head {
    padding: 8px 8px 4px 18px;
  }
  .dialog-body {
    padding: 4px 18px calc(22px + var(--safe-b));
  }
  .auth-card {
    padding: 24px 20px;
    border-radius: 20px;
  }
}
@keyframes sheet {
  from {
    transform: translateY(40px);
    opacity: 0.4;
  }
}

@media (max-width: 380px) {
  .tiles {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .tile-value {
    font-size: 22px;
  }
  .slot-row .pos-name {
    width: 38%;
  }
  .tab {
    font-size: 10.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Admin: reset someone's password (inside Edit account) */
.pw-reset {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.pw-reset h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

/* Blackout dates on the vacation calendar */
.cal-day.blackout {
  background-image: repeating-linear-gradient(135deg, transparent 0 7px, var(--red-soft) 7px 9px);
}
.cal-blackout {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--red);
  line-height: 1.2;
  margin: 2px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cal-blackout svg {
  width: 11px;
  height: 11px;
  flex: none;
}
.pill.blackout-pill {
  background: var(--red-soft);
  color: var(--red);
}
.pill.blackout-pill svg {
  width: 12px;
  height: 12px;
  margin-right: 3px;
  vertical-align: -1px;
}
.chip:disabled {
  opacity: 0.5;
  text-decoration: line-through;
  cursor: not-allowed;
}

/* Calendar sync buttons */
.stack-btns {
  display: grid;
  gap: 8px;
}

/* Overtime list */
.ot-row {
  align-items: center;
}
.ot-num {
  text-align: right;
  flex: none;
  max-width: 55%;
}
.ot-num b {
  font-size: 15px;
}
.ot-num .pill {
  margin-left: 6px;
}
.ot-num p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}
@media (max-width: 520px) {
  .ot-row {
    flex-wrap: wrap;
  }
  .ot-num {
    text-align: left;
    max-width: none;
    padding-left: 46px;
  }
}
.ot-num b {
  display: inline;
}

/* Call-offs and shift trades */
.section-title {
  font-size: 17px;
  margin: 24px 0 10px;
}
.checks.one-col {
  grid-template-columns: 1fr;
}
.checks .check svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}
.trade-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 6px 0;
}
.trade-line > svg {
  width: 18px;
  height: 18px;
  flex: none;
  margin-top: 3px;
  color: var(--muted);
}
.trade-line p {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--muted);
}
