/* ---------- Tokens: quiet surfaces, one primary action ---------- */
:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-2: #F0F0F2;
  --border: #E8E8ED;
  --text: #1D1D1F;
  --muted: #6E6E73;
  --accent: #1D1D1F;
  --accent-contrast: #FFFFFF;
  --accent-soft: #F0F0F2;
  --danger: #B42318;
  --danger-soft: #FBE9E7;
  --on-danger: #FFFFFF;
  --warn: #6E6E73;
  --warn-soft: #F0F0F2;
  --ok: #6E6E73;
  --ok-soft: #F0F0F2;
  --info: #6E6E73;
  --info-soft: #F0F0F2;
  --mark: #E8E8ED;
  --focus-ring: #0071E3;
  --brass: #8E8E93;
  --dusk: #8E8E93;
  color-scheme: light;
  --field-bg: #F5F5F7;
  --field-border: #D2D2D7;
  --bar-bg: #1D1D1F;
  --shadow: none;
  --radius-panel: 14px;
  --radius-card: 14px;
  --radius-control: 10px;
  --radius-pill: 999px;
  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-text);
  --font-data: var(--font-text);
  --fill-bg: #1D1D1F;
  --fill-hover: #333336;
  --fill-text: #FFFFFF;
  --type-operations-bg: #F0F0F2;
  --type-experience-bg: #F0F0F2;
  --type-experience-text: #6E6E73;
  --type-gifts-bg: #F0F0F2;
  --type-residents-bg: #F0F0F2;
  --type-amenities-bg: #F0F0F2;
  --type-text: #6E6E73;
  --seg-active-bg: transparent;
  --seg-active-text: #1D1D1F;
  --seg-slide: .2s ease;
}

/* The navigation is the dashboard's one dark surface. */
.tabs {
  --muted: #B6B6BC;
  --border: #333336;
  color: #FFFFFF;
}
.tabs a:hover, .tabs a[aria-current="page"] { color: #FFFFFF; }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-text);
  --shift: var(--brass);
}
body[data-shift="Afternoon"] { --shift: var(--dusk); }
::selection { background: var(--accent-soft); color: var(--text); }
input, textarea, [contenteditable] { caret-color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-family: var(--font-display); font-size: 2.1rem; font-weight: 600; letter-spacing: -.025em; text-wrap: balance; }
h2 { font-family: var(--font-display); font-size: 1.05rem; font-weight: 550; letter-spacing: -.01em; }
h3 { font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: .18em; }
mark { background: var(--mark); color: inherit; border-radius: 0; padding: 0 1px; }
kbd {
  font: 600 .72rem/1 var(--font-data); padding: 2px 5px; border-radius: 0;
  border: 1px solid var(--border); border-bottom-width: 2px; background: var(--surface); color: var(--muted);
}
:focus-visible { outline: 1px solid var(--focus-ring); outline-offset: 2px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 0; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); font-weight: 600; }
.spacer { flex: 1; }
.empty { color: var(--muted); padding: 12px 0; }

