/* Notch Studio admin — same brand as the website, tuned for daily work: calm, dense, easy to scan. */
:root {
  --ink: #16143B; --ink-2: #2A2860; --soft: #4A4B70; --muted: #6B6C8C;
  --bg: #F3F4F9; --card: #FFFFFF; --line: #E3E5EF; --line-2: #EEF0F6;
  --cobalt: #3B4BFF; --cobalt-d: #2633D6; --cobalt-t: #E8EAFF; --peach: #FF9F80;
  --coral: #E0623A;
  --good: #15803D; --good-t: #E3F6EA; --warn: #A15C00; --warn-t: #FFF1D6; --bad: #B42318; --bad-t: #FDE8E6; --info-t: #E8EAFF;
  --r: 14px; --r-sm: 10px;
  --shadow: 0 1px 0 rgba(22,20,59,.05), 0 8px 24px -16px rgba(22,20,59,.25);
  --f-d: "Syne", system-ui, sans-serif; --f-b: "Manrope", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--f-b); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--f-d); letter-spacing: -.015em; margin: 0; line-height: 1.15; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--cobalt); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 700; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: #C9CCE0; background: #FAFBFE; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn.primary:hover { background: var(--cobalt-d); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-t); border-color: #F3C3BE; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(22,20,59,.05); }
