/* Optimo app styles. Uses tokens.css; app-only tokens below. */
:root {
  --sidebar-w: 236px;
  --topbar-h: 60px;
  --gap: 16px;
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent);
  --shadow-sm: 0 1px 2px color-mix(in srgb, var(--ground-deep) 7%, transparent);
  --shadow-pop: 0 4px 12px color-mix(in srgb, var(--ground-deep) 9%, transparent), 0 18px 48px color-mix(in srgb, var(--ground-deep) 15%, transparent);
  --on-brand: var(--on-ground);
  --scrim: color-mix(in srgb, var(--ground-deep) 45%, transparent);
  --hover: color-mix(in srgb, var(--text) 5%, transparent);
  --active: color-mix(in srgb, var(--text) 8%, transparent);
  --input-bg: var(--surface);
  --border-strong: color-mix(in srgb, var(--border) 70%, var(--text-3));
  --av-yes: var(--ok); --av-yes-bg: var(--ok-soft);
  --av-maybe: var(--warn); --av-maybe-bg: var(--warn-soft);
  --av-pref: color-mix(in srgb, var(--teal) 60%, var(--text)); --av-pref-bg: color-mix(in srgb, var(--teal) 16%, var(--surface));
  --av-off-bg: var(--surface-2);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font-sans); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-family: var(--font-display); font-weight: 600; font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 14px; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
.mono { font-variant-numeric: tabular-nums; font-family: var(--font-sans); font-feature-settings: "tnum"; }
kbd { font: 500 11px var(--font-mono); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.grow { flex: 1; }
.pad { padding: 16px; }
.mr-auto { margin-right: auto; }
.bad-text { color: var(--bad); }
.danger-text { color: var(--bad) !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; display: inline-block; vertical-align: middle; }
.icon.flip { transform: rotate(180deg); }
:focus-visible { outline: none; box-shadow: var(--ring); }
::selection { background: color-mix(in srgb, var(--brand) 22%, transparent); }

/* ---------- Boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
/* The loading mark is the logo: four dots, one gold. A soft dip runs round
   them, one dot at a time, so it reads as the mark at work, not a spinner.
   The first frame is the still logo (the landing page leaves on the same
   picture in the same place, site.css .leave-mark), so the handoff has no cut. */
.boot-mark { width: 34px; height: 34px; display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.boot-mark i { border-radius: 50%; background: var(--ground); animation: boot-dot var(--dur-loop) var(--ease-in-out) infinite backwards; }
.boot-mark i:nth-child(2) { background: var(--gold); animation-delay: calc(var(--dur-loop) * .25); }
.boot-mark i:nth-child(4) { animation-delay: calc(var(--dur-loop) * .5); }
.boot-mark i:nth-child(3) { animation-delay: calc(var(--dur-loop) * .75); }
@keyframes boot-dot { 0%, 45%, 100% { opacity: 1; transform: none; } 22% { opacity: .3; transform: scale(.78); } }
@media (prefers-reduced-motion: reduce) { .boot-mark i { animation: none; } }
@keyframes pulse { 50% { opacity: .45; transform: scale(.92); } }
.boot-error { max-width: 520px; margin: 15vh auto; padding: 24px; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  box-shadow: var(--shadow-sm); transition: background var(--dur-1), border-color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1);
}
.btn:hover { background: color-mix(in srgb, var(--surface) 92%, var(--text)); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 1px 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--on-brand); }
.btn.danger:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); border: 0;
  background: transparent; color: var(--text-2); cursor: pointer; transition: background var(--dur-1), color var(--dur-1);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.xs { width: 22px; height: 22px; border-radius: 6px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.link-btn:hover { text-decoration: underline; }

.input, .select {
  height: 36px; width: 100%; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--input-bg); color: var(--text); font: inherit; font-size: 13.5px; transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
textarea.input { height: auto; padding: 10px; resize: vertical; }
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input::placeholder { color: var(--text-3); }
.input.num { text-align: right; font-feature-settings: "tnum"; }
.select { appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238f887c' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
.select-sm, .input-sm { height: 30px; font-size: 13px; }
.select-sm { padding-right: 26px; }
.input-sm.num { width: 80px; }
.input-title { font-weight: 600; font-size: 15px; border-color: transparent; background: transparent; padding: 0 6px; }
.input-title:hover { border-color: var(--border); }
.input-unit { display: inline-flex; align-items: center; gap: 6px; }
.input-unit .input { width: 84px; }
.input-unit span { color: var(--text-2); font-size: 13px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; cursor: pointer; }
input[type="range"] { accent-color: var(--brand); flex: 1; }
.check, .radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.range-row { display: flex; gap: 14px; align-items: center; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--text-3); }
.form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.three { grid-template-columns: 1.3fr 1fr 1fr; }

.toggle { position: relative; width: 36px; height: 20px; border-radius: 99px; border: 0; padding: 0; background: var(--border-strong); cursor: pointer; flex: none; transition: background var(--dur-1); }
.toggle span { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--dur-2) var(--ease-out); }
.toggle.on { background: var(--brand); }
.toggle.on span { transform: translateX(16px); }
.toggle.small { width: 30px; height: 17px; }
.toggle.small span { width: 13px; height: 13px; }
.toggle.small.on span { transform: translateX(13px); }
.toggle:disabled { opacity: .5; }
.toggle-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.badge.neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--border-strong); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toggle-chip.on { background: color-mix(in srgb, var(--role, var(--brand)) 14%, var(--surface)); border-color: color-mix(in srgb, var(--role, var(--brand)) 45%, var(--border)); color: color-mix(in srgb, var(--role, var(--brand)) 75%, var(--text)); }
.filter-chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter-chip.on .muted { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.chip-x { border: 0; background: none; padding: 0; display: grid; place-items: center; cursor: pointer; color: var(--text-3); }
.chip.more { cursor: default; color: var(--text-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.role-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.role-chip { cursor: default; flex: none; white-space: nowrap; height: 22px; padding: 0 8px; font-size: 12px; background: color-mix(in srgb, var(--role) 12%, var(--surface)); border-color: color-mix(in srgb, var(--role) 30%, transparent); color: color-mix(in srgb, var(--role) 70%, var(--text)); }
.role-chip.main { font-weight: 600; }

.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 12px; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }

.spinner { display: inline-block; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: spin calc(var(--dur-loop) / 2) linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; font-size: 13.5px; margin-bottom: 16px; }
.callout > .icon { margin-top: 2px; }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); color: color-mix(in srgb, var(--warn) 60%, var(--text)); }
.callout.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); color: color-mix(in srgb, var(--bad) 70%, var(--text)); }
.callout.info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 20%, transparent); color: color-mix(in srgb, var(--brand) 55%, var(--text)); }
.callout.stale { align-items: center; }
.issue-list { margin: 6px 0 0; padding-left: 18px; }
.warnings { display: block; }
.warnings summary { cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.warnings ul { margin: 8px 0 0; padding-left: 22px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 12px; }

/* ---------- Shell ---------- */
.brand-link { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; font-family: var(--font-display); font-weight: 600; font-size: 20px; color: var(--text); letter-spacing: -0.02em; text-decoration: none !important; }

.pilot-bar { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 8px; }
.pilot-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 99px; }
.menu-btn { display: none; }
.org { display: flex; align-items: center; gap: 9px; min-width: 0; }
.org-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 72px; }
@media (max-width: 1440px) { .privacy-badge .privacy-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.content { padding: 28px 32px 64px; min-width: 0; }

/* ---------- Pages ---------- */
.page { max-width: 1080px; margin: 0 auto; }
.page.wide { max-width: 1320px; }
.page.narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; flex: 1 1 420px; }
.lede { color: var(--text-2); font-size: 15px; margin-top: 6px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.eyebrow-line { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.section { margin-bottom: 32px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head p { margin-top: 2px; font-size: 13px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box > .icon { position: absolute; left: 10px; color: var(--text-3); pointer-events: none; }
.search-box .input { padding-left: 32px; }
.search-box.sm { width: 240px; max-width: 100%; }
.search-box.sm .input { height: 32px; }
.hint-line { display: flex; align-items: center; gap: 6px; margin: -4px 0 10px; }
.empty-inline { padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.empty { text-align: center; padding: 56px 24px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty h3 { font-size: 17px; margin-bottom: 6px; }
.empty p { color: var(--text-2); max-width: 52ch; margin: 0 auto; }
.empty-actions { display: flex; gap: 8px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; border: 0; background: none; cursor: pointer; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--brand); }
.tab.active .icon { color: var(--brand); }
.tab-count { font-size: 11.5px; padding: 0 6px; height: 18px; line-height: 18px; border-radius: 99px; background: var(--surface-2); color: var(--text-2); font-feature-settings: "tnum"; }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; max-width: 100%; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; z-index: 2; background: var(--surface); text-align: left; font-weight: 600; font-size: 12px; color: var(--text-2); padding: 0 8px; height: 38px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 4px 8px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.table .num { text-align: right; }
.table .center { text-align: center; }
.table.compact td { padding: 6px 8px; white-space: nowrap; }
.th-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.cell-input { width: 100%; min-width: 60px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text); font: inherit; }
.cell-input:hover { border-color: var(--border); background: var(--surface); }
.cell-input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); background: var(--surface); }
.cell-input.num { text-align: right; width: 72px; font-feature-settings: "tnum"; }
.cell-input::placeholder { color: var(--text-3); }
.name-input { min-width: 160px; font-weight: 500; }
.roster-table td:first-child { padding-left: 8px; }
.row-warn td { background: color-mix(in srgb, var(--warn-soft) 60%, transparent); }
.row-off td { opacity: .55; }
.row-actions { width: 40px; }
.cb { display: block; margin: 0 auto; }
.role-picker-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 6px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; color: var(--text-3); }
.role-picker-btn:hover { border-color: var(--border); background: var(--surface); }
.role-pop { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.role-pop-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }

/* ---------- Popovers & menus ---------- */
.popover-wrap { position: relative; }
.popover { position: absolute; z-index: 60; min-width: 200px; margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); animation: pop var(--dur-1) var(--ease-out); }
.popover.fixed { position: fixed; margin: 0; }
.popover.align-right { right: 0; }
.popover.align-left { left: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-wrap { position: relative; display: inline-flex; }
.menu { padding: 5px; display: flex; flex-direction: column; }
.popover.menu { top: 100%; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; font-size: 13.5px; white-space: nowrap; color: var(--text); }
.menu-item:hover:not(:disabled) { background: var(--hover); }
.menu-item:disabled { opacity: .45; cursor: default; }
.menu-item .icon { color: var(--text-2); }
.menu-item.danger, .menu-item.danger .icon { color: var(--bad); }
.menu-hint { margin-left: auto; padding-left: 12px; color: var(--text-3); font-size: 12px; }
.menu-item kbd { margin-left: auto; }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.pop-head { display: flex; gap: 10px; align-items: center; padding: 12px 12px 8px; border-bottom: 1px solid var(--border); }
.pop-title { padding: 12px 12px 6px; font-weight: 600; }
.pop-search { margin: 0 10px 4px; }
.pop-foot { padding: 8px 12px 10px; border-top: 1px solid var(--border); }
.cand-list { max-height: 260px; overflow: auto; }

/* ---------- Modals ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: var(--scrim); backdrop-filter: blur(2px); animation: fade var(--dur-2) var(--ease-out); }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-pop); animation: modal-in var(--dur-3) var(--ease-out); outline: none; }
@keyframes modal-in { from { opacity: 0; transform: scale(.97); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-sm { max-width: 460px; } .modal-md { max-width: 600px; } .modal-lg { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; }
.modal-head h2 { font-size: 18px; }
.modal-head p { margin-top: 3px; font-size: 13px; }
.modal-body { padding: 4px 20px 16px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 40%, var(--surface)); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
.confirm-body { color: var(--text-2); font-size: 14px; }
.drawer-overlay { place-items: stretch end; padding: 0; }
.drawer { width: min(560px, 100vw); height: 100vh; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-pop); animation: slide var(--dur-3) var(--ease-out); }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } }
.drawer-body { flex: 1; overflow: auto; padding: 8px 20px 24px; }
/* Exits (ui.js Drawer .closing, toasts .leaving): shorter than the entrance,
   the same direction back out. */
.drawer-overlay.closing { animation: fade-out var(--dur-2) var(--ease-in-out) both; }
.drawer-overlay.closing .drawer { animation: slide-out var(--dur-2) var(--ease-in-out) both; }
@keyframes slide-out { to { transform: translateX(16px); opacity: 0; } }
.toast.leaving { animation: toast-out 180ms var(--ease-in-out) both; }
@keyframes toast-out { to { opacity: 0; transform: translateY(-4px) scale(.98); } }
.drawer .modal-foot { border-radius: 0; }

/* Toasts stack in one column, newest at the bottom, all as wide as the widest
   so two at once read as a tidy pile, never as overlapping cards. The column
   is its own view-transition group so a route change never paints over it. */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: stretch; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; view-transition-name: toasts; }