/* ---------- Top bar & nav ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, calc((100vw - 1240px) / 2));
  background: var(--bg); border: 0;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: var(--radius-control); flex: none;
  display: grid; place-items: center;
  font: 700 .85rem/1 var(--font-display);
  background: var(--fill-bg); color: var(--fill-text);
}
.brand-name { font-family: var(--font-display); font-weight: 650; white-space: nowrap; }
.brand-sub { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.global-search { flex: 1; max-width: 520px; margin-left: auto; }
.global-search input { width: 100%; padding-inline: 18px; }

.tabs {
  display: flex; gap: 4px; overflow-x: auto;
  padding: 0 max(16px, calc((100vw - 1240px) / 2));
  background: var(--bar-bg); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.tabs a {
  padding: 12px 14px; color: var(--muted); text-decoration: none; font-weight: 550;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs a:hover { color: #FFFFFF; }
.tabs a[aria-current="page"] { color: #FFFFFF; border-bottom-color: #FFFFFF; }

main { max-width: 1240px; margin: 0 auto; padding: 24px 16px 64px; outline: none; }

/* ---------- Controls ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--field-bg);
  border: 1px solid var(--field-border); border-radius: var(--radius-control); padding: 8px 10px; min-height: 40px;
  width: 100%;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 1px; }
[aria-invalid="true"] { border-color: var(--danger); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.45; }

label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 550; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--text); font-weight: 400; font-size: .95rem; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: .9rem; }
label.check input { width: 18px; height: 18px; min-height: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 550; font-size: .9rem;
  padding: 8px 14px; min-height: 40px; border-radius: var(--radius-control); cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--fill-bg); border-color: var(--fill-bg); color: var(--fill-text); }
.btn-primary:hover { background: var(--fill-hover); border-color: var(--fill-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .82rem; }
.file-btn { flex-direction: row; color: var(--text); font-size: .9rem; }

.link-btn {
  font: inherit; background: none; border: 0; padding: 0; color: var(--text); text-align: left;
  cursor: pointer; font-weight: 600;
}
.link-btn:hover { color: var(--accent); text-decoration: underline; }
.small-link { font-size: .85rem; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: .74rem; font-weight: 500; padding: 2px 9px; border-radius: 0;
  border: 1px solid transparent;
}
.badge.cat { background: var(--surface-2); color: var(--muted); font-weight: 450; }
.badge.log-type-operations_events { background: var(--type-operations-bg); color: var(--type-text); }
.badge.log-type-resident_experience { background: var(--type-experience-bg); color: var(--type-experience-text); }
.badge.log-type-welcome_gifts { background: var(--type-gifts-bg); color: var(--type-text); }
.badge.log-type-residents_guests { background: var(--type-residents-bg); color: var(--type-text); }
.badge.log-type-amenities_common_areas { background: var(--type-amenities-bg); color: var(--type-text); }
.pri-high { background: var(--danger-soft); color: var(--danger); }
.pri-medium { background: var(--warn-soft); color: var(--warn); }
.pri-low { background: var(--surface-2); color: var(--muted); }
.st-open { background: var(--info-soft); color: var(--info); }
.st-in-progress { background: var(--accent-soft); color: var(--accent); }
.st-waiting { background: var(--warn-soft); color: var(--warn); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.overdue { background: var(--danger-soft); color: var(--danger); border-color: rgba(227, 144, 138, .35); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

/* ---------- Page layout ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card {
  background: var(--surface); border: 0; border-radius: var(--radius-panel);
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0;
}
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.count {
  display: inline-block; min-width: 1.6em; text-align: center; font-size: .72rem; font-weight: 500;
  background: none; color: var(--muted); border-radius: 0; padding: 1px 4px; margin-left: 4px;
  vertical-align: 2px;
}

.team-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; font-size: .9rem; }
.segmented { position: relative; isolation: isolate; display: flex; flex-wrap: wrap; gap: 4px; }
.seg-thumb {
  position: absolute; top: 0; left: 0; z-index: -1; pointer-events: none;
  background: var(--seg-active-bg); border-radius: var(--radius-pill);
  transition: transform var(--seg-slide), width var(--seg-slide), height var(--seg-slide);
}
.seg {
  font: inherit; font-size: .85rem; font-weight: 550; border: 0; background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: var(--radius-pill); cursor: pointer; min-height: 34px;
  transition: color var(--seg-slide);
}
.seg:hover { color: var(--text); }
.seg[aria-pressed="true"] { color: var(--seg-active-text); font-weight: 600; }
.team-filter .seg { padding: 6px 12px; }
/* Team filters use one underline treatment. */
.segmented .seg { border-radius: 0; border-bottom: 2px solid transparent; }
.segmented .seg[aria-pressed="true"] { border-bottom-color: var(--text); }
.seg-thumb { display: none; }

.overview-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0 20px; align-items: start; }

