/* ==========================================================================
   Convo Monitor specific components (responsive)
   Spec: HotelEar_UIUX_Design.md §5 (alerts, listen) + §6 (KPI/overview)
   Mobile-first, design tokens only.
   ========================================================================== */

/* ---------------------------------------------------------------- overview KPI row */
.stat-grid { margin-bottom: 18px; }
.stat { gap: 6px; padding: 14px 14px; border-radius: var(--radius-lg); }
.stat .value { font-size: 22px; }
.stat .label { font-size: 11px; }
.stat .meta-trend { flex-wrap: wrap; }
@media (min-width: 861px) {
  .stat .value { font-size: 26px; }
}

/* ---------------------------------------------------------------- hotel section headers */
.hotel-section { margin-bottom: 22px; }
.hotel-section > h2 {
  align-items: center; gap: 8px;
  font-size: 16px; margin-bottom: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hotel-section > h2 .muted { overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- device cards (overview) */
.device-card { padding: 18px 16px; gap: 12px; }
.device-card .head { flex-wrap: wrap; gap: 8px; }
.device-card .name { font-size: 15px; }
.device-card .meta { font-size: 12px; }
.device-card .actions { margin-top: 2px; display: grid; grid-template-columns: 1fr; gap: 8px; }
.device-card .actions .btn-sm { width: 100%; }
.device-card .meter {
  height: 8px; margin-top: 2px;
}

@media (min-width: 620px) {
  .device-card .actions { grid-template-columns: 1fr 1fr; }
}
.device-card.alerting { animation: pulse-danger 2.2s infinite ease-out; }

/* badge-alert (open incident count link on device card / nav) */
.badge-alert {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--danger); background: var(--danger-soft);
  border: 1px solid var(--danger); border-radius: 999px;
  font-size: 11.5px; font-weight: 700; padding: 3px 10px;
  text-decoration: none; position: relative;
}
.badge-alert::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; animation: blink-dot 1.6s infinite;
}

/* ---------------------------------------------------------------- alert stack / banners */
.alert-stack { margin-bottom: 14px; }
.alert-banner {
  gap: 12px; padding: 12px 14px;
  border-radius: var(--radius-lg);
  position: relative; overflow: hidden;
}

.alert-banner__text strong { font-size: 14px; }
.alert-banner__text span { font-size: 12.5px; line-height: 1.5; }

@media (max-width: 860px) {
  .alert-banner {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 12px; row-gap: 8px;
    align-items: start;
    border-radius: var(--radius-lg);
  }
  
  
  
}

/* ---------------------------------------------------------------- listen dock (overview)
   Mobile: full-width bottom sheet floating above the bottom nav. */
.listen-dock {
  position: fixed; z-index: 68;  /* above bottom nav (60) and topbar (65); below menu overlay (70), menu (75), search (80), dialogs (85) */
  left: 0; right: 0;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 10px);
  width: auto; transform: none;
  margin: 0 12px;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-base) ease-out;
  will-change: transform;
}

.listen-dock .meter { height: 8px; margin-top: 12px; }

/* Blocked autoplay state: full-panel tap-to-start overlay */

/* Quick actions row (Add note / Raise incident etc.) */

@media (max-width: 620px) {
  .listen-dock { margin: 0 0; }
  
  
  
}
@media (min-width: 861px) {
  .listen-dock {
    left: 50%; right: auto;
    bottom: 24px;
    transform: translateX(-50%);
    width: min(600px, calc(100% - 48px));
    margin: 0;
  }
  
  
  
}

/* Inline listen panel (incident detail) on mobile stays in flow */

/* controls row on small phones */

/* ---------------------------------------------------------------- incident detail mobile order
   Phones: the two columns (.inc-main / .inc-side) dissolve so every card is a direct item of
   the one-column .inc-layout grid, then the live-listen card moves up near the top:
   conversation, listen, details, notes, timeline. */
@media (max-width: 860px) {
  .inc-layout > .inc-main, .inc-layout > .inc-side { display: contents; }
  .inc-layout #ai-card { order: 1; }
  .inc-layout #listen-box { order: 2; scroll-margin-top: 72px; }
  .inc-layout #summary { order: 3; }
  .inc-layout #notes-card { order: 4; }
  .inc-layout #timeline-card { order: 5; }
  /* The timeline is part of the page here: a scroll box inside the scrolling page traps the swipe
     (overscroll-behavior: contain) and its fade mask stops touch scrolling in mobile browsers. */
  .timeline, .inc-side .timeline, .timeline.has-more {
    max-height: none; overflow: visible; overscroll-behavior: auto; margin-right: 0; padding-right: 0;
    -webkit-mask-image: none; mask-image: none;
  }
  .timeline:not(.is-expanded) > li:nth-child(n+9) { display: none; }   /* TIMELINE_PHONE_ROWS = 8 */
  .timeline:not(.is-expanded) > li:nth-child(8) { padding-bottom: 0; }
  .timeline:not(.is-expanded) > li:nth-child(8)::after { display: none; }
  .timeline-more { display: flex; justify-content: center; width: 100%; margin-top: 12px; }
}
@media (min-width: 861px) { .timeline-more { display: none !important; } }
#listen-box { scroll-margin-top: 72px; }
#listen-box .listen-monitoring:empty { display: none; }
#listen-box .listen-monitoring { margin-bottom: 10px; }

/* "Monitoring inactive — reason" (overview cards, devices table, incident listen card) */
.monitoring-off {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; line-height: 1.35;
  color: var(--warning-text, var(--warning)); background: var(--warning-soft);
}
.monitoring-off .icon { flex: none; }
.monitoring-off--block { display: flex; border-radius: var(--radius-sm, 8px); padding: 7px 10px; }
td .monitoring-off { margin-top: 6px; }
.dc-monitoring { margin: 0 0 10px; }
.dev-settings__warn { color: var(--warning-text, var(--warning)); font-weight: 600; }

/* Phones: compact "Reconnecting" chip in the topbar, only while live updates are down. */
.ws-state--compact { height: 24px; padding: 0 8px; font-size: 11.5px; }
.ws-state--compact:not(.off) { display: none !important; }

/* Push blocked in the browser: looks disabled, still clickable to explain how to allow it. */
[data-push-enable].is-disabled { opacity: .6; cursor: help; }
/* Both columns start flush at the top: spacing comes only from the grid gap. */
#ai-card { margin-bottom: 0; }
#ai-card:empty, #listen-box:empty { display: none; }
.grid-2 > .stack > * + * { margin-top: 0; }
@media (max-width: 860px) {
  .grid-2 > .stack > * { margin-top: 0; }
}
.ai-summary-text { font-size: 14.5px; line-height: 1.6; }
.note { padding: 10px 12px; }