.toasts:empty { display: none; }
.toast { pointer-events: auto; position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--ground-deep); color: var(--on-ground); box-shadow: var(--shadow-pop); font-size: 13.5px; max-width: min(560px, calc(100vw - 32px)); animation: rise var(--dur-2) var(--ease-out); }
.toast.ok .icon { color: color-mix(in srgb, var(--teal) 70%, var(--on-ground)); } .toast.bad .icon { color: color-mix(in srgb, var(--coral) 80%, var(--on-ground)); } .toast.info .icon { color: var(--gold); }
.toast-action { margin-left: 6px; border: 0; background: color-mix(in srgb, var(--on-ground) 12%, transparent); color: var(--on-ground); border-radius: 6px; padding: 4px 10px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.toast-action:hover { background: color-mix(in srgb, var(--on-ground) 20%, transparent); }
.keys { width: 100%; border-collapse: collapse; }
.keys td { padding: 7px 0; border-bottom: 1px solid var(--border); }
.keys td:first-child { width: 45%; }

/* ---------- Welcome ---------- */
.eyebrow { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 99px; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 12.5px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.choice { text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 26px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); cursor: pointer; transition: transform var(--dur-1), box-shadow var(--dur-1), border-color var(--dur-1); }
.choice:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); box-shadow: var(--shadow-pop); }
.primary-choice { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); background: linear-gradient(180deg, color-mix(in srgb, var(--brand-soft) 55%, var(--surface)), var(--surface)); }
.choice-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--brand); color: var(--on-brand); margin-bottom: 8px; }
.choice-icon.alt { background: var(--accent); }
.choice-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.choice-desc { color: var(--text-2); }
.choice-cta { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 600; }
.setup.standalone { min-height: 100vh; }
.setup-head { padding: 20px 32px; }
.setup-head .brand-link { padding: 0; }
.setup.standalone .setup-body { max-width: 900px; margin: 0 auto; padding: 12px 24px 48px; }

/* ---------- Engine ---------- */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.role-card { padding: 14px 16px 16px; border-top: 3px solid var(--role); display: flex; flex-direction: column; gap: 8px; }
.role-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.color-swatch { position: relative; width: 26px; height: 26px; border-radius: 8px; background: var(--role); cursor: pointer; flex: none; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 12%, transparent); }
.color-swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.role-times { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 10px; margin-top: 6px; }
.role-times label { display: flex; flex-direction: column; gap: 5px; }
.role-times .input-unit .input { width: 100%; }
.field-list { padding: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 120px auto 28px; gap: 8px; align-items: center; margin-bottom: 8px; }
.field-row.add { grid-template-columns: 1fr 120px auto; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); margin-bottom: 0; }
.field-id { font-size: 11.5px; color: var(--text-3); background: var(--surface-2); padding: 2px 6px; border-radius: 5px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }

.rule-group { padding: 6px 0; margin-bottom: 14px; overflow: hidden; }
.rule-group-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 8px; }
.cat-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--text-2); }
.rule { border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.rule-main { display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 16px; }
.rule-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; background: none; padding: 0; cursor: pointer; }
.rule-title { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.rule-sentence { font-size: 14.5px; color: var(--text); line-height: 1.45; }
.rule.off .rule-sentence { color: var(--text-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-3) 50%, transparent); }
.rule-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.strength-select { width: auto; height: 30px; font-size: 12.5px; font-weight: 600; border-radius: 99px; padding-left: 12px; }
.strength-select.s-must { color: var(--bad); background-color: var(--bad-soft); border-color: transparent; }
.strength-select.s-high { color: var(--warn); background-color: var(--warn-soft); border-color: transparent; }
.strength-select.s-medium { color: var(--brand); background-color: var(--brand-soft); border-color: transparent; }
.strength-select.s-low { color: var(--text-2); background-color: var(--surface-2); border-color: transparent; }
.rule-edit { padding: 4px 16px 16px 66px; display: flex; flex-direction: column; gap: 12px; animation: fade var(--dur-1); }
.rule-strength-help { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.param-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; }
.param { display: flex; flex-direction: column; gap: 6px; }
.param.wide { grid-column: 1 / -1; }
.param .input.num { max-width: 140px; }
.filter, .pairs { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.filter-row, .pair-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-row .select { width: auto; max-width: 220px; }
.filter-row .input { width: 160px; }
.pair-row .select { width: 200px; }
.filter-empty { font-size: 13px; color: var(--text-2); padding: 2px 2px 4px; }
.filter-match { font-size: 13px; color: var(--text-2); display: flex; gap: 6px; align-items: center; }
.filter-match .select { width: auto; }
.day-pick { display: flex; gap: 3px; }
.day-chip { height: 28px; min-width: 34px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); font-size: 12px; cursor: pointer; }
.day-chip.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.filter-spacer { width: 0; }
.rule-catalog { display: flex; flex-direction: column; gap: 20px; margin-top: 14px; }
.rule-catalog h4 { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; color: var(--text-2); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.catalog-item { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color var(--dur-1), background var(--dur-1); }
.catalog-item:hover { border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 40%, var(--surface)); }
.catalog-title { font-weight: 600; }
.catalog-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }

/* ---------- Week ---------- */
.day-list { display: flex; flex-direction: column; gap: 18px; }
.day-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.day-head h3 { font-size: 15px; }
.day-head .btn { margin-left: auto; }
.event-row { display: grid; grid-template-columns: 150px 1fr auto 34px; gap: 16px; align-items: center; padding: 10px 12px 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; cursor: pointer; transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.event-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.event-time { color: var(--text-2); font-size: 13px; }
.event-name { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.event-meta { font-size: 12.5px; margin-top: 2px; }
.meta-req { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); margin-left: 8px; }
.event-needs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.need { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; background: color-mix(in srgb, var(--role) 11%, var(--surface)); color: color-mix(in srgb, var(--role) 70%, var(--text)); white-space: nowrap; }
.needs-grid { display: flex; flex-direction: column; gap: 6px; }
.need-edit { display: grid; grid-template-columns: 150px auto 1fr; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); }
.need-role { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper .input { width: 56px; height: 30px; text-align: center; }
.attr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.attr-field { display: flex; flex-direction: column; gap: 4px; }
.multi { position: relative; }
.multi-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 38px; padding: 4px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input-bg); }
.multi-box:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.multi-box .chip { cursor: default; height: 26px; }
.multi-input { flex: 1; min-width: 120px; border: 0; background: none; outline: none; font: inherit; color: var(--text); height: 28px; }
.multi-menu { position: absolute; top: 100%; left: 0; right: 0; z-index: 10; margin-top: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); }