/* ---------- Overview sections: white panels on the off-white page, like the Quick log ---------- */
main[data-view="overview"] .card:not(.quick-log) {
  background: var(--surface); border: 0; border-radius: var(--radius-panel); box-shadow: none;
  padding: 18px 20px; margin-bottom: 20px;
}
/* Plain headings keep the task content in the foreground. */
.card h2 { font-weight: 600; }
.card h2 .count { font-weight: 400; }
form.card.quick-log { padding: 24px; gap: 14px; border: 0; }
.quick-log .btn-primary { --fill-bg: #0071E3; --fill-hover: #0064CA; --fill-text: #FFFFFF; }
.attention-card .card-head { align-items: baseline; }
.attention-card h2 { font-size: 1.05rem; }
.todo-panel > h2 .disclosure { width: 100%; }
.todo-panel #todo-body { margin-top: 12px; }

.small-link.link-btn, a.small-link { font-weight: 500; color: var(--accent); text-decoration: none; }
.small-link.link-btn:hover, a.small-link:hover { text-decoration: underline; color: var(--accent); }

/* ---------- Task rows (Needs attention, Coming up) ---------- */
.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.task:first-child { border-top: 0; padding-top: 4px; }
.task-check { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 500; line-height: 1.35; }
.task-meta { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.task-due.is-overdue { color: var(--danger); }
.task-due.is-today { color: var(--muted); }
.task-due.is-today::before, .task-status::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 5px 2px 0; border-radius: 50%; background: #9C875D; }
.task-status::before { background: #8E8E93; }
.task-title:hover { text-decoration: none; color: var(--muted); }
.task-next { font-size: .85rem; color: var(--text); opacity: .85; margin-top: 3px; }

.attention-clear { display: flex; align-items: center; gap: 10px; padding: 6px 0 2px; color: var(--muted); }
.attention-clear::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok);
}

/* ---------- Follow-up list items ---------- */
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.item:first-child { border-top: 0; }
.item.is-overdue .meta { color: var(--danger); }
.item-main { flex: 1; min-width: 0; }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.meta { font-size: .85rem; color: var(--muted); }
.next { font-size: .85rem; margin-top: 2px; }

/* ---------- Notices & links ---------- */
.notices { list-style: none; margin: 0 0 10px; padding: 0; }
.notices li {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 8px 10px; margin-bottom: 6px; background: var(--warn-soft); border-radius: var(--radius-control); font-size: .9rem;
}
main[data-view="overview"] .notices li { background: none; border-radius: 0; margin: 0; padding: 8px 0; border-top: 1px solid var(--border); align-items: center; }
main[data-view="overview"] .notices li:first-child { border-top: 0; padding-top: 2px; }

/* Show/hide buttons: To-do list, Quick log "More options" */
.disclosure {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; color: inherit;
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
}
.disclosure::after {
  content: ""; width: 7px; height: 7px; flex: none; margin-left: 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .2s ease;
}
.disclosure[aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }
.todo-panel h2 .disclosure { font-weight: inherit; }

.todos { list-style: none; margin: 0 0 10px; padding: 0; }
.todos li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.todos li:first-child { border-top: 0; }
.todos li.done label span { text-decoration: line-through; color: var(--muted); }
.todo-actions { display: flex; gap: 4px; flex-shrink: 0; }
/* Quick log: the Overview's front door, so it gets the most weight on the page. */
.quick-log { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; padding: 18px 20px 16px; }
.quick-log-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; color: var(--text); }
.quick-log-field { position: relative; flex: 1; min-width: 0; }
.quick-log-field input { width: 100%; }
#quick-log-input { min-height: 50px; font-size: 1.05rem; padding: 10px 16px; border-radius: var(--radius-control); border-color: transparent; }
.inline-form:has(#quick-log-input) > .btn { min-height: 50px; }
.quick-log-picks {
  position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control);
  box-shadow: 0 12px 28px -14px rgba(28, 29, 31, .25);
}
.quick-log-picks li { padding: 8px 10px; border-radius: calc(var(--radius-control) - 3px); cursor: pointer; }
.quick-log-picks li:hover { background: var(--surface-2); }
.quick-log-picks li[aria-selected="true"] { background: var(--accent-soft); color: var(--text); }
.quick-log-fu-toggle { margin-left: auto; }
.quick-log-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; }
.quick-log-more { font-size: .88rem; color: var(--muted); padding: 4px 0; }
.quick-log-more:hover { color: var(--text); }
.quick-log-options { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.quick-log-fu { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 12px; }
.quick-log-bookings { margin: 0; padding-left: 18px; }
.quick-log-bookings li { padding: 2px 0; }
.quick-log-dest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.quick-log-dest select { width: auto; max-width: 100%; min-height: 34px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .btn { min-height: 40px; }
.quick-links { list-style: none; margin: 0; padding: 0; }
.quick-links li { padding: 6px 0; border-top: 1px solid var(--border); }
.quick-links li:first-child { border-top: 0; }
.quick-links a { font-weight: 600; }

/* ---------- Shift logs ---------- */
.logs { display: flex; flex-direction: column; gap: 8px; }
.log {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow);
  padding: 12px 14px;
}
/* Inside a card the logs are rows, not cards within a card. */
.logs.compact { gap: 0; }
.logs.compact .log { background: none; border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; padding: 10px 0; }
.logs.compact .log:first-child { border-top: 0; padding-top: 2px; }
.log-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 4px; }
.log-head .btn-ghost {
  background: var(--surface); border-color: var(--border); border-radius: var(--radius-control);
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
}
/* Touch screens have no real hover, so a tapped button doesn't stay black. */
@media (hover: hover) {
  .log-head .btn-ghost:hover { background: var(--fill-bg); border-color: var(--fill-bg); color: var(--fill-text); }
}
.log-head .btn-ghost:active { transform: translateY(1px) scale(.95); }
.log-unit { font-size: 1rem; }
/* Unit codes like E0903 are data: fixed-width so they line up and read digit by digit. */
.log p { font-size: .92rem; }
.pending { margin-top: 6px !important; padding: 6px 10px; background: var(--warn-soft); border-radius: var(--radius-control); }
.day-group { margin-bottom: 20px; }
.day-head { font-size: .9rem; color: var(--muted); margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }

/* ---------- Filters ---------- */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
  background: var(--surface); border: 0; border-radius: var(--radius-panel); box-shadow: var(--shadow);
  padding: 12px; margin-bottom: 8px;
}
.filters label { flex: 0 1 160px; }
.filters label.grow { flex: 1 1 240px; }
.result-count { font-size: .85rem; color: var(--muted); margin: 0 0 12px 2px; }

/* ---------- Follow-up table ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 0; border-radius: var(--radius-panel); box-shadow: var(--shadow); }
.fu-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.fu-table th {
  text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.fu-table td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.fu-table tr.is-overdue td { background: color-mix(in srgb, var(--danger-soft) 70%, transparent); }
.fu-table tr.is-done { color: var(--muted); }
.fu-table tr.is-done .item-title { text-decoration: line-through; color: var(--muted); }
.status-select { min-height: 32px; padding: 4px 8px; font-size: .85rem; width: auto; font-weight: 600; margin-bottom: 4px; }
.status-select.st-open { color: var(--info); }
.status-select.st-in-progress { color: var(--accent); }
.status-select.st-waiting { color: var(--warn); }
.status-select.st-done { color: var(--ok); }

/* ---------- Resources ---------- */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.res-grid .card { margin-bottom: 0; }
.res-list { list-style: none; margin: 0; padding: 0; }
.res { padding: 10px 0; border-top: 1px solid var(--border); }
.res:first-child { border-top: 0; }
.res-head { display: flex; align-items: center; gap: 4px; }
.res-name { font-weight: 650; }
.res-notes { font-size: .88rem; color: var(--muted); margin-top: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: .72rem; padding: 1px 7px; border-radius: 0; background: var(--surface-2); color: var(--muted); }

