/* The parts that belong only to a provider front desk. Everything shared with the rest of the site (the tokens, the buttons, the fields, the cards, the badges, the tables, the notices, the focus ring and
   both themes) comes from ci.css, so a desk is made of the same components as every other page. The accent colour of each provider is set by an accent class on the body (see ci.css), and the
   buttons, links and lines inside the desk follow it without any rule of their own. What is left here is the layout of the desk: the identity band, the request inbox, the day timeline and the small
   adjustments to the shared table. */

.desk .main { padding-top: 0; }
.desk code { white-space: nowrap; }

/* ---- the identity of the provider: its mark, its name, its kind of place and what the visitor may do ---- */
.identity { background: var(--surface); border-bottom: 1px solid var(--border); border-top: 4px solid var(--accent); }
.identity-inner { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-4); align-items: center; padding-block: var(--space-4); }
.mark { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); }
.mark-svg { width: 32px; height: 32px; }
.identity-text { flex: 1 1 240px; min-width: 0; display: grid; gap: var(--space-2); }
.identity h1 { font-size: var(--fs-xl); line-height: var(--lh-xl); max-width: none; overflow-wrap: anywhere; }
.keyform { flex: 0 1 340px; display: flex; gap: var(--space-2); align-items: flex-start; margin: 0; }
.keyform .field { flex: 1 1 auto; }
.keyform .btn, .keyform button { flex: none; margin-top: 24px; }
@media (max-width: 539px) { .keyform { flex-basis: 100%; } }

/* ---- the body of the page ---- */
.desk-body { padding-top: var(--space-5); padding-bottom: var(--space-6); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.sections { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.sections a { display: inline-flex; align-items: center; min-height: var(--control); padding: 0 var(--space-3); border-radius: var(--radius); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; text-decoration: none; transition: background-color var(--dur), color var(--dur); }
.sections a:hover { background: var(--surface-2); color: var(--text); }
.js .refresh.needs-js { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; }
.refresh .check { min-height: var(--control-sm); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.refresh .updated { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-3); font-variant-numeric: tabular-nums; }
@media (max-width: 639px) { .sections { flex-wrap: nowrap; overflow-x: auto; width: 100%; scrollbar-width: none; } .sections::-webkit-scrollbar { display: none; } .sections a { flex: none; } }
.clock { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-3); max-width: none; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-3); }
.desk .stats { margin-bottom: var(--space-5); }
.desk .stat-value { font-size: 36px; line-height: 44px; }
.desk-stack { display: grid; gap: var(--space-5); }
.count { margin: 0; max-width: none; font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 600; color: var(--text-3); }
h3 .count { margin-left: var(--space-2); font-weight: 400; }
.filter { display: none; margin-bottom: var(--space-4); max-width: 360px; }
.js .filter.needs-js { display: block; }
.refs { margin: var(--space-1) 0 0; max-width: none; font-size: var(--fs-xs); line-height: var(--lh-sm); color: var(--text-3); }
.refs code { color: var(--text-2); }
.desk .card > .empty { margin: 0; }