.mode-card { display: flex; justify-content: space-between; gap: 20px; padding: 16px 18px; margin-bottom: 16px; flex-wrap: wrap; align-items: flex-end; }
.mode-card .segmented { margin: 2px 0 6px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); align-items: center; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-sw { width: 14px; height: 14px; border-radius: 4px; }
.av-yes { --c: var(--av-yes); --bgc: var(--av-yes-bg); }
.av-maybe { --c: var(--av-maybe); --bgc: var(--av-maybe-bg); }
.av-pref { --c: var(--av-pref); --bgc: var(--av-pref-bg); }
.av-off { --c: var(--text-3); --bgc: var(--av-off-bg); }
.av-win { --c: color-mix(in srgb, var(--teal) 70%, var(--text)); --bgc: color-mix(in srgb, var(--teal) 14%, var(--surface)); }
.legend-sw { background: var(--bgc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent); }
.avail-wrap { max-height: calc(100vh - 290px); min-height: 300px; }
.avail { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.avail th { position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 8px 6px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 12.5px; text-align: center; white-space: nowrap; }
.avail th.sticky-col, .avail .sticky-col { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; }
.avail thead th.sticky-col { z-index: 4; }
.avail-day { display: flex; align-items: center; justify-content: center; gap: 2px; }
.avail-count { font-weight: 400; font-size: 11.5px; }
.person-cell { padding: 6px 12px !important; min-width: 170px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); border-right: 1px solid var(--border); }
.person-cell { display: table-cell; }
.person-name { display: block; font-weight: 500; font-size: 13.5px; white-space: nowrap; margin-bottom: 2px; }
.avail td { padding: 3px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.avail-td { min-width: 92px; }
.avail-cell { position: relative; display: flex; height: 36px; border-radius: 7px; background: var(--bgc); color: color-mix(in srgb, var(--c) 85%, var(--text)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent); transition: box-shadow var(--dur-1); }
.avail-cell:hover { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 60%, transparent); }
.avail-cell.implied { opacity: .8; }
.avail-cell.av-off { background-image: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--text-3) 9%, transparent) 5px 6px); }
.avail-main { flex: 1; min-width: 0; border: 0; background: none; color: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 7px; }
.win-btn-wrap { display: flex; }
.win-btn { width: 22px; border: 0; background: none; color: inherit; opacity: 0; cursor: pointer; display: grid; place-items: center; border-radius: 0 7px 7px 0; }
.avail-cell:hover .win-btn, .win-btn:focus-visible { opacity: .8; }
.win-btn:hover { background: color-mix(in srgb, var(--c) 15%, transparent); }
.win-editor { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.win-row { display: flex; gap: 6px; align-items: center; }
.win-row .input { width: 108px; padding: 0 6px; }
.win-row .select { width: auto; }
.win-foot { display: flex; justify-content: flex-end; gap: 6px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }

.changes-layout { display: grid; grid-template-columns: 400px 1fr; gap: 18px; align-items: start; }
.change-form { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.change-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.change-type { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 500; text-align: left; color: var(--text-2); }
.change-type:hover { border-color: var(--border-strong); color: var(--text); }
.change-type.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.change-list { padding: 14px 16px; }
.change-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.change-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.ct-unavailable { background: var(--bad-soft); color: var(--bad); }
.ct-lock { background: var(--brand-soft); color: var(--brand); }
.ct-forbid { background: var(--warn-soft); color: var(--warn); }
.ct-request { background: var(--accent-soft); color: var(--accent); }
.change-text { flex: 1; }
.change-summary { margin: 6px 0 16px; padding-left: 20px; color: var(--text-2); }
.change-summary li { margin-bottom: 4px; }

/* ---------- CSV import ---------- */
.csv-drop { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.csv-text { width: 100%; min-height: 160px; font-family: var(--font-mono); font-size: 12.5px; }
.csv-or { color: var(--text-3); font-size: 12px; }
.csv-map-head { display: flex; justify-content: space-between; margin-bottom: 12px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-bottom: 16px; }
.map-row { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 500; }
.map-row.bad .select { border-color: var(--bad); }
.req { margin-left: 6px; color: var(--bad); font-size: 11px; font-weight: 600; }
.preview { border: 1px solid var(--border); border-radius: var(--radius-sm); margin: 6px 0; max-height: 220px; }
.mode-pick { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }

/* ---------- Schedule ---------- */
.status-line { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 14px; color: var(--text-2); flex-wrap: wrap; }
.status-line b { color: var(--text); }
.status-line:has(.status-body) { flex-wrap: nowrap; align-items: flex-start; }
.status-line:has(.status-body) > .icon { flex: none; margin-top: 2px; }
.status-body b { display: block; }
.status-line.ok .icon { color: var(--ok); }
.status-line.brand .icon { color: var(--brand); }
.status-line.warn .icon { color: var(--warn); }
.summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { text-align: left; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px; min-width: 0; font: inherit; color: inherit; }
.stat.clickable { cursor: pointer; transition: border-color var(--dur-1), transform var(--dur-1); }
.stat.clickable:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: var(--text-3); }
.stat-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; font-feature-settings: "tnum"; line-height: 1.2; }
.stat-sub { font-size: 12px; color: var(--text-2); line-height: 1.35; }
.stat-bar { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 2px 0; }
.stat-bar span { display: block; height: 100%; background: currentColor; border-radius: 99px; transform-origin: left center; }
.stat-ok .stat-value, .stat-ok .stat-bar { color: var(--ok); }
.stat-warn .stat-value, .stat-warn .stat-bar { color: var(--warn); }
.stat-bad .stat-value, .stat-bad .stat-bar { color: var(--bad); }

.diff { padding: 14px 16px; margin-bottom: 20px; border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); }
.diff-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.diff-head h3 { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.diff-head p { margin-top: 2px; }
.diff-actions { display: flex; gap: 6px; align-items: center; }
.diff-add { color: var(--ok); font-weight: 600; }
.diff-rem { color: var(--bad); font-weight: 600; }
.diff-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; margin-top: 14px; }
.diff-person { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.diff-name { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.diff-items { display: flex; flex-direction: column; gap: 4px; }
.diff-item { display: flex; gap: 6px; align-items: baseline; font-size: 13px; padding: 3px 8px; border-radius: 6px; }
.diff-item .icon { align-self: center; }
.diff-item.add { background: var(--ok-soft); color: color-mix(in srgb, var(--ok) 75%, var(--text)); }
.diff-item.rem { background: var(--bad-soft); color: color-mix(in srgb, var(--bad) 75%, var(--text)); }
.diff-item.role { background: var(--brand-soft); color: var(--brand); }

.sched-day { margin-bottom: 26px; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.ev-card { padding: 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ev-card.has-short { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }
.ev-card header { display: flex; justify-content: space-between; align-items: center; }
.ev-time { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.ev-fill { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; font-feature-settings: "tnum"; }
.ev-fill.ok { background: var(--ok-soft); color: var(--ok); }
.ev-fill.bad { background: var(--bad-soft); color: var(--bad); }
.ev-card h4 { font-size: 15px; line-height: 1.3; }
.ev-loc { display: flex; gap: 5px; align-items: center; font-size: 12.5px; }
.ev-roles { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.ev-role-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.ev-role-label .muted { margin-left: auto; font-weight: 500; font-feature-settings: "tnum"; }
.ev-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip-wrap { display: inline-flex; }
.person-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px 0 8px; border-radius: 7px; font-size: 12.5px; font-weight: 500; cursor: pointer; border: 1px solid color-mix(in srgb, var(--role) 28%, transparent); background: color-mix(in srgb, var(--role) 10%, var(--surface)); color: var(--text); box-shadow: inset 3px 0 0 var(--role); transition: border-color var(--dur-1), background var(--dur-1); max-width: 100%; }
.person-chip:hover { border-color: color-mix(in srgb, var(--role) 60%, transparent); background: color-mix(in srgb, var(--role) 16%, var(--surface)); }
.pc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-flag { color: var(--brand); }
.pc-tag { display: inline-grid; place-items: center; height: 16px; padding: 0 4px; border-radius: 4px; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.pc-tag.maybe { background: var(--av-maybe-bg); color: var(--av-maybe); }
.pc-tag.step { background: var(--surface-2); color: var(--text-2); }
.pc-tag.new { background: var(--ok-soft); color: var(--ok); }
.pc-tag.out { background: var(--bad-soft); color: var(--bad); }
.person-chip.pending-off .pc-name, .shift-block.pending-off .sb-name { text-decoration: line-through; text-decoration-color: var(--bad); }
.person-chip.pending-off, .shift-block.pending-off { border-style: dashed; opacity: .85; }
.ev-request { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; background: var(--warn-soft); color: var(--text); padding: 8px 10px; border-radius: 8px; margin-top: 4px; line-height: 1.45; }
.ev-request .icon { color: var(--warn); }
.ev-request .btn, .viol .btn { flex: none; align-self: center; }
.person-chip.is-new { border-color: color-mix(in srgb, var(--ok) 55%, transparent); box-shadow: inset 3px 0 0 var(--role), 0 0 0 2px color-mix(in srgb, var(--ok) 18%, transparent); }
.person-chip.open-slot { border: 1.5px dashed color-mix(in srgb, var(--bad) 60%, transparent); background: var(--bad-soft); color: var(--bad); box-shadow: none; font-weight: 600; }
.person-chip.removed { cursor: default; box-shadow: none; border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); background: transparent; color: var(--bad); }
.ev-short { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--bad); background: var(--bad-soft); padding: 8px 10px; border-radius: 8px; margin-top: 4px; line-height: 1.45; }
.ev-short .icon { margin-top: 2px; }
.avail-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.ad-all, .ad-preferred { background: var(--av-yes); } .ad-if_needed, .ad-partly { background: var(--av-maybe); } .ad-off { background: var(--border-strong); }

.person-grid { font-size: 12.5px; }
.person-grid th { text-align: center; }
.person-grid th.sticky-col { text-align: left; }
.person-grid .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.person-grid thead .sticky-col { z-index: 3; }
.person-grid td { vertical-align: top; padding: 5px 4px; min-width: 92px; }
.pg-cell { display: table-cell; }
.block-wrap { display: flex; width: 100%; margin-bottom: 3px; }
.shift-block { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 1px; padding: 4px 7px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--role) 25%, transparent); background: color-mix(in srgb, var(--role) 10%, var(--surface)); box-shadow: inset 3px 0 0 var(--role); cursor: pointer; min-width: 0; }
.shift-block:hover { background: color-mix(in srgb, var(--role) 17%, var(--surface)); }
.shift-block.is-new { border-color: var(--ok); }
.shift-block.if-needed { border-style: dashed; }
.sb-time { font-size: 11px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.sb-name { font-size: 12px; font-weight: 500; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.hours-cell { min-width: 120px; vertical-align: middle !important; }
.hours-num { font-feature-settings: "tnum"; white-space: nowrap; }
.hours-bar { height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.hours-bar span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.hours-bar.full span { background: var(--warn); }

.issue-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; margin-bottom: 10px; }
.issue-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); }
.issue-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.issue-card p { color: var(--text-2); font-size: 13px; }
.issue-card .levers { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }
.issue-card .lever-head { font-weight: 600; color: var(--text); margin: 4px 0 2px; }
.issue-card .lever-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-2); display: grid; gap: 3px; }
.reason-bar { display: flex; height: 7px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; margin-top: 4px; }
.reason-bar span { display: block; height: 100%; }
.reason-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.reason-legend > span { display: inline-flex; gap: 5px; align-items: center; }
.viol-list { padding: 4px 16px; }
.viol { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.viol:first-child { border-top: 0; }
.viol-text { font-weight: 500; }
.strength-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; }
.s-must.strength-dot { background: var(--bad); } .s-high.strength-dot { background: var(--warn); } .s-medium.strength-dot { background: var(--brand); } .s-low.strength-dot { background: var(--text-3); }