/* ---------------------------------------------------------------- incident header: badges + actions */
.incident-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.incident-badges .badge { cursor: default; }
.incident-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.incident-actions:empty { display: none; }
.incident-actions .btn { min-height: 38px; padding-inline: 16px; white-space: nowrap; }
@media (max-width: 860px) {
  .page-head:has(.incident-actions) { flex-wrap: wrap; }
  /* Two buttons per row: Delete / False alarm, then Acknowledge / Resolve. */
  .incident-actions { width: 100%; margin-left: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .incident-actions .btn { width: 100%; min-width: 0; min-height: 44px; padding-inline: 10px; justify-content: center; }
  /* An odd one out (e.g. Resolve alone) takes the full row. */
  .incident-actions .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- summary text (incident) */
.issue-summary {
  padding: 14px 16px; margin-bottom: 14px;
  background: var(--surface-2); border-radius: var(--radius);
}
.issue-summary__label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 4px;
}
.issue-summary p { margin: 0; font-size: 15px; line-height: 1.55; font-weight: 500; color: var(--text-1); }
/* Closed incident: the closure record at the top of the details card */
.closure {
  padding: 14px 16px; margin-bottom: 14px;
  background: var(--surface-2); border-radius: var(--radius);
}
.closure .detail-table { margin-top: 4px; }
.timeline li.k-REOPENED::before { background: var(--warning); }
/* Notes: one quick update box */
.note-compose { margin-top: 16px; }
.note-compose textarea { width: 100%; min-height: 64px; resize: vertical; }
.note-compose__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
@media (max-width: 560px) { .note-compose__foot .muted { display: none; } .note-compose__foot { justify-content: flex-end; } }
.resolve-recent { padding: 10px 12px; margin-bottom: 12px; background: var(--surface-2); border-radius: var(--radius); }
.resolve-recent p { margin: 4px 0 0; overflow-wrap: anywhere; }
.facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px; margin: 0 0 4px; padding: 2px 2px 0;
}
.facts__item { min-width: 0; }
.facts dt { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.facts dd { margin: 0; font-size: 14px; font-weight: 500; color: var(--text-1); overflow-wrap: anywhere; }
.facts__warn dd { color: var(--danger); }
@media (max-width: 520px) { .facts { grid-template-columns: minmax(0, 1fr); } }
.tech-details { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.tech-details > summary {
  cursor: pointer; font-size: 13px; color: var(--text-2); font-weight: 500;
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
}
.tech-details > summary::-webkit-details-marker { display: none; }
.tech-details > summary::before { content: "▸"; font-size: 11px; transition: transform .15s; }
.tech-details[open] > summary::before { transform: rotate(90deg); }
.tech-details table { margin-top: 10px; }

/* ---------------------------------------------------------------- sticky bottom actions (mobile) */

/* ---------------------------------------------------------------- filters sheet (incidents) */

/* ---------------------------------------------------------------- chart legend (reports) */

/* ---------------------------------------------------------------- code box (devices) */
.code-box {
  font-family: var(--font-mono); font-size: 13.5px;
  user-select: all; -webkit-user-select: all;
  overflow-wrap: anywhere;
}
@media (max-width: 620px) {
  .code-box { font-size: 12px; letter-spacing: .12em; }
}
/* ---------------------------------------------------------------- activation code dialog */
.act-modal > p:first-child { margin: -4px 0 14px; }
.act-code {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2, var(--bg));
}
.act-code__value {
  font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: .16em;
  user-select: all; -webkit-user-select: all; overflow-wrap: anywhere;
}
.act-steps { margin: 16px 0 10px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.act-chip {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: .06em; cursor: pointer;
  padding: 2px 8px; border: 1px dashed var(--border); border-radius: 6px; background: transparent; color: inherit;
}
.act-chip:hover { border-style: solid; border-color: var(--primary, #3b5bdb); }
@media (max-width: 620px) { .act-code__value { font-size: 20px; letter-spacing: .1em; } }
/* ---------------------------------------------------------------- notification bell + panel (topbar)
   Alerts live behind the bell instead of banners in the page header. */
.alert-stack { display: none !important; }
.topbar-right { position: relative; }
.notif-bell { display: inline-flex !important; width: 40px; height: 40px; border-radius: 10px; color: var(--text-2); }
.notif-bell[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }
.notif-bell__count {
  position: absolute; top: 3px; right: 2px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface); font-variant-numeric: tabular-nums;
}
.notif-bell.is-ringing svg { animation: bell-ring .9s ease-in-out; transform-origin: 50% 2px; }
@keyframes bell-ring {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); }
  45% { transform: rotate(9deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) { .notif-bell.is-ringing svg { animation: none; } }

.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 90;
  width: 400px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06);
  display: flex; flex-direction: column; overflow: hidden;
  animation: notif-in .16s ease-out;
}
@keyframes notif-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.notif-panel__head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--border); font-size: 14.5px;
}
.notif-panel__list { max-height: min(460px, calc(100vh - 180px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.notif-panel__foot {
  display: block; text-align: center; padding: 11px; font-size: 13px; font-weight: 500;
  border-top: 1px solid var(--border); color: var(--primary);
}
.notif-panel__foot:hover { background: var(--surface-2); text-decoration: none; }

.notif-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-item__dot { flex: 0 0 auto; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--danger); }
.notif-item--medium .notif-item__dot { background: var(--warning); }
.notif-item--low .notif-item__dot { background: var(--primary); }
.notif-item__body { flex: 1; min-width: 0; }
.notif-item__title { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.notif-item__title:hover { text-decoration: none; color: var(--primary); }
.notif-item__where { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.notif-item__summary {
  font-size: 12.5px; line-height: 1.45; color: var(--text-2); margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-item__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.notif-item__time { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.notif-item__actions { display: flex; gap: 6px; }
.notif-item__actions .btn { min-height: 30px; padding: 0 10px; font-size: 12.5px; }

.notif-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 36px 16px; color: var(--text-3); font-size: 13px; text-align: center; }
.notif-empty strong { color: var(--text-1); font-size: 14px; }
.notif-empty__icon {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--success-soft, var(--surface-2)); color: var(--success);
}
/* inside the mobile sheet the rows sit flush */
.sheet .notif-item { padding: 14px 4px; }
.sheet .notif-item__actions .btn { min-height: 38px; }

/* ---------------------------------------------------------------- reports: alerts per day chart */
.sw-HIGH { background: var(--danger); }
.sw-MEDIUM { background: var(--warning); }
.sw-LOW { background: var(--info); }
.daychart__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.daychart__head h2 { margin: 0 0 2px; }
.daychart__legend { margin-top: 4px; }
.daychart { --axis-w: 30px; }
.daychart__plot { position: relative; height: 200px; margin-left: var(--axis-w); }
/* recessive gridlines; the numbers sit in the left gutter */
.daychart__grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--border); }
.daychart__grid:first-child { border-top-color: var(--text-3); opacity: .5; } /* baseline */
.daychart__grid span {
  position: absolute; right: calc(100% + 8px); transform: translateY(-50%);
  font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums;
}
.daychart__cols { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.daychart__col { flex: 1 1 0; min-width: 0; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px; outline: none; cursor: default; }
.daychart__col.is-hover, .daychart__col:focus-visible { background: color-mix(in srgb, var(--text-3) 10%, transparent); }
.daychart__stack { width: min(70%, 44px); display: flex; flex-direction: column-reverse; gap: 2px; }
.daychart__seg { min-height: 3px; }
.daychart__stack .daychart__seg:last-child { border-radius: 4px 4px 0 0; }
.daychart__x { display: flex; gap: 2px; margin-left: var(--axis-w); margin-top: 8px; }
.daychart__xl { flex: 1 1 0; min-width: 0; font-size: 11px; color: var(--text-3); text-align: center; white-space: nowrap; overflow: visible; }
.daychart__tip {
  position: absolute; top: 0; transform: translate(-50%, -8px); z-index: 5; pointer-events: none;
  min-width: 140px; padding: 10px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14); font-size: 12px; color: var(--text-2);
}
.daychart__tip strong { display: block; color: var(--text-1); font-size: 12.5px; }
.daychart__tip-total { margin: 1px 0 6px; color: var(--text-3); }
.daychart__tip-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.daychart__tip-row i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.daychart__tip-row b { margin-left: auto; padding-left: 12px; color: var(--text-1); font-variant-numeric: tabular-nums; }
.daychart__empty { padding: 48px 16px; text-align: center; color: var(--text-3); font-size: 13.5px; border: 1px dashed var(--border); border-radius: var(--radius); }
@media (max-width: 520px) { .daychart__plot { height: 160px; } }

/* ---------------------------------------------------------------- screen-reader-only text */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- device settings dialog */
.dev-settings { display: flex; flex-direction: column; gap: 16px; }
.dev-settings .slider-group { margin: 0; }
.dev-settings__switch span { font-weight: 600; }
.dev-settings__scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); }
.dev-settings__grid { margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dev-settings__section {
  display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border-light);
}
.dev-settings__note { margin: -6px 0 0; }
.dev-settings__notice { padding: 10px 12px; margin: 0; }
.dev-settings__notice .alert-banner__text { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.dev-settings__advanced { border-top: 1px solid var(--border-light); padding-top: 12px; }
.dev-settings__advanced summary {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--text-2); list-style: none; border-radius: var(--radius-sm);
}
.dev-settings__advanced summary::-webkit-details-marker { display: none; }
.dev-settings__advanced summary::before {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--dur-fast) var(--ease-out);
}
.dev-settings__advanced[open] summary::before { transform: rotate(45deg); }
.dev-settings__advanced summary:hover { color: var(--text); }
.dev-settings__advanced summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.dev-settings__advanced-body { display: flex; flex-direction: column; gap: 16px; padding-top: 12px; }
@media (max-width: 520px) { .dev-settings__grid { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .dev-settings__advanced summary::before { transition: none; } }

/* ---------------------------------------------------------------- incidents list */
.inc-filters { margin-top: 12px; align-items: end; }
.inc-filters__reset { display: flex; align-items: flex-end; }
.inc-what { min-width: 220px; }
.inc-what__title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.inc-what__detail { max-width: 52ch; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inc-tag { font-size: 11px; font-weight: 600; }
.inc-table td { vertical-align: top; }
.inc-table tr.clickable:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* reports: four summary tiles in one row */
@media (min-width: 861px) { .report-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------- device card (overview) */
.dc { --dc-c: var(--text-3); --dc-soft: var(--surface-3); gap: 16px; padding: 18px; }
.dc[data-tone="ok"]   { --dc-c: var(--success); --dc-soft: var(--success-soft); }
.dc[data-tone="warn"] { --dc-c: var(--warning); --dc-soft: var(--warning-soft); }
.dc[data-tone="bad"]  { --dc-c: var(--danger);  --dc-soft: var(--danger-soft); }
.dc-head { display: flex; align-items: center; gap: 12px; }
.dc-tile {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--radius-lg); background: var(--dc-soft); color: var(--dc-c);
}
.dc-title { flex: 1; min-width: 0; }
.dc-name { margin: 0; font-size: 15.5px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.dc-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--dc-c); }
.dc-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dc[data-tone="ok"] .dc-pill::before { box-shadow: 0 0 0 3px var(--success-soft); }
.dc-open {
  flex: none; align-self: flex-start; display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px;
  border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: 12.5px; font-weight: 700; text-decoration: none;
}
.dc-open:hover { background: var(--danger); color: var(--surface); }
.dc-open:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.dc-live { padding: 6px 0 2px; }
.dc-caption { display: flex; align-items: baseline; justify-content: center; gap: 8px; margin-top: 10px; }
.dc-caption__text { font-size: 13.5px; font-weight: 500; color: var(--text); }
.dc-level { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-3); }