/* ---- the request inbox: an urgent request cannot be missed ---- */
.emergency-card.has-holds { border-color: var(--danger); border-left: 8px solid var(--danger); }
ol.holds { list-style: none; margin: 0; padding: 0; max-width: none; display: grid; gap: var(--space-2); }
.hold { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.hold .age { margin-left: auto; font-size: var(--fs-sm); color: var(--text-3); }
ol.requests { list-style: none; margin: 0; padding: 0; max-width: none; display: grid; gap: var(--space-3); }
.request { margin: 0; padding: var(--space-4); background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius); }
.request.urgent { border-color: var(--danger); border-left-width: 8px; background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.request-head { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; margin-bottom: var(--space-2); }
.request .age { margin-left: auto; font-size: var(--fs-sm); color: var(--text-3); }
.said { margin: 0; max-width: 62ch; font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.said::before { content: "\201C"; }
.said::after { content: "\201D"; }
.answer { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.answer-row { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.answer-row input { flex: 1 1 220px; min-width: 0; }
.quick { display: none; gap: var(--space-2); flex-wrap: wrap; margin: var(--space-2) 0 0; max-width: none; }
.js .quick.needs-js { display: flex; }
details.answered { margin-top: var(--space-4); border-top: 1px solid var(--border); padding-top: var(--space-1); }
ul.answered-list { list-style: none; margin: 0; padding: 0; max-width: none; }
.answered-list li { margin: 0; padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.answered-list .said { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 400; color: var(--text-2); }
.given { margin: var(--space-1) 0 0; color: var(--text); max-width: none; }

/* ---- the appointment book: a timeline for each day ---- */
.day { margin-bottom: var(--space-5); }
.day:last-child { margin-bottom: 0; }
.day h3 { padding: var(--space-2) 0; border-bottom: 2px solid var(--accent-text); font-size: var(--fs-md); line-height: var(--lh-md); }
ol.timeline { list-style: none; margin: 0; padding: 0; max-width: none; }
.visit { margin: 0; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: var(--space-2) var(--space-4); align-items: start; padding: var(--space-3); border-bottom: 1px solid var(--border); border-left: 4px solid var(--accent-text); }
.visit.attended, .visit.confirmed { border-left-color: var(--success); }
.visit.no_show { border-left-color: var(--warning); }
.visit.passed { background: color-mix(in srgb, var(--warning) 8%, var(--surface)); border-left-color: var(--warning); }
.visit .time { grid-row: 1 / span 2; font-family: var(--mono); font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.visit .detail { grid-column: 2; grid-row: 1; min-width: 0; }
.visit .what { margin: 0; max-width: none; color: var(--text); }
.visit .state { grid-column: 3; grid-row: 1; }
.visit .acts { grid-column: 2 / -1; grid-row: 2; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.visit .acts form { margin: 0; }
@media (max-width: 599px) {
  .visit { grid-template-columns: 56px minmax(0, 1fr); }
  .visit .time { grid-row: 1 / span 3; }
  .visit .state { grid-column: 2; grid-row: 2; }
  .visit .acts { grid-column: 2; grid-row: 3; }
}

/* ---- the tables of the desk: a name with a line under it, and badges that sit side by side ---- */
.desk .table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.desk .table td .out { color: var(--text-3); font-weight: 600; }
.cell { display: block; min-width: 0; text-align: left; }
.cell .sub { display: block; font-size: var(--fs-xs); line-height: var(--lh-sm); color: var(--text-3); }
.cell-badges { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); justify-content: flex-end; }
@media (min-width: 640px) { .cell-badges { justify-content: flex-start; } }

/* ---- the patient guide ---- */
.entries { border-top: 1px solid var(--border); }
.entries details { border-bottom: 1px solid var(--border); }
.entries summary { padding-block: var(--space-2); font-size: var(--fs-md); line-height: var(--lh-md); }
.entries details p { margin: 0 0 var(--space-4); max-width: 66ch; color: var(--text-2); }
.source { margin: var(--space-4) 0 0; max-width: none; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--text-3); }
#warning-signs { margin-bottom: var(--space-4); }

@media print { .toolbar, .keyform, .quick, .answer, .acts { display: none !important; } .stat, .card, .request { break-inside: avoid; } }

/* a desk shown inside another page (the onboarding wizard): no band, and only the work. The shell leaves out the header and the footer on its own. */
body.desk.embedded .identity, body.desk.embedded .toolbar .sections { display: none; }
body.desk.embedded .desk-body { padding-top: var(--space-3); }
body.desk.embedded .stats, body.desk.embedded .clock { display: none; }
body.desk.embedded #appointments { order: -1; }
body.desk.embedded #places { display: none; }
body.desk.embedded .main { padding-block: 0; }

/* ---- the desk as an app: a menu on the left in the colour of the provider, a top bar, and one section at a time ---- */
.app-shell { --side-bg: color-mix(in srgb, var(--accent) 30%, #0b1210); --side-text: #eef3f1; --side-muted: #a8b9b2; --side-hover: rgb(255 255 255 / 0.08); }
.app-shell .main { padding: 0; }
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.embedded .app { grid-template-columns: minmax(0, 1fr); min-height: 0; }
.app-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-5);
  padding: var(--space-5) var(--space-4); background: var(--side-bg); color: var(--side-text); }
.app-brand { display: flex; align-items: center; gap: var(--space-2); color: var(--side-text); text-decoration: none; font-weight: 700; font-size: var(--fs-lg); }
.app-brand small { margin-left: auto; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--side-hover); color: var(--side-muted); font-size: var(--fs-xs); font-weight: 600; }
.app-identity { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-3); border-radius: var(--radius); background: var(--side-hover); }
.app-identity .mark { width: 44px; height: 44px; background: var(--accent); color: var(--on-accent); }
.app-identity .facility { margin: 0; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.app-identity .type { margin: 2px 0 0; font-size: var(--fs-xs); color: var(--side-muted); }
.app-nav { display: grid; gap: 2px; }
.app-nav a { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-3); border-radius: var(--radius); color: var(--side-text);
  text-decoration: none; font-weight: 600; font-size: var(--fs-sm); }
.app-nav a:hover { background: var(--side-hover); }
.app-nav a[aria-current="true"] { background: rgb(255 255 255 / 0.14); box-shadow: inset 3px 0 0 var(--on-accent); }
.app-nav .count { margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: var(--radius-pill); background: rgb(255 255 255 / 0.14); font-size: var(--fs-xs); text-align: center; font-variant-numeric: tabular-nums; }
.app-nav .count.alert { background: var(--danger); color: #fff; }
.app-side-foot { margin-top: auto; display: grid; gap: var(--space-3); font-size: var(--fs-sm); color: var(--side-muted); }
.app-side-foot p { margin: 0; display: flex; align-items: center; gap: var(--space-2); }
.app-side-foot .keyform { flex: none; flex-direction: column; align-items: stretch; }
.app-side-foot .keyform .btn, .app-side-foot .keyform button { margin-top: 0; }
.app-side-foot label { color: var(--side-text); }
.env .dot { width: 8px; height: 8px; border-radius: 50%; background: #f2b84b; }

.app-main { min-width: 0; display: flex; flex-direction: column; }
.app-top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); padding: var(--space-4) var(--space-6);
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); border-top: 4px solid var(--accent); }
.embedded .app-top { position: static; padding: var(--space-3) var(--space-4); }
.app-title { min-width: 0; }
.crumb { margin: 0; font-size: var(--fs-xs); color: var(--text-3); max-width: none; }
.app-top h1 { margin: 0; font-size: var(--fs-lg); line-height: 1.3; max-width: none; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-left: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 700; }
.chip.sim { background: light-dark(#fdf1d6, #3a2e12); color: light-dark(#7a5200, #f2cf7d); }
.chip.live { background: var(--accent-soft); color: var(--accent-text); }
.chip.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.app-tabs .app-nav { display: flex; overflow-x: auto; gap: var(--space-1); padding: var(--space-2) var(--space-4); border-bottom: 1px solid var(--border); background: var(--surface); scrollbar-width: none; }
.app-tabs .app-nav a { color: var(--text-2); white-space: nowrap; min-height: 38px; }
.app-tabs .app-nav a[aria-current="true"] { background: var(--accent-soft); color: var(--accent-text); box-shadow: none; }

#desk-live { width: 100%; max-width: 1180px; padding: var(--space-5) var(--space-6) var(--space-7); }
.embedded #desk-live { padding: var(--space-4); }
#desk-live > .panel + .panel { margin-top: var(--space-5); }
.panel[hidden] { display: none !important; }
.tiles { list-style: none; margin: 0; padding: 0; max-width: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); }
.tile { display: grid; gap: 2px; height: 100%; padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1);
  color: inherit; text-decoration: none; transition: border-color var(--dur); }
.tile:hover { border-color: var(--accent-text); }
.tile .label { font-size: var(--fs-sm); color: var(--text-3); font-weight: 600; }
.tile .figure { font-size: 34px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .note { font-size: var(--fs-xs); color: var(--text-3); }
.tile.alert { border-color: var(--danger); border-left: 6px solid var(--danger); }
.tile.alert .figure { color: var(--danger); }
.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-4); margin-top: var(--space-5); align-items: start; }
.card-head .more { margin-left: auto; font-size: var(--fs-sm); font-weight: 600; }
.feed { list-style: none; margin: 0; padding: 0; max-width: none; display: grid; }
.feed li + li { border-top: 1px solid var(--border); }
.feed a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: var(--space-3); padding: var(--space-3) 0; color: inherit; text-decoration: none; font-size: var(--fs-sm); }
.feed-text { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.feed-text > span { color: var(--text-2); }
.feed a:hover b { text-decoration: underline; }
.feed .icon { margin-top: 2px; color: var(--accent-text); }
.feed .tone-danger .icon, .log .tone-danger .log-icon { color: var(--danger); }
.feed .tone-warning .icon { color: var(--warning); }
.feed .when { max-width: 7.5rem; font-size: var(--fs-xs); color: var(--text-3); text-align: right; }
.log .when { margin-left: auto; flex: none; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.log { list-style: none; margin: 0; padding: 0; max-width: none; }
.log li { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.log li:first-child { border-top: 0; }
.log-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); }
.log .tone-danger .log-icon { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.log .tone-success .log-icon { color: var(--success); }
.log-cue, .log-detail { margin: 0; max-width: none; }
.log-cue { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.log-detail { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }

@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app-side { position: static; height: auto; gap: var(--space-3); padding: var(--space-3) var(--space-4); }
  .app-identity { padding: var(--space-2); }
  .app-side .app-nav { display: flex; overflow-x: auto; scrollbar-width: none; }
  .app-side .app-nav a { white-space: nowrap; min-height: 40px; }
  .app-side .app-nav a[aria-current="true"] { box-shadow: inset 0 -3px 0 var(--on-accent); }
  .app-side-foot { margin-top: 0; }
  .app-top { position: static; padding: var(--space-3) var(--space-4); }
  #desk-live { padding: var(--space-4); }
}

/* Messages: the words Talk sent, and a tick when the provider took the text, two when the phone received it */
.texts .text-body { margin: var(--space-1) 0 0; max-width: 60ch; font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
.texts .when { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ticks { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.ticks b { letter-spacing: -0.2em; margin-right: 0.25em; }
.ticks.tone-success { color: var(--accent-text); font-weight: 600; }
.ticks.tone-danger { color: var(--danger); font-weight: 600; }