.checklist { padding: 8px; max-width: 640px; }
.check-step { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
.check-step:hover { background: var(--hover); }
.check-step > .icon { margin-left: auto; color: var(--text-3); }
.check-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.check-step.done .check-num { background: var(--ok); border-color: var(--ok); color: var(--on-brand); }
.check-text { display: flex; flex-direction: column; }
.check-text .muted { font-size: 13px; }
.checklist-foot { display: flex; align-items: center; gap: 14px; padding: 14px 12px 8px; border-top: 1px solid var(--border); margin-top: 6px; }

.cap-box { display: flex; align-items: center; gap: 10px; margin: 6px 0 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; flex-wrap: wrap; }
.cap-input { width: 72px; }
.msg-mode { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.msg-list { display: flex; flex-direction: column; gap: 10px; }
.msg { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.msg-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-2); }
.msg-head .msg-actions { margin-left: auto; display: flex; gap: 4px; }
.msg-text { margin: 0; padding: 10px 14px; font-family: var(--font-sans); font-size: 13px; white-space: pre-wrap; line-height: 1.55; }

/* ---------- Solve progress ---------- */
.solve-card { padding: 4px 0 0; }
.solve-head { display: flex; gap: 14px; padding: 18px 20px 10px; align-items: flex-start; }
.solve-head h2 { font-size: 18px; }
.solve-head p { font-size: 13px; margin-top: 2px; }
.solve-orb { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.solve-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px 20px; }
.solve-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.stat-num { font-size: 18px; font-weight: 600; }
.spark { margin: 6px 20px; height: 64px; border-radius: 10px; border: 1px solid var(--border); padding: 4px; display: grid; place-items: center; }
.spark svg { width: 100%; height: 100%; }
.solve-steps { list-style: none; margin: 10px 0 4px; padding: 0 20px; display: flex; flex-direction: column; gap: 8px; }
.solve-steps li { display: flex; gap: 10px; align-items: center; color: var(--text-3); font-size: 13.5px; }
.solve-steps li.done { color: var(--text-2); }
.solve-steps li.now { color: var(--text); font-weight: 500; }
.step-dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: grid; place-items: center; flex: none; }
.solve-steps li.done .step-dot { background: var(--ok); border-color: var(--ok); color: var(--on-brand); }
.solve-steps li.now .step-dot { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); animation: pulse var(--dur-loop) var(--ease-in-out) infinite; }
.solve-note { padding: 6px 20px 14px; }

/* ---------- Settings ---------- */
.settings-card { padding: 20px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 14px; }
.settings-card h2 { display: flex; align-items: center; gap: 8px; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--border)); background: color-mix(in srgb, var(--bad-soft) 40%, transparent); }
.settings-card.pilot { background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 70%, var(--surface)), var(--surface)); }
.settings-card.pilot .btn { align-self: flex-start; }

.print-head { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) { .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) {


  .changes-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {

  /* Phones and small tablets: the navigation is a bottom tab bar, always visible. */








  .menu-btn { display: none !important; }

  .toasts { bottom: calc(72px + env(safe-area-inset-bottom)); }

  .content { padding: 20px 16px 48px; }
  .org-name { max-width: 140px; }
  .two-col { grid-template-columns: 1fr; }
  .event-row { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .event-row .event-time { grid-column: 1 / -1; }
  .event-needs { justify-content: flex-start; grid-column: 1; }
  .rule-edit { padding-left: 16px; }

}
@media (max-width: 720px) {
  h1 { font-size: 25px; }
  .org { display: none; }


  .build-btn span { display: none; }
  .build-btn { width: 36px; padding: 0; }
  /* Two columns, no sideways scroll: every number is visible at a glance. */
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
  .summary .stat-value { font-size: 20px; }
  .summary .stat-sub { font-size: 12px; overflow-wrap: anywhere; }
  .stat { padding: 12px; }
  .stat-value { font-size: 22px; }
  .choice-grid { grid-template-columns: 1fr; }
  .form-row, .form-row.three, .attr-grid { grid-template-columns: 1fr; }
  .rule-main { flex-wrap: wrap; gap: 10px; }
  .rule-text { flex-basis: calc(100% - 60px); }
  .rule-actions { margin-left: 46px; }
  .page-head { margin-bottom: 18px; }
  .page-actions { width: 100%; }
  .page-actions .btn.lg { width: 100%; }
  .event-grid, .issue-cards, .diff-list { grid-template-columns: 1fr; }
  .search-box.sm { width: 100%; }
  .toolbar-right { margin-left: 0; }
  .field-row { grid-template-columns: 1fr 100px 28px; }
  .field-row .field-id { display: none; }
  .field-row.add { grid-template-columns: 1fr 100px auto; }
  .role-times { grid-template-columns: 1fr 1fr; }
  .need-edit { grid-template-columns: 1fr auto; }
  .need-edit > .muted { display: none; }
  .mode-card .segmented button { font-size: 12px; padding: 5px 8px; }
  .solve-stats { grid-template-columns: 1fr 1fr 1fr; padding: 8px 14px; }
  .stat-num { font-size: 15px; }

  .toasts { bottom: calc(68px + env(safe-area-inset-bottom)); }
  .drawer { width: 100vw; }
  .person-cell { min-width: 150px; }
}


/* ---------- Print ---------- */
@media print {
  @page { margin: 10mm; }
  :root { --bg: Canvas; --surface: Canvas; --surface-2: color-mix(in srgb, CanvasText 5%, Canvas); --border: color-mix(in srgb, CanvasText 15%, Canvas); --text: CanvasText; --text-2: color-mix(in srgb, CanvasText 75%, Canvas); --text-3: color-mix(in srgb, CanvasText 55%, Canvas); }
  body { background: var(--bg); font-size: 11px; }
  .no-print, .toasts, .page-actions, .callout, .diff, .tabs, .privacy-banner, .offline-banner, .demo-banner { display: none !important; }

  .content { padding: 0; }
  .page.wide { max-width: none; }
  .table-wrap { overflow: visible; }
  /* The schedule prints as a plain staff sheet: no metrics, costs or controls. */
  .schedule-page > :not(.print-sheet) { display: none !important; }
  .print-sheet { display: block !important; color: var(--text); }
}
.print-sheet { display: none; }
.ps-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 2px solid var(--text); padding-bottom: 4px; margin-bottom: 8px; font-size: 14px; }
.ps-meta { font-size: 10px; color: var(--text-2); }
.ps-day { width: 100%; border-collapse: collapse; margin-bottom: 10px; break-inside: auto; font-size: 10.5px; }
.ps-day thead { display: table-header-group; }
.ps-day thead th { text-align: left; font-size: 12px; padding: 4px 6px; background: var(--surface-2); border: 1px solid var(--border); print-color-adjust: exact; -webkit-print-color-adjust: exact; break-after: avoid; }
.ps-day td { border: 1px solid var(--border); padding: 3px 6px; vertical-align: top; }
.ps-day tr { break-inside: avoid; }
.ps-time { width: 15%; white-space: nowrap; }
.ps-event { width: 27%; }
.ps-event span, .ps-role span { color: var(--text-2); font-size: 9.5px; }
.ps-role { width: 13%; white-space: nowrap; }
.ps-open { color: var(--bad); print-color-adjust: exact; -webkit-print-color-adjust: exact; }

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

.toolbar .select { width: auto; }
.role-picker .role-chips { flex-wrap: nowrap; }
.roster-table th { white-space: normal; line-height: 1.25; max-width: 120px; }
.need-edit { grid-template-columns: 150px auto 1fr; }
.need-times { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.role-time-row { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; padding-top: 6px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.role-time-row .input { width: 120px; }
.preset-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 18px; margin-bottom: 20px; flex-wrap: wrap; }
.preset-card .card-title { margin-bottom: 4px; }
/* Intake inside the app shell */
.setup.embedded .setup-body { max-width: 980px; margin: 0 auto; }
@media (max-width: 720px) { .need-times { justify-content: flex-start; grid-column: 1 / -1; } }
.pseudo-tag { display: block; font-size: 10.5px; color: var(--text-3); padding-left: 9px; margin-top: -4px; letter-spacing: .04em; }
.privacy-badge { text-decoration: none !important; }
.privacy-note { display: flex; gap: 8px; align-items: flex-start; max-width: 980px; margin: 0 auto 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--brand-soft); color: color-mix(in srgb, var(--brand) 60%, var(--text)); font-size: 13px; }
.privacy-note .icon { margin-top: 2px; }
.privacy-banner { display: flex; align-items: center; gap: 10px; max-width: 1320px; margin: 0 auto 18px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 60%, var(--text)); font-size: 13.5px; flex-wrap: wrap; }
.privacy-banner .grow { min-width: 200px; }
.see-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.see-list li { display: flex; gap: 10px; align-items: flex-start; }
.see-list .icon { margin-top: 2px; flex: none; }
.see-yes .icon { color: var(--ok); } .see-no .icon { color: var(--bad); } .see-info .icon { color: var(--brand); }
.key-status { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.share-preview { max-height: 220px; overflow: auto; margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font: 11.5px/1.5 var(--font-mono); white-space: pre-wrap; word-break: break-all; }
.share-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.share-facts > div { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.share-facts b { display: block; font-size: 18px; }
.export-choice { display: flex; flex-direction: column; gap: 8px; }
.export-choice label { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.export-choice label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 50%, var(--surface)); }
.export-choice input { margin-top: 3px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.row-between p { margin-top: 2px; }
#privacy { scroll-margin-top: 80px; }

/* ---- Auth (sign in, sign up, reset, invite) ---------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 0.9fr) 1.1fr; background: var(--bg); }
.auth-side { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 32px 44px; color: var(--on-ground);
  background: radial-gradient(700px 420px at 110% -10%, color-mix(in srgb, var(--coral) 30%, transparent), transparent 60%), radial-gradient(600px 500px at -20% 110%, color-mix(in srgb, var(--teal) 45%, transparent), transparent 60%), linear-gradient(160deg, var(--ground-deep), var(--ground) 60%); }
.auth-side::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(color-mix(in srgb, var(--gold) 22%, transparent) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, black 30%, black 70%, transparent); pointer-events: none; }
.auth-side .brand-link { color: var(--on-ground); padding: 0; position: relative; z-index: 1; }
.auth-pitch { position: relative; z-index: 1; max-width: 420px; }
.auth-pitch h2 { font-family: var(--font-display); font-weight: 500; font-size: clamp(28px, 3vw, 38px); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 26px; color: var(--on-ground); }
.auth-pitch ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.auth-pitch li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; color: var(--on-ground-2); }
.auth-pitch li .icon { flex: none; margin-top: 1px; padding: 6px; box-sizing: content-box; border-radius: 9px; background: color-mix(in srgb, var(--on-ground) 12%, transparent); color: var(--gold); }
.auth-side-foot { position: relative; z-index: 1; margin: 0; font-size: 13px; color: var(--on-ground-3); }
.auth-main { display: flex; flex-direction: column; align-items: center; padding: 24px; background: radial-gradient(700px 360px at 80% -10%, color-mix(in srgb, var(--brand) 8%, transparent), transparent 70%), var(--bg); }
.auth-top { width: 100%; max-width: 440px; display: flex; align-items: center; justify-content: flex-end; min-height: 36px; }
.auth-mobile-brand { display: none; margin-right: auto; padding: 0; }
.auth-card { width: 100%; max-width: 440px; margin: auto 0; padding: 34px 34px 30px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop, var(--shadow)); animation: rise var(--dur-3) var(--ease-out) both; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form h1 { font-family: var(--font-display); font-weight: 500; font-size: 30px; letter-spacing: -0.02em; margin: 0; }
.auth-form > p.muted { margin: -6px 0 4px; }
.auth-form .field { margin: 0; }
.field-label-row { display: flex; align-items: baseline; justify-content: space-between; }
.auth-submit { width: 100%; justify-content: center; margin-top: 4px; }
.auth-switch { margin: 2px 0 0; text-align: center; font-size: 13.5px; color: var(--text-2); }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-error { margin: 0; animation: pop var(--dur-2) var(--ease-out); }
.auth-legal { margin: 18px 0 6px; text-align: center; }
.auth-loading { align-items: center; padding: 30px 0; }
.auth-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.auth-icon.ok { background: var(--ok-soft); color: var(--ok); }
.auth-icon.warn { background: var(--warn-soft); color: var(--warn); }
.pw-wrap { position: relative; display: flex; }
.pw-wrap .input { flex: 1; padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 26px; padding: 0 9px; border: 0; border-radius: 6px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; cursor: pointer; }
.pw-toggle:hover { color: var(--text); }
.center { text-align: center; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-mobile-brand { display: inline-flex; }
  .auth-card { padding: 26px 22px; }
}

/* ---- Boot / error card ------------------------------------------------------------- */
.boot-inner { display: grid; justify-items: center; gap: 16px; }
.boot-card { width: min(440px, calc(100vw - 32px)); display: grid; gap: 14px; justify-items: start; padding: 30px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.boot-card h1 { font-family: var(--font-display); font-weight: 500; font-size: 26px; margin: 4px 0 0; }
.boot-card .input { width: 100%; }

/* ---- Account menu -------------------------------------------------------------------- */
.account-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); cursor: pointer; }
.account-btn:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.account-btn .avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.demo { background: var(--accent-soft); color: var(--accent); }
.account-pop { width: 280px; }
.account-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.account-id { display: flex; flex-direction: column; min-width: 0; }
.account-id b, .account-id span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-org { margin: 0 4px 4px; padding: 9px 10px; border-radius: 8px; background: var(--surface-2); }
.account-org-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.account-org-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-label { padding: 4px 10px 2px; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.member-list li { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.member-list li:last-child { border-bottom: 0; }
.select.sm { height: 30px; font-size: 13px; width: auto; }
.copy-row { display: flex; gap: 8px; margin-top: 12px; }
.copy-row .input { flex: 1; font-size: 12.5px; }
.invite-form, .convert-form { display: grid; gap: 14px; }
.invite-form .field, .convert-form .field { margin: 0; }

/* ---- Save status, demo banner, offline ------------------------------------------------ */
.save-status { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border: 0; border-radius: 99px; background: transparent; color: var(--text-3); font-size: 12px; font-weight: 500; white-space: nowrap; font-family: inherit; }
.save-status.ok .icon { color: var(--ok); }
.save-status.warn { background: var(--warn-soft); color: var(--warn); cursor: pointer; }
.save-status.bad { background: var(--bad-soft); color: var(--bad); cursor: pointer; }
.demo-banner { display: flex; align-items: center; gap: 12px; max-width: 1320px; margin: 0 auto 18px; padding: 10px 12px 10px 10px; border-radius: 12px; flex-wrap: wrap;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-soft) 90%, var(--surface)), color-mix(in srgb, var(--brand-soft) 80%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); font-size: 13.5px; }
.demo-banner .grow { min-width: 220px; }
.demo-pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 99px; background: var(--accent); color: var(--on-brand); font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.demo-badge { background: var(--accent-soft); color: var(--accent); }
.offline-banner { max-width: 1320px; margin: 0 auto 18px; align-items: center; }
.setup-head { display: flex; align-items: center; justify-content: space-between; }
.choice:disabled { opacity: .55; cursor: default; transform: none; }

/* ---- Upgrade panel and conflicts --------------------------------------------------- */
.upgrade { display: grid; gap: 14px; }
.upgrade-badge { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--on-brand); background: var(--brand); }
.upgrade-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.upgrade-list li { display: flex; gap: 8px; align-items: flex-start; }
.upgrade-list .icon { color: var(--ok); margin-top: 2px; flex: none; }
.conflict-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.conflict-list li { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); flex-wrap: wrap; }
@media (max-width: 720px) {
  .save-status { display: none; }
  .demo-banner .btn { width: 100%; justify-content: center; }
}
.check-inbox-head { width: 100%; align-self: stretch; }
.cap-warn { color: color-mix(in srgb, var(--warn) 70%, var(--text)); background: var(--warn-soft); padding: 8px 10px; border-radius: 8px; }
.event-open { all: unset; cursor: pointer; font: inherit; color: inherit; border-radius: 4px; }
.event-open:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }
.cap-note { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; color: color-mix(in srgb, var(--warn) 70%, var(--text)); }

