:root {
  color-scheme: light dark;
  --bg: #f1f3f4; --surface: #fff; --raised: #f4f5f6; --hover: #e7e9ea; --line: rgb(25 28 29 / .09); --edge: rgb(25 28 29 / .16);
  --text: #191c1d; --muted: #5c666a; --solid: #191c1d; --on-solid: #fff; --danger: #ba1a1a; --danger-soft: rgb(186 26 26 / .09);
  --shadow: 0 18px 40px -16px rgb(0 0 0 / .25);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e0f; --surface: #141718; --raised: #1c1f20; --hover: #272a2c; --line: rgb(225 227 228 / .09); --edge: rgb(225 227 228 / .17);
    --text: #e6e8e9; --muted: #98a2a6; --solid: #f1f3f4; --on-solid: #141718; --danger: #ffb4ab; --danger-soft: rgb(255 180 171 / .12);
    --shadow: 0 25px 50px -12px rgb(0 0 0 / .6);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 Commissioner, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 20px; line-height: 28px; font-weight: 600; }
h2 { font-size: 16px; line-height: 24px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
ul { list-style: none; }
a { color: var(--text); text-underline-offset: 3px; }
svg { width: 100%; height: 100%; display: block; }
[data-icon]:not(button) { display: inline-flex; flex: none; width: 18px; height: 18px; }

/* ---------- Controls ---------- */
button, input, textarea, select { font: inherit; color: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 16px;
  border: 1px solid var(--edge); border-radius: 999px; background: transparent; font-weight: 500; white-space: nowrap; cursor: pointer;
  text-decoration: none; transition: background-color .12s ease-out; }
button:hover, .button:hover { background: var(--hover); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--solid); border-color: var(--solid); color: var(--on-solid); font-weight: 600; }
button.primary:hover { opacity: .88; }
button.link { border: 0; min-height: 0; text-decoration: underline; background: none; }
button.quiet { border-color: transparent; }
button.danger { color: var(--danger); }
button.danger:hover { background: var(--danger-soft); }
button.destructive { background: var(--danger); border-color: var(--danger); color: var(--on-solid); }
button.destructive:hover { background: var(--danger); opacity: .88; }
.icon-button { flex: none; width: 36px; height: 36px; min-height: 36px; padding: 9px; border-color: transparent; border-radius: 50%; }
input, textarea, select { width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid var(--edge); border-radius: 12px; background: var(--raised); font-size: 14px; }
textarea { resize: vertical; }
input[type="color"] { width: 100%; height: 40px; padding: 4px; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
label.switch { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; font-size: 14px; cursor: pointer; }
.switch input { appearance: none; flex: none; position: relative; width: 42px; min-height: 0; height: 24px; padding: 0; border-radius: 12px; background: var(--hover); cursor: pointer; transition: background-color .12s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .12s; }
.switch input:checked { background: var(--solid); border-color: var(--solid); }
.switch input:checked::after { background: var(--on-solid); transform: translateX(18px); }
.muted { color: var(--muted); font-weight: 400; }
.error { color: var(--danger); font-size: 13px; }
.credit { font-size: 11px; color: var(--muted); }
.card { display: flex; flex-direction: column; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.card > button, .card > button.primary { align-self: flex-start; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions.end { justify-content: flex-end; }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--hover); font-size: 11px; font-weight: 600; line-height: 20px; text-align: center; }
.pill.alert { background: #d70015; color: #fff; }
.avatar { position: relative; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--hover) center / cover; font-size: 15px; font-weight: 600; }
.avatar.flag { font-size: 20px; }
.avatar.online::after { content: ""; position: absolute; right: 0; bottom: 0; width: 10px; height: 10px; border-radius: 50%; background: #15803d; box-shadow: 0 0 0 2px var(--surface); }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 32px 16px; text-align: center; }
[data-icon].big { width: 36px; height: 36px; color: var(--muted); }

/* ---------- Sign in ---------- */
.auth { max-width: 400px; margin: 0 auto; padding: 48px 16px; display: flex; flex-direction: column; gap: 12px; }
.auth h1 { font-size: 28px; line-height: 36px; }
.auth .card > button { align-self: stretch; }

/* ---------- Frame ---------- */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 232px minmax(0, 1fr); padding-top: env(safe-area-inset-top); }
.rail { display: flex; flex-direction: column; gap: 4px; min-height: 0; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; }
.brand strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; }
.brand .mark[data-icon] { width: 22px; height: 22px; }
.tab { justify-content: flex-start; gap: 12px; padding: 10px 12px; border-color: transparent; border-radius: 12px; }
.tab[aria-current="page"] { background: var(--hover); font-weight: 600; }
.tab .pill { margin-left: auto; }
.tab[aria-current="page"] .pill:not(.alert) { background: var(--surface); }
.connection { margin-top: auto; padding: 0 12px; font-size: 12px; color: var(--muted); }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 4px 0; border-top: 1px solid var(--line); }
.me .avatar { width: 36px; height: 36px; }
.me div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.me strong, .me span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.me span { font-size: 12px; }
.views { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.views > section { flex: 1; min-height: 0; }
.mobile-only { display: none; }

/* ---------- Inbox ---------- */
.inbox { position: relative; display: grid; grid-template-columns: 330px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.column { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.column-head { display: flex; flex-direction: column; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: var(--raised); }
.segmented button { min-height: 30px; padding: 4px 12px; border: 0; }
.segmented button[aria-pressed="true"] { background: var(--solid); color: var(--on-solid); font-weight: 600; }
.search { position: relative; flex-direction: row; align-items: center; }
.search [data-icon] { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; border-radius: 999px; }
#delete-closed { align-self: flex-start; padding-inline: 10px; }
#list { overflow-y: auto; padding: 8px; }
#list:empty { display: none; }
#list button { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px; border: 0; border-radius: 14px; text-align: left; font-weight: 400; }
#list button[aria-current="true"] { background: var(--hover); }
#list .avatar { grid-row: span 2; }
#list span:not(.avatar):not(.count) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#list .who { font-weight: 600; }
#list .when { justify-self: end; font-size: 12px; color: var(--muted); }
#list .preview { color: var(--muted); font-size: 13px; }
#list .unread .preview { color: var(--text); font-weight: 600; }
#list .count { justify-self: end; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #d70015; color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.column .credit { margin-top: auto; padding: 10px 16px; }

#thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#thread header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.thread-who { flex: 1; min-width: 0; }
.thread-who h2, .thread-who p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.thread-who p { font-size: 12px; }
.back { display: none; }
.messages { flex: 1; overflow-y: auto; padding: 20px max(16px, calc((100% - 760px) / 2)); display: flex; flex-direction: column; gap: 10px; }
.msg { flex: none; max-width: min(75%, 520px); padding: 10px 16px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { display: block; margin-top: 3px; font-size: 11px; opacity: .6; }
.msg a { color: inherit; }
.msg.visitor { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.agent { align-self: flex-end; background: var(--solid); color: var(--on-solid); border-bottom-right-radius: 6px; }
.typing { padding: 0 max(20px, calc((100% - 760px) / 2)) 4px; font-size: 12px; }
#reply { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 792px; margin: 0 auto; padding: 8px 16px 16px; }
.composer { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--edge); border-radius: 18px; background: var(--surface); }
.composer:focus-within { border-color: var(--text); }
.composer textarea { min-height: 44px; padding: 0 4px; border: 0; border-radius: 0; background: none; resize: none; outline: none; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#saved { width: auto; max-width: 70%; min-height: 32px; padding: 4px 12px; border-radius: 999px; font-size: 13px; }
.send { flex: none; width: 36px; height: 36px; margin-left: auto; padding: 9px; border-radius: 50%; }
.placeholder .big { margin-bottom: 4px; }

#details { display: none; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; padding: 16px; border-left: 1px solid var(--line); background: var(--surface); }
.details-head { display: flex; align-items: center; justify-content: space-between; }
#visitor-info { display: flex; flex-direction: column; gap: 14px; }
#visitor-info dt { font-size: 12px; color: var(--muted); }
#visitor-info dd { overflow-wrap: anywhere; }
.inbox.show-details #details { display: flex; position: absolute; top: 0; right: 0; bottom: 0; z-index: 5; width: min(320px, 100%); box-shadow: var(--shadow); }
@media (min-width: 1240px) {
  #inbox.has-thread { grid-template-columns: 330px minmax(0, 1fr) 300px; }
  #inbox.has-thread #details { display: flex; position: static; width: auto; box-shadow: none; }
  #details-toggle, #details-close { display: none; }
}

/* ---------- Visitors ---------- */
.page { overflow-y: auto; }
.page-inner { display: flex; flex-direction: column; gap: 20px; max-width: 1040px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cards:empty { display: none; }
.cards li { gap: 12px; }
.card-top { display: flex; align-items: center; gap: 12px; }
.card-top div { min-width: 0; }
.card-top strong, .card-top p { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-top p { font-size: 12px; }
.viewing { padding: 10px 12px; border-radius: 12px; background: var(--raised); overflow-wrap: anywhere; }
.viewing small { display: block; font-size: 11px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips > span { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--muted); }
.device { display: inline-flex; align-items: center; gap: 6px; }
.device-icon { display: inline-flex; flex: none; width: 14px; height: 14px; }
.cards li > button { align-self: stretch; margin-top: auto; }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.subnav { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; padding: 16px 12px; border-right: 1px solid var(--line); }
.subnav h1 { padding: 0 12px 12px; }
.subnav button { justify-content: flex-start; gap: 12px; padding: 9px 12px; border-color: transparent; border-radius: 12px; }
.subnav button[aria-current="true"] { background: var(--hover); font-weight: 600; }
.subnav .mobile-only { display: none; }
.settings-scroll { overflow-y: auto; }
.settings-body { min-width: 0; display: flex; flex-direction: column; gap: 16px; max-width: 760px; margin: 0 auto; padding: 24px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card-head p { margin-top: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.grid .wide { grid-column: 1 / -1; }
.grid button.wide { justify-self: start; }
summary { cursor: pointer; font-size: 13px; font-weight: 500; }
details[open] summary { margin-bottom: 14px; }
.photo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.photo { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--hover) center / cover; font-size: 26px; font-weight: 600; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.rows li > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rows p { font-size: 13px; }
.rows:empty::after { content: "Nothing here yet."; color: var(--muted); }
pre { padding: 14px; border-radius: 12px; background: var(--raised); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.save-bar { position: sticky; bottom: 12px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 10px 12px 10px 20px; border: 1px solid var(--edge); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.save-bar p { margin-right: auto; font-size: 13px; }

/* ---------- Leads, tours and Today ---------- */
.stack { min-width: 0; }
.page-inner.narrow { max-width: 760px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.stats.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { display: flex; flex-direction: column; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); }
.stat strong { font-size: 17px; line-height: 24px; overflow-wrap: anywhere; }
.stat span, .stat small { font-size: 12px; color: var(--muted); }
.stat.alert strong { color: var(--danger); }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chip { flex: none; min-height: 30px; padding: 3px 12px; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--solid); border-color: var(--solid); color: var(--on-solid); }
.chip .n { opacity: .65; font-size: 12px; }
.column-scroll { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow-y: auto; }
.leadlist { padding: 8px; }
.leadlist:empty { display: none; }
.leadlist button { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px; border: 0; border-radius: 14px; text-align: left; font-weight: 400; }
.leadlist button[aria-current="true"] { background: var(--hover); }
.leadlist .avatar { grid-row: span 3; align-self: start; }
.leadlist .who, .leadlist .preview, .leadlist .next { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leadlist .who { font-weight: 600; }
.leadlist .preview { color: var(--muted); font-size: 13px; }
.leadlist .next { grid-column: 2 / -1; font-size: 12px; color: var(--muted); }
.leadlist .unread .who::before { content: "● "; color: #d70015; }
.leadlist .count { justify-self: end; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #d70015; color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.next.now { color: var(--text); font-weight: 600; }
.next.bad { color: var(--danger); font-weight: 600; }
.sources { margin-top: auto; padding: 10px 16px; font-size: 12px; }
.stage { justify-self: end; align-self: center; padding: 0 8px; border: 1px solid var(--edge); border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.stage.won, .stage.confirmed, .stage.active { background: var(--solid); border-color: var(--solid); color: var(--on-solid); }
.stage.lost, .stage.done, .stage.cancelled { color: var(--muted); }

.detail { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.detail > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.detail > p { padding: 8px 16px 0; }
.detail-body { display: flex; flex: 1; flex-direction: column; gap: 16px; min-height: 0; overflow-y: auto; padding: 16px max(16px, calc((100% - 820px) / 2)) 32px; }
.detail-body > * { flex: none; }
#timeline { display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow-y: auto; }
#timeline:empty { display: none; }
#timeline:not(:empty) + #timeline-empty { display: none; }
.entry { max-width: 92%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 14px; align-self: flex-start; }
.entry.out { align-self: flex-end; background: var(--raised); }
.entry .meta { font-size: 12px; color: var(--muted); }
.entry .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.actions.between { justify-content: space-between; align-items: center; }
#mail-saved { width: auto; max-width: 60%; border-radius: 999px; }

.tours { display: flex; flex-direction: column; }
.tours > * { flex: 1; min-height: 0; }
.segmented.four { grid-template-columns: repeat(4, auto); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar input[type="search"] { flex: 1; min-width: 160px; border-radius: 999px; }
.toolbar select { width: auto; border-radius: 999px; }
.toolbar > p { flex: 1; min-width: 200px; }
.toolbar h2 { min-width: 150px; text-align: center; }
.toolbar .icon-button { font-size: 22px; line-height: 1; border-color: var(--edge); padding: 0 0 3px; }
.records { display: flex; flex-direction: column; gap: 10px; }
.record { display: flex; flex-direction: column; align-items: stretch; gap: 3px; width: 100%; padding: 14px 16px; border-color: var(--line); border-radius: 18px; background: var(--surface); text-align: left; white-space: normal; font-weight: 400; }
.record-top { display: flex; justify-content: space-between; gap: 12px; }
.record-top strong { overflow-wrap: anywhere; }
.row-link { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 2px 0; border: 0; border-radius: 8px; text-align: left; white-space: normal; font-weight: 400; }
.row-link span { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.row-link span:empty { display: none; }
#today-body .rows li { flex-wrap: wrap; }
#today-body .rows li > .row-link { flex-basis: 220px; }
.records li.card { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; }
.rows li > .row-link { flex: 1; }
.rows li > div.actions { flex: none; }
.card h2 .pill { margin-left: 8px; vertical-align: 2px; }
.warns { display: flex; flex-wrap: wrap; gap: 6px; }
.warns:empty { display: none; }
.warn { padding: 1px 10px; border: 1px solid var(--edge); border-radius: 999px; font-size: 12px; }
.warn.bad { border-color: transparent; background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendar .dow { font-size: 12px; color: var(--muted); text-align: center; }
.cell { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 2px; min-width: 0; min-height: 74px; padding: 4px; border-color: var(--line); border-radius: 10px; font-size: 12px; text-align: left; }
.cell.other { opacity: .45; }
.cell.today > span:first-child { font-weight: 800; text-decoration: underline; }
.cell[aria-pressed="true"] { border-color: var(--text); }
.cell .bar { overflow: hidden; padding: 0 4px; border-left: 3px solid var(--hue); border-radius: 3px; background: var(--hover); font-size: 11px; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; }
.cell .more { color: var(--muted); font-size: 11px; }
.service { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.service-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.service-fields .pick, .service-fields .what { grid-column: span 2; }
.request { display: flex; flex-direction: column; gap: 8px; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-size: 14px; font-weight: 400; cursor: pointer; }
.check input { flex: none; width: 18px; min-height: 0; height: 18px; accent-color: var(--solid); }
a.button.primary { background: var(--solid); border-color: var(--solid); color: var(--on-solid); font-weight: 600; }
button.link { padding: 0; }
.actions.add button { min-height: 32px; padding: 4px 12px; font-size: 13px; }
#save-lead svg { width: 18px; height: 18px; }
/* With the visitor details beside it, the chat header only has room for the icon. */
@media (min-width: 1240px) and (max-width: 1599px) {
  #save-lead { width: 36px; padding: 9px; }
  #save-lead .label { display: none; }
}

/* ---------- Dialogs ---------- */
dialog { margin: auto; max-height: calc(100dvh - 32px); overflow-y: auto; width: min(480px, calc(100vw - 32px)); padding: 24px; border: 1px solid var(--edge); border-radius: 24px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / .55); backdrop-filter: blur(4px); }
dialog form { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Phones and small windows ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .views { grid-row: 1; }
  .rail { grid-row: 2; flex-direction: row; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .brand, .me { display: none; }
  .connection { position: fixed; top: 8px; left: 50%; z-index: 10; margin: 0; transform: translateX(-50%); padding: 2px 12px; border-radius: 999px; background: var(--hover); }
  .connection:empty { display: none; }
  .tab { position: relative; flex: 1; flex-direction: column; justify-content: center; gap: 2px; padding: 6px; font-size: 11px; }
  .tab .pill { position: absolute; top: 2px; left: calc(50% + 6px); }
  .inbox, .inbox.has-thread { grid-template-columns: minmax(0, 1fr); }
  .column { border-right: 0; }
  .inbox.has-thread .column { display: none; }
  .placeholder { display: none; }
  .back { display: inline-flex; }
  .inbox.has-thread .detail { grid-column: 1; }
  .tab-label { font-size: 10px; }
  .detail > header { gap: 6px; padding: 10px 8px; }
  .detail-body { padding: 12px 12px 24px; }
  #save-lead { width: 36px; padding: 9px; }
  #save-lead .label { display: none; }
  .segmented.four { width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .segmented.four button { padding: 4px; font-size: 12px; }
  .calendar { gap: 2px; }
  .cell { min-height: 52px; padding: 3px; border-radius: 8px; }
  .cell .bar { height: 5px; padding: 0; border: 0; background: var(--hue); font-size: 0; line-height: 0; }
  .service-fields .pick, .service-fields .what { grid-column: 1 / -1; }
  .stats.compact .stat { padding: 8px 10px; }
  #thread header { gap: 6px; padding: 10px 8px; }
  #thread-avatar { display: none; }
  #toggle-status { padding-inline: 12px; }
  .msg { max-width: 85%; }
  .settings { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .subnav { flex-direction: row; overflow-x: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .subnav h1 { display: none; }
  .subnav button { flex: none; }
  .subnav .mobile-only { display: inline-flex; }
  .settings-body, .page-inner { padding: 16px; }
  input, textarea, select { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