/* ---------- Dialogs ---------- */
dialog {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  border: 1px solid var(--border); border-radius: var(--radius-panel); padding: 0;
  background: var(--surface); color: var(--text); box-shadow: 0 24px 48px -24px rgba(28, 29, 31, .3);
}
dialog.wide { width: min(820px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(28, 29, 31, .45); }
dialog form, .dialog-body { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
dialog h2 { font-size: 1.2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.followup-inline { border: 1px dashed var(--field-border); border-radius: var(--radius-card); padding: 10px 12px 12px; margin: 0; }
.followup-inline legend { padding: 0 4px; }
.followup-inline:has(input[name="makeFollowup"]:not(:checked)) .grid-3 { opacity: .5; }
.form-error {
  background: var(--danger-soft); color: var(--danger); padding: 8px 12px; border-radius: var(--radius-control); font-weight: 550; font-size: .9rem;
}
.stack { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Toasts ---------- */
.toast-region {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000;
  display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(480px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--text); color: var(--bg); padding: 10px 12px 10px 16px; border-radius: var(--radius-control); font-weight: 550;
  box-shadow: 0 12px 28px -14px rgba(28, 29, 31, .35); animation: toast-in .35s cubic-bezier(.16, 1, .3, 1);
}
.toast-msg { flex: 1; }
.toast-error { background: var(--danger); color: var(--on-danger); }
.toast-action {
  font: inherit; font-weight: 650; cursor: pointer; flex: none;
  background: transparent; color: inherit; border: 1px solid currentColor; border-radius: calc(var(--radius-control) - 2px);
  padding: 4px 10px; min-height: 32px;
}
.toast-action:hover { background: rgba(127, 127, 127, .2); }
.toast :focus-visible { outline-color: currentColor; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
  .seg, .seg-thumb { transition: none; }
  .log-head .btn-ghost { transition: none; }
  .log-head .btn-ghost:active { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .global-search { order: 3; flex-basis: 100%; max-width: none; }
  .account { margin-left: auto; }
  h1 { font-size: 1.6rem; }
  main { padding-top: 16px; }
  .page-head .actions { width: 100%; }
  .btn kbd { display: none; } /* shortcut hints only matter with a keyboard */
  .quick-log { padding: 16px; }
  .quick-log .inline-form { flex-wrap: wrap; }
  .quick-log .inline-form > .quick-log-field, .quick-log .inline-form > input { flex: 1 1 100%; }
  .quick-log .inline-form > .btn { flex: 1 1 auto; }
  .page-head .actions .btn { flex: 1; }
  .filters label, .filters label.grow { flex: 1 1 calc(50% - 10px); }
  .filters label.grow { flex-basis: 100%; }
  .grid-2, .grid-3, .quick-log-fu { grid-template-columns: 1fr; }
  .quick-log-fu-toggle { margin-left: 0; }
  .res-grid { grid-template-columns: 1fr; }
  .item { flex-direction: column; gap: 6px; }
  .item-side { flex-direction: row; align-items: center; justify-content: space-between; }

  /* Table becomes stacked cards */
  .table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .fu-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .fu-table, .fu-table tbody, .fu-table tr, .fu-table td { display: block; width: 100%; }
  .fu-table tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow);
    margin-bottom: 10px; padding: 8px 12px;
  }
  .fu-table tr.is-overdue { border-color: var(--danger); }
  .fu-table tr.is-overdue td { background: none; }
  .fu-table td { border: 0; padding: 4px 0; display: flex; gap: 12px; align-items: flex-start; }
  .fu-table td::before {
    content: attr(data-label); flex: 0 0 72px; font-size: .75rem; font-weight: 650; text-transform: uppercase;
    letter-spacing: .03em; color: var(--muted); padding-top: 3px;
  }
  .fu-table td[data-label="Task"] { display: block; padding-bottom: 6px; }
  .fu-table td[data-label="Task"]::before { display: none; }
  .fu-table td > div { margin-left: 0; }
}

/* ---------- Login ---------- */
.signed-out .tabs, .signed-out main, .signed-out .global-search,
.signed-out .account { visibility: hidden; }
dialog.login { width: min(400px, calc(100vw - 24px)); }
dialog.login::backdrop { background: var(--bg); }
dialog.login .brand { margin-bottom: 4px; }
dialog.login .btn-primary { margin-top: 4px; }

/* Resident search results */
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.people li:first-child { border-top: 0; }

/* Shared database status */
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius-control); background: var(--info-soft); color: var(--info); font-weight: 550; }
.banner-error { background: var(--danger-soft); color: var(--danger); }

/* Shift note preview: matches the Outlook email (Calibri 11pt, black on white) in every theme */
.note-preview {
  background: #fff; color: #000; border: 1px solid var(--border); border-radius: var(--radius-control);
  padding: 16px 20px; max-height: 60vh; overflow: auto;
  font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 11pt; line-height: 1.15;
}
.note-preview:focus-visible { outline: 1px solid var(--focus-ring); outline-offset: 2px; }
/* Some computers only have the regular Calibri face installed, so bold can't be drawn.
   The preview then thickens bold text on screen only; the copied HTML still uses <b>,
   which Outlook renders with its real Calibri Bold. */
.note-preview.fake-bold b { -webkit-text-stroke: 0.035em currentColor; }

/* ---------- New shift log: step 1 section cards, step 2 subtype options ---------- */
.step-label { margin: 0 0 -6px; font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.step-section { font-weight: 650; color: var(--accent); }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.type-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.type-card {
  display: block; position: relative; cursor: pointer; color: var(--text); font-weight: 400;
  padding: 12px 40px 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface);
}
.type-card:hover { border-color: var(--accent); }
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card:has(input:checked) { border: 2px solid var(--accent); background: var(--accent-soft); padding: 11px 39px 11px 13px; }
/* Arrow hints that choosing a card moves on to the next step. */
.type-card::after { content: "›"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--muted); }
.type-card:hover::after, .type-card:has(input:checked)::after { color: var(--accent); }
.type-card:has(input:focus-visible) { outline: 1px solid var(--focus-ring); outline-offset: 2px; }
.type-card-title { display: block; font-weight: 650; font-size: .95rem; }
.type-card-desc { display: block; font-size: .84rem; color: var(--muted); margin-top: 2px; }
.type-card-eg { display: block; font-size: .78rem; color: var(--muted); margin-top: 6px; }
.subtype-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.subtype-option {
  display: inline-flex; flex-direction: row; align-items: center; cursor: pointer; position: relative;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 0; color: var(--text); font-size: .88rem; font-weight: 550;
}
.subtype-option input { position: absolute; opacity: 0; pointer-events: none; }
.subtype-option:hover { border-color: var(--accent); }
.subtype-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.subtype-option:has(input:focus-visible) { outline: 1px solid var(--focus-ring); outline-offset: 2px; }
#log-step2 { display: flex; flex-direction: column; gap: 14px; }
#log-step2 .step-section { margin-bottom: -8px; }