/* ---------- This week: drop, read, build ---------- */
.home-page .page-head { margin-bottom: 18px; }
.dropzone {
  display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 168px; padding: 24px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface);
  color: var(--text-2); cursor: pointer; text-align: left;
  transition: border-color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out);
}
.dropzone:hover { border-color: var(--brand); }
.dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone:focus-visible { border-color: var(--brand); }
.dropzone > .icon { color: var(--brand); }
.dropzone .dz-text { display: flex; flex-direction: column; gap: 3px; max-width: 46ch; }
.dropzone .dz-text b { color: var(--text); font-size: 15px; font-weight: 600; }
.dropzone.compact { min-height: 0; padding: 10px 14px; justify-content: flex-start; border-style: dashed; font-size: 13.5px; }
.dropzone.compact b { color: var(--text); font-weight: 600; }
.teach-hint { margin-top: 10px; }
.week-moved { align-items: center; }

.file-list { list-style: none; margin: 14px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.file-row + .file-row { border-top: 1px solid var(--border); }
.file-main { display: grid; grid-template-columns: 10px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; align-items: center; gap: 12px; padding: 10px 14px; min-height: 48px; }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-status { font-size: 13px; font-weight: 600; }
.file-status.ok { color: var(--ok); } .file-status.warn { color: var(--warn); } .file-status.brand { color: var(--brand); } .file-status.bad { color: var(--bad); } .file-status.muted { color: var(--text-3); }
.file-what { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.st-dot.ok { background: var(--ok); } .st-dot.warn { background: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 30%, transparent); }
.st-dot.brand { background: var(--teal); } .st-dot.bad { background: var(--bad); } .st-dot.muted { background: var(--border-strong); }
.file-row.open { background: color-mix(in srgb, var(--surface-2) 50%, var(--surface)); }
.drift-notes { position: relative; }
.drift-notes ul { position: absolute; right: 0; top: 24px; z-index: 5; width: 320px; margin: 0; padding: 10px 12px 10px 26px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); font-size: 12.5px; color: var(--text-2); }
.drift-notes summary { list-style: none; cursor: pointer; }
.drift-notes summary::-webkit-details-marker { display: none; }

