
:root {
  --bg: #ffffff; --text: #0a0a0a; --text-2: #5d5f66; --text-3: #8e9097;
  --surface: #f5f5f7; --surface-2: #ececf0; --ink: #0a0a0a; --line: rgb(0 0 0 / 0.07);
  --accent: #0a0a0a; --accent-soft: #f0f0f3; --assistant-soft: #ecebfb; --ok: #1a9a52; --ok-soft: #e8f6ee; --warn: #b4441c; --warn-soft: #fdf0ea;
  --note: #fff8e1; --note-line: #f1e1b0; --note-text: #765800;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 16px; --gutter: 28px;
}
@media (max-width: 760px) { :root { --gutter: 16px; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-feature-settings: "cv11", "ss01", "ss03"; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a.link, .prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 28px; letter-spacing: -0.03em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 0.8em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); } .small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }

/* ---- Shell: sidebar, top bar, page, footer ---- */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 12px; padding: 14px 12px 12px; border-right: 1px solid var(--line); background: #fff; overflow-y: auto; z-index: 40; }
.side-top { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 2px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.brand-mark { width: 22px; height: 23px; flex: none; display: block; }
.switch { position: relative; min-width: 0; flex: 1; }
.switch .cur { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 8px; border-radius: 10px; font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.switch .cur span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch .cur svg { width: 16px; height: 16px; flex: none; color: var(--text-3); }
.switch select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.switch:hover .cur, .switch:focus-within .cur { background: var(--surface); }
.qs { position: relative; }
.qs svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.qs input[type=search] { height: 38px; padding: 0 44px 0 34px; border-radius: 10px; font-size: 14px; }
.qs kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 500 11px var(--font); color: var(--text-3); background: var(--surface); border-radius: 6px; padding: 2px 6px; pointer-events: none; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 12px; color: var(--text-3); font-weight: 500; padding: 16px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 14px; white-space: nowrap; appearance: none; border: 0; background: none; font-family: inherit; cursor: pointer; width: 100%; text-align: left; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: #f8f8fa; color: var(--text); }
.nav-item.on { background: var(--surface); color: var(--text); }
.nav-item .count { margin-left: auto; font-size: 12px; line-height: 20px; min-width: 20px; text-align: center; padding: 0 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.side-bottom { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.main-col { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.bar { position: sticky; top: 0; z-index: 20; height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 var(--gutter); background: rgb(255 255 255 / 0.92); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: var(--text-2); white-space: nowrap; }
.crumbs span { overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--text-3); }
.crumbs .here { color: var(--text); font-weight: 500; }
.bar-end { margin-left: auto; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.bar-link { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; color: var(--text-2); font-size: 14px; font-weight: 500; appearance: none; border: 0; background: none; font-family: inherit; cursor: pointer; }
.bar-link svg { width: 17px; height: 17px; }
.bar-link:hover { background: var(--surface); color: var(--text); }
.me { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 8px; font-size: 14px; font-weight: 500; }
.me .avatar { width: 30px; height: 30px; font-size: 12px; }
.icon-btn { display: none; appearance: none; border: 0; background: none; padding: 7px; border-radius: 10px; color: var(--text-2); cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; display: block; }
.icon-btn:hover { background: var(--surface); color: var(--text); }
main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px var(--gutter) 64px; flex: 1; }
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 24px; padding: 16px var(--gutter); border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.foot a:hover { color: var(--text); }
.scrim { display: none; }
@media (min-width: 901px) {
  .app.collapsed { grid-template-columns: 68px minmax(0, 1fr); }
  .app.collapsed .side { padding-left: 10px; padding-right: 10px; }
  .app.collapsed .switch, .app.collapsed .qs, .app.collapsed .nav-label, .app.collapsed .nav-item .label, .app.collapsed .nav-item .count { display: none; }
  .app.collapsed .side-top { justify-content: center; }
  .app.collapsed .nav-item { justify-content: center; padding: 9px 0; }
  .app.collapsed .collapse svg { transform: scaleX(-1); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 284px; transform: translateX(-100%); transition: transform 0.2s ease; }
  .app.nav-open .side { transform: none; box-shadow: 0 20px 60px -20px rgb(0 0 0 / 0.35); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / 0.18); }
  .icon-btn.menu { display: inline-flex; margin-left: -8px; }
  .side .collapse { display: none; }
  .bar-link .label, .me .name { display: none; }
  .crumbs span:not(.here) { display: none; }
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--text-2); }

/* ---- Pieces ---- */
.btn { appearance: none; border: 0; font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--surface); color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #2a2a2e; }
.btn.blue { background: var(--accent); color: #fff; }
.btn.quiet { background: transparent; color: var(--text-2); padding: 9px 10px; }
.btn.quiet:hover { color: var(--text); background: var(--surface); }
.btn.danger { color: var(--warn); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.chip.blue { background: var(--accent-soft); color: var(--accent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; }
.card + .card { margin-top: 12px; }
.grid > .card + .card, .cols .card + .card { margin-top: 0; }
.card .btn:not(.primary):not(.quiet):not(.blue), .row .btn:not(.primary):not(.quiet):not(.blue), .notice .btn { background: #fff; }
.card .btn:not(.primary):not(.quiet):not(.blue):hover, .row .btn:not(.primary):not(.quiet):not(.blue):hover, .notice .btn:hover { background: var(--surface-2); }
.card.white .btn:not(.primary):not(.quiet):not(.blue) { background: var(--surface); }
.card.white .btn:not(.primary):not(.quiet):not(.blue):hover { background: var(--surface-2); }
.row .btn.quiet:hover { background: #fff; }
.card.white { background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.05), 0 12px 32px -18px rgb(0 0 0 / 0.18); }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.three, .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Four stats in a row need a wide screen; between phone and desktop they sit two by two so "9 seconds" stays on one line. */
@media (max-width: 1100px) { .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.two, .grid.three { grid-template-columns: 1fr; } .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat .n { font-size: 24px; } }
.stat .n { font-size: 28px; font-weight: 500; letter-spacing: -0.03em; }
.stat .l { color: var(--text-2); font-size: 13px; }
.section { margin-top: 36px; }
.section > h2 { margin-bottom: 14px; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-2); background: var(--surface); border-radius: var(--radius); }
.flash { margin: 0 0 20px; padding: 12px 16px; border-radius: 12px; background: var(--ok-soft); color: #11663a; }
.flash.error { background: var(--warn-soft); color: var(--warn); }
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.list { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 14px; background: var(--surface); }
a.row:hover { background: var(--surface-2); }
.row .main { min-width: 0; flex: 1; }
.row .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.day { margin: 26px 0 10px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.day:first-child { margin-top: 0; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
table.t th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 13px; padding: 0 14px 4px; white-space: nowrap; }
table.t td { background: var(--surface); padding: 14px; vertical-align: middle; }
table.t td:first-child { border-radius: 14px 0 0 14px; } table.t td:last-child { border-radius: 0 14px 14px 0; }
table.t tr.link:hover td { background: var(--surface-2); cursor: pointer; }
.scroll-x { overflow-x: auto; }
/* A wide table in its own card: on a phone it scrolls sideways inside the card, never the page. */
.table-card { padding: 6px 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t.wide { min-width: 880px; }
table.t th.num, table.t td.num { text-align: right; white-space: nowrap; }
table.t tr.total td { background: transparent; font-weight: 500; }
table.t td.mono { white-space: nowrap; }
table.t td:first-child { min-width: 190px; }
@media (max-width: 1200px) { .hide-md { display: none; } }

/* ---- Forms ---- */
form.stack { display: flex; flex-direction: column; gap: 16px; }
label.f { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 14px; }
label.f .hint { font-weight: 400; color: var(--text-2); font-size: 13px; }
input[type=text], input[type=tel], input[type=number], input[type=time], input[type=url], input[type=date], input[type=search], select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 0; border-radius: 12px; padding: 11px 14px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.1); width: 100%;
}
.card input, .card select, .card textarea { background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
input[disabled], select[disabled], textarea[disabled] { background: var(--surface); color: var(--text-2); }
textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.radio { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: #fff; cursor: pointer; }
.radio input { margin-top: 3px; accent-color: var(--accent); }
.radio .d { color: var(--text-2); font-size: 13px; font-weight: 400; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .split { grid-template-columns: 1fr; } }
.week { display: grid; grid-template-columns: 70px 1fr; gap: 8px 12px; align-items: center; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; font-weight: 400; }
.check-grid .check { font-weight: 400; }
[data-hours-times][hidden] { display: none; }
/* A job with a technician picker: on a phone its buttons go on their own line under the customer. */
@media (max-width: 640px) { .row.crew { flex-wrap: wrap; } .row.crew .main { flex: 1 1 calc(100% - 100px); } .row.crew .end { margin-left: 0; width: 100%; flex-wrap: wrap; } }

/* ---- Inbox ---- */
.inbox { display: grid; grid-template-columns: clamp(270px, 28vw, 340px) minmax(0, 1fr); gap: 24px; height: calc(100vh - 210px); min-height: 460px; }
.inbox .threads { overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.convo { display: block; padding: 12px 14px; border-radius: 14px; }
.convo:hover { background: var(--surface); }
.convo.on { background: var(--surface-2); }
.convo .top-line { display: flex; gap: 8px; align-items: baseline; }
.convo .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .tm { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.convo .sn { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.thread-pane { display: flex; flex-direction: column; min-height: 0; }
.thread-wrap { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; }
.thread-main { display: flex; flex-direction: column; min-height: 0; }
.thread-wrap > aside { align-self: start; max-height: 100%; overflow-y: auto; }
.facts-mini { display: none; padding: 10px 16px; margin-bottom: 12px; flex: none; }
.facts-mini summary { cursor: pointer; font-weight: 500; font-size: 14px; color: var(--text-2); }
.facts-mini[open] summary { margin-bottom: 10px; }
.facts-mini .facts { flex-direction: row; flex-wrap: wrap; gap: 8px 24px; }
.back { display: none; margin-left: -10px; }
@media (max-width: 1100px) {
  .thread-wrap { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
  .thread-wrap > aside { display: none; }
  .facts-mini { display: block; }
}
@media (max-width: 860px) {
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox.has-thread .threads { display: none; } .inbox:not(.has-thread) .thread-pane { display: none; }
  .thread-wrap { display: flex; flex-direction: column; } .thread { overflow: visible; }
  .composer { position: sticky; bottom: 0; } .back { display: inline-flex; }
}
.thread { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 6px 4px 16px 0; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.customer { background: var(--surface); align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.assistant { background: var(--assistant-soft); align-self: flex-end; border-bottom-right-radius: 6px; }
.bubble.owner { background: var(--ink); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.meta { font-size: 11px; color: var(--text-3); margin: 2px 6px 0; }
.meta.r { align-self: flex-end; } .meta.l { align-self: flex-start; }
.photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.photos img { max-width: 220px; max-height: 220px; border-radius: 12px; object-fit: cover; }
.composer { background: #fff; padding: 12px 0 4px; }
.composer form { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { min-height: 46px; height: 46px; }
.notice { padding: 12px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--text); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.facts { display: flex; flex-direction: column; gap: 10px; }
.facts dt { color: var(--text-3); font-size: 12px; }
.facts dd { margin: 0; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; align-self: center; }
.sn-ic svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 5px; color: var(--text-3); }
.meta.c { align-self: center; }
.callcard { align-self: center; width: min(560px, 100%); background: #fff; border-radius: 16px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08); padding: 12px 16px; }
.call-top { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.call-ic { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.call-ic svg { width: 15px; height: 15px; }
.call-sum { margin: 8px 0 0; color: var(--text-2); font-size: 14px; }
.call-audio { display: block; width: 100%; height: 36px; margin-top: 10px; }
.calls .callrow { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; border-radius: 14px; background: var(--surface); }
.calls .callrow .top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.calls .callrow .who { font-weight: 500; }
.calls .callrow .when { margin-left: auto; color: var(--text-3); font-size: 13px; white-space: nowrap; }
.calls .callrow .what { color: var(--text-2); font-size: 14px; }
.calls .callrow .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.calls .callrow .call-audio { max-width: 480px; }
.call-tx { margin-top: 8px; font-size: 14px; }
.call-tx summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 500; }
.call-tx ol { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }
.tx-who { font-size: 12px; font-weight: 500; color: var(--text-2); }
.tx-text { white-space: pre-wrap; word-wrap: break-word; }
.note { align-self: flex-end; max-width: 78%; padding: 10px 14px; border-radius: 14px; background: var(--note); box-shadow: inset 0 0 0 1px var(--note-line); white-space: pre-wrap; word-wrap: break-word; }
.note-label { font-size: 11px; font-weight: 600; color: var(--note-text); margin-bottom: 2px; white-space: normal; }
.composer .tab-input { position: absolute; opacity: 0; pointer-events: none; }
.composer .tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.composer .tabs label { padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.composer .tabs label:hover { color: var(--text); background: var(--surface); }
#compose-reply:checked ~ .tabs label[for=compose-reply] { background: var(--surface-2); color: var(--text); }
#compose-note:checked ~ .tabs label[for=compose-note] { background: var(--note); color: var(--note-text); }
#compose-reply:focus-visible ~ .tabs label[for=compose-reply], #compose-note:focus-visible ~ .tabs label[for=compose-note] { outline: 2px solid var(--accent); outline-offset: 2px; }
#compose-reply:checked ~ .note-pane, #compose-note:checked ~ .reply-pane { display: none; }
.note-pane textarea { background: var(--note); }
.composer-foot { display: flex; align-items: center; gap: 4px 10px; margin-top: 6px; flex-wrap: wrap; }
.composer .composer-foot .hint { margin-top: 0; }
.saved { position: relative; }
.saved > summary { list-style: none; }
.saved > summary::-webkit-details-marker { display: none; }
.saved-menu { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 10; width: min(380px, 80vw); max-height: 320px; overflow-y: auto; background: #fff; border-radius: 14px; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.06), 0 16px 40px -16px rgb(0 0 0 / 0.25); padding: 6px; display: flex; flex-direction: column; }
.saved-item { appearance: none; border: 0; background: none; font: inherit; color: inherit; text-align: left; padding: 8px 10px; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.saved-item:hover, .saved-item:focus-visible { background: var(--surface); }
.saved-item .t { font-weight: 500; font-size: 14px; }
.saved-item .s { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assign { display: flex; align-items: center; gap: 8px; }
.assign select { width: auto; max-width: 200px; padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.js .nojs { display: none; }
.saved-edit { background: var(--surface); border-radius: 14px; }
.saved-edit > summary { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; list-style: none; }
.saved-edit > summary::-webkit-details-marker { display: none; }
.saved-edit .main { min-width: 0; flex: 1; }
.saved-edit .t { font-weight: 500; }
.saved-edit .s { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-edit[open] .s, .saved-edit[open] summary .btn { display: none; }
.saved-edit > form { padding: 0 18px 14px; }
.saved-edit .btn:not(.primary):not(.quiet) { background: #fff; }
.src summary { cursor: pointer; color: var(--text-3); font-size: 12px; margin-top: 2px; list-style: none; }
.src summary::-webkit-details-marker { display: none; }
.src summary:hover { color: var(--accent); }
.src-form { gap: 8px; margin-top: 8px; }
.src-form [hidden] { display: none; }

/* ---- Dashboard pages ---- */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; margin-top: 40px; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.whenbox { width: 86px; flex-shrink: 0; }
.whenbox .d { font-size: 12px; color: var(--text-3); }
.whenbox .t { font-weight: 500; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.filters a { padding: 6px 12px; border-radius: 999px; color: var(--text-2); font-weight: 500; font-size: 14px; }
.filters a:hover { color: var(--text); background: var(--surface); }
.filters a.on { background: var(--surface-2); color: var(--text); }
.filters .count { color: var(--text-3); margin-left: 4px; font-weight: 400; }
.search { margin-bottom: 10px; }
.thread-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.thread-head .who-line { color: var(--text-2); font-size: 14px; margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fix { align-self: flex-end; margin: -2px 6px 4px; max-width: 78%; font-size: 13px; }
.fix summary { cursor: pointer; color: var(--text-3); list-style: none; text-align: right; }
.fix summary::-webkit-details-marker { display: none; }
.fix summary:hover { color: var(--accent); }
.fix[open] { width: min(460px, 78%); }
.fix[open] summary { color: var(--text-2); margin-bottom: 8px; }
.fix form { background: var(--surface); border-radius: 14px; padding: 14px; }
.composer .hint { color: var(--text-3); font-size: 12px; margin-top: 6px; }
.state { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.state .t { font-weight: 500; }
.state .s { color: var(--text-2); font-size: 14px; }
.set { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 12px 48px; padding: 30px 0; }
.set:first-of-type { padding-top: 0; }
.set .d h2 { margin-bottom: 6px; }
.set .d p { color: var(--text-2); font-size: 14px; }
@media (max-width: 860px) { .set { grid-template-columns: 1fr; } }
.steps { margin: 10px 0 0; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.steps li + li { margin-top: 4px; }
.steps code, .kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; background: #fff; padding: 1px 6px; border-radius: 6px; color: var(--text); }
.mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.mark.done { background: var(--ok-soft); color: var(--ok); }
.mark.todo { background: var(--surface-2); color: var(--text-3); }
.mark.bad { background: var(--warn-soft); color: var(--warn); }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.55; min-height: 460px; tab-size: 2; }
.price-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px 10px; align-items: center; }
@media (max-width: 640px) { .price-grid { grid-template-columns: 1fr 1fr; } .price-grid > :nth-child(3n) { grid-column: 1 / -1; } .price-grid > span:nth-child(3) { display: none; } }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.kv { display: grid; grid-template-columns: minmax(110px, 160px) minmax(0, 1fr); gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; word-break: break-all; }
.seen { width: 130px; text-align: right; }
@media (max-width: 640px) { .seen { display: none; } }
.copy-line { display: flex; gap: 8px; align-items: center; }
.copy-line input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ---- Details from a website ---- */
.from { font-weight: 400; font-size: 13px; color: var(--text-2); }
.from a { color: var(--accent); }
.from a:hover { text-decoration: underline; }
.f-group { display: flex; flex-direction: column; gap: 8px; font-weight: 500; font-size: 14px; }
.f-group .hint { font-weight: 400; color: var(--text-2); font-size: 13px; }
.review { display: flex; flex-direction: column; gap: 6px; }
.review-row { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1fr); gap: 8px 24px; align-items: start; padding: 16px 18px; border-radius: 14px; background: var(--surface); word-break: break-word; }
.review-row .k { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.review-row .k .from { font-size: 12px; }
@media (max-width: 760px) { .review-row { grid-template-columns: 1fr; } }

/* ---- Admin errors page ---- */
.stack-list { display: flex; flex-direction: column; gap: 12px; }
.code-sample { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface); border-radius: 10px; padding: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-word; margin: 8px 0 0; }

/* ---- Public status page ---- */
.status-page { max-width: 760px; margin: 0 auto; }
.status-operational { color: var(--ok); font-weight: 500; }
.status-degraded { color: var(--warn); font-weight: 500; }
.status-down { color: var(--warn); font-weight: 600; }
.up-strip { display: flex; gap: 3px; align-items: stretch; height: 36px; }
.up-day { flex: 1; border-radius: 3px; background: var(--surface-2); }
.up-day.ok { background: var(--ok); }
.up-day.partial { background: #e0b341; }
.up-day.down { background: var(--warn); }
.status-foot { margin-top: 28px; }

/* ---- Notifications ---- */
.alert-kinds { display: flex; flex-direction: column; gap: 6px; }
.alert-kinds .row { align-items: flex-start; }
.alert-kinds .row .t, .alert-kinds .row .s { white-space: normal; }
.alert-kinds .end { padding-top: 2px; gap: 18px; }
.alert-kinds .end .faint { font-size: 13px; white-space: nowrap; }
@media (max-width: 640px) { .alert-kinds .row { flex-direction: column; gap: 10px; } .alert-kinds .end { margin-left: 0; } }
[data-push-state] .t { font-weight: 500; }
[data-push-state] .s { color: var(--text-2); font-size: 14px; }
[data-push-state][hidden], [data-push-error][hidden] { display: none; }
.device-here { margin-left: 8px; }

/* ---- Performance and charts (src/web/charts.ts) ---- */
.chart { margin: 0; }
.chart-area { position: relative; padding-top: 20px; }
.chart-max { position: absolute; top: 0; left: 0; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chart-svg { display: block; width: 100%; height: 160px; overflow: visible; }
.chart-svg .col { fill: var(--ink); }
.chart-svg .col:hover { fill: #55575e; }
.chart-svg .gridline { stroke: rgb(0 0 0 / 0.08); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg .axis { stroke: rgb(0 0 0 / 0.16); stroke-width: 1; }
.chart-x { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.chart-empty { margin: 8px 0 0; }
.chart-data { margin-top: 12px; font-size: 13px; }
.chart-data summary { cursor: pointer; color: var(--text-2); width: max-content; }
.chart-data summary:hover { color: var(--text); }
.chart-data table.t { margin-top: 6px; }
table.t tbody th { background: var(--surface); padding: 14px; text-align: left; font-weight: 400; font-size: inherit; color: var(--text); white-space: normal; }
table.t tbody th:first-child { border-radius: 14px 0 0 14px; }
.chart-data table.t tbody th, .chart-data table.t td { padding: 8px 12px; }
.stack-svg { display: block; width: 100%; height: 14px; border-radius: 999px; overflow: hidden; }
.part.p0 { fill: var(--ink); } .key.p0 { background: var(--ink); }
.part.p1 { fill: #55575e; } .key.p1 { background: #55575e; }
.part.p2 { fill: #a3a5ab; } .key.p2 { background: #a3a5ab; }
.part.p3 { fill: #dedfe4; } .key.p3 { background: #dedfe4; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08); }
.part.empty { fill: var(--surface-2); }
.legend { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 24px; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend .mono { margin-left: auto; white-space: nowrap; }
.key { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.cell-bar { display: block; width: 100%; min-width: 64px; height: 8px; }
.cell-bar .track { fill: rgb(0 0 0 / 0.06); }
.cell-bar .fill { fill: var(--ink); }
.kpi .n { font-size: 28px; font-weight: 500; letter-spacing: -0.03em; }
.kpi .l { color: var(--text-2); font-size: 13px; }
.kpi .d { color: var(--text-3); font-size: 13px; margin-top: 6px; }
@media (max-width: 640px) { .kpi .n { font-size: 24px; } }
.chart-card h3 { margin-bottom: 4px; }
.chart-card .sub { color: var(--text-2); font-size: 13px; margin: 0 0 14px; }
.rates { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0 0 16px; font-size: 14px; color: var(--text-2); }
.rates b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.flag-list .row { align-items: flex-start; }
.flag-list .row .t, .flag-list .row .s { white-space: normal; }
.flag-list .quote { margin: 6px 0 0; padding: 8px 12px; border-radius: 10px; background: #fff; font-size: 14px; color: var(--text); white-space: pre-wrap; word-wrap: break-word; }
.flag-list .end { padding-top: 2px; }
/* A link to one reply or call (from a flag): a zero-height mark just before it, which takes back the thread's gap. */
.thread .anchor { display: block; height: 0; margin-bottom: -8px; }
.anchor:target + .bubble, .anchor:target + .callcard { box-shadow: 0 0 0 2px var(--ink); }
@media (max-width: 640px) { .flag-list .row { flex-direction: column; } .flag-list .end { margin-left: 0; } }

/* ---- Sign-in ---- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .box { width: 100%; max-width: 380px; }
.auth h1 { margin: 22px 0 8px; }
.auth .brand-mark { width: 24.8px; height: 26px; }
.auth .code { letter-spacing: 0.3em; font-size: 20px; text-align: center; }