/* voice-memo style waveform: hairline bars, faded edges, accent fading to grey */
.dc-meter {
  --wave: var(--danger);
  display: flex; align-items: center; justify-content: space-between; height: 44px; padding: 0 4px;
  /* fade out the oldest readings on the left only; the newest stays crisp on the right */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%);
          mask-image: linear-gradient(90deg, transparent, #000 18%);
}
.dc-meter[data-tone="ok"] { --wave: var(--primary); }
.dc-meter[data-tone="warm"] { --wave: var(--warning); }
.dc-meter[data-tone="hot"] { --wave: var(--danger); }
.dc-meter i {
  flex: none; width: 2px; height: 100%; border-radius: 999px;
  background: var(--wave);  /* fallback if color-mix is unsupported */
  background: color-mix(in srgb, var(--wave) calc((1 - var(--p)) * 100%), var(--text-3));
  opacity: calc(.55 + (1 - var(--p)) * .45);
  transform: scaleY(var(--h, .05)); transform-origin: center;
  transition: transform 180ms var(--ease-out);
}
.dc-meter[data-tone="idle"] i { background: var(--border-dark); opacity: .8; }
.dc-noaudio {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 12px;
  border-radius: var(--radius); background: var(--dc-soft); color: var(--text-2); font-size: 13px; line-height: 1.4;
}
.dc-noaudio__icon { flex: none; display: inline-flex; color: var(--dc-c); }

.dc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dc-actions:has(> :only-child) { grid-template-columns: 1fr; }
.dc-actions .btn { width: 100%; min-height: 40px; justify-content: center; }
@media (max-width: 860px) { .dc-actions .btn { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .dc-meter i { transition: none; } }

/* ---------------------------------------------------------------- overview page */
.ov-head { align-items: flex-end; flex-wrap: wrap; }
.ov-filter { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); }
.ov-filter__btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.ov-filter__btn:hover { color: var(--text); }
.ov-filter__btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.ov-filter__btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.ov-filter__count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger-soft); color: var(--danger); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ov-filter__count[data-zero="1"] { background: var(--surface-3); color: var(--text-3); }

/* KPI tiles: icon chip in the tone colour, clickable where they lead somewhere */
.ov-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ov-kpis--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat.ov-kpi {
  --k-c: var(--text-3); --k-soft: var(--surface-3);
  display: flex; flex-direction: column; gap: 0; color: inherit; text-decoration: none; position: relative; overflow: hidden;
}
.ov-kpi[data-tone="ok"]   { --k-c: var(--success); --k-soft: var(--success-soft); }
.ov-kpi[data-tone="warn"] { --k-c: var(--warning); --k-soft: var(--warning-soft); }
.ov-kpi[data-tone="bad"]  { --k-c: var(--danger);  --k-soft: var(--danger-soft); }
.ov-kpi[data-tone="info"] { --k-c: var(--primary); --k-soft: var(--primary-soft); }
a.ov-kpi { transition: border-color 150ms ease, box-shadow 150ms ease; }
a.ov-kpi:hover { border-color: var(--border-dark); box-shadow: var(--shadow-sm); }
a.ov-kpi:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ov-kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ov-kpi__icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border-radius: 9px; background: var(--k-soft); color: var(--k-c);
}
.ov-kpi .value { font-variant-numeric: tabular-nums; }
.ov-kpi[data-tone="bad"] .value { color: var(--danger-text); }
.ov-kpi__of { font-size: .6em; font-weight: 500; color: var(--text-3); }
.ov-kpi__bar { height: 4px; margin-top: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.ov-kpi__bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--k-c); transition: width 400ms var(--ease-out, ease); }
.ov-kpi__bar + .meta-trend { margin-top: 8px; }