.week-summary { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.summary-line { font-size: 16px; }
.summary-line b { font-weight: 600; }
.review summary { cursor: pointer; font-size: 13.5px; list-style: none; }
.review summary::-webkit-details-marker { display: none; }
.review[open] summary { margin-bottom: 8px; }
.review-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.review-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px; flex-wrap: wrap; }
.review-list li + li { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.review-name { font-weight: 500; }
.review-list .select { max-width: 280px; }
.seg-choice { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.build-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }

.week-status { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--border); }
.week-status h2 { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }
.week-status dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0; }
.week-status dl > div { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; padding: 4px 16px 4px 0; }
.week-status dl > div + div { padding-left: 16px; border-left: 1px solid var(--border); }
.week-status dt { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-2); }
.week-status dd { margin: 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.week-status dl a { font-size: 13px; }

/* ---------- Here's how we read your file ---------- */
.mapping { padding: 16px 14px 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; animation: rise var(--dur-2) var(--ease-out); }
.mapping h3 { font-size: 15px; outline: none; }
.mapping-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.mapping-head p { margin-top: 2px; font-size: 13.5px; }
.mapping-chips { display: flex; gap: 8px; }
.mapping .callout { margin: 0; }
.ai-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; }
.ai-note { flex-basis: 100%; }
.ai-done { display: flex; align-items: center; gap: 6px; color: var(--ok); }
.map-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.map-table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
.map-table th, .map-table td { padding: 5px 8px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; text-align: left; vertical-align: middle; }
.map-table thead th { background: var(--surface-2); font-weight: 600; }
.map-roles th { padding: 6px; }
.map-heads th { color: var(--text-2); font-weight: 500; }
.map-table .ignored { color: var(--text-3); }
.map-table td.ignored { background: color-mix(in srgb, var(--surface-2) 40%, var(--surface)); }
.role-pick { display: flex; align-items: center; gap: 6px; }
.role-pick .select { min-width: 150px; }
.role-fixed { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text-2); }
.conf { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--border-strong); }
.conf.hi { background: var(--ok); } .conf.mid { background: var(--gold); } .conf.lo { background: var(--coral); } .conf.set { background: var(--brand); } .conf.none { background: transparent; border: 1px solid var(--border-strong); }
.map-questions { display: flex; flex-direction: column; gap: 6px; }
.q-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13.5px; padding: 4px 0; }
.q-row + .q-row { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.time-answer { display: inline-flex; align-items: center; gap: 6px; }
.map-result { display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.result-lines ul { margin: 4px 0 0; padding-left: 18px; color: var(--text); }
.result-lines li { margin: 1px 0; }
.mapping-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }
.save-as { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.save-as .input { width: 260px; font-weight: 400; color: var(--text); }

/* ---------- Teach your files ---------- */
.teach-list { list-style: none; margin: 14px 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.teach-row { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.teach-row + .teach-row { border-top: 1px solid var(--border); }
.teach-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.teach-what { flex: 1; min-width: 200px; }
.teach-title { font-weight: 600; }
.teach-explain { margin: 0; padding-left: 40px; font-size: 13px; color: var(--text-2); }
.teach-row > p { padding-left: 22px; }
.teach-row .mapping { margin: 6px -14px -12px; }

/* ---------- Roster: sticky names, column chooser ---------- */
.roster-wrap { max-height: calc(100vh - 260px); }
.roster-table th:first-child, .roster-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.roster-table th:first-child { z-index: 3; }
.roster-table tbody tr:hover td:first-child { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.roster-table td:first-child { min-width: 200px; white-space: nowrap; }
.col-chooser { margin-left: auto; }
.col-pop { display: flex; flex-direction: column; gap: 6px; padding: 12px; max-height: 360px; overflow: auto; }
.col-pop .check.disabled { color: var(--text-3); cursor: default; }
.new-tag { border: 0; cursor: pointer; margin-left: 4px; font: inherit; font-size: 11px; font-weight: 600; }

/* ---------- Event notes ---------- */
.event-notes, .ev-notes { font-size: 12.5px; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.event-notes { margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ev-notes { margin: 4px 0 0; padding: 6px 8px; border-radius: 6px; background: var(--surface-2); }
.ps-notes { font-style: italic; }
.notes-input { min-height: 72px; }

/* ---------- Saved file types ---------- */
.recipe-list { list-style: none; margin: 0; padding: 0; }
.recipe-list li { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; }
.recipe-list li + li { border-top: 1px solid var(--border); }
.recipe-name { font-weight: 600; width: 100%; }
.recipe-list summary { cursor: pointer; }
.recipe-list ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Name key sync ---------- */
.keysync { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.keysync-form { display: flex; flex-direction: column; gap: 12px; max-width: 460px; }
.pass-fields { display: flex; flex-direction: column; gap: 10px; }
.pass-meter { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 6px; }
.pass-meter > span { height: 4px; border-radius: 2px; background: var(--border); transition: background-color var(--dur-2) var(--ease-out); }
.pass-meter em { grid-column: 1 / -1; font-style: normal; font-size: 12px; color: var(--text-2); }
.pass-meter.s0 > span:nth-child(1) { background: var(--coral); }
.pass-meter.s1 > span:nth-child(-n+2) { background: var(--gold); }
.pass-meter.s2 > span { background: var(--ok); }
.pass-warning { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text); }
.pass-warning .icon { color: var(--warn); margin-top: 2px; }
.unlock-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.unlock-form .input { width: 220px; }

@media (max-width: 760px) {
  .file-main { grid-template-columns: 10px minmax(0, 1fr) auto; }
  .file-status, .file-what { grid-column: 2; }
  .file-actions { grid-column: 3; grid-row: 1; }
  .week-status dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .week-status dl > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .save-as .input { width: 100%; }
  .dropzone { min-height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .mapping { animation: none; }
  .dropzone, .pass-meter > span { transition: none; }
}
.q-row .select, .q-row .input { width: auto; min-width: 180px; }

/* ---------- Staffing review (needs from rules) ---------- */
.warn-text { color: var(--warn); }
.staffing-review.has-missing > summary .link-btn { color: var(--warn); }
.staff-list .staff-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr) auto; align-items: center; gap: 4px 14px; }
.staff-row.missing { background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.staff-main, .staff-needs { display: flex; flex-direction: column; min-width: 0; }
.staff-hint { overflow-wrap: anywhere; }
.staff-edit { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; padding: 2px 0 4px; }
.staff-num { display: flex; flex-direction: column; gap: 2px; }
.staff-num .input { width: 72px; }
.build-note { margin: 8px 0 0; }
.need-hint { margin: 4px 0 0; }
@media (max-width: 720px) { .staff-list .staff-row { grid-template-columns: 1fr auto; } .staff-needs { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- What-if, someone dropped, history ---------- */
.advise { display: flex; flex-direction: column; gap: 16px; }
.advise-form { gap: 12px; }
.advise-busy { display: flex; align-items: center; gap: 10px; color: var(--text-2); padding: 8px 0; }
.advise-message { margin: 0; font-weight: 600; font-size: 15px; }
.advise-message.st-no_cover { color: var(--bad); font-size: 16px; }
.advise-message.st-direct, .advise-message.st-replan { color: var(--text); }
.advise-section { display: flex; flex-direction: column; gap: 8px; }
.advise-section h3 { margin: 6px 0 0; font-size: 14px; }
.whatif-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.whatif-limit { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.whatif-limit .input { width: 64px; }
.shift-picks { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow: auto; }
.option-list, .plan-list, .ca-people, .relax-list, .history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.option-list .option, .relax-list li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.option-list .option.best { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.slot-options { display: flex; flex-direction: column; gap: 6px; }
.ca-head { font-size: 13.5px; }
.plan-card { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.plan-card.best { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.plan-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.plan-summary { margin: 0; color: var(--text-2); }
.plan-moves { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.plan-moves li { display: grid; grid-template-columns: minmax(90px, 140px) 1fr; gap: 8px; }
.pm-name { font-weight: 600; }
.pm-text { display: flex; flex-direction: column; }
.pm-move { color: var(--text-2); }
.pm-move::before { display: inline-block; width: 1em; font-weight: 700; content: "\2022"; color: var(--text-3); }
.pm-move.mv-add::before { content: "+"; color: var(--ok); } .pm-move.mv-remove::before { content: "\2212"; color: var(--bad); }
.plan-effects { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-2); }
.eff.good { color: var(--ok); } .eff.bad { color: var(--bad); }
.plan-actions { display: flex; justify-content: flex-end; }
.ca-slot { display: flex; flex-direction: column; gap: 6px; }
.ca-person { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.ca-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ca-blockers { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: var(--text-2); }
.contact-btns { display: inline-flex; gap: 4px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; gap: 4px; }
.history-item { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.hi-dot { flex: none; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--text-3); }
.hk-publish .hi-dot, .hk-revert .hi-dot { background: var(--brand); }
.hk-dropout .hi-dot, .hk-whatif .hi-dot { background: var(--accent); }
.history-empty { padding: 16px 0; }

/* ---------- Engine: how your team works ---------- */
.how-card { padding: 4px 18px; }
.how-group { padding: 14px 0; }
.how-group + .how-group { border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.how-group h3 { margin: 0 0 8px; font-size: 14px; }
.how-list { margin: 0; display: grid; gap: 6px; }
.how-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 12px; }
.how-row dt { color: var(--text-2); }
.how-row dd { margin: 0; }
.policy-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.policy-list li { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; gap: 12px; align-items: baseline; }
.policy-area { color: var(--text-2); font-size: 13px; }
@media (max-width: 720px) { .how-row, .policy-list li { grid-template-columns: 1fr; gap: 2px; } }

/* ---------- Day types (calendar) ---------- */
.daytype-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.daytype-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.daytype-color { width: 32px; height: 32px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.daytype-name { width: 180px; }
.weekday-map { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wm-day { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wm-day .select { width: 100%; }
.rotation-edit { display: flex; flex-direction: column; gap: 8px; }
.rot-weekends { align-self: end; padding-bottom: 8px; }
.daytype-wrap { display: inline-flex; }
.daytype-chip { --dt: var(--text-3); height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--dt) 40%, transparent); background: color-mix(in srgb, var(--dt) 12%, var(--surface)); color: color-mix(in srgb, var(--dt) 75%, var(--text));
  transition: background var(--dur-1) var(--ease-out); }
.daytype-chip:hover { background: color-mix(in srgb, var(--dt) 20%, var(--surface)); }
.daytype-chip.plain { font-weight: 500; color: var(--text-2); border-color: var(--border); background: var(--surface); }
.daytype-chip:disabled { cursor: default; }
.day-chip.daytype-pick { width: auto; padding: 0 9px; }
.calendar-warnings ul { margin: 4px 0 0; padding-left: 18px; }
.callout.sm { padding: 8px 12px; font-size: 13px; }
@media (max-width: 720px) { .weekday-map { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Staffing formulas ---------- */
.formula-list { padding: 4px 0; }
.formula { padding: 10px 16px; }
.formula + .formula { border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.formula-head { display: flex; align-items: center; gap: 10px; }
.formula-edit { display: flex; flex-direction: column; gap: 12px; padding: 12px 0 4px; }
.formula-needs { display: flex; flex-direction: column; gap: 6px; }
.fn-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fn-role { display: inline-flex; align-items: center; gap: 6px; min-width: 120px; font-weight: 500; }
.fn-per { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.fn-row .input.num { width: 64px; }
.calendar-settings .add-daytype { width: auto; align-self: flex-start; justify-self: start; }
.fn-row .select { width: auto; min-width: 140px; flex: none; }
.fn-row .input.num { flex: none; }

/* Mapping: per-column "Private: keep on this computer" and "What we will see" */
.private-toggle { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-weight: 400; color: var(--text-2); white-space: nowrap; cursor: pointer; }
.private-toggle.suspect { color: var(--warn, #b45309); font-weight: 600; }
.private-note { display: flex; align-items: center; gap: 6px; }
.will-see { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.will-see .table-wrap { max-width: 100%; overflow-x: auto; }

/* ---- Something changed (change/)  ---------------------------------------------------- */
.change-btn { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); color: var(--brand); font-weight: 650; }
.change-btn:hover { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); }
.change-panel { display: flex; flex-direction: column; gap: 16px; padding-top: 4px; }
.step-in { animation: rise var(--dur-3) var(--ease-out); }
::view-transition-old(change-step) { animation: var(--dur-2) var(--ease-in-out) both fade-out; }
::view-transition-new(change-step) { animation: var(--dur-3) var(--ease-out) both rise; }
@keyframes fade-out { to { opacity: 0; } }
.change-start { display: flex; flex-direction: column; gap: 20px; }
.say-it { display: flex; flex-direction: column; gap: 8px; }
.say-label { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.say-row { display: flex; gap: 8px; }
.say-row .input { flex: 1; height: 44px; font-size: 1rem; }
.say-row .btn { height: 44px; }
.pick-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font: inherit; font-size: .9rem; cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out); }
.pick-chip:hover { border-color: var(--border-strong); color: var(--text); }
.pick-chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.pick-chip:disabled { opacity: .45; cursor: default; }
.pick-chip:focus-visible { outline: none; box-shadow: var(--ring); }
.pc-sub { color: var(--text-3); font-weight: 400; font-size: .8rem; }
.pick-chip.on .pc-sub { color: inherit; opacity: .8; }
.said { display: flex; align-items: center; gap: 6px; margin: 0; }
.clarify { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--gold) 14%, var(--surface)); }
.row-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.people-pick { display: flex; flex-direction: column; gap: 8px; }
.event-pick { display: flex; flex-direction: column; margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 240px; overflow: auto; }
.event-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.event-row:last-child { border-bottom: 0; }
.event-row:hover { background: var(--hover); }
.event-row.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.er-when { min-width: 82px; color: var(--text-3); font-variant-numeric: tabular-nums; font-size: .85rem; }
.stepper { display: inline-flex; align-items: center; gap: 12px; }
.stepper b { min-width: 2.5ch; text-align: center; font-variant-numeric: tabular-nums; }
.confirm-actions { display: flex; justify-content: space-between; gap: 8px; padding-top: 4px; position: sticky; bottom: -24px; background: var(--surface); padding-bottom: 16px; }
.tabular { font-variant-numeric: tabular-nums; }

/* results */
.results { display: flex; flex-direction: column; gap: 14px; }
.results h3, .results-loading h3 { font-size: .8rem; font-weight: 650; color: var(--text-3); margin: 0 0 8px; letter-spacing: .01em; }
.option-rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.option-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 10px; animation: rise var(--dur-3) var(--ease-out) both; }
.recommended .option-card { border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); box-shadow: var(--shadow-sm); }
.option-card.busy { opacity: .85; }
.oc-head { display: flex; align-items: flex-start; gap: 10px; }
.oc-title { font-family: var(--font-display); font-size: 1rem; }
.oc-reason { color: var(--text-2); margin-top: 2px; }
.mini-diff { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.md-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: .88rem; }
.md-row .md-choose { flex-basis: 100%; max-width: 100%; }
.md-name { font-weight: 600; margin-right: 4px; }
.md-slot { padding: 2px 8px; border-radius: 6px; font-size: .8rem; line-height: 1.5; }
.md-slot.off { background: var(--surface-2); color: var(--text-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-3) 60%, transparent); }
.md-slot.on { background: color-mix(in srgb, var(--teal) 16%, var(--surface)); color: var(--text); }
.oc-costs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cost { color: var(--text-2); }
.cost.good { color: var(--ok); }
.cost.warn { color: var(--warn); }
.cost.bad { color: var(--bad); }
.oc-actions { display: flex; justify-content: flex-end; }
.calm-note { display: flex; gap: 6px; align-items: flex-start; color: var(--text-2); margin: -4px 0 0; }
.no-shift-note { display: flex; gap: 6px; align-items: flex-start; color: var(--text-2); margin: 6px 0 0; }
.no-shift-note svg { color: var(--ok); flex: none; margin-top: 2px; }
.back-btn { align-self: flex-start; }
.results-loading { display: flex; flex-direction: column; gap: 10px; }
.scan-line { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.scan-line .tabular { margin-left: auto; font-weight: 400; }
.scan-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 40%, transparent); animation: scan var(--dur-loop) var(--ease-in-out) infinite; }
@keyframes scan { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.skel-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); }
.skel { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 0%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer var(--dur-loop) linear infinite; animation-delay: calc(var(--i, 0) * var(--dur-1)); }
.skel.w40 { width: 40%; } .skel.w55 { width: 55%; } .skel.w70 { width: 70%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.nofix-lede { margin: 0; color: var(--text); }
.call-list, .relax-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.call-row, .relax-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }

/* schedule after a change */
.change-banner { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 6; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--gold) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--border)); animation: rise var(--dur-3) var(--ease-out); }
/* "Something changed" sequence (motion.js playChange): the person who is out
   is struck through with an "Out" tag, the replacement keeps a highlight and a
   "Moved" or "Added" tag for ~2 s. Tags sit on the chip's corner. */
.person-chip, .shift-block { position: relative; }
.person-chip[data-out], .shift-block[data-out] { background: var(--surface-2); color: var(--text-3); border-style: dashed; border-color: color-mix(in srgb, var(--bad) 55%, transparent); box-shadow: none; transition: background var(--dur-3), color var(--dur-3); }
[data-out] .pc-name, [data-out] .sb-name { text-decoration: line-through; text-decoration-color: var(--bad); text-decoration-thickness: 2px; }
.person-chip[data-out]::before, .shift-block[data-out]::before,
.person-chip[data-moved]::before, .shift-block[data-moved]::before { position: absolute; top: -9px; right: -6px; z-index: 2; height: 16px; padding: 0 5px; border-radius: 4px; font: 700 9.5px/16px var(--font-sans); letter-spacing: .03em; text-transform: uppercase; pointer-events: none; animation: tag-in var(--dur-2) var(--ease-spring) both; }
.person-chip[data-out]::before, .shift-block[data-out]::before { content: attr(data-out); background: var(--bad); color: #fff; }
.person-chip[data-moved]::before, .shift-block[data-moved]::before { content: attr(data-moved); background: var(--brand); color: var(--on-brand); }
.person-chip[data-moved], .shift-block[data-moved] { background: color-mix(in srgb, var(--gold) 34%, var(--surface)); border-color: color-mix(in srgb, var(--gold) 70%, var(--text)); box-shadow: inset 3px 0 0 var(--role), 0 0 0 3px color-mix(in srgb, var(--gold) 50%, transparent); }
.chip-ghost { transform-origin: center; }
@keyframes tag-in { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.change-banner .change-line { font-weight: 600; }
.flip-pulse { animation: flip-pulse var(--dur-4) var(--ease-out) 2; }
@keyframes flip-pulse { 0% { box-shadow: 0 0 0 0 var(--pulse); background-color: var(--pulse); } 100% { box-shadow: 0 0 0 10px transparent; } }
@media (max-width: 600px) {
  .row-fields { grid-template-columns: 1fr; }
  .say-row { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .scan-dot, .skel { animation: none; }
  ::view-transition-old(change-step), ::view-transition-new(change-step) { animation: none; }
}

/* sheet: tiles, token sentences, impact, bands */
.tile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: .92rem; text-align: left; cursor: pointer; transition: border-color var(--dur-1) var(--ease-out), background-color var(--dur-1) var(--ease-out); }
.tile .icon { color: var(--brand); flex: none; }
.tile:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); background: color-mix(in srgb, var(--brand-soft) 40%, var(--surface)); }
.tile:focus-visible { outline: none; box-shadow: var(--ring); }
.say-note { margin: 0; color: var(--text); }
.live-preview { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--brand); font-weight: 600; animation: token-in var(--dur-1) var(--ease-out) both; }
.recent-changes h3, .known-list h3 { margin: 0 0 6px; color: var(--text-2); font-weight: 650; }
.recent-changes ul, .known-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.known-list li { display: flex; align-items: center; gap: 8px; }
.known-list { margin: 16px 0 4px; }
.token-card { display: flex; flex-direction: column; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.intent-line { display: flex; flex-direction: column; gap: 8px; }
.il-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.verb-pick { max-width: 60%; color: var(--text-2); }
.token-sentence { margin: 0; font-family: var(--font-display); font-size: 1.12rem; line-height: 1.9; }
.token { display: inline; padding: 2px 6px; margin: 0 1px; border: 0; border-radius: 6px; background: var(--brand-soft); color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; transition: background-color var(--dur-1) var(--ease-out); animation: token-in var(--dur-1) var(--ease-out) both; }
.token:hover, .token.on { background: color-mix(in srgb, var(--brand) 20%, var(--surface)); }
.token:focus-visible { outline: none; box-shadow: var(--ring); }
.token.ai { text-decoration: underline dotted; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.token.missing { background: color-mix(in srgb, var(--coral) 14%, var(--surface)); color: var(--bad); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--coral) 45%, transparent); }
@keyframes token-in { from { opacity: 0; transform: translateY(4px); } }
.token-editor { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); animation: rise var(--dur-2) var(--ease-out) both; }
.te-done { align-self: flex-end; }
.when-editor, .needs-steppers { display: flex; flex-direction: column; gap: 8px; }
.stepper-row { display: flex; align-items: center; gap: 10px; }
.form-grid { display: flex; flex-direction: column; gap: 8px; }
.input.num { width: 6.5em; display: inline-block; }
.bad-text { color: var(--bad); margin: 0; }
.impact { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); }
.impact p { margin: 0; }
.band-row { display: flex; flex-wrap: wrap; gap: 6px; }
.band-chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); }
.band-chip.band-live { background: color-mix(in srgb, var(--coral) 16%, var(--surface)); color: var(--bad); }
.band-chip.band-short { background: color-mix(in srgb, var(--orange) 18%, var(--surface)); color: color-mix(in srgb, var(--orange) 55%, var(--text)); }
.band-chip.band-published { background: color-mix(in srgb, var(--teal) 14%, var(--surface)); color: color-mix(in srgb, var(--teal) 60%, var(--text)); }
.band-chip.band-future { background: color-mix(in srgb, var(--gold) 20%, var(--surface)); color: var(--text); }

/* results: badges, call-around, leave it short */
.oc-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.oc-badges:empty { display: none; }
.badge-rec { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--gold); color: var(--ground-deep); font-size: .75rem; font-weight: 700; }
.badge-soft { display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: .75rem; font-weight: 600; }
.badge-soft.proven { background: var(--ok-soft); color: var(--ok); }
.recommended .option-card { border-color: color-mix(in srgb, var(--gold) 70%, var(--border)); background: color-mix(in srgb, var(--gold) 9%, var(--surface)); }
.alternatives h4, .nearest h4, .relax h4, .call-around h4 { margin: 4px 0 8px; color: var(--text-2); font-weight: 650; }
.alternatives .option-card { padding: 12px 14px; }
.seg-head { margin: 8px 0 0; font-size: .95rem; }
.call-slot p { margin: 0 0 4px; }
.call-btns { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.call-btns .btn.on { background: var(--brand-soft); color: var(--brand); }
.call-row.st-no .grow { opacity: .55; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-3) 60%, transparent); }
.call-row.st-asked .grow b::after { content: " (asked)"; font-weight: 400; color: var(--text-3); }
.call-row.st-yes { background: var(--ok-soft); }
.leave-short { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); }
.escalate, .escalate-done { display: flex; flex-direction: column; gap: 10px; }
.escalate textarea { resize: vertical; }
.toast-ring { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; transform: rotate(-90deg); }
.toast-ring circle { fill: none; stroke: currentColor; stroke-width: 2.5; stroke-dasharray: 50.3; stroke-dashoffset: 0; animation: ring-down var(--ms, 45000ms) linear forwards; }
@keyframes ring-down { to { stroke-dashoffset: 50.3; } }

/* phone: the sheet becomes a bottom sheet */
@media (max-width: 600px) {
  .drawer.change-sheet { position: fixed; left: 0; right: 0; bottom: 0; width: 100vw; height: 88vh; border-left: 0; border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; animation: sheet-up var(--dur-3) var(--ease-out); }
  .drawer.change-sheet::before { content: ""; display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--border); }
  .drawer-overlay:has(.change-sheet) { place-items: end stretch; }
  .tile-grid { grid-template-columns: 1fr 1fr; }
  .token-sentence { font-size: 1.02rem; }
  .call-btns .btn { min-height: 44px; }
  .call-row > .grow { flex: 1 1 100%; }
  .call-btns { width: 100%; justify-content: flex-start; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .token, .token-editor { animation: none; }
  .toast-ring circle { animation: none; }
  .drawer.change-sheet { animation: none; }
}

/* ---------- Imports: questions, understood meter, roster gaps (UX critique 2, P0-2..5) ---------- */
/* The preview table scrolls inside its own box; it never widens the page (P1-10). */
.file-row, .mapping, .map-table-wrap, .will-see, .map-questions { min-width: 0; max-width: 100%; }
/* position: relative keeps the screen-reader-only labels (absolutely positioned) in the
   scroller: without it they escaped the overflow box and widened the page to 2400px. */
.map-table-wrap, .will-see .table-wrap, .gap-table-wrap { contain: inline-size; overflow-x: auto; position: relative; }
.q-row .q-text { flex: 1 1 280px; min-width: 0; overflow-wrap: anywhere; white-space: normal; line-height: 1.45; }
.q-row .select { flex: none; max-width: 100%; }
.q-intro { margin: 2px 0 2px; font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.q-block { display: flex; flex-direction: column; gap: 2px; padding: 8px 0 2px; border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.q-block:first-child { border-top: 0; padding-top: 0; }
.q-roles-read summary { cursor: pointer; list-style: none; overflow-wrap: anywhere; }
.q-roles-read summary::-webkit-details-marker { display: none; }
.q-value { animation: rise var(--dur-2) var(--ease-out) both; }
.understood { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.understood-bar { width: 120px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; flex: none; }
.understood-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--ok); transform-origin: left center; transition: transform var(--dur-4) var(--ease-out), background-color var(--dur-2) var(--ease-out); }
.understood-bar.mid > span { background: var(--gold); }
.understood-bar.low > span { background: var(--coral); }
.understood-n { font-variant-numeric: tabular-nums; color: var(--text); }
.low-understood .check { margin-top: 6px; }
.btn.warn { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); color: var(--text); }
.btn.warn:hover:not(:disabled) { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); }
.roster-gaps { align-items: flex-start; }
.roster-gaps .grow { min-width: 0; }
.roster-gaps.skipped { opacity: .85; }
.gap-rules { margin-top: 4px; }
.gap-rules summary { cursor: pointer; list-style: none; display: inline; }
.gap-rules summary::-webkit-details-marker { display: none; }
.gap-rules ul { margin: 6px 0 0; padding-left: 18px; }
.gap-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.gap-editor { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; animation: rise var(--dur-3) var(--ease-out) both; }
.gap-table-wrap { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.gap-table th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
.gap-all { display: flex; gap: 4px; align-items: center; justify-content: center; font-weight: 400; margin-top: 2px; }
.file-actions .edit-reading { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .q-value, .gap-editor { animation: none; } .understood-bar > span { transition: none; } }
.callout.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); color: color-mix(in srgb, var(--ok) 55%, var(--text)); }
.recipe-list li { flex-wrap: wrap; }
.recipe-edit { flex-basis: 100%; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.recipe-edit .mapping { border-top: 0; }

/* ---------- Phone pass: touch targets, short banner, roster as cards ---------- */
.short-copy { display: none; }
@media (max-width: 600px) {
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn.sm { width: 40px; height: 40px; }
  .verify-banner .long-copy { display: none; }
  .verify-banner .short-copy { display: inline; }
  .verify-banner { padding: 8px 10px; gap: 8px; }
  .roster-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; max-height: none; }
  .roster-table, .roster-table tbody { display: block; width: 100%; }
  .roster-table thead { display: none; }
  .roster-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-width: 0; align-items: center; gap: 6px 12px; margin-bottom: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
  .roster-table td { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0; border: 0; min-width: 0; }
  .roster-table td:first-child { grid-column: 1; font-weight: 600; position: static; min-width: 0; white-space: normal; box-shadow: none; background: transparent; padding-left: 0; }
  .roster-table td:first-child .name-input { width: 100%; min-width: 0; }
  .roster-table td > * { min-width: 0; max-width: 100%; }
  .roster-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .roster-table td.row-actions { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .roster-table td[data-label] { grid-column: 1 / -1; }
  .roster-table td[data-label]::before { content: attr(data-label); color: var(--text-3); font-size: 13px; font-weight: 400; }
  .roster-table td[data-label] .cell-input { max-width: 8em; text-align: right; }
  .roster-table .cell-input { min-height: 40px; }
}

/* ---------- Motion: route transitions, build reveal (js/app/motion.js) ----------
   Route changes run inside a view transition. Names are set only while one runs
   (html.vt-route), so they never touch normal rendering. The sidebar and top bar
   sit in the root snapshot, which does not animate: only the page body moves.
   A tab change inside a page ([data-vt="tab"]) keeps the page still and moves
   just the tab body (the schedule grid); the schedule head and the intake stage
   rail are shared elements that hold their place. */
.vt-route .content { view-transition-name: page; }
.vt-route .schedule-page > .page-head { view-transition-name: schedule-head; }
.vt-route .schedule-page .tab-body { view-transition-name: schedule-grid; }
.vt-route .week-page .tab-body, .vt-route .page:not(.schedule-page) > .tab-body { view-transition-name: tab-body; }
.ix-rail { view-transition-name: stage-rail; }
.ix-main { view-transition-name: ix-stage; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(*) { animation-duration: var(--dur-3); animation-timing-function: var(--ease-out); }
::view-transition-old(page) { animation: var(--dur-1) var(--ease-in-out) both fade-out; }
::view-transition-new(page) { animation: var(--dur-3) var(--ease-out) both page-in; }
[data-vt="tab"]::view-transition-old(page), [data-vt="tab"]::view-transition-new(page) { animation: none; }
::view-transition-old(schedule-grid), ::view-transition-old(tab-body), ::view-transition-old(ix-stage) { animation: var(--dur-1) var(--ease-in-out) both fade-out; }
::view-transition-new(schedule-grid), ::view-transition-new(tab-body), ::view-transition-new(ix-stage) { animation: var(--dur-2) var(--ease-out) both page-in; }
::view-transition-old(schedule-head), ::view-transition-new(schedule-head), ::view-transition-old(stage-rail), ::view-transition-new(stage-rail) { animation: none; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
/* The tab indicator slides between tabs (one element, transform only). */
.tabs { position: relative; }
.tab-ink { position: absolute; left: 0; bottom: 0; width: 1px; height: 2px; background: var(--brand); transform-origin: left center; pointer-events: none; opacity: 0; }
.tabs.has-ink .tab-ink { opacity: 1; transition: transform var(--dur-2) var(--ease-out); }
.tabs.has-ink .tab.active { border-bottom-color: transparent; }
/* Skeletons share .skel (shimmer) and .skel-card above. */
.skel-page { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.skel-page .skel-card + .skel-card { margin-top: 0; }
.skel.skel-h1 { height: 26px; width: 38%; border-radius: 8px; margin-bottom: 4px; }
.skel-cards { display: grid; gap: 10px; }
.skel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.skel-list li { display: grid; grid-template-columns: 10px minmax(0, 2fr) minmax(0, 3fr); gap: 14px; align-items: center; min-height: 48px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.skel-list .skel { width: auto; }
.skel.skel-dot { width: 10px; height: 10px; border-radius: 50%; }
.skel.skel-pill { height: 26px; width: 120px; border-radius: 8px; }
.skel.skel-pill.wide { width: 210px; }
/* Build progress: a schedule-shaped skeleton instead of a spinner. */
.solve-grid { grid-template-columns: repeat(3, 8px); grid-template-rows: repeat(3, 8px); gap: 3px; place-content: center; }
.solve-grid i { display: block; width: 8px; height: 8px; border-radius: 2px; }
.solve-grid i.skel { background-color: color-mix(in srgb, var(--brand) 18%, var(--surface)); }
.solve-grid i.on { background: var(--brand); animation: cell-on var(--dur-3) var(--ease-out) both; }
@keyframes cell-on { from { opacity: .3; transform: scale(.6); } }
.spark.empty { position: relative; overflow: hidden; }
.spark.empty .skel.spark-skel { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 6px; opacity: .8; }
/* "New" (imported) badge sits beside the name inside the sticky name cell
   instead of spilling over the first role chip. */
.roster-table td:first-child:has(.new-tag) .name-input { width: calc(100% - 46px); min-width: 120px; }
.roster-table .new-tag { vertical-align: middle; }
@media (max-width: 600px) {

  .icon-btn.sm, .roster-table td > .icon-btn.sm { width: 44px; min-width: 44px; height: 44px; flex: none; }
  /* Switches keep their look; the hit area grows to 44px. */
  .toggle::after { content: ""; position: absolute; inset: -12px -4px; }
  .roster-table .cb { width: 22px; height: 22px; }
}

/* ---------- Phone pass 2: every control is at least 44 by 44 px to tap ----------
   Form controls and buttons grow to 44px tall; small marks (chips, the
   availability clock, color swatches) keep their look and get an invisible
   44px hit area. scripts/mobile-check.mjs audits every page at 390px. */
@media (max-width: 600px) {
  .btn, .btn.sm, .btn.lg { height: auto; min-height: 44px; }
  .input, .select, .select-sm, .input-sm, .cell-input, .strength-select { min-height: 44px; }
  .roster-table .cell-input { min-height: 44px; }
  input[type=range] { height: 44px; }
  input[type=color] { width: 44px; height: 44px; padding: 4px; }

  .build-btn { width: 44px; min-width: 44px; height: 44px; }
  .tab { height: 44px; }
  .segmented button { min-height: 44px; min-width: 44px; justify-content: center; }
  label.check { min-height: 44px; align-items: center; }
  .week-status dl > div > a { display: inline-flex; align-items: center; justify-content: flex-end; min-width: 44px; min-height: 44px; }
  .icon-btn, .icon-btn.sm, .icon-btn.xs { width: 44px; min-width: 44px; height: 44px; flex: none; }
  .role-picker-btn, .rule-text, .link-btn, .menu-item, .token, .q-chip, .pick-chip { min-height: 44px; }
  .chip, .event-open, .chip-x { position: relative; }
  .chip::after, .event-open::after, .chip-x::after { content: ""; position: absolute; inset: -9px -4px; }
  .event-open { display: inline-block; }
  .event-open::after { inset: -12px -6px; }
  /* Availability: no hover on touch, so the clock shows; both halves 44px. */
  .avail-cell { min-height: 44px; }
  .avail-main { min-height: 44px; }
  .win-btn { width: 44px; min-height: 44px; opacity: .65; }
  .cb-hit, .roster-table td > .cb-hit { min-width: 44px; min-height: 44px; }
  /* Schedule cards: chips a little taller, rows a little apart, 44px hit. */
  .person-chip { position: relative; height: 32px; }
  .person-chip::after { content: ""; position: absolute; inset: -6px -3px; }
  .ev-chips { gap: 12px 6px; }
  .toggle.small::after { inset: -14px -7px; }
  body .rate-scale { gap: 8px; flex-wrap: wrap; }
  body .rate-scale button { width: 44px; height: 44px; }
  body .qc summary { min-height: 44px; }
  .gap-rules summary { display: inline-flex; align-items: center; min-height: 44px; }
  .toast-action { position: relative; }
  .toast-action::after { content: ""; position: absolute; inset: -8px -4px; }
  /* Filter and role chips, day-type chips and event names: finger-sized on phones. */
  .filter-chip, .toggle-chip { height: auto; min-height: 44px; padding: 0 14px; }
  .daytype-chip { height: auto; min-height: 44px; }
  .event-open { min-height: 44px; }
  /* Already published and unchanged: the badge says so; no greyed-out button row. */
  .page-actions .publish-btn:disabled { display: none; }
}
.cb-hit { display: inline-grid; place-items: center; cursor: pointer; }
.boot-actions { display: flex; flex-wrap: wrap; gap: 10px; }