/* ---------- Overview ----------
   The quick-access links live in the menu panel, so the Overview is one column. */
.overview-head, .overview-main { min-width: 0; }
.overview-head .page-head { margin-bottom: 14px; }
.desk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 6px; color: var(--muted); }
.shift-chip {
  display: inline-flex; align-items: center; gap: 7px; font-weight: 550; color: var(--text);
}
.shift-chip::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--shift); }

/* ---------- Menu panel (☰): quick-access links, slides in from the left ---------- */
.menu-btn {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-control); background: transparent; color: var(--text); cursor: pointer;
}
.menu-btn:hover { background: var(--surface-2); }
.menu-btn svg { width: 20px; height: 20px; }
.signed-out .menu-btn { visibility: hidden; }

/* Account & settings dropdown (profile icon, far right of the top bar) */
.account { position: relative; flex: none; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 220px;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: 0 16px 32px -16px rgba(28, 29, 31, .25);
}
.account-email {
  margin: 0; padding: 8px 10px 10px; font-size: .82rem; color: var(--muted);
  border-bottom: 1px solid var(--border); margin-bottom: 4px; overflow-wrap: anywhere;
}
.account-email:empty { display: none; }
.account-item {
  font: inherit; font-size: .9rem; text-align: left; color: var(--text); background: none; border: 0;
  padding: 8px 10px; min-height: 36px; border-radius: calc(var(--radius-card) - 6px); cursor: pointer;
}
.account-item:hover { background: var(--surface-2); }
#signout-btn { margin-top: 4px; border-top: 1px solid var(--border); border-radius: 0 0 calc(var(--radius-card) - 6px) calc(var(--radius-card) - 6px); }
dialog.drawer {
  margin: 0; inset: 0 auto 0 0; width: min(320px, 86vw); height: 100dvh; max-height: 100dvh;
  border: 0; border-right: 1px solid var(--border); border-radius: 0 var(--radius-panel) var(--radius-panel) 0;
  animation: drawer-in .3s cubic-bezier(.16, 1, .3, 1);
}
@keyframes drawer-in { from { transform: translateX(-100%); } }
.drawer-body { display: flex; flex-direction: column; gap: 24px; min-height: 100%; padding: 16px 20px 24px; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (prefers-reduced-motion: reduce) { dialog.drawer { animation: none; } }

/* Quick-access links: plain lists under small headings, no boxes. */
.quick-access { display: flex; flex-direction: column; gap: 22px; }
.quick-card h2 {
  font-family: var(--font-text); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.quick-card ul { list-style: none; margin: 0; padding: 0; }
.quick-card li { font-size: .88rem; line-height: 1.35; padding: 3px 0; overflow-wrap: anywhere; }
.quick-card a { color: var(--text); text-decoration: none; }
.quick-card a:hover { color: var(--accent); text-decoration: underline; }
.quick-card .unset { color: var(--muted); }
.shortcut-list li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .84rem; }
.shortcut-list kbd { min-width: 1.6em; text-align: center; }

@media (max-width: 860px) {
  .shortcuts { display: none; } /* no keyboard on most phones */
}

/* Controls share one geometry; pills are reserved for actions. */
.btn { border-radius: var(--radius-pill); }
.brand-name { font-size: .9rem; font-weight: 500; }
.global-search { position: relative; }
.global-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.global-search input { padding-left: 40px; padding-right: 42px; background: #EBEBEE; border: 0; border-radius: var(--radius-control); }
.search-shortcut { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); opacity: .65; font-size: .78rem; pointer-events: none; }
input[type="checkbox"] { appearance: none; width: 18px; height: 18px; min-height: 18px; padding: 0; flex: none; border: 1px solid #A1A1A6; border-radius: 50%; background: transparent; cursor: pointer; }
input[type="checkbox"]:checked { background: var(--text); border-color: var(--text); position: relative; }
input[type="checkbox"]:checked::after { content: ""; position: absolute; left: 5px; top: 2px; width: 5px; height: 9px; border: solid white; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.pri-high { background: var(--surface-2); color: var(--muted); }
.btn-danger, .btn-danger-ghost { background: var(--surface-2); border-color: transparent; color: var(--text); }

/* Keep the dashboard and navigation on the same centered workspace. */
.topbar, .tabs { padding-inline: max(24px, calc((100vw - 1240px) / 2 + 24px)); }
main { margin-inline: auto; padding-inline: 24px; }
.page-head { justify-content: flex-start; gap: 20px 32px; }
.badges { justify-content: flex-start; }
.item-side { align-items: flex-start; }

/* Notes float over the workspace; only the notes intercept pointer events. */
.sticky-stack {
  position: fixed; bottom: 24px; right: 24px; z-index: 90;
  gap: 8px; padding: 10px 16px; border-radius: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.sticky-stack:hover { background: var(--surface-2); }
.sticky-stack svg { width: 20px; height: 20px; }
.sticky-layer { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.sticky-note {
  position: absolute; width: min(260px, calc(100vw - 16px)); height: min(250px, calc(100dvh - 16px));
  display: flex; flex-direction: column; pointer-events: auto;
  background: #F5F0DE; color: #494536; border-radius: 6px;
  box-shadow: 0 8px 28px rgba(29,29,31,.14); overflow: hidden;
}
.sticky-toolbar { display: flex; align-items: center; padding: 4px 6px 4px 32px; }
.sticky-grip, .sticky-delete {
  display: flex; align-items: center; justify-content: center; min-height: 36px;
  background: transparent; color: #665F4C; border: 0; border-radius: 8px; cursor: pointer;
}
.sticky-grip { flex: 1; justify-content: flex-start; gap: 5px; font: 500 .75rem var(--font-text); cursor: grab; touch-action: none; user-select: none; }
.sticky-grip svg, .sticky-delete svg { width: 20px; height: 20px; }
.sticky-delete { width: 36px; }
.sticky-delete:hover { background: rgba(73,69,54,.08); }
.sticky-note.is-dragging .sticky-grip { cursor: grabbing; }
.sticky-note textarea { flex: 1; min-height: 0; padding: 4px 16px 16px; background: transparent; color: inherit; border: 0; border-radius: 0; resize: none; font-size: .95rem; line-height: 1.55; }
.sticky-note textarea::placeholder { color: #77705C; }
.sticky-note textarea:focus-visible { outline: none; }
.signed-out .sticky-stack, .signed-out .sticky-layer { visibility: hidden; }
@media (max-width: 720px) {
  .topbar, .tabs { padding-inline: 16px; }
  main { padding-inline: 16px; }
  .sticky-stack { bottom: 16px; right: 16px; }
  main { padding-bottom: 96px; }
}

.sticky-resize {
  position: absolute; left: 4px; top: 8px; display: grid; place-items: center;
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: #665F4C; cursor: nwse-resize; touch-action: none;
}
.sticky-resize:hover { background: rgba(73,69,54,.08); }
.sticky-resize svg { width: 20px; height: 20px; transform: rotate(180deg); }
.sticky-note textarea { padding-bottom: 30px; }

/* Quiet note controls retain their full pointer targets. */
.sticky-delete, .sticky-resize { color: #8B8576; }
.sticky-delete svg, .sticky-resize svg { width: 14px; height: 14px; }
.sticky-delete:hover, .sticky-resize:hover,
.sticky-delete:focus-visible, .sticky-resize:focus-visible { color: #494536; }