/* hotel header */
.ov-hotel { margin-bottom: 28px; }
.ov-hotel__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.ov-hotel__icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
}
.ov-hotel__title { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.ov-hotel__title h2 { margin: 0; font-size: 16px; }
.ov-hotel__meta { font-size: 12.5px; color: var(--text-3); }
.ov-hotel__chips { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.ov-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; text-decoration: none; background: var(--surface-3); color: var(--text-2);
}
.ov-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ov-chip[data-tone="ok"]   { background: var(--success-soft); color: var(--success); }
.ov-chip[data-tone="warn"] { background: var(--warning-soft); color: var(--warning-text); }
.ov-chip[data-tone="bad"]  { background: var(--danger-soft); color: var(--danger); }
a.ov-chip:hover { filter: brightness(.96); }
a.ov-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ov-empty { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* device cards: cards without live audio are compact */
.ov-grid { align-items: start; }
.dc { position: relative; overflow: hidden; }
.dc[data-state="PENDING"], .dc[data-state="DISABLED"] { background: var(--surface-2); box-shadow: none; }
.dc[data-state="PENDING"] .dc-name, .dc[data-state="DISABLED"] .dc-name { color: var(--text-2); }
.dc-open { gap: 5px; }
.dc[data-state="PENDING"] .dc-actions { grid-template-columns: auto; justify-content: start; }
.dc[data-state="PENDING"] .dc-actions .btn { min-height: 34px; height: 34px; }
.dc-seen { white-space: nowrap; }
/* the "Not activated" pill already says it all; keep these cards to a header and one button */
.dc[data-state="PENDING"] .dc-live { display: none; }
.dc[data-state="PENDING"] { gap: 12px; }
.dc .hidden { display: none !important; }

@media (max-width: 1100px) { .ov-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) {
  .ov-head { align-items: stretch; }
  .ov-filter { width: 100%; }
  .ov-filter__btn { flex: 1; justify-content: center; height: 36px; }
  .ov-hotel__chips { margin-left: 0; width: 100%; }
  /* Phones: one grouped panel, a row per figure (icon · label + note · value) instead of four boxes. */
  .ov-kpis, .ov-kpis--two {
    display: flex; flex-direction: column; gap: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
  }
  .stat.ov-kpi {
    display: grid; grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-areas: "icon label value" "icon note value";
    align-items: center; column-gap: 12px; row-gap: 1px;
    min-height: 0; padding: 11px 14px; border: 0; border-radius: 0; box-shadow: none; background: transparent;
  }
  .stat.ov-kpi + .stat.ov-kpi { border-top: 1px solid var(--border); }
  a.ov-kpi:hover { box-shadow: none; background: var(--surface-2); }
  a.ov-kpi:active { background: var(--surface-2); }
  .ov-kpi__top { display: contents; }
  .ov-kpi__icon { grid-area: icon; width: 32px; height: 32px; }
  .ov-kpi .label { grid-area: label; font-size: 13.5px; font-weight: 600; color: var(--text); text-transform: none;
    letter-spacing: 0; }
  .ov-kpi .meta-trend { grid-area: note; margin: 0; font-size: 12px; line-height: 1.35; color: var(--text-3); }
  .ov-kpi .value { grid-area: value; font-size: 20px; line-height: 1.1; text-align: right; white-space: nowrap; }
  .ov-kpi__bar { display: none; }  /* "1 / 2" already says it */
}
@media (prefers-reduced-motion: reduce) { .ov-kpi__bar i, a.ov-kpi { transition: none; } }

/* ---------------------------------------------------------------- raise alert dialog */
.ra-modal { width: min(520px, 100%); }
.ra-modal h2 { margin-bottom: 14px; font-size: 18px; }
.ra-form { display: flex; flex-direction: column; gap: 18px; }
.ra-location {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--radius-lg);
}
.ra-location strong { color: var(--text); font-size: 14.5px; }
.ra-location__icon {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius); background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border);
}
.ra-priority { margin: 0; padding: 0; border: 0; min-width: 0; }
.ra-priority legend { padding: 0; margin-bottom: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.ra-priority__options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ra-option { --ra-c: var(--info); --ra-soft: var(--info-soft); position: relative; display: block; margin: 0; cursor: pointer; }
.ra-option--HIGH { --ra-c: var(--danger); --ra-soft: var(--danger-soft); }
.ra-option--MEDIUM { --ra-c: var(--warning); --ra-soft: var(--warning-soft); }
.ra-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ra-option__body {
  display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.ra-option__label { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; color: var(--text); }
.ra-option__label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ra-c); flex: none; }
.ra-option__hint { font-size: 12px; color: var(--text-3); }
.ra-option:hover .ra-option__body { border-color: var(--border-dark); }
.ra-option input:checked + .ra-option__body { border-color: var(--ra-c); background: var(--ra-soft); }
.ra-option input:focus-visible + .ra-option__body { outline: 2px solid var(--primary); outline-offset: 2px; }
.ra-details { display: flex; flex-direction: column; gap: 6px; }
.ra-details__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ra-details__head label { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.ra-count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ra-details textarea { width: 100%; resize: vertical; }
.ra-note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; color: var(--text-3); }
.ra-modal .modal-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-light); }
.ra-modal .modal-actions .btn { min-width: 110px; justify-content: center; }
@media (max-width: 520px) {
  .ra-priority__options { grid-template-columns: minmax(0, 1fr); }
  .ra-option__body { flex-direction: row; align-items: center; justify-content: space-between; min-height: 48px; }
  .ra-modal .modal-actions .btn { flex: 1; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .ra-option__body { transition: none; } }

/* ---------------------------------------------------------------- desktop search dropdown */
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 90; width: max(100%, 380px);
  max-height: min(420px, 70vh); overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.search-dropdown .search-result {
  display: block; margin: 0; padding: 9px 12px; border: 0; border-radius: var(--radius); background: transparent;
}
.search-dropdown .search-result:hover,
.search-dropdown .search-result[aria-selected="true"] { background: var(--primary-soft); }
.search-dropdown .search-result strong { font-size: 13.5px; }
.search-dropdown .search-result small { display: block; margin-top: 1px; font-size: 12px; }
.search-dropdown .search-empty { padding: 18px 12px; }

/* overview: message when the "only issues" switch hides every device */
.ov-all-good { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--success); font-weight: 600; }

/* ---------------------------------------------------------------- live transcript (testing) */
.speech-debug { margin-bottom: 18px; }
.speech-debug__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.speech-debug__head h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 2px; font-size: 15px; }
.speech-debug__list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.speech-debug__line { padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border-light); }
.speech-debug__line--ai { border-color: var(--warning); }
.speech-debug__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.speech-debug__meta time { font-variant-numeric: tabular-nums; color: var(--text-3); }
.speech-debug__weak { color: var(--warning-text); font-weight: 600; }
.speech-debug__text { margin: 6px 0 0; font-size: 14.5px; color: var(--text); overflow-wrap: anywhere; }
.speech-debug__orig { margin: 2px 0 0; overflow-wrap: anywhere; }
.speech-debug__empty { padding: 14px 4px; font-size: 13px; }

