/* Try Customs CRM
   A midnight "chrome" frame (top bar and menu) around bright, orderly panels.
   One typeface, Archivo: its wide cut for titles, normal width for everything else. */

/* Archivo, bundled with the app (SIL Open Font License, see fonts/OFL-LICENSE.txt) */
@font-face {
  font-family: 'Archivo'; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(/static/fonts/archivo-latin-ext.woff2) format('woff2-variations'), url(/static/fonts/archivo-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(/static/fonts/archivo-latin.woff2) format('woff2-variations'), url(/static/fonts/archivo-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  --bg: #EEF1F4;
  --surface: #FFFFFF;
  --surface-2: #F5F7F9;
  --ink: #14202B;
  --ink-2: #34424E;
  --muted: #5D6A76;
  --line: #DDE2E7;
  --line-strong: #C4CCD4;
  --accent: #0F6E8C;
  --accent-hover: #0B5A73;
  --accent-ink: #FFFFFF;
  --accent-soft: #E2F0F4;
  --warn: #B4321F;
  --warn-soft: #FBECE9;
  --ok: #1D7A4B;
  --ok-soft: #E5F3EA;
  --amber: #8F5600;
  --amber-soft: #FCF0DC;
  --chrome: #14202B;
  --chrome-2: #1D2B37;
  --chrome-ink: #EAF0F4;
  --chrome-muted: #98A7B3;
  --focus: #2F8FB0;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-panel: 12px;
  --r-ctl: 8px;
  --appbar: 56px;
  --nav-w: 248px;
  color-scheme: light;
}
:root[data-theme="dark"] { --bg: #0D141A; --surface: #151F28; --surface-2: #1A2530; --ink: #E7ECF0; --ink-2: #C3CDD5; --muted: #93A1AD;
    --line: #25323E; --line-strong: #33424F; --accent: #4DB2D0; --accent-hover: #6CC2DB; --accent-ink: #052430; --accent-soft: #11303B;
    --warn: #FF8C74; --warn-soft: #3A1D18; --ok: #62CB92; --ok-soft: #12301F; --amber: #E9B24E; --amber-soft: #352710;
    --chrome: #0A1015; --chrome-2: #121C24; --chrome-ink: #E7ECF0; --chrome-muted: #8696A3; --focus: #6CC2DB; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] { --bg: #0D141A; --surface: #151F28; --surface-2: #1A2530; --ink: #E7ECF0; --ink-2: #C3CDD5; --muted: #93A1AD;
    --line: #25323E; --line-strong: #33424F; --accent: #4DB2D0; --accent-hover: #6CC2DB; --accent-ink: #052430; --accent-soft: #11303B;
    --warn: #FF8C74; --warn-soft: #3A1D18; --ok: #62CB92; --ok-soft: #12301F; --amber: #E9B24E; --amber-soft: #352710;
    --chrome: #0A1015; --chrome-2: #121C24; --chrome-ink: #E7ECF0; --chrome-muted: #8696A3; --focus: #6CC2DB; }
}

:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="auto"] { color-scheme: light dark; }

/* Stage colors: --c is the dot, the label tint is mixed from it */
[data-s="Inquiry"]     { --c: #64748B; }
[data-s="Quoted"]      { --c: #B7791F; }
[data-s="Booked"]      { --c: #0F6E8C; }
[data-s="Dropped Off"] { --c: #5B5BD6; }
[data-s="In Progress"] { --c: #C2570C; }
[data-s="Ready"]       { --c: #1D7A4B; }
[data-s="Picked Up"]   { --c: #8A96A1; }
[data-s="Lost"]        { --c: #9A5555; }
:root[data-theme="dark"] [data-s="Booked"] { --c: #4DB2D0; }
:root[data-theme="dark"] [data-s="Dropped Off"] { --c: #8C8CF0; }
:root[data-theme="dark"] [data-s="In Progress"] { --c: #F08A3C; }
:root[data-theme="dark"] [data-s="Ready"] { --c: #62CB92; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] [data-s="Booked"] { --c: #4DB2D0; }
  :root[data-theme="auto"] [data-s="Dropped Off"] { --c: #8C8CF0; }
  :root[data-theme="auto"] [data-s="In Progress"] { --c: #F08A3C; }
  :root[data-theme="auto"] [data-s="Ready"] { --c: #62CB92; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 650; }
p { margin: 0 0 8px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 14px; margin-top: 6px; line-height: 1.45; }
.sub { font-size: 15px; color: var(--muted); margin: 12px 0 6px; }
.empty { color: var(--muted); margin: 0; padding: 14px 16px; font-size: 15px; }
[data-icon] { display: inline-flex; width: 20px; height: 20px; flex: none; }
[data-icon] svg { width: 100%; height: 100%; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 16px; border-radius: var(--r-ctl); border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: 600 15px/1 var(--font);
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn [data-icon] { width: 18px; height: 18px; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.small [data-icon] { width: 16px; height: 16px; }
.btn.big { min-height: 50px; font-size: 16px; width: 100%; }
.btn.danger { background: var(--surface); color: var(--warn); border-color: var(--line-strong); }
.btn.danger:hover { background: var(--warn-soft); }
.btn:disabled { opacity: .45; cursor: default; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; color: inherit; cursor: pointer; text-decoration: none; flex: none;
}
.iconbtn:hover { background: rgba(127, 140, 152, .16); }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.sec-head .linkish { white-space: nowrap; }
.linkish:hover { text-decoration: underline; }

input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--ink); font: 400 16px/1.35 var(--font);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
label { display: block; font-size: 14px; font-weight: 500; color: var(--ink-2); }
label > input, label > select, label > textarea { margin-top: 5px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--ink); font-size: 15px; padding: 6px 0; }
label.check input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--accent); box-shadow: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btnrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.inline { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.inline > input, .inline > label { flex: 1; }
.stack > * + * { margin-top: 14px; }

/* ---------- App frame ---------- */
body.crm { min-height: 100vh; }
.appbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 6px;
  height: calc(var(--appbar) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0;
  background: var(--chrome); color: var(--chrome-ink);
}
.appbar-title { flex: 1; min-width: 0; margin-left: 4px; font-size: 19px; font-weight: 650; font-stretch: 112%; letter-spacing: .005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-actions { display: flex; gap: 2px; }
.appbar .iconbtn[aria-current="page"] { background: var(--chrome-2); }

.nav {
  position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: min(84vw, var(--nav-w));
  display: flex; flex-direction: column; gap: 6px; padding: calc(10px + env(safe-area-inset-top)) 12px 16px;
  background: var(--chrome); color: var(--chrome-ink); overflow-y: auto;
  transform: translateX(-102%); transition: transform .2s ease; visibility: hidden;
}
body.menu-open .nav { transform: none; visibility: visible; }
.scrim { position: fixed; inset: 0; z-index: 25; background: rgba(8, 14, 20, .5); opacity: 0; pointer-events: none; transition: opacity .2s; }
body.menu-open .scrim { opacity: 1; pointer-events: auto; }
.nav-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding-left: 6px; }
.brand { font-size: 21px; font-weight: 750; font-stretch: 125%; letter-spacing: .01em; }
.nav-new { margin: 10px 0 8px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-list a {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 10px;
  color: var(--chrome-muted); text-decoration: none; font-size: 16px; font-weight: 550;
}
.nav-list a:hover { background: var(--chrome-2); color: var(--chrome-ink); }
.nav-list a[aria-current="page"] { background: var(--chrome-2); color: var(--chrome-ink); box-shadow: inset 3px 0 0 var(--accent); }
.nav-label { flex: 1; }
.nav-count { min-width: 22px; padding: 1px 7px; border-radius: 11px; font-size: 13px; font-weight: 650; text-align: center; background: var(--chrome-2); color: var(--chrome-ink); }
.nav-count:empty { display: none; }
.nav-count.hot { background: var(--warn); color: #fff; }

.main { max-width: 900px; margin: 0 auto; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); }
.main:focus { outline: none; }
@media (min-width: 1024px) {
  .nav { transform: none; visibility: visible; transition: none; width: var(--nav-w); }
  .nav-close, .menu-btn, .scrim { display: none; }
  .appbar { margin-left: var(--nav-w); padding-left: 20px; }
  .main { margin-left: var(--nav-w); max-width: none; padding: 0 32px 48px; }
  .main > * { max-width: 900px; margin-left: auto; margin-right: auto; }
  .main.wide > * { max-width: 1180px; }
}

.bar { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent); z-index: 50; opacity: 0; }
body.busy .bar { opacity: 1; width: 80%; transition: width 8s cubic-bezier(.1, .7, .2, 1); }
body.busy { cursor: progress; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); z-index: 60;
  max-width: min(520px, calc(100% - 32px)); padding: 12px 16px; border-radius: 10px; background: var(--chrome); color: var(--chrome-ink);
  font-size: 15px; box-shadow: 0 10px 30px rgba(8, 14, 20, .25); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--warn); color: #fff; }
.toast.has-action { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: max-content; padding: 8px 8px 8px 16px; pointer-events: auto; }
.toast.has-action > span { min-width: 0; }
.toast-action {
  flex: none; min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: #7FD0EA;
  font: 700 15px/1 var(--font); letter-spacing: .02em; cursor: pointer;
}
.toast-action:hover { background: rgba(255, 255, 255, .1); }

/* ---------- Page headers ---------- */
.hero { padding: 22px 0 6px; }
.hero h2 { font-size: clamp(26px, 6.4vw, 36px); font-weight: 700; font-stretch: 118%; letter-spacing: -.005em; line-height: 1.08; }
.hero p { margin: 8px 0 0; font-size: 17px; color: var(--ink-2); max-width: 36em; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0 12px; }
.pagehead h2 { font-size: 26px; font-weight: 700; font-stretch: 118%; }
.toolbar { display: flex; gap: 8px; align-items: center; padding: 18px 0 4px; }
.searchwrap { position: relative; flex: 1; }
.searchwrap [data-icon] { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.searchwrap input { padding-left: 38px; }

/* ---------- Panels and lists ---------- */
.sec { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.sec > h2, .sec > .sec-head { display: flex; align-items: center; gap: 8px; padding: 13px 16px; font-size: 16px; font-weight: 650; border-bottom: 1px solid var(--line); }
.sec > .sec-head h2 { font-size: 16px; font-weight: 650; }
.sec-head .spacer { flex: 1; }
.sec-head .hint { margin: 0; font-size: 13px; }
.sec.plain { background: none; border: 0; border-radius: 0; overflow: visible; }
.sec.plain > h2 { padding: 0 0 8px; border: 0; font-size: 18px; }
.count { display: inline-flex; min-width: 22px; justify-content: center; padding: 1px 7px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 650; color: var(--ink-2); }
.count.hot { background: var(--warn); border-color: var(--warn); color: #fff; }
.sec > .hint, .sec > .copyrow, .sec > label, .sec > .fieldgroup, .sec > details, .sec > .conn, .sec > .savebar, .sec > .btnrow { margin-left: 16px; margin-right: 16px; }
.sec > .hint:first-child, .sec > h2 + .hint, .sec > h2 + label { margin-top: 12px; }
.sec > :last-child:not(.rows):not(.conn):not(.savebar) { margin-bottom: 16px; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li + li { border-top: 1px solid var(--line); }
.row {
  display: flex; width: 100%; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 16px;
  border: 0; background: none; color: inherit; text-align: left; font: inherit; text-decoration: none; cursor: pointer;
}
a.row:hover, button.row:hover { background: var(--surface-2); }
.row-main { min-width: 0; flex: 1; }
.row-name { display: block; font-size: 16px; font-weight: 600; line-height: 1.3; }
.row-sub { display: block; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: block; font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.row-meta.warn { color: var(--warn); font-weight: 600; }
.avatar {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 14px; font-weight: 700; font-stretch: 110%;
}

/* Stage label */
.tag {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  background: var(--surface-2); background: color-mix(in srgb, var(--c) 13%, var(--surface));
  color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.tag::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* Needs reply cards */
.reply { padding: 14px 16px; }
.reply-main { display: flex; gap: 12px; text-decoration: none; color: inherit; }
.reply-body { min-width: 0; flex: 1; display: grid; gap: 3px; }
.reply-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.reply-top .row-name { font-size: 17px; }
.when { flex: none; font-size: 13px; font-weight: 600; color: var(--warn); }
.reply-contact { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--ink-2); }
.reply-contact span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.reply-contact [data-icon] { width: 15px; height: 15px; color: var(--muted); }
.reply-contact .missing { color: var(--muted); font-style: italic; }
.reply-msg { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reply-msg b { color: var(--ink-2); font-weight: 600; }
.reply-acts { display: flex; gap: 8px; margin: 10px 0 0 52px; }
@media (max-width: 420px) { .reply-acts { margin-left: 0; } .reply-acts .btn { flex: 1; } }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
@media (hover: hover) and (pointer: fine) { .msg-list-pane .chips { flex-wrap: wrap; overflow: visible; } }
.chip { flex: none; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 7px 13px; font: 600 14px/1.2 var(--font); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip span { opacity: .65; margin-left: 3px; }

.alert { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 14px; background: var(--warn-soft); border: 1px solid var(--warn-soft); border-left: 4px solid var(--warn); border-radius: var(--r-ctl); font-size: 15px; }
.alert.info { background: var(--accent-soft); border-color: var(--accent-soft); border-left-color: var(--accent); }

.form { margin-top: 18px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.form > * + * { margin-top: 14px; }
.form .btn.big { margin-top: 20px; }

/* Setup checklist */
.setup .row { cursor: default; }
.setup .row-name { font-weight: 550; }
.setup .row-name.done { color: var(--muted); font-weight: 400; }
.setup > .hint { padding-bottom: 2px; }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 0 10px; }
.cal-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-tools .seg { margin: 0; }
.cal-head h2 { font-size: clamp(20px, 5.6vw, 26px); font-weight: 700; font-stretch: 118%; white-space: nowrap; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav .iconbtn { border: 1px solid var(--line-strong); background: var(--surface); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--ev); }
.ev-dropoff { --ev: var(--accent); }
.ev-pickup { --ev: #1D7A4B; }
.ev-appointment { --ev: #5B5BD6; }
.ev-consultation { --ev: #C2385F; }
.ev-call { --ev: #A3368E; }
.ev-followup { --ev: #B7791F; }
.ev-reminder { --ev: #64748B; }
.ev-due { --ev: #C2570C; }
:root[data-theme="dark"] .ev-followup { --ev: #E9B24E; }
:root[data-theme="dark"] .ev-due { --ev: #F08A3C; }
:root[data-theme="dark"] .ev-pickup { --ev: #62CB92; }
:root[data-theme="dark"] .ev-appointment { --ev: #8C8CF0; }
:root[data-theme="dark"] .ev-consultation { --ev: #F2809F; }
:root[data-theme="dark"] .ev-call { --ev: #E07ACB; }
:root[data-theme="dark"] .ev-reminder { --ev: #94A3B8; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .ev-followup { --ev: #E9B24E; }
  :root[data-theme="auto"] .ev-due { --ev: #F08A3C; }
  :root[data-theme="auto"] .ev-pickup { --ev: #62CB92; }
  :root[data-theme="auto"] .ev-appointment { --ev: #8C8CF0; }
  :root[data-theme="auto"] .ev-consultation { --ev: #F2809F; }
  :root[data-theme="auto"] .ev-call { --ev: #E07ACB; }
  :root[data-theme="auto"] .ev-reminder { --ev: #94A3B8; }
}
.is-done .row-name, .ev.is-done { opacity: .55; text-decoration: line-through; }

.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.cal-dow, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow span { padding: 8px 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-day {
  position: relative; min-height: 64px; padding: 6px 4px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.out { background: var(--surface-2); color: var(--muted); }
.cal-num { align-self: flex-start; display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 4px; border-radius: 13px; font-size: 14px; font-weight: 600; }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-day[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-evs { display: flex; flex-wrap: wrap; gap: 3px; min-width: 0; }
.ev { width: 7px; height: 7px; border-radius: 50%; background: var(--ev); font-size: 0; overflow: hidden; }
.ev-more { font-size: 11px; color: var(--muted); line-height: 7px; }
@media (min-width: 700px) {
  .cal-day { min-height: 104px; padding: 6px; }
  .cal-evs { flex-direction: column; flex-wrap: nowrap; }
  .ev {
    width: auto; height: auto; border-radius: 5px; padding: 2px 6px; font-size: 12px; line-height: 1.35; font-weight: 550;
    background: var(--surface-2); background: color-mix(in srgb, var(--ev) 14%, var(--surface)); color: var(--ink);
    border-left: 3px solid var(--ev); white-space: nowrap; text-overflow: ellipsis;
  }
  .ev-more { line-height: 1.3; padding-left: 4px; }
}
.agenda .row { align-items: flex-start; }
.agenda-time { flex: none; width: 74px; font-size: 14px; font-weight: 650; color: var(--ink); padding-top: 1px; }
.agenda-date { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.agenda.boxed { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 4px; }
.agenda.boxed .row { padding: 10px 12px; }
.agenda-kind { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.agenda-kind::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--ev); }

/* ---------- Job detail ---------- */
.detail {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto; overscroll-behavior: contain; background: var(--bg);
  transform: translateX(100%); transition: transform .22s ease; visibility: hidden;
}
.detail.open { transform: none; visibility: visible; }
@media (min-width: 900px) {
  .detail { left: auto; width: 620px; border-left: 1px solid var(--line); box-shadow: -18px 0 48px rgba(8, 14, 20, .22); }
}
@media (prefers-reduced-motion: reduce) { .detail, .toast, .nav, .scrim { transition: none; } body.busy .bar { transition: none; } }
.d-wrap { padding: 0 0 calc(40px + env(safe-area-inset-bottom)); }
.d-bar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; min-height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0 8px; background: var(--surface);
}
.d-bar-name { flex: 1; min-width: 0; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .15s; }
.detail.scrolled .d-bar-name { opacity: 1; }
.d-top { background: var(--surface); padding: 0 16px; }
.d-title { display: flex; gap: 12px; align-items: center; padding: 2px 0 6px; }
.d-title .avatar { width: 46px; height: 46px; font-size: 16px; }
.d-title h1 { font-size: 24px; font-weight: 700; font-stretch: 114%; }
.d-title p { color: var(--muted); margin: 2px 0 0; font-size: 14px; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; padding: 6px 0 10px; }
.dtabs { position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 3; display: flex; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dtabs button { flex: 1; padding: 12px 4px 11px; border: 0; background: none; color: var(--muted); font: 600 15px/1 var(--font); cursor: pointer; position: relative; }
.dtabs button[aria-selected="true"] { color: var(--ink); }
.dtabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 16%; right: 16%; bottom: 0; height: 3px; border-radius: 2px 2px 0 0; background: var(--accent); }
.dtabs .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); margin-left: 5px; vertical-align: 2px; }
.d-wrap > .alert { margin: 14px 16px 0; }

.d-sec { margin: 14px 16px 0; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.d-sec > h3 { font-size: 16px; font-weight: 650; margin-bottom: 10px; }
.d-sec > label + label, .d-sec > .grid2 + label, .d-sec > label + .grid2 { margin-top: 12px; }

.stepper { display: flex; flex-wrap: wrap; gap: 6px; }
.step { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px; padding: 7px 12px; font: 600 14px/1.2 var(--font); cursor: pointer; }
.step::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.step.on { background: var(--surface-2); background: color-mix(in srgb, var(--c) 15%, var(--surface)); border-color: var(--c); color: var(--ink); }

/* Conversation */
.thread { list-style: none; margin: 0; padding: 0; }
.msg { display: flex; flex-direction: column; margin: 10px 0; }
.msg:first-child { margin-top: 0; }
.msg .bub { max-width: 86%; padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); border: 1px solid var(--line); overflow-wrap: anywhere; font-size: 15px; }
.msg .bub p { margin: 0; white-space: pre-wrap; }
.msg .bub strong { display: block; font-weight: 650; margin-bottom: 3px; }
.msg.out { align-items: flex-end; }
.msg.out .bub { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); border-radius: 14px 14px 4px 14px; }
.msg.failed .bub { opacity: .55; }
.msg .meta { font-size: 12px; color: var(--muted); margin-top: 4px; max-width: 86%; }
.msg.failed .meta { color: var(--warn); }
.msg .long p { max-height: 11em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.msg .long.open p { max-height: none; -webkit-mask-image: none; mask-image: none; }
.msg .more { margin-top: 4px; color: inherit; }
.sys { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0; list-style: none; }

.composer { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); overflow: hidden; margin-bottom: 10px; }
.seg button { border: 0; background: var(--surface); color: var(--ink-2); padding: 8px 14px; font: 600 14px/1 var(--font); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.composer textarea, .composer select, .composer input { margin-bottom: 8px; }
.sendrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sendrow .hint { margin: 0; }

/* Photos */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.ph img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-ctl); background: var(--line); }
.ph-acts { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; font-size: 13px; }
.ph label.check { font-size: 13px; padding: 0; gap: 5px; }
.ph label.check input { width: 16px; height: 16px; }
.uploader { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.uploader label { flex: 1; min-width: 150px; }
.filepick { position: relative; overflow: hidden; }
.filepick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }

/* Money */
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; }
.figures div { padding: 4px 0 8px; }
.figures dt { font-size: 13px; color: var(--muted); }
.figures dd { margin: 4px 0 0; font-size: 26px; font-weight: 700; font-stretch: 110%; font-variant-numeric: tabular-nums; }
.paylist { list-style: none; margin: 0; padding: 0; }
.paylist li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.paylist li:first-child { border-top: 0; padding-top: 0; }
.paid { color: var(--ok); font-weight: 600; }

.notes { list-style: none; margin: 12px 0 0; padding: 0; }
.notes li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.notes time { display: block; color: var(--muted); font-size: 12px; }
.pre { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 10px 12px; font-size: 14px; margin: 0; }

/* ---------- Settings ---------- */
.conn { list-style: none; margin: 0; padding: 0; }
.conn li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; }
.sec > .conn { border-top: 1px solid var(--line); margin: 0; padding: 0 16px; }
.conn strong { display: block; font-size: 15px; font-weight: 650; }
.state-on { color: var(--ok); font-size: 14px; font-weight: 600; }
.state-off { color: var(--muted); font-size: 14px; }
.copyrow { display: flex; gap: 8px; margin-top: 5px; }
.copyrow input { font-size: 14px; background: var(--surface-2); }
details.tpl { border-top: 1px solid var(--line); padding: 12px 16px; margin: 0 !important; }
.sec > h2 + details.tpl, .sec > .hint + details.tpl { border-top: 1px solid var(--line); }
details.tpl[open] { background: var(--surface-2); }
details.tpl summary { position: relative; cursor: pointer; font-size: 15px; font-weight: 650; list-style: none; padding-right: 28px; }
details.tpl summary::-webkit-details-marker { display: none; }
details.tpl summary::after {
  content: ''; position: absolute; right: 4px; top: 6px; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s;
}
details.tpl[open] > summary::after { transform: rotate(-135deg); top: 10px; }
details.adv summary { list-style: none; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::before { content: '+ '; }
details.adv[open] summary::before { content: '− '; }
details.tpl summary small { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 2px; }
details.tpl > label, details.tpl > .btnrow, details.tpl > .links, details.tpl > .alert, details.tpl > .hint, details.tpl > details { margin-top: 12px; }
.conn-card summary small.state-on { color: var(--ok); font-weight: 600; }
details.adv summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted); }
.fieldgroup { padding: 16px 0 4px; border-top: 1px solid var(--line); }
.sec > h2 + .fieldgroup { border-top: 0; }
.fieldgroup h3 { font-size: 15px; font-weight: 650; }
.fieldgroup label { margin-top: 12px; }
.savebar { position: sticky; bottom: 0; padding: 12px 0 14px; background: var(--surface); border-top: 1px solid var(--line); }
.settings-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; }
.settings-foot .hint { margin: 0; }

/* ---------- Public pages (booking form, customer page, sign-in) ---------- */
body.site { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.site-bar { background: var(--chrome); color: var(--chrome-ink); }
.site-bar .inner { max-width: 600px; margin: 0 auto; padding: 16px 18px; }
.site-bar .wordmark { margin: 0; color: var(--chrome-ink); font-size: 22px; }
.site-bar .wordmark span { color: var(--chrome-muted); }
.narrow { max-width: 600px; margin: 0 auto; padding: 26px 18px 48px; }
.wordmark { font-size: 26px; font-weight: 750; font-stretch: 125%; letter-spacing: .01em; margin: 0 0 18px; line-height: 1.1; }
.wordmark span { font-weight: 500; font-stretch: 100%; color: var(--muted); font-size: .7em; margin-left: 4px; }
.narrow h2 { font-size: 22px; font-weight: 700; font-stretch: 112%; margin: 6px 0 10px; }
.narrow h3.sec { all: unset; display: block; font-size: 16px; font-weight: 650; margin: 22px 0 6px; }
.lede { font-size: 17px; color: var(--ink-2); margin-bottom: 18px; }
.opt { color: var(--muted); font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 14px 0 0; }
legend { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two > label { margin-top: 0; }
.consent { font-size: 14px !important; color: var(--muted) !important; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.error { padding: 10px 12px; background: var(--warn-soft); border-left: 4px solid var(--warn); border-radius: var(--r-ctl); color: var(--ink); }
.notice { padding: 10px 12px; background: var(--ok-soft); border-left: 4px solid var(--ok); border-radius: var(--r-ctl); }
.narrow form.stack, .status-card { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.status-card { margin-bottom: 20px; }
.status-card h2 { font-size: 28px; font-weight: 700; font-stretch: 116%; margin: 6px 0 6px; }
.status-label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 650; color: var(--accent); margin: 0; }
.status-label::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
h2.sec { all: unset; display: block; font-size: 18px; font-weight: 650; margin: 24px 0 10px; }
.narrow .gallery a { display: block; }
.narrow .gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-ctl); display: block; }

@media (max-width: 420px) {
  .two, .grid2 { grid-template-columns: 1fr; }
  .figures dd { font-size: 22px; }
  .agenda-time { width: 64px; }
}

/* ---------- Add / edit form (bottom sheet on phones, dialog on computers) ---------- */
body.sheet-open { overflow: hidden; }
.sheet-host[hidden] { display: none; }
.sheet-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(8, 14, 20, .5); }
.sheet {
  position: fixed; z-index: 71; left: 0; right: 0; bottom: 0; max-height: 92vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 16px 16px 0 0; box-shadow: 0 -12px 40px rgba(8, 14, 20, .3);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; max-height: 86vh; transform: translate(-50%, -50%); border-radius: 14px; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 8px 10px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 19px; font-weight: 700; font-stretch: 112%; }
.sheet-body { overflow-y: auto; padding: 14px 18px 18px; display: grid; gap: 14px; }
.sheet-body > .grid2 > label, .sheet-body .field > label { margin-top: 0; }
.sheet-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 18px 14px; border-top: 1px solid var(--line); }
.sheet-foot .spacer { flex: 1; }
@media (max-width: 699px) {
  .sheet-foot > .btn:last-child { order: -1; width: 100%; min-height: 46px; }
  .sheet-foot .spacer { display: none; }
}
.field { display: grid; gap: 8px; }
.field-label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.field .linkish { justify-self: start; display: inline-flex; align-items: center; gap: 4px; }
.field .linkish [data-icon] { width: 16px; height: 16px; }
.kind-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.kchip {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink-2); font: 600 14px/1.2 var(--font); cursor: pointer;
}
.kchip::before { content: ''; width: 9px; height: 9px; border-radius: 3px; background: var(--ev); }
.kchip[aria-checked="true"] { border-color: var(--ev); background: var(--surface-2); background: color-mix(in srgb, var(--ev) 14%, var(--surface)); color: var(--ink); }
.picked { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.pick-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pick-list > li + li { border-top: 1px solid var(--line); }
.pick-list .row { padding: 9px 12px; }
.pick-list .avatar { width: 34px; height: 34px; font-size: 12px; }
.pick-list .empty { padding: 10px 12px; }

/* ---------- Messages ---------- */
.msg-layout { display: block; }
@media (max-width: 1023px) {
  .msg-layout.has-thread .msg-list-pane { display: none; }
  .msg-layout:not(.has-thread) .msg-thread-pane { display: none; }
  .msg-thread-pane { padding-top: 16px; }
}
@media (min-width: 1024px) {
  .msg-layout { display: grid; grid-template-columns: minmax(320px, 380px) 1fr; gap: 20px; align-items: start; }
  .msg-thread-pane { position: sticky; top: calc(var(--appbar) + 18px); height: calc(100vh - var(--appbar) - 36px); margin-top: 18px; }
  .msg-thread-pane .thread-card { height: 100%; }
  .msg-thread-pane .thread-scroll { flex: 1; min-height: 0; overflow-y: auto; }
  .back-to-list { display: none; }
}
.conn-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.conn-line > span { display: inline-flex; align-items: center; gap: 6px; }
.conn-line [data-icon] { width: 15px; height: 15px; }
.conn-line .linkish { font-size: 13px; }
.warn-text { color: var(--warn); font-weight: 650; }

.conv { position: relative; align-items: flex-start; }
.conv.active { background: var(--accent-soft); }
.conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.conv-time { flex: none; font-size: 13px; color: var(--muted); }
.conv-snippet { display: flex; gap: 6px; align-items: flex-start; margin-top: 2px; font-size: 14px; color: var(--muted); }
.conv-snippet [data-icon] { width: 15px; height: 15px; margin-top: 2px; }
.conv-snippet > span:last-child { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.conv-snippet b { font-weight: 600; color: var(--ink-2); }
.conv.unread .row-name { font-weight: 750; }
.conv.unread .conv-time { color: var(--accent); font-weight: 650; }
.conv.unread .conv-snippet { color: var(--ink-2); }
.conv-flags { display: flex; gap: 6px; margin-top: 5px; }
.flag-hot, .flag-warn { font-size: 12px; font-weight: 650; padding: 1px 8px; border-radius: 999px; }
.flag-hot { color: var(--warn); background: var(--warn-soft); }
.flag-warn { color: var(--amber); background: var(--amber-soft); }
.unread-dot { position: absolute; left: 5px; top: 28px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* Swipe a row left to delete it (conversations on Messages, jobs on Today). The red layer sits
   under the row and shows as the row slides away. */
.swipe { position: relative; overflow: hidden; }
.swipe > .swipe-body {
  position: relative; z-index: 1; background: var(--surface); touch-action: pan-y; user-select: none; -webkit-user-select: none;
  -webkit-user-drag: none; -webkit-touch-callout: none; transition: transform .24s cubic-bezier(.2, .8, .2, 1), background-color .12s;
}
.swipe > .conv.active { background: var(--accent-soft); }
.swipe > a.swipe-body:hover { background: var(--surface-2); }
.swipe > .conv.active:hover { background: var(--accent-soft); }
.swipe.dragging > .swipe-body { transition: none; }
.swipe > .reply.swipe-body a, .swipe > .reply.swipe-body button { -webkit-user-drag: none; }
.swipe-action { position: absolute; inset: 0; background: var(--warn); transition: background-color .15s; }
.swipe.armed .swipe-action { background: #8E2414; }
.swipe-del {
  position: absolute; top: 0; right: 0; bottom: 0; width: max(92px, var(--pull, 0px)); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; border: 0; background: transparent; color: #fff; font: 650 13px/1 var(--font); cursor: pointer;
}
.swipe-del [data-icon] { width: 20px; height: 20px; transition: transform .15s; }
.swipe.armed .swipe-del { align-items: flex-start; padding-left: 26px; }
.swipe.armed .swipe-del [data-icon] { transform: scale(1.15); }
.swipe.removing { height: 0 !important; opacity: 0; border-top-color: transparent !important; transition: height .2s ease, opacity .2s ease; }
:root[data-theme="dark"] .swipe-action { background: #A3301D; }
:root[data-theme="dark"] .swipe.armed .swipe-action { background: #7C2213; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .swipe-action { background: #A3301D; }
  :root[data-theme="auto"] .swipe.armed .swipe-action { background: #7C2213; }
}
/* With a mouse, a trash button appears on hover (and on keyboard focus) in place of the time. */
.conv-trash {
  position: absolute; z-index: 2; top: 6px; right: 8px; width: 36px; height: 36px; color: var(--muted);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.conv-trash [data-icon] { width: 18px; height: 18px; }
.conv-trash:hover { color: var(--warn); background: var(--warn-soft); }
.swipe:has(:focus-visible) .conv-trash { opacity: 1; pointer-events: auto; }
.swipe:has(:focus-visible) :is(.conv-time, .when, .row > .tag) { visibility: hidden; }
@media (hover: hover) and (pointer: fine) {
  .swipe:not(.dragging):not(.open):hover .conv-trash { opacity: 1; pointer-events: auto; }
  .swipe:not(.dragging):not(.open):hover :is(.conv-time, .when, .row > .tag) { visibility: hidden; }
}
.swipe.open .conv-trash, .swipe.dragging .conv-trash { opacity: 0; pointer-events: none; }
.swipe > a.row.swipe-body:not(.conv) ~ .conv-trash { top: 50%; margin-top: -18px; } /* job rows: where the stage label sits */
.swipe > .reply.swipe-body ~ .conv-trash { top: 10px; }
.thread-del { color: var(--muted); }
.thread-del:hover { color: var(--warn); background: var(--warn-soft); }
.thread-del [data-icon] { width: 20px; height: 20px; }
#convlist > .deleted-hint { margin: 0; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 14px; }
.deleted-row { cursor: default; align-items: center; }
.deleted-row .row-name { color: var(--ink-2); }
.deleted-when { display: block; margin-top: 1px; font-size: 13px; color: var(--muted); }
.deleted-row .conv-snippet > span:last-child { -webkit-line-clamp: 1; }
.deleted-row .btn { flex: none; }
.spam-row .deleted-when { color: var(--warn); }
.spam-row .row-name { overflow-wrap: anywhere; }

/* Check texting / Check email results */
.diag-row { margin-top: 12px; }
.diag { margin-top: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.diag > .hint { margin: 0; }
.diag-sum { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.diag-sum.ok { color: var(--ok); }
.diag-sum.bad { color: var(--warn); }
.diag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.diag-item { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.diag-item > [data-icon] { flex: none; width: 22px; height: 22px; padding: 3px; border-radius: 50%; margin-top: -1px; }
.diag-item.ok > [data-icon] { color: var(--ok); background: var(--ok-soft); }
.diag-item.warn > [data-icon] { color: var(--amber); background: var(--amber-soft); }
.diag-item.bad > [data-icon] { color: var(--warn); background: var(--warn-soft); }
.diag-item > span { min-width: 0; display: grid; gap: 3px; }
.diag-item b { font-weight: 650; }
.diag-item > span > span { color: var(--ink-2); overflow-wrap: anywhere; }
.diag-item .btn { justify-self: start; margin-top: 6px; }
.diag-recent { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; }
.diag-recent summary { cursor: pointer; font-weight: 650; color: var(--ink-2); }
.diag-recent ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.diag-recent li { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); }
.diag-recent .diag-why { flex-basis: 100%; color: var(--ink-2); }
@media (prefers-reduced-motion: reduce) { .swipe > .swipe-body, .swipe-action, .swipe-del [data-icon], .swipe.removing, .conv-trash { transition: none; } }

.thread-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; }
.thread-empty { min-height: 320px; align-items: center; justify-content: center; color: var(--muted); }
.thread-empty p { margin: 0; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.thread-head .back-to-list { margin-left: -8px; }
.thread-who { flex: 1; min-width: 0; }
.thread-who h2 { font-size: 18px; font-weight: 700; font-stretch: 110%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-who p { margin: 1px 0 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.contact-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 4px; font-size: 14px; color: var(--ink-2); overflow-wrap: anywhere; }
.contact-chip [data-icon] { width: 16px; height: 16px; color: var(--muted); }
.thread-card > .alert { margin: 12px 14px 0; }
.thread-scroll { padding: 14px; }
.thread-scroll > .empty { padding: 24px 0; text-align: center; }
.m-composer { margin: 0; padding: 12px 14px 14px; border-top: 1px solid var(--line); background: var(--surface-2); }
.fu-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.fu-quick { display: flex; gap: 6px; }

/* ---------- Follow-ups ---------- */
.pagehead .hint { margin: 4px 0 0; }
.fu-item { padding: 14px 16px; }
.fu-item.overdue { box-shadow: inset 3px 0 0 var(--warn); }
.fu-who { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.fu-who:hover .row-name { text-decoration: underline; }
.fu-body { margin: 8px 0 0 52px; }
.fu-what { margin: 0; font-size: 15px; font-weight: 550; }
.fu-what .agenda-kind { margin-right: 6px; }
.fu-meta { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.fu-meta .linkish { font-size: 13px; margin-left: 4px; }
.fu-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0 52px; }
.fu-done { display: grid; gap: 10px; margin: 12px 0 0 52px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.fu-done .sub, .fu-done .btnrow, .fu-done .inline { margin: 0; }
.fu-done > .linkish { justify-self: start; }
@media (max-width: 480px) { .fu-body, .fu-acts, .fu-done { margin-left: 0; } }
.page-summary { margin: 0; font-size: 17px; color: var(--ink-2); }
.fu-remind { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); }

/* Messages: Texts | Emails */
.seg { display: flex; gap: 4px; margin-top: 18px; padding: 4px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; }
.seg-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 10px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font: 650 16px/1 var(--font); cursor: pointer;
}
.seg-btn [data-icon] { width: 18px; height: 18px; }
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.seg-btn[aria-selected="true"]:hover { color: var(--surface); }
.seg-count { min-width: 22px; padding: 2px 7px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.seg + .toolbar { padding-top: 10px; }
.sent-row .deleted-when { color: var(--muted); }

/* Today: Recently deleted */
.trash-sec > summary { display: flex; align-items: center; gap: 8px; padding: 13px 16px; font-size: 16px; font-weight: 650; cursor: pointer; list-style: none; }
.trash-sec > summary::-webkit-details-marker { display: none; }
.trash-sec > summary::after { content: ''; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.trash-sec[open] > summary { border-bottom: 1px solid var(--line); }
.trash-sec[open] > summary::after { transform: rotate(-135deg); }
.trash-row { cursor: default; }
.trash-row .btn { flex: none; }

/* Settings: System check */
.sys-body { padding: 0 16px 16px; }
.sys-body > .hint { margin: 12px 0 0; }
.sys-sum { margin: 14px 0 4px; }
.sys-part { margin-top: 14px; }
.sys-part h3 { margin: 0; font-size: 15px; font-weight: 700; }
.sys-part .diag { margin-top: 8px; }
.sys-part .diag-sum { display: none; }