.btn.sm { height: 32px; padding: 0 10px; font-size: .84rem; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 700; font-size: .85rem; }
.field small { color: var(--muted); font-size: .8rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(59,75,255,.15); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span2 { grid-column: 1 / -1; }
.form-err { background: var(--bad-t); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: .9rem; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(60% 60% at 80% 20%, rgba(59,75,255,.18), transparent 70%), var(--bg); padding: 16px; }
.login-card { width: min(400px, 100%); background: var(--card); border-radius: 20px; padding: 32px; box-shadow: 0 30px 60px -30px rgba(22,20,59,.45); display: grid; gap: 14px; }
.login-card form { display: grid; gap: 14px; margin-top: 8px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-d); font-weight: 800; font-size: 1.3rem; }
.brand svg { width: 30px; height: 30px; }
.brand span { position: relative; line-height: 1; }
.brand small { position: absolute; right: 0; top: 100%; font-family: var(--f-b); font-size: .5em; font-weight: 700; letter-spacing: .06em; margin-top: 1px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--ink); color: #fff; display: flex; flex-direction: column; padding: 20px 14px; gap: 22px; }
.side .brand { padding: 4px 8px 10px; color: #fff; }
.side .brand small { color: var(--peach); }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #C9CBEE; text-decoration: none; font-weight: 700; font-size: .93rem; }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; }
.nav .count { margin-left: auto; background: var(--coral); color: #fff; font-size: .72rem; font-weight: 800; padding: 1px 7px; border-radius: 99px; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.mode { border-radius: 12px; padding: 12px; font-size: .82rem; background: rgba(255,255,255,.07); color: #DCDDF6; }
.mode b { display: flex; align-items: center; gap: 8px; color: #fff; font-size: .88rem; }
.mode b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--peach); }
.mode.live b::before { background: #4ADE80; }
.side .btn.ghost { color: #C9CBEE; justify-content: flex-start; }
.side .btn.ghost:hover { background: rgba(255,255,255,.07); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(243,244,249,.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .menu { display: none; }
.search { position: relative; flex: 1; max-width: 420px; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); }
.search input { padding-left: 36px; background: #fff; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid; max-height: 360px; overflow: auto; }
.search-results a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .9rem; }
.search-results a:hover, .search-results a.on { background: var(--bg); }
.search-results small { color: var(--muted); }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.content { padding: 24px 28px 60px; display: grid; gap: 20px; align-content: start; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }

/* ---------- Cards, tiles ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head .muted { font-size: .85rem; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px; display: grid; gap: 4px; text-decoration: none; color: var(--ink); transition: transform .15s; }
a.tile:hover { transform: translateY(-2px); }
.tile .label { font-size: .85rem; font-weight: 700; color: var(--soft); display: flex; align-items: center; gap: 8px; }
.tile .label svg { width: 16px; height: 16px; color: var(--cobalt); }
.tile .value { font-family: var(--f-d); font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.tile .sub { font-size: .82rem; color: var(--muted); }
.tile.alert .value { color: var(--bad); }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }

/* ---------- Chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: .76rem; font-weight: 800; white-space: nowrap; background: var(--line-2); color: var(--soft); }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.good { background: var(--good-t); color: var(--good); }
.chip.warn { background: var(--warn-t); color: var(--warn); }
.chip.bad { background: var(--bad-t); color: var(--bad); }
.chip.info { background: var(--info-t); color: var(--cobalt-d); }
.chip.plain::before { display: none; }
.pkg { display: inline-block; font-weight: 800; font-size: .78rem; padding: 2px 8px; border-radius: 6px; background: var(--ink); color: #fff; }
.pkg.Launch { background: #E8EAFF; color: var(--cobalt-d); }
.pkg.Grow { background: #FFE7DE; color: #A8401C; }
.pkg.Sell { background: var(--ink); color: #fff; }
.pkg.Bespoke { background: #EDE9FE; color: #5B21B6; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .76rem; font-weight: 800; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #FAFBFE; }
td.r, th.r { text-align: right; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: .82rem; color: #fff; flex: none; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.1rem; }
.who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-family: var(--f-d); font-size: 1.05rem; margin-bottom: 4px; }

/* ---------- Filters / tabs ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-weight: 700; font-size: .85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.filters button em { font-style: normal; color: var(--muted); font-weight: 700; }
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters button[aria-pressed="true"] em { color: #C9CBEE; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--soft); font-weight: 700; font-size: .92rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--cobalt); }

/* ---------- Lists ---------- */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .grow b { display: block; font-size: .92rem; }
.li .grow small { color: var(--muted); font-size: .82rem; }
.ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--cobalt-t); color: var(--cobalt); }
.ic svg { width: 16px; height: 16px; }
.ic.bad { background: var(--bad-t); color: var(--bad); }
.ic.warn { background: var(--warn-t); color: var(--warn); }
.ic.good { background: var(--good-t); color: var(--good); }
.act { display: grid; gap: 0; }
.act .li { align-items: flex-start; }
.act time { color: var(--muted); font-size: .78rem; white-space: nowrap; }

/* ---------- Pipeline ---------- */
.pipeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stage { border-radius: 12px; padding: 12px; background: var(--bg); text-decoration: none; color: var(--ink); }
.stage:hover { background: var(--cobalt-t); }
.stage b { display: block; font-family: var(--f-d); font-size: 1.5rem; line-height: 1.1; }
.stage span { font-size: .8rem; font-weight: 700; color: var(--soft); }

/* ---------- Chart ---------- */
.chart { position: relative; }
.chart svg { width: 100%; height: 240px; display: block; overflow: visible; }
.chart .grid line { stroke: #ECEEF5; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--f-b); }
.chart .bar { transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart.hovering .bar { opacity: .45; }
.chart.hovering .col.on .bar { opacity: 1; }
.legend { display: flex; gap: 16px; font-size: .82rem; font-weight: 700; color: var(--soft); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 12px; font-size: .82rem; min-width: 170px; box-shadow: 0 10px 24px -10px rgba(0,0,0,.5); transform: translate(-50%, -100%); white-space: nowrap; }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.chart-table { margin-top: 10px; }

/* ---------- Client detail ---------- */
.client-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.client-head .grow { flex: 1; min-width: 200px; }
.client-head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.client-head .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--soft); font-size: .9rem; margin-top: 6px; }
.client-head .meta a { color: inherit; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; }
.breakdown { display: grid; gap: 0; font-size: .9rem; }
.breakdown div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.breakdown div.neg span:last-child { color: var(--good); }
.breakdown .total { border-bottom: 0; font-family: var(--f-d); font-weight: 800; font-size: 1.1rem; padding-top: 12px; }
.breakdown .vat { color: var(--muted); border-bottom: 0; padding-top: 0; }
.progress { display: flex; gap: 6px; }
.progress span { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.progress span.on { background: var(--cobalt); }
.progress-labels { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); font-weight: 700; margin-top: 6px; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: .9rem; }
.note time { display: block; color: var(--muted); font-size: .76rem; margin-bottom: 2px; }

/* package editor */
.pkg-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pkg-pick label { position: relative; border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; display: grid; gap: 2px; }
.pkg-pick input { position: absolute; opacity: 0; }
.pkg-pick b { font-family: var(--f-d); }
.pkg-pick small { color: var(--muted); font-weight: 700; }
.pkg-pick label:has(input:checked) { border-color: var(--cobalt); background: var(--cobalt-t); }
.pkg-pick label:has(input:focus-visible) { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.feat-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.feat-list label { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: .9rem; cursor: pointer; }
.feat-list input { width: 18px; height: 18px; accent-color: var(--cobalt); }
.feat-list .price { margin-left: auto; color: var(--muted); font-weight: 700; font-size: .82rem; }
.feat-list .inc { margin-left: auto; color: var(--good); font-weight: 800; font-size: .78rem; }
.toggle { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--cobalt); }
.diff { padding: 12px 14px; border-radius: 12px; background: var(--warn-t); color: var(--warn); font-weight: 700; font-size: .9rem; display: grid; gap: 8px; }
.diff .toggle { color: var(--ink); font-weight: 600; }

/* maintenance plans */
.plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.plans button { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 14px; text-align: left; cursor: pointer; display: grid; gap: 2px; }
.plans button b { font-family: var(--f-d); }
.plans button span { color: var(--muted); font-size: .85rem; font-weight: 700; }
.plans button[aria-pressed="true"] { border-color: var(--cobalt); background: var(--cobalt-t); }
.dd { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 12px; background: var(--bg); flex-wrap: wrap; }
.dd .grow { flex: 1; min-width: 200px; }
.dd .grow b { display: block; }
.dd .grow small { color: var(--muted); }
.callout { padding: 12px 14px; border-radius: 12px; background: var(--info-t); color: var(--ink-2); font-size: .9rem; }
.callout.warn { background: var(--warn-t); color: #6B3D00; }

/* ---------- Modal / drawer ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(22,20,59,.45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--card); border-radius: 18px; box-shadow: 0 40px 80px -30px rgba(0,0,0,.5); animation: rise .2s; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-body { padding: 20px 22px; display: grid; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--bg); cursor: pointer; display: grid; place-items: center; }
.x svg { width: 16px; height: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.lines { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: 1fr 140px 36px; gap: 8px; align-items: center; }
.line .x { width: 36px; height: 36px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.link-box { display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.link-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.share { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: center; }
.share img { width: 150px; height: 150px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.inv-paper { border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 14px; }
.inv-paper .top-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 80; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: .9rem; box-shadow: 0 16px 30px -14px rgba(0,0,0,.5); animation: rise .2s; max-width: 380px; }
.toast.bad { background: var(--bad); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) { .tiles { grid-template-columns: repeat(2, 1fr); } .cols { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 70; transform: translateX(-100%); transition: transform .25s; }
  .shell.nav-open .side { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.4); }
  .top { padding: 12px 16px; }
  .top .menu { display: grid; }
  .content { padding: 18px 16px 60px; }
  .pkg-pick, .plans { grid-template-columns: 1fr 1fr; }
  .pipeline { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile .value { font-size: 1.45rem; }
  .grid2, .grid3, .feat-list { grid-template-columns: 1fr; }
  .top-actions .btn span { display: none; }
  .hide-sm { display: none; }
  .share { grid-template-columns: 1fr; justify-items: center; }
  .line { grid-template-columns: 1fr 100px 36px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* fixes */
[hidden] { display: none !important; }
.search input#q { padding-left: 38px; }
.share { grid-template-columns: 150px minmax(0, 1fr); }
.share > * { min-width: 0; }
.modal-body > * { min-width: 0; }
@media (max-width: 600px) { .share { grid-template-columns: minmax(0, 1fr); } }
.modal-body { grid-template-columns: minmax(0, 1fr); }
.share > div { grid-template-columns: minmax(0, 1fr); }

/* Readable numbers: body font, even-width digits, no squeezed letter-spacing */
.tile .value { font-family: var(--f-b); font-weight: 800; font-size: 2rem; letter-spacing: -.01em; font-variant-numeric: tabular-nums lining-nums; }
.tile .value small { font-size: .55em; font-weight: 700; color: var(--muted); margin-left: 2px; }
.stage b { font-family: var(--f-b); font-weight: 800; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.breakdown .total { font-family: var(--f-b); font-weight: 800; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.chart .axis text { font-size: 12px; fill: var(--soft); font-weight: 600; }
.li b.num { font-size: 1rem; }

/* Handover countdown */
.handover { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-left: 6px solid var(--cobalt); }
.handover.warn { border-left-color: #F59E0B; }
.handover.bad { border-left-color: var(--bad); }
.handover.good { border-left-color: var(--good); }
.ho-main { display: grid; gap: 2px; }
.ho-label { font-size: .82rem; font-weight: 800; color: var(--soft); }
.ho-count { font-family: var(--f-b); font-weight: 800; font-size: 1.7rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.handover.bad .ho-count { color: var(--bad); }
.handover.good .ho-count { color: var(--good); }
.ho-main small { color: var(--muted); }
.ho-actions { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.ho-actions input { width: auto; }

/* Email templates */
.tpl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tpl { display: grid; gap: 10px; align-content: start; padding: 14px; border-radius: 12px; background: var(--bg); }
.tpl textarea { min-height: 190px; font-size: .88rem; line-height: 1.45; }
.tpl .btn { justify-self: start; }
@media (max-width: 1100px) { .tpl-grid { grid-template-columns: 1fr; } }

/* Handover: payment gate */
.handover { flex-wrap: wrap; }
.ho-pay { flex-basis: 100%; display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.ho-pay.held { background: var(--warn-t); }
.ho-pay.ok { background: var(--good-t); }
.ho-pay .grow { flex: 1; min-width: 0; }
.ho-pay b { display: block; font-size: .92rem; }
.ho-pay small { color: var(--soft); font-size: .84rem; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--cobalt); font-weight: 700; cursor: pointer; font-size: inherit; text-decoration: underline; }
.tpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .tpl-grid { grid-template-columns: 1fr; } }

.tpl-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .tpl-grid { grid-template-columns: 1fr; } }

/* ---------- Next step ---------- */
.next-step { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: var(--info-t); border: 1px solid #D5D9FF; }
.next-step .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--cobalt); color: #fff; flex: none; }
.next-step .ic svg { width: 18px; height: 18px; }
.next-step small { display: block; font-size: .78rem; font-weight: 800; color: var(--cobalt-d); }
.next-step b { display: block; font-size: .98rem; line-height: 1.35; }
.next-step .grow { flex: 1; min-width: 0; }
.next-step.bad { background: var(--bad-t); border-color: #F3C3BE; } .next-step.bad .ic { background: var(--bad); } .next-step.bad small { color: var(--bad); }
.next-step.warn { background: var(--warn-t); border-color: #F2D9A6; } .next-step.warn .ic { background: var(--warn); } .next-step.warn small { color: var(--warn); }
.next-step.good { background: var(--good-t); border-color: #BFE6CC; } .next-step.good .ic { background: var(--good); } .next-step.good small { color: var(--good); }
.next-step.done { background: var(--card); border-color: var(--line); } .next-step.done .ic { background: var(--good-t); color: var(--good); } .next-step.done small { color: var(--muted); }
.next-chip { display: inline-block; font-size: .8rem; font-weight: 800; color: var(--cobalt-d); background: var(--info-t); padding: 3px 9px; border-radius: 8px; white-space: nowrap; }
.next-chip.bad { color: var(--bad); background: var(--bad-t); } .next-chip.warn { color: var(--warn); background: var(--warn-t); } .next-chip.good { color: var(--good); background: var(--good-t); }
.next-chip.done { color: var(--muted); background: transparent; padding-inline: 0; font-weight: 600; }

/* ---------- Today ---------- */
.card.today { border-top: 3px solid var(--cobalt); }

/* ---------- Notes & history ---------- */
.note-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.note-form textarea { min-height: 46px; height: 46px; resize: vertical; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: flex; gap: 12px; padding: 9px 0; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--line-2); }
.timeline li:first-child::before { top: 16px; } .timeline li:last-child::before { bottom: calc(100% - 16px); }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #C9CCE0; flex: none; margin-top: 4px; position: relative; }
.timeline .tl-money .dot { border-color: var(--good); background: var(--good-t); }
.timeline .tl-alert .dot { border-color: var(--bad); background: var(--bad-t); }
.timeline .tl-note .dot { border-color: var(--cobalt); background: var(--cobalt); }
.timeline .grow { flex: 1; min-width: 0; }
.tl-meta { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.tl-meta > span { flex: 1; min-width: 0; }
.tl-meta time { color: var(--muted); font-size: .8rem; white-space: nowrap; margin-left: auto; }
.tl-meta .btn { height: 26px; padding: 0 6px; color: var(--muted); }
.tl-note p { margin: 4px 0 0; background: var(--line-2); border-radius: 10px; padding: 9px 12px; font-size: .92rem; white-space: pre-wrap; }
.fbtn { height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font-weight: 700; font-size: .85rem; display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.fbtn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Leads ---------- */
.lead-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.lead-flow a { padding: 12px 16px; text-decoration: none; color: inherit; display: grid; gap: 2px; position: relative; }
.lead-flow a + a { border-left: 1px solid var(--line-2); }
.lead-flow a[aria-current] { background: var(--info-t); }
.lead-flow b { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.lead-flow span { font-size: .84rem; color: var(--soft); font-weight: 700; }
.quiet { color: var(--warn); font-weight: 700; font-size: .78rem; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: .92rem; }

/* ---------- Remind all ---------- */
.pick-list { display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 14px; }
.pick-list > * { display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; }
.pick-list > * + * { border-top: 1px solid var(--line-2); }
.pick-list .grow { flex: 1; min-width: 0; } .pick-list b { display: block; } .pick-list small { color: var(--muted); }
.pick-list input { width: 18px; height: 18px; accent-color: var(--cobalt); }
.pick-list .btn.done { color: var(--good); border-color: #BFE6CC; background: var(--good-t); }

/* ---------- Undo in messages ---------- */
.toast { display: flex; align-items: center; gap: 14px; }
.toast-undo { margin-left: auto; background: none; border: 0; color: #AEB5FF; font: inherit; font-weight: 800; cursor: pointer; padding: 4px 2px; text-decoration: underline; text-underline-offset: 3px; }
.toast-undo:hover { color: #fff; }

/* ---------- Phone layout ---------- */
.bnav { display: none; }
@media (max-width: 900px) {
  .bnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px -20px rgba(22,20,59,.4); }
  .bnav a, .bnav button { display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none; font: inherit; font-size: .72rem; font-weight: 700; color: var(--muted); text-decoration: none; position: relative; cursor: pointer; border-radius: 10px; }
  .bnav svg { width: 22px; height: 22px; }
  .bnav [aria-current] { color: var(--cobalt); background: var(--info-t); }
  .bnav em { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--bad); color: #fff; font-style: normal; font-size: .68rem; display: grid; place-items: center; }
  .content { padding-bottom: 110px; }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
  .toast { max-width: none; }
}
@media (max-width: 600px) {
  .btn { height: 44px; } .btn.sm { height: 38px; padding: 0 12px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .filters button, .fbtn { flex: none; height: 38px; }
  .next-step { flex-wrap: wrap; } .next-step .btn { width: 100%; }
  .li { flex-wrap: wrap; } .li .btn { margin-left: 50px; }
  .lead-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lead-flow a:nth-child(3) { border-left: 0; } .lead-flow a:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .overlay { padding: 0; place-items: end stretch; }
  .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .note-form { grid-template-columns: 1fr; }
  .client-head { flex-wrap: wrap; }
  .page-head { flex-wrap: wrap; gap: 12px; }
}

/* ---------- Phone fixes: nothing wider than the screen ---------- */
.content > *, .cols > *, .stack > *, .client-head > * { min-width: 0; }
.chart-table { overflow-x: auto; }
.page-head > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
.client-head h1 { overflow-wrap: anywhere; }
td b, td .chip, td.num { white-space: nowrap; }
@media (max-width: 600px) {
  .client-head h1 { font-size: 1.45rem; }
  .client-head .meta { flex-wrap: wrap; }
  .client-head > div:last-child { width: 100%; }
  .client-head > div:last-child .btn { flex: 1; }
  .page-head > div:last-child { width: 100%; }
  .page-head > div:last-child .btn.primary { flex: 1; }
  td small { display: block; min-width: 9em; }
  td { vertical-align: top; }
}

/* ---------- Backups ---------- */
.restore-upload { margin-top: 14px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.restore-upload summary { cursor: pointer; font-weight: 700; font-size: .92rem; }
.restore-upload p { margin-top: 8px; }