/* ---------------------------------------------------------------- live monitor card (overview) */

/* header */

/* level */

/* actions */

/* raise alert panel */


/* ---------------------------------------------------------------- AI instructions (Settings > Devices) */
.ai-rules { margin-top: 16px; }
.ai-rules__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.ai-rules__head h2 { margin: 0; }
.ai-rules__head p { margin: 2px 0 0; }
.ai-rules__picker { display: flex; flex-direction: row; align-items: center; gap: 10px; margin: 0; white-space: nowrap; }
.ai-rules__picker select { min-width: 220px; }
.ai-rules textarea { width: 100%; min-height: 140px; resize: vertical; font-size: 14px; line-height: 1.55; }
.ai-rules textarea[readonly] { background: var(--surface-2); color: var(--text-2); }
.ai-rules__foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 860px) {
  .ai-rules__head { flex-direction: column; align-items: stretch; }
  .ai-rules__picker { flex-direction: column; align-items: stretch; gap: 6px; }
  .ai-rules__picker select { min-width: 0; width: 100%; }
  .ai-rules__foot .btn { width: 100%; min-height: 44px; }
}

/* ---------------------------------------------------------------- incident: Conversation card */
.convo-card__title { margin: 0 0 12px; font-size: 15px; }
.convo-card__label { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.convo-card__quote {
  margin: 0 0 14px; padding: 10px 12px; background: var(--surface-2);
  font-style: italic; border-radius: var(--radius); color: var(--text);
}
.convo-card__summary { margin: 0 0 12px; font-size: 14px; line-height: 1.6; color: var(--text); }

/* ---------------------------------------------------------------- audit log */
/* Phone cards: the full entry (who, target, details, date, hotel, IP), wrapping instead of cut off. */
.list-row--detail { align-items: start; }
.list-row--detail .list-row__dot { margin-top: 5px; }
.list-row--detail .list-row__title,
.list-row--detail .list-row__sub { white-space: normal; overflow-wrap: anywhere; }
.list-row__target { margin-top: 3px; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.list-row__details { margin-top: 3px; font-size: 12.5px; color: var(--text-2); line-height: 1.45; overflow-wrap: anywhere; }
.list-row__meta { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 5px; font-size: 11.5px; color: var(--text-3);
  font-variant-numeric: tabular-nums; }
.list-row--detail .list-row__status { text-transform: none; }
.audit-when { white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-action { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--info-soft); color: var(--info); }
.audit-action--listen { background: var(--success-soft); color: var(--success); }
.audit-action--warn { background: var(--danger-soft); color: var(--danger); }
.audit-action--muted { background: var(--surface-3); color: var(--text-2); }
/* Shown in full: wraps instead of being cut off. */
.audit-details { display: inline-block; max-width: 60ch; white-space: normal; overflow-wrap: anywhere;
  vertical-align: bottom; color: var(--text-2); }
.stat .stat-note { margin-top: 4px; font-size: 12px; color: var(--text-3); }

/* ---------------------------------------------------------------- sign-in page */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.auth-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(180deg, #1b2540, #0b1020); color: #fff; flex: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
/* brand panel */
.auth-side {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px 48px;
  background: #101828; color: #e4e7ec; overflow: hidden;
}
.auth-side::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 400px at 85% 10%, rgba(37, 86, 214, .35), transparent 70%);
}
.auth-side > * { position: relative; }
.auth-side__brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; color: #fff; }
.auth-side__body { max-width: 440px; }
.auth-side h2 { margin: 0 0 12px; font-size: 30px; line-height: 1.2; letter-spacing: -.02em; color: #fff; }
.auth-side p { margin: 0 0 26px; font-size: 15px; line-height: 1.6; color: #b4bccb; }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: #e4e7ec; }
.auth-point-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: rgba(255, 255, 255, .08); color: #9db8ff;
}
.auth-wave { display: flex; align-items: center; gap: 5px; height: 64px; }
.auth-wave i { flex: 1; max-width: 6px; height: calc(var(--h) * 100%); border-radius: 999px; background: rgba(157, 184, 255, .45); }
.auth-wave i:nth-child(3n) { background: rgba(157, 184, 255, .8); }

/* form panel */
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form__brand { display: none; align-items: center; gap: 10px; margin-bottom: 28px; font-size: 16px; font-weight: 700; color: var(--text); }
.auth-form h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.01em; color: var(--text); }
.auth-sub { margin: 0 0 24px; font-size: 14.5px; color: var(--text-2); }
.auth-alert { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; padding: 11px 14px; border-radius: var(--radius); font-size: 14px; }
.auth-alert svg { flex: none; margin-top: 2px; }
.auth-alert--error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.auth-alert--ok { background: var(--success-soft); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 25%, transparent); }
.auth-field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; font-size: 13px; font-weight: 600; color: var(--text); }
.auth-field input { width: 100%; height: 46px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.auth-password { position: relative; display: block; }
.auth-password input { padding-right: 44px; }
/* Sits inside the field's border (any field height): a small round button with a soft hover. */
.auth-eye {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; min-height: 0; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--text-3); cursor: pointer;
  transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.auth-eye:hover { color: var(--text); background: var(--surface-3, var(--surface-2)); }
.auth-eye:active { transform: translateY(-50%) scale(.92); }
.auth-eye[aria-pressed="true"] { color: var(--primary); }
.auth-eye[aria-pressed="true"]:hover { background: var(--primary-soft); }
.auth-eye:focus-visible { outline: 2px solid var(--primary); outline-offset: 0; }
.auth-caps { font-size: 12.5px; font-weight: 600; color: var(--warning-text, var(--warning)); }
.auth-submit { position: relative; width: 100%; height: 48px; margin-top: 8px; font-size: 15px; justify-content: center; gap: 10px; }
.auth-spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: auth-spin .7s linear infinite;
}
.auth-submit.is-loading .auth-spinner { display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-help { margin: 18px 0 0; font-size: 13px; color: var(--text-2); text-align: center; }
.auth-privacy {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin: 28px 0 0; padding-top: 18px;
  border-top: 1px solid var(--border-light); font-size: 12.5px; color: var(--text-3);
}
@media (max-width: 960px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .auth-form__brand { display: flex; }
  .auth-main { align-items: flex-start; padding-top: 12vh; }
}
@media (prefers-reduced-motion: reduce) { .auth-spinner { animation-duration: 2s; } }
.auth-alert { transition: opacity .3s ease, transform .3s ease; }
.auth-alert.is-leaving { opacity: 0; transform: translateY(-4px); }
@media (prefers-reduced-motion: reduce) { .auth-alert { transition: none; } }

/* ---------------------------------------------------------------- incident detail layout */
.inc-facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 16px; padding: 0; overflow: hidden;
}
.inc-fact { min-width: 0; padding: 16px 20px; border-left: 1px solid var(--border-light); }
.inc-fact:first-child { border-left: 0; }
.inc-fact dt { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.inc-fact dd { margin: 0; font-size: 16px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.inc-fact__sub { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 400; color: var(--text-3); }
.inc-fact.facts__warn dd { color: var(--danger); }

/* two columns whose tops line up; every card keeps its natural height */
.inc-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.inc-main, .inc-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.inc-main > *, .inc-side > * { margin: 0 !important; }
.inc-main > #ai-card:empty, .inc-side > #listen-box:empty { display: none; }
.inc-main .card, .inc-side .card { margin: 0; }
.inc-side .timeline { max-height: min(70vh, 680px); }
#summary > .tech-details:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.detail-table { width: 100%; margin-top: 12px; }
#summary > .detail-table:first-child { margin-top: 0; }

@media (max-width: 1100px) {
  .inc-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inc-fact:nth-child(3) { border-left: 0; }
  .inc-fact:nth-child(n+3) { border-top: 1px solid var(--border-light); }
}
@media (max-width: 860px) {
  .inc-layout { grid-template-columns: minmax(0, 1fr); }
  .inc-fact { padding: 14px 16px; }
}

/* Desktop: both columns end on the same line. The side column stretches to the row height;
   the timeline fills what is left and scrolls inside (contain:size keeps its long list from
   making the row taller). The last left card stretches if the left side is the shorter one. */
@media (min-width: 861px) {
  .inc-layout { align-items: stretch; }
  .inc-main > :last-child { flex: 1 1 auto; }
  .inc-side #timeline-card { flex: 1 1 auto; min-height: 260px; display: flex; flex-direction: column; }
  .inc-side .timeline { flex: 1 1 auto; min-height: 0; max-height: none; contain: size; overflow-y: auto; }
}

/* ---------------------------------------------------------------- loading & navigation feedback */
.top-progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10000; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #7aa2ff));
  box-shadow: 0 0 10px color-mix(in srgb, var(--primary) 55%, transparent);
  transform: scaleX(0); transform-origin: 0 50%; opacity: 0;
  transition: transform .22s ease-out, opacity .25s ease;
}
.top-progress.is-active { opacity: 1; }

/* skeleton rows and cards (shapes of the real content, so nothing jumps when data arrives) */
.sk-row td { padding-top: 16px; padding-bottom: 16px; }
.sk-bar { display: block; height: 11px; border-radius: 6px; max-width: 220px; }
.sk-bar--sub { width: 46% !important; height: 9px; margin-top: 8px; opacity: .7; }
.sk-card { min-height: 150px; padding: 18px; }
.sk-card .skeleton.line { height: 12px; }
.sk-card .skeleton.line:first-child { height: 16px; }
.sk-card .skeleton.line.w90 { width: 90%; }
.inc-facts:empty {
  min-height: 82px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

/* load failed: say so, and offer Retry */
.load-error { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; text-align: center; }
td.load-error { display: table-cell; }
td.load-error > * { display: block; margin: 0 auto 6px; }
.load-error__title { font-weight: 600; color: var(--text); }
.load-error__hint { font-size: 13px; color: var(--text-3); }
.load-error .btn { margin-top: 6px; }

@media (prefers-reduced-motion: reduce) {
  .top-progress { transition: opacity .2s ease; }
  .inc-facts:empty { animation: none; }
}
.sk-chart { height: 220px; border-radius: var(--radius); }
.stat-grid > .sk-card { min-height: 96px; }

/* ---------------------------------------------------------------- shared list visuals (incidents, devices, audit, settings) */
.u-tone { --u-c: var(--text-3); --u-soft: var(--surface-3); }
.u-tone[data-tone="ok"]   { --u-c: var(--success); --u-soft: var(--success-soft); }
.u-tone[data-tone="warn"] { --u-c: var(--warning); --u-soft: var(--warning-soft); }
.u-tone[data-tone="bad"]  { --u-c: var(--danger);  --u-soft: var(--danger-soft); }
.u-tone[data-tone="info"] { --u-c: var(--primary); --u-soft: var(--primary-soft); }

/* icon chip at the start of a row */
.u-tile {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 9px; background: var(--u-soft); color: var(--u-c);
}
.u-lead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.u-lead__text { min-width: 0; }
.u-lead__title { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-lead__sub { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* status with a coloured dot */
.u-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px; border-radius: 999px;
  font-weight: 600; font-size: 12px; white-space: nowrap;
  color: var(--text-2); background: var(--surface-3);
}
.u-pill::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.u-pill[data-tone="ok"]   { color: var(--success-text); background: var(--success-soft); }
.u-pill[data-tone="ok"]::before { background: var(--success); }
.u-pill[data-tone="warn"] { color: var(--warning-text); background: var(--warning-soft); }
.u-pill[data-tone="warn"]::before { background: var(--warning); }
.u-pill[data-tone="bad"]  { color: var(--danger-text); background: var(--danger-soft); }
.u-pill[data-tone="bad"]::before { background: var(--danger); }
.u-pill[data-tone="info"] { color: var(--primary); background: var(--primary-soft); }
.u-pill[data-tone="info"]::before { background: var(--primary); }

/* initials avatar */
.u-person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.u-avatar {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.u-person__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-person--lg .u-avatar { width: 34px; height: 34px; font-size: 12.5px; }

/* small horizontal sound level bar */
.u-level { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.u-level__bar { width: 56px; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.u-level__bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width 300ms ease; }
/* Small breakdown tables (reports): fit the card on phones instead of scrolling sideways */
.table-scroll.table-fit table { min-width: 0; width: 100%; }
.table-fit .u-level__bar { width: 40px; }
@media (max-width: 420px) { .table-fit .u-level__bar { display: none; } }
.breakdown-empty { margin: 4px 0 0; }
.u-level[data-tone="warm"] .u-level__bar i { background: var(--warning); }
.u-level[data-tone="hot"] .u-level__bar i { background: var(--danger); }

/* summary strip of small stat tiles at the top of a page */
.u-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.u-stat {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.u-stat__num { font-size: 22px; font-weight: 600; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums; }
.u-stat__label { font-size: 12.5px; color: var(--text-2); }
@media (max-width: 860px) { .u-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .u-stat { padding: 12px; } }
@media (prefers-reduced-motion: reduce) { .u-level__bar i { transition: none; } }

/* incidents / audit row details */
.inc-lead { align-items: flex-start; }
.inc-lead .u-tile { margin-top: 1px; }
.audit-dur { font-variant-numeric: tabular-nums; }
.audit-inc {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary); text-decoration: none; font-variant-numeric: tabular-nums;
}
.audit-inc:hover { background: var(--primary); color: var(--primary-ink); }
.audit-inc:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (min-width: 861px) {
  .dev-table tr[data-state="pending"] td, .dev-table tr[data-state="disabled"] td { background: var(--surface-2); }
}
@media (max-width: 860px) {
  /* the device / user name with its icon or avatar heads the mobile card, without a label */
  .table-cards td.is-primary:has(> .cell-value > .u-lead) { display: block; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--border-light); text-align: left; }
  .table-cards td.is-primary:has(> .cell-value > .u-lead)::before { display: none; }
  .table-cards td.is-primary > .cell-value > .u-lead { text-align: left; }
  .table-cards td.is-primary > .cell-value > .u-lead .u-lead__sub { display: block; }
}

.u-avatar--lg { width: 34px; height: 34px; font-size: 12.5px; }
tr:has(.u-pill:not([data-tone="ok"])) .u-avatar--lg { background: var(--surface-3); color: var(--text-3); }
.badge.small svg { margin-left: 4px; vertical-align: -1px; }
/* Settings > Devices: thresholds summary */
.thr { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
/* Settings > Devices: the PC a device key belongs to */
.dev-pc { display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.dev-pc .icon { flex: none; opacity: .7; }
/* Devices table: the warning is as wide as its text, quieter than on the overview cards. */
.thr .monitoring-off {
  margin-top: 0; padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; line-height: 1.4;
}
.thr__chip {
  display: inline-flex; align-items: center; gap: 5px; align-self: flex-start; height: 24px; padding: 0 8px; border-radius: 6px;
  background: var(--surface-3); color: var(--text); font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.thr__chip svg { color: var(--text-3); }
.thr__chip svg:not(:first-child) { margin-left: 4px; }
.thr__meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.inc-table td:nth-child(2), .inc-table td:nth-child(3) { white-space: nowrap; }
.inc-table .inc-what__detail { max-width: 52ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


/* ---------------------------------------------------------------- dialogs (CM.modal) */
.modal-backdrop {
  /* No backdrop blur: re-blurring the whole page each frame made dialogs slow to open. */
  background: var(--overlay);
  opacity: 0; transition: opacity 160ms ease;
}
.modal-backdrop.is-open { opacity: 1; }
.modal:focus { outline: none; }
.modal {
  display: flex; flex-direction: column; padding: 0; overflow: hidden;
  width: min(560px, 100%); max-height: min(88dvh, 820px);
  border-radius: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-3);
  transform: translateY(8px) scale(.98); transition: transform 200ms var(--ease-out, ease);
}
.modal-backdrop.is-open .modal { transform: none; }
.modal-backdrop .modal { border-radius: 16px; }
.modal--sm { width: min(440px, 100%); }
.modal--lg { width: min(720px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border-light); }
.modal-head__icon { width: 38px; height: 38px; border-radius: 10px; }
.modal-head__text { flex: 1; min-width: 0; padding-top: 1px; }
.modal-head h2, .modal .modal-head h2 { margin: 0; font-size: 17px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.modal-head__sub { margin: 3px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.modal-close {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin: -4px -6px 0 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-3); cursor: pointer;
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.modal-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 20px; }
.modal-body > form, .modal-body > .dev-settings { margin: 0; }
.modal-message { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-2); }
/* a confirm dialog has no separate body heading, so keep it compact */
.modal--sm .modal-head { border-bottom: 0; padding-bottom: 4px; }
.modal--sm .modal-body { padding-top: 6px; padding-left: 70px; }
.modal .modal-actions, .modal-actions {
  display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin: 0;
  padding: 14px 20px; border-top: 1px solid var(--border-light); background: var(--surface-2);
}
.modal-actions .btn { min-width: 96px; height: 38px; justify-content: center; }
.ra-modal .modal-actions { margin-top: 0; padding-top: 14px; }

@media (max-width: 620px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal-backdrop .modal {
    width: 100%; max-height: 92dvh; margin: 0; border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
    border-bottom: 0; padding: 0; transform: translateY(100%);
    transition: transform 220ms var(--ease-out, ease); will-change: transform;
  }
  .modal::before { content: ""; display: block; flex: none; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--border-dark); }
  .modal-backdrop.is-open .modal { transform: translateY(0); }
  .modal-head { padding: 12px 16px 12px; }
  .modal-body { padding: 16px; }
  .modal--sm .modal-body { padding-left: 16px; }
  .modal .modal-actions, .modal-actions {
    flex-direction: column-reverse; padding: 12px 16px calc(12px + var(--safe-bottom, 0px));
  }
  .modal-actions .btn, .ra-modal .modal-actions .btn { width: 100%; height: 46px; flex: none; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .modal { transition: none; }
}

/* edit drawer (users): same header / footer feel as the dialogs */
.drawer-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--border-light); }
.drawer-title { font-size: 17px; font-weight: 650; }
.drawer-foot { gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border-light); background: var(--surface-2); }
.drawer-foot .btn { min-width: 96px; height: 38px; justify-content: center; }
@media (max-width: 860px) {
  .drawer::before { content: ""; display: block; flex: none; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--border-dark); }
  .drawer-head { padding: 12px 16px; }
  .drawer-foot { flex-direction: column-reverse; padding: 12px 16px calc(12px + var(--safe-bottom, 0px)); }
  .drawer-foot .btn { width: 100%; height: 46px; font-size: 15px; }
}

/* Incident page: Recording | Live (saved complaint recordings next to live listening) */
.listen-tabs { margin-bottom: 12px; }
.listen-tabs[hidden], .rec-host[hidden], .listen-live[hidden] { display: none; }
.rec-host { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.rec-note { margin: 0; }
/* Recording player: a tab per clip, then play, waveform (click to jump), time, -10/+10 s, speed */
.rec-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rec-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.rec-chip:hover { border-color: var(--border-dark); color: var(--text); }
.rec-chip.is-active { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.rec-chip__dur { font-weight: 500; font-variant-numeric: tabular-nums; opacity: .8; }
.rec-player {
  --rec-played: var(--primary); --rec-rest: var(--border-dark);
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  border-radius: 12px; background: var(--surface-2); outline: none;
}
.rec-player:focus-visible { box-shadow: 0 0 0 2px var(--primary); }
.rec-play {
  flex: none; width: 46px; height: 46px; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--primary); color: #fff; cursor: pointer;
  box-shadow: 0 2px 8px rgba(59, 108, 240, .35); transition: transform .12s ease;
}
.rec-play:active { transform: scale(.94); }
.rec-play:disabled { opacity: .6; cursor: progress; }
.rec-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.rec-wave { display: block; width: 100%; height: 44px; cursor: pointer; touch-action: none; }
.rec-bar { display: flex; align-items: center; gap: 6px; }
.rec-time { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rec-spacer { flex: 1; }
.rec-btn {
  height: 28px; min-width: 44px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.rec-btn:hover { color: var(--text); border-color: var(--border-dark); }
@media (max-width: 860px) {
  .rec-player { gap: 12px; padding: 12px; }
  .rec-btn { height: 34px; min-width: 48px; }  /* finger-sized */
}

/* Overview: "Listen live" turns the device card into the player, in place */
.dc.is-listening > :not(.dc-player) { display: none; }
.dc.is-listening { padding: 0; overflow: hidden; }
.dc-player .lpx { width: 100%; max-width: none; border: 0; border-radius: inherit; box-shadow: none; }

/* Overview, tablet and desktop: compact device cards of a fixed width instead of stretched ones */
@media (min-width: 620px) {
  .ov-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 340px)); justify-content: start; gap: 16px; }
  .dc { gap: 14px; padding: 16px; }
  .dc-tile { width: 38px; height: 38px; }
  .dc-name { font-size: 15px; }
  .dc-meter { height: 36px; }
  .dc-caption { margin-top: 8px; }
  .dc-actions .btn { min-height: 36px; font-size: 13.5px; }
}

/* Overview: card <-> player swap (View Transitions, see swapView in overview.js). The card resizes while
   the old view fades out quickly and the new one fades in; snapshots stay top-anchored, never stretched. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(dc-active) { animation-duration: 260ms; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-image-pair(dc-active) { overflow: hidden; border-radius: var(--radius-lg); }
::view-transition-old(dc-active), ::view-transition-new(dc-active) {
  height: auto; width: 100%; object-fit: none; object-position: top center;
}
::view-transition-old(dc-active) { animation: dc-vt-out 110ms ease-out both; }
::view-transition-new(dc-active) { animation: dc-vt-in 220ms 50ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes dc-vt-out { to { opacity: 0; } }
@keyframes dc-vt-in { from { opacity: 0; } to { opacity: 1; } }

/* AI usage page: numbers line up, today's calls against the daily cap stand out when near or over it */
.usage-table td.num, .usage-table th.right { font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-cap { display: inline-block; padding: 1px 8px; border-radius: 999px; }
.usage-cap--near { background: var(--warning-soft); color: var(--warning-text, var(--warning)); font-weight: 600; }
.usage-cap--over { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.usage-help ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.7; }

/* AI usage page, all screen sizes.
   Wide: full tables. Tablet: the stats in two rows, wide tables scroll sideways. Phone: each row is a card
   (name and total cost on top, the other figures as labelled pairs), the filters in a sheet, the period and
   hotel shown under the title. */
.usage-scope { display: none; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--primary); }
.usage-table td.usage-total { font-weight: 700; color: var(--text); }
.usage-table td.usage-name { font-weight: 600; color: var(--text); }
@media (max-width: 1180px) and (min-width: 861px) {
  .report-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card:has(.usage-table) .table-scroll { overflow-x: auto; }
  .usage-table { min-width: 860px; }
  .usage-table td.usage-name { min-width: 170px; }  /* names on one or two lines, not four */
}
@media (max-width: 860px) {
  .usage-scope { display: block; }
  .report-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .report-stats .stat { padding: 12px; }
  .report-stats .stat .value { font-size: 20px; overflow-wrap: anywhere; }
  .report-stats .stat .stat-note { font-size: 11.5px; line-height: 1.4; }

  .card:has(.usage-table) { padding: 14px; }
  .card:has(.usage-table) h2 { margin-bottom: 10px; font-size: 16px; }
  .usage-table, .usage-table tbody { display: block; width: 100%; min-width: 0; }
  .usage-table thead { display: none; }
  .usage-table tbody { display: flex; flex-direction: column; gap: 10px; }
  .usage-table tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-lg);
    background: var(--surface); box-shadow: var(--shadow-xs);
  }
  .usage-table td, .usage-table td.right { display: block; padding: 0 !important; border: 0; text-align: left; font-size: 14px; min-width: 0; }
  /* tokens on the left, their cost beside them on the right */
  .usage-table td[data-label="Input tokens"], .usage-table td[data-label="Output tokens"] { grid-column: 1; }
  .usage-table td[data-label="Input cost"], .usage-table td[data-label="Output cost"] { grid-column: 2; }
  .usage-table td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3);
  }
  /* top line: the name on the left, the total on the right */
  .usage-table td.usage-name { grid-row: 1; grid-column: 1; font-size: 15px; align-self: center; overflow-wrap: anywhere; }
  .usage-table td.usage-name::before { display: none; }
  .usage-table td.usage-total, .usage-table td.usage-total.right { grid-row: 1; grid-column: 2; text-align: right; font-size: 17px; }
  .usage-table td.usage-total::before { text-align: right; }
  .usage-table td:nth-child(2) { grid-row: 2; }  /* the figures start on the second line */
  .usage-table tr.usage-empty { display: block; }
  .usage-table tr.usage-empty td { text-align: center; }
  .usage-table tr.usage-empty td::before { display: none; }
  .usage-help { padding: 14px; }
  /* By day: the latest week first; "Show all days" opens the rest */
  .usage-table tr.usage-more-hidden { display: none; }
  .usage-more { display: block; width: 100%; margin-top: 10px; }
}
@media (min-width: 861px) { .usage-more { display: none; } }
@media (max-width: 380px) {
  .report-stats { grid-template-columns: 1fr; }
}

