:root {
  --brand: #d32f2f;
  --brand-dark: #9a1f1f;
  --ink: #27272a;
  --muted: #71717a;
  --line: #e4e4e7;
  --bg: #f4f4f5;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
.hidden { display: none !important; }

/* ---- Header ---- */
#authbar { background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.hdr { max-width: 1000px; margin: 0 auto; padding: 12px 18px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hdr-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.hdr-logo { height: 34px; width: auto; display: block; }
.hdr-name { font-size: 18px; font-weight: 800; color: var(--brand); letter-spacing: -.01em; }
.hdr-user { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hdr-username { font-size: 14px; font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; }
.signout { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 600; }
.signout:hover { background: var(--bg); }
.hdr-nav { max-width: 1000px; margin: 0 auto; padding: 8px 18px 10px; display: flex; gap: 4px; flex-wrap: wrap; border-top: 1px solid var(--bg); }
.navlink { color: var(--ink); text-decoration: none; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.navlink:hover { background: var(--bg); }
.nav-dd { position: relative; }
.nav-dd-btn { background: none; border: none; cursor: pointer; font-family: inherit; }
.nav-dd-menu { position: absolute; top: 100%; right: 0; margin-top: 4px; min-width: 170px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; display: none; z-index: 50; }
.nav-dd.open .nav-dd-menu { display: block; }
.nav-dd-item { display: block; padding: 8px 12px; border-radius: 7px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; white-space: nowrap; }
.nav-dd-item:hover { background: var(--bg); }
.gate-logo { display: block; height: 64px; width: auto; margin: 0 auto 14px; }
@media (max-width: 540px) { .hdr-username { display: none; } }

/* ---- Layout ---- */
.container { max-width: 1000px; margin: 0 auto; padding: 24px 18px 60px; }
.narrow { max-width: 640px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
h1.page-title { font-size: 24px; margin: 6px 0 4px; }
.subtitle { color: var(--muted); margin: 0 0 20px; }

/* ---- Sign-in gate ---- */
.gate { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-card { text-align: center; max-width: 420px; }
.gate-logo { height: 64px; margin-bottom: 14px; }
#gsi-button { display: flex; justify-content: center; margin-top: 18px; }
#signin-message { color: var(--muted); font-size: 14px; margin-top: 14px; min-height: 18px; }

/* ---- Form ---- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=date], input[type=time], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(211,47,47,.12); }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 150px; }

.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 560px) { .cat-grid { grid-template-columns: 1fr; } }
.cat-tile { border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; user-select: none; }
.cat-tile.active { border-color: var(--brand); background: rgba(211,47,47,.05); }
.cat-tile input { margin-right: 8px; }
.cat-tile .cat-name { font-weight: 600; }
.reserve-tile { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; font-weight: 600; cursor: pointer; }

.btn { background: var(--brand); color: #fff; border: none; border-radius: 10px; padding: 12px 20px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .7; cursor: default; }
.spinner { display: inline-block; width: 14px; height: 14px; margin-right: 7px; vertical-align: -2px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: dg-spin .6s linear infinite; }
@keyframes dg-spin { to { transform: rotate(360deg); } }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: #fff; color: var(--brand); border: 1px solid #f3c0c0; }
.btn-danger:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-secondary:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn:disabled:hover { background: var(--brand); }
.btn-secondary:disabled:hover { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-danger:disabled:hover { background: #fff; color: var(--brand); border-color: #f3c0c0; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---- Badges & chips ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.st-submitted { background: #e0e7ff; color: #3730a3; }
.st-pending { background: #ede9fe; color: #5b21b6; }
.st-declined { background: #fee2e2; color: #991b1b; }
.st-scheduled { background: #cffafe; color: #155e75; }
.st-progress { background: #fef3c7; color: #92400e; }
.st-completed { background: #dcfce7; color: #166534; }
.st-cancelled { background: #f4f4f5; color: #71717a; text-decoration: line-through; }
.chip { display: inline-block; background: var(--bg); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; }
.chip-cat { background: #fff; }

/* ---- Tables / cards list ---- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar select, .toolbar input { width: auto; }
.req-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.req-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.req-title { font-weight: 700; font-size: 16px; margin: 0; }
.req-meta { color: var(--muted); font-size: 13px; margin: 4px 0; }
.req-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.req-actions select { min-width: 130px; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.doc-link { color: var(--brand); font-weight: 600; text-decoration: none; }
.doc-link:hover { text-decoration: underline; }

/* ---- Styled dialogs (UI.confirm / UI.alert / UI.prompt) ---- */
.ui-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 3000; }
.ui-modal { background: #fff; border-radius: 14px; max-width: 440px; width: 100%; padding: 22px 24px; box-shadow: 0 12px 44px rgba(0,0,0,.28); }
.ui-modal-msg { font-size: 15px; line-height: 1.5; color: var(--ink); white-space: pre-line; }
.ui-modal-input { width: 100%; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; font-family: inherit; }
.ui-modal-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(211,47,47,.12); }
.ui-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #18181b; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .2s; z-index: 1000; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-error { background: #b91c1c; }

/* ---- Success panel ---- */
.success { text-align: center; padding: 20px; }
.success .check { font-size: 48px; }

/* ---- View toggle ---- */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.view-btn { background: #fff; border: none; padding: 7px 14px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted); border-right: 1px solid var(--line); }
.view-btn:last-child { border-right: none; }
.view-btn.active { background: var(--brand); color: #fff; }
.week-nav { display: inline-flex; align-items: center; gap: 6px; }
.week-nav strong { font-size: 14px; }
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range label { font-size: 12px; color: var(--muted); font-weight: 600; }
.wk-date { width: auto; padding: 5px 8px; font-size: 13px; border: 1px solid var(--line); border-radius: 8px; }

/* ---- Location chip ---- */
.loc-chip { display: inline-block; padding: 2px 9px; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 700; }

/* ---- Compact table ---- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table th { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-weight: 700; white-space: nowrap; }
.dash-table th[data-sort] { cursor: pointer; user-select: none; }
.dash-table td { padding: 8px 10px; border-bottom: 1px solid var(--bg); vertical-align: middle; }
.dash-table tr:last-child td { border-bottom: none; }
.dash-table .nowrap { white-space: nowrap; }
.dash-table .day-row td { background: var(--bg); font-weight: 800; font-size: 13px; color: var(--ink); padding: 10px; border-bottom: 1px solid var(--line); }
/* Compact print icon at the right of each day header. */
.dash-table .iconbtn { float: right; border: none; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.dash-table .iconbtn:hover { background: rgba(0,0,0,.08); }
/* The single "Past" divider that separates old events from upcoming ones. */
.dash-table .past-divider td { background: #fff; color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 26px 10px 8px; border-top: 2px solid var(--line); }
.dash-table .pdate { font-size: 11px; color: var(--muted); font-weight: 600; }
/* Past events read as clearly "done": rows dimmed. */
.dash-table tr.past-day:not(.day-row) { opacity: .55; }
.set-status-sm, .set-assign-sm { padding: 4px 6px; font-size: 12px; max-width: 140px; }

/* ---- Responsive tables: stack rows into labeled cards on phones ---- */
@media (max-width: 640px) {
  .table-wrap { border: none; background: transparent; overflow-x: visible; }
  .dash-table { font-size: 14px; }
  .dash-table thead { display: none; }
  .dash-table, .dash-table tbody, .dash-table tr, .dash-table td { display: block; width: 100%; }
  .dash-table tr { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 2px; margin-bottom: 10px; }
  .dash-table td { padding: 6px 14px; border: none; display: flex; justify-content: space-between; align-items: center; gap: 14px; text-align: right; min-height: 34px; }
  .dash-table td::before { content: attr(data-label); font-weight: 700; color: var(--muted); text-align: left; white-space: nowrap; flex: 0 0 auto; }
  .dash-table td:empty { display: none; }
  .dash-table td[data-label=""]::before { content: none; }
  .dash-table .set-status-sm, .dash-table .set-assign-sm { max-width: 65%; font-size: 14px; }
  .dash-table .day-row td { display: block; text-align: left; background: var(--bg); border-radius: 8px; font-weight: 800; }
  .dash-table .day-row td::before { content: none; }
}

/* ---- Week calendar ---- */
.cal { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.cal-head { display: grid; grid-template-columns: 48px repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.cal-gutter-h { border-right: 1px solid var(--line); }
.cal-dh { text-align: center; padding: 6px 2px; font-size: 12px; font-weight: 700; color: var(--muted); border-right: 1px solid var(--line); }
.cal-dh:last-child { border-right: none; }
.cal-dn { font-size: 15px; color: var(--ink); }
.cal-body { display: grid; grid-template-columns: 48px repeat(7, 1fr); position: relative; }
.cal-gutter { position: relative; border-right: 1px solid var(--line); }
.cal-hour { position: absolute; right: 5px; font-size: 10px; color: var(--muted); transform: translateY(-6px); }
.cal-col { position: relative; border-right: 1px solid var(--line); background: repeating-linear-gradient(#fff, #fff 71px, #eef 71px, #eef 72px); }
.cal-col:last-child { border-right: none; }
.cal-today { background: repeating-linear-gradient(#fffdf5, #fffdf5 71px, #eef 71px, #eef 72px); }
.cal-ev { position: absolute; border-radius: 5px; color: #fff; padding: 2px 5px; overflow: hidden; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.2); box-sizing: border-box; }
.cal-ev:hover { filter: brightness(1.07); }
/* Title leads (bold); the room line carries the time in parens, e.g. "BM (9:00 AM)".
   Titles wrap over as many lines as the block allows, breaking long words rather
   than slicing them at the edge. */
.cal-ev-t { display: block; font-size: 10px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; word-break: break-word; }
.cal-ev-l { display: block; font-size: 9px; opacity: .92; overflow-wrap: anywhere; word-break: break-word; }

/* ---- Staff page ---- */
.staff-card { padding: 16px; margin-bottom: 12px; }
.role-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 12px; }
.role-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; cursor: pointer; user-select: none; }
.role-chip input { margin: 0; }

/* ---- Diagram controls + preview ---- */
.diagram-controls { display: flex; gap: 10px; flex-wrap: wrap; }
.diagram-controls label.btn { display: inline-block; }
.diagram-preview { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.diagram-thumb { max-width: 240px; max-height: 180px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.btn-link { background: none; border: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 4px; font-size: 14px; }
.btn-link:hover { text-decoration: underline; }

/* ---- Diagram builder modal ---- */
.diagram-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; align-items: center; justify-content: center; padding: 16px; }
.diagram-modal { position: relative; background: #fff; border-radius: 14px; width: 100%; max-width: 920px; max-height: 94vh; display: flex; flex-direction: column; overflow: hidden; }
.diagram-head { padding: 16px 18px 8px; display: flex; flex-direction: column; gap: 2px; }
.diagram-head strong { font-size: 17px; }
.diagram-palette { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 18px; border-bottom: 1px solid var(--line); align-items: center; }
.palette-btn { cursor: pointer; }
.palette-btn:hover { background: var(--bg); }
.diagram-palette .chip { cursor: pointer; }
.diagram-palette .chip:hover { background: var(--bg); }
.diagram-palette label { font-size: 12px; color: var(--muted); font-weight: 600; }
.dg-group { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 9px; background: #fafafa; }
.dg-check { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.diagram-palette select { width: auto; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.palette-sep { flex: 1; }
.diagram-canvas-wrap { padding: 14px 18px; overflow: auto; background: #fafafa; }
#dg-canvas { width: 100%; height: auto; max-height: 64vh; border-radius: 8px; touch-action: none; display: block; margin: 0 auto; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.dg-meta-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 18px 0; }
.dg-meta-loc { display: inline-block; padding: 3px 11px; border-radius: 6px; color: #fff; font-size: 13px; font-weight: 700; }
.dg-meta-time { font-size: 13px; font-weight: 600; color: var(--ink); }
.dg-inventory-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 18px; border-top: 1px solid var(--line); background: #fafafa; }
.dg-inv-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dg-inv-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dg-inv-item { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--ink); }
.dg-inv-item b { color: var(--brand); }
.diagram-actions { padding: 12px 18px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }
.dg-texted { display: none; position: absolute; inset: 0; background: rgba(0,0,0,.35); align-items: center; justify-content: center; }
.dg-texted-box { background: #fff; border-radius: 12px; padding: 18px; width: 90%; max-width: 380px; display: flex; flex-direction: column; gap: 10px; }
.dg-texted-box textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; font-family: inherit; resize: vertical; }
.dg-texted-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dg-texted-box select { width: auto; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; margin-left: 6px; }
.dg-layouts-row { border-top: 1px solid var(--bg); }
.dg-layouts-row select { min-width: 160px; }
.dg-text-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.dg-tbtn { min-width: 32px; height: 32px; border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; cursor: pointer; font-size: 15px; }
.dg-tbtn.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.dg-tsep { width: 1px; height: 22px; background: #e2e8f0; margin: 0 2px; }
.dg-tlabel { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #475569; }
.dg-tlabel input[type="color"] { width: 34px; height: 30px; padding: 1px; }
.dg-share { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #1d4ed8; background: #eff6ff; padding: 4px 10px; border-radius: 6px; }
#dg-del-layout:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Settings: per-location watcher chip editor ---- */
.wx-card { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 10px; }
.wx-loc { flex: 0 0 150px; }
.wx-body { flex: 1; }
.wx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.wx-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 13px; }
.wx-chip button { border: none; background: #d4d4d8; color: #fff; border-radius: 999px; width: 18px; height: 18px; line-height: 1; cursor: pointer; font-size: 12px; }
.wx-chip button:hover { background: var(--brand); }
.wx-add { display: flex; gap: 6px; }
.wx-add input { flex: 1; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.wx-empty { color: var(--muted); font-size: 13px; }

/* ---- Settings sections ---- */
.set-section { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 16px; }
.set-section h3 { margin: 0 0 4px; }
.set-section > .muted { margin: 0 0 12px; font-size: 13px; }
.set-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.set-lbl { flex: 0 0 130px; font-weight: 600; font-size: 14px; }
.set-section input[type="email"], .set-section input[type="text"], .set-section input[type="time"], .set-section input[type="number"], .set-section select {
  padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.set-section input[type="email"], .set-section input[type="text"]:not(#bo-label) { min-width: 240px; }
.bo-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.bo-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px 5px 12px; font-size: 13px; }
.bo-chip button { border: none; background: #d4d4d8; color: #fff; border-radius: 999px; width: 18px; height: 18px; line-height: 1; cursor: pointer; font-size: 12px; }
.bo-chip button:hover { background: var(--brand); }
.bo-add { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.bo-add input { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }

/* ---- Recurring ("Repeat this setup") ---- */
.rep-toggle { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.rep-panel { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafafa; }
.rep-modes { display: flex; gap: 16px; margin-bottom: 12px; }
.rep-modes label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.rep-weekdays { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.rep-wd { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; background: #fff; font-size: 13px; cursor: pointer; }
.rep-add { display: flex; gap: 8px; margin-bottom: 8px; }
.rep-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rep-chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 13px; }
.rep-chip button { border: none; background: #d4d4d8; color: #fff; border-radius: 999px; width: 18px; height: 18px; cursor: pointer; }
#rep-preview .dash-table input[type="time"] { width: auto; padding: 4px 6px; font-size: 13px; }

/* ============================================================
   Polish Pass v1 — visual hierarchy, toolbar grouping,
   keyboard focus states, mobile toolbar, "what happens next",
   loading/empty states, calendar status cues.
   ============================================================ */

/* ---- Dashboard toolbar: read as clusters, not one wall ---- */
.toolbar { align-items: center; column-gap: 14px; row-gap: 10px; }
.tb-group { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tb-group-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; margin-right: 2px; }
.tb-actions { margin-left: auto; }               /* push doc/export to the right on wide screens */
@media (min-width: 900px) {
  .tb-filters { padding-left: 14px; border-left: 1px solid var(--line); }
}

/* ---- Keyboard focus rings (mouse clicks stay clean via :focus-visible) ---- */
.btn:focus-visible, .btn-secondary:focus-visible, .btn-danger:focus-visible,
.view-btn:focus-visible, .btn-link:focus-visible, .navlink:focus-visible,
.nav-dd-item:focus-visible, .signout:focus-visible, .iconbtn:focus-visible,
.doc-link:focus-visible, .chip-warn:focus-visible {
  outline: 3px solid rgba(211, 47, 47, .5);
  outline-offset: 2px;
}
.view-toggle:focus-within { border-radius: 9px; }
.view-toggle { overflow: visible; }               /* don't clip a focused button's ring */

/* ---- "What happens next" strip on the request form ---- */
.next-steps { display: flex; gap: 10px; margin: 0 0 22px; flex-wrap: wrap; }
.next-step { flex: 1; min-width: 160px; display: flex; align-items: flex-start; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.ns-num { flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--brand);
  color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.ns-txt { font-size: 13px; line-height: 1.35; }
.ns-txt strong { display: block; }
.ns-txt span { color: var(--muted); }
@media (max-width: 560px) { .next-steps { flex-direction: column; } .next-step { min-width: 0; } }

/* ---- Loading placeholder (before live data arrives) ---- */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--muted); padding: 48px 20px; font-size: 14px; }
.loading .spinner { width: 18px; height: 18px; border-color: rgba(0, 0, 0, .15); border-top-color: var(--brand); }

/* ---- Empty state: a little warmth ---- */
.empty .empty-emoji { display: block; font-size: 34px; margin-bottom: 8px; }

/* ---- Calendar: keep location color, but flag what needs action ---- */
.cal-ev.ev-pending { outline: 2px dashed rgba(255, 255, 255, .9); outline-offset: -3px; }
.cal-ev.ev-done { opacity: .45; }
.cal-ev.ev-done .cal-ev-t { text-decoration: line-through; }

/* ---- Mobile: let the dense toolbar breathe and stack ---- */
@media (max-width: 640px) {
  .toolbar { align-items: stretch; }
  .tb-group { width: 100%; }
  .tb-actions { margin-left: 0; }
  .tb-filters { padding-left: 0; border-left: none; }
  .tb-filters select { flex: 1 1 42%; min-width: 0; width: auto; }
  .tb-filters #filter-search { flex: 1 1 100%; width: auto; }
  .tb-group-label { flex: 1 1 100%; }
  .tb-filters .date-range { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; }
  .tb-filters .date-range .wk-date { flex: 1; min-width: 0; }
  .view-toggle { display: flex; }
  .view-toggle .view-btn { flex: 1; }
}