/* Topbar hotel picker: the hotel shown by default on Overview, Incidents, Devices and Reports */
.hotel-picker { position: relative; }
.hotel-picker__btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; max-width: 260px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.hotel-picker__btn:hover { border-color: var(--border-dark); color: var(--text); }
.hotel-picker__btn[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.hotel-picker__label { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hotel-picker__chev { flex: none; color: var(--text-3); transition: transform .15s ease; }
.hotel-picker__btn[aria-expanded="true"] .hotel-picker__chev { transform: rotate(180deg); }
.hotel-picker__menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 95; width: 280px;
  padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06);
  animation: notif-in .14s ease-out;
}
.hotel-picker__search { width: 100%; height: 34px; margin-bottom: 6px; padding: 0 10px; font-size: 13.5px; }
.hotel-picker__list { max-height: min(360px, calc(100vh - 140px)); overflow-y: auto; overscroll-behavior: contain; }
.hotel-picker__sep { height: 1px; margin: 4px 6px; background: var(--border); }
.hotel-picker__opt {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 6px 8px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text); text-align: left;
  font: inherit; font-size: 13.5px; cursor: pointer; outline: none;
}
.hotel-picker__opt:hover, .hotel-picker__opt.is-active { background: var(--surface-2); }
.hotel-picker__opt.is-selected { color: var(--primary); font-weight: 600; }
.hotel-picker__opt[hidden] { display: none; }
.hotel-picker__check { flex: none; width: 16px; display: inline-flex; color: var(--primary); }
.hotel-picker__name { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.hotel-picker__name, .hotel-picker__sub { overflow-wrap: anywhere; }
.hotel-picker__sub { font-size: 11.5px; font-weight: 400; color: var(--text-3); }
.hotel-picker__tag {
  flex: none; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 500;
  background: var(--surface-3); color: var(--text-3);
}
.hotel-picker__count {
  flex: none; min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
  font-size: 11.5px; font-weight: 700; background: var(--danger-soft); color: var(--danger);
}
/* Phones: a compact picker in the top bar; its list opens full width under the bar */
@media (max-width: 860px) {
  .hotel-picker { flex: none; }
  /* only the icon (the title keeps its room); blue with a dot while one hotel is chosen */
  .hotel-picker__btn { position: relative; width: 40px; height: 40px; padding: 0; justify-content: center;
    border-color: transparent; background: transparent; border-radius: 10px; }
  .hotel-picker__label, .hotel-picker__chev { display: none; }
  .hotel-picker__btn.is-filtered { color: var(--primary); background: var(--primary-soft); }
  .hotel-picker__btn.is-filtered::after { content: ""; position: absolute; top: 7px; right: 7px; width: 7px; height: 7px;
    border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 2px var(--surface); }
  .hotel-picker__menu {
    position: fixed; top: calc(var(--safe-top) + var(--topbar-h-sm) + 4px); left: 8px; right: 8px; width: auto;
    padding: 8px; border-radius: 14px;
  }
  .hotel-picker__list { max-height: calc(100dvh - var(--safe-top) - var(--topbar-h-sm) - 120px); }
  .hotel-picker__opt { min-height: 46px; font-size: 15px; }  /* finger-sized */
}
