/* Super Glazing CRM
   Navy frames the work; yellow only means "act on this now". */

:root {
  --navy: #001935;
  --navy-2: #0a2747;
  --navy-3: #18395c;
  --yellow: #ffcc00;
  --yellow-soft: #fff4c2;
  --glass: #b7dbde;
  --glass-2: #dcedef;
  --glass-3: #eef6f7;
  --paper: #f5f8f9;
  --white: #ffffff;
  --ink: #10202f;
  --ink-2: #44566a;
  --ink-3: #6d7e8e;
  --line: #d9e3e7;
  --line-2: #e8eef1;
  --red: #b42318;
  --red-soft: #fdecea;
  --green: #1e7a46;
  --green-soft: #e3f4ea;
  --orange: #b4532a;

  --s-new: #8a6a00;      --s-new-bg: #fff4c2;
  --s-contacted: #1f5f99; --s-contacted-bg: #e2eefa;
  --s-survey: #5b3fa8;   --s-survey-bg: #eeeafa;
  --s-quoted: #a8481c;   --s-quoted-bg: #fcebe2;
  --s-won: #1e7a46;      --s-won-bg: #e3f4ea;
  --s-lost: #5f6b76;     --s-lost-bg: #eceff1;

  --src-website: #2a78d6;
  --src-facebook: #eb6834;
  --src-canvasser: #1baf7a;
  --src-phone: #7a5cc4;
  --src-other: #c98500;

  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --r: 6px;
  --r-lg: 10px;
  --side: 236px;
  --tab: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-variation-settings: "wdth" 100;
}
img { max-width: 100%; }
a { color: var(--s-contacted); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.i { flex: none; display: block; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--yellow); color: var(--navy); padding: 8px 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Frame ---------- */

.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side);
  background: var(--navy); color: #cfe0ea;
  display: flex; flex-direction: column; z-index: 20;
}
.brand { display: block; padding: 18px 22px 8px; }
.brand img { width: 150px; height: auto; display: block; }
.side-nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.side-nav a, .me {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r);
  color: #cfe0ea; text-decoration: none; font-weight: 500;
}
.side-nav a:hover { background: var(--navy-2); color: var(--white); }
.side-nav a.on { background: var(--navy-3); color: var(--white); box-shadow: inset 3px 0 0 var(--yellow); }
.pill-count {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 11px; background: var(--yellow); color: var(--navy);
  font-size: 12px; font-weight: 700; display: inline-grid; place-items: center;
}
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--navy-3); display: flex; align-items: center; gap: 4px; }
.me { flex: 1; min-width: 0; padding: 8px; }
.me:hover { background: var(--navy-2); }
.me span:last-child { min-width: 0; color: var(--white); font-size: 14px; line-height: 1.25; }
.me small { display: block; color: #8fa8ba; font-size: 12px; }
.avatar {
  --c: #2f6f8f;
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--c); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-grid; place-items: center; letter-spacing: .02em;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.icon-btn {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  width: 38px; height: 38px; border-radius: var(--r); display: grid; place-items: center;
}
.side .icon-btn:hover { background: var(--navy-2); color: #fff; }

.main-wrap { margin-left: var(--side); min-height: 100vh; }
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: rgba(245, 248, 249, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-2);
}
.top-brand { display: none; }
.search {
  flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r);
  padding: 0 12px; color: var(--ink-3);
}
.search:focus-within { border-color: var(--navy-3); }
.search input { border: 0; outline: 0; background: transparent; padding: 10px 0; width: 100%; color: var(--ink); }
.add-lead { margin-left: auto; }
.main { padding: 24px 28px 64px; max-width: 1400px; }

.tabbar { display: none; }

/* ---------- Type & headings ---------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 28px; font-weight: 700; font-variation-settings: "wdth" 112; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
h2.h { font-size: 17px; font-weight: 650; font-variation-settings: "wdth" 106; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head a { font-size: 14px; }

/* ---------- Buttons & form controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--white); color: var(--ink);
  padding: 9px 14px; border-radius: var(--r); cursor: pointer;
  font-weight: 600; font-size: 14px; text-decoration: none; line-height: 1.2; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn-navy { background: var(--navy); border-color: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--navy-3); border-color: var(--navy-3); }
.btn-yellow { background: var(--yellow); border-color: var(--yellow); color: var(--navy); }
.btn-yellow:hover { background: #ffd633; border-color: #e6b800; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--glass-3); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 13px 18px; font-size: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { border: 0; background: none; padding: 0; color: var(--s-contacted); cursor: pointer; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.link-btn.danger { color: var(--red); }

.field { display: block; margin-bottom: 14px; }
.field > span, .label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, select.input, textarea.input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--white); color: var(--ink);
}
.field textarea, textarea.input { resize: vertical; min-height: 80px; line-height: 1.45; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: 0; border-color: var(--navy-3); box-shadow: 0 0 0 3px var(--glass-2); }
.hint { display: block; font-size: 13px; color: var(--ink-3); margin-top: 5px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--navy); flex: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
code, .code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px;
  background: var(--glass-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 6px; word-break: break-all;
}
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row code { flex: 1; padding: 8px 10px; }

/* ---------- Surfaces ---------- */

.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.panel + .panel { margin-top: 16px; }
.panel-flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }

.flashes { padding: 16px 28px 0; display: grid; gap: 8px; max-width: 1400px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-radius: var(--r); background: var(--green-soft); color: var(--green); font-weight: 500; }
.flash span { flex: 1; color: var(--ink); }
.flash-error { background: var(--red-soft); color: var(--red); }
.flash-warn { background: var(--yellow-soft); color: #8a6a00; }
.flash-x { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 4px; }

/* ---------- Badges ---------- */

.stage {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; color: var(--c); background: var(--bg);
}
.stage::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stage-new { --c: var(--s-new); --bg: var(--s-new-bg); }
.stage-contacted { --c: var(--s-contacted); --bg: var(--s-contacted-bg); }
.stage-survey_booked { --c: var(--s-survey); --bg: var(--s-survey-bg); }
.stage-quoted { --c: var(--s-quoted); --bg: var(--s-quoted-bg); }
.stage-won { --c: var(--s-won); --bg: var(--s-won-bg); }
.stage-lost { --c: var(--s-lost); --bg: var(--s-lost-bg); }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 4px; background: var(--glass-3); color: var(--ink-2); border: 1px solid var(--line-2); white-space: nowrap; }
.tag-warn { background: var(--red-soft); color: var(--red); border-color: transparent; }

/* ---------- Dashboard ---------- */

.dash { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.dash-col { display: grid; gap: 20px; min-width: 0; }

/* The waiting list: the one loud thing in the app. */
.waiting { background: var(--navy); color: var(--white); border-radius: var(--r-lg); padding: 20px 20px 10px; }
.waiting-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.waiting-head h2 { font-size: 22px; font-weight: 700; font-variation-settings: "wdth" 115; }
.waiting-head h2 b { color: var(--yellow); }
.waiting-head a { color: var(--glass); font-size: 14px; }
.waiting-list { list-style: none; margin: 0; padding: 0; }
.wait {
  display: grid; grid-template-columns: 8px minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--navy-3);
}
.wait-bar { align-self: stretch; border-radius: 4px; background: var(--yellow); }
.wait.late .wait-bar { background: #ff8a4c; }
.wait-name { font-weight: 650; font-size: 16px; color: var(--white); text-decoration: none; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-name:hover { text-decoration: underline; }
.wait-meta { color: #9fb7c8; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-time { text-align: right; font-variant-numeric: tabular-nums; line-height: 1.2; }
.wait-time b { display: block; font-size: 20px; font-weight: 700; font-variation-settings: "wdth" 85; color: var(--yellow); }
.wait.late .wait-time b { color: #ff9d66; }
.wait-time small { color: #9fb7c8; font-size: 12px; }
.waiting .btn-call { background: var(--yellow); color: var(--navy); border: 0; padding: 10px 14px; }
.waiting-empty { padding: 4px 0 14px; color: #cfe0ea; }
.waiting-empty b { color: var(--white); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); }
.kpi { padding: 16px 18px; border-left: 1px solid var(--line-2); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.kpi-value { font-size: 30px; font-weight: 700; font-variation-settings: "wdth" 88; letter-spacing: -.01em; line-height: 1.15; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; color: var(--ink-3); }
.kpi-sub .up { color: var(--green); font-weight: 600; }
.kpi-sub .down { color: var(--red); font-weight: 600; }

.range { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--white); }
.range a { padding: 6px 12px; font-size: 13px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
.range a + a { border-left: 1px solid var(--line); }
.range a.on { background: var(--navy); color: var(--white); }

.today-list { list-style: none; margin: 0; padding: 0; }
.today-item { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.today-item:first-child { border-top: 0; }
.today-time { font-weight: 700; font-variant-numeric: tabular-nums; font-variation-settings: "wdth" 90; font-size: 17px; }
.today-time small { display: block; font-weight: 500; color: var(--ink-3); font-size: 12px; }
.today-item a { font-weight: 600; text-decoration: none; color: var(--ink); }
.today-item a:hover { text-decoration: underline; }

.funnel { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.funnel li { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.funnel-bar { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; border-radius: 5px; background: var(--c); min-width: 4px; }
.funnel li a { color: var(--ink); text-decoration: none; }
.funnel li a:hover { text-decoration: underline; }

.setup { background: var(--yellow-soft); border: 1px solid #f2dc7a; border-radius: var(--r-lg); padding: 14px 18px; }
.setup h2 { font-size: 15px; margin-bottom: 6px; }
.setup ul { margin: 0; padding-left: 18px; }
.setup li { margin: 3px 0; }
.setup a { color: var(--navy); font-weight: 500; }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-3); font-size: 11px; font-family: var(--font); }
.chart .bar-hit { fill: transparent; cursor: default; }
.chart .bar-hit:hover + g rect, .chart g.col:hover rect { opacity: .85; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.tip {
  position: absolute; pointer-events: none; z-index: 5; background: var(--navy); color: var(--white);
  font-size: 13px; padding: 8px 10px; border-radius: var(--r); min-width: 140px; transform: translate(-50%, -100%); margin-top: -8px;
  box-shadow: 0 6px 18px rgba(0, 25, 53, .25);
}
.tip[hidden] { display: none; }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tip div span { display: flex; align-items: center; gap: 6px; color: #cfe0ea; }
.tip i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--glass-3); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--glass-3); }
.cell-name { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.cell-name a { font-weight: 600; color: var(--ink); text-decoration: none; }
.cell-name small { display: block; color: var(--ink-3); font-size: 12.5px; }
.new-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 0 3px var(--yellow-soft); flex: none; }
.dot-src { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot-src::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--ink-3)); }

/* ---------- Leads list ---------- */

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--ink-2); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.chip b { font-weight: 500; color: var(--ink-3); }
.chip.on { background: var(--navy); border-color: var(--navy); color: var(--white); }
.chip.on b { color: var(--glass); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 14px; color: var(--ink-2); }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }
.empty h2 { font-size: 18px; color: var(--ink); margin-bottom: 6px; }
.lead-cards { display: none; }

/* ---------- Pipeline ---------- */

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(196px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; scroll-snap-type: x mandatory; }
.col { background: var(--glass-3); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 10px; scroll-snap-align: start; min-height: 220px; }
.col.over { background: var(--glass-2); border-color: var(--glass); }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 10px; }
.col-head h2 { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.col-head h2 .n { color: var(--ink-3); font-weight: 500; }
.col-value { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cards { display: grid; gap: 8px; min-height: 160px; align-content: start; }
.card {
  display: block; background: var(--white); border: 1px solid var(--line); border-radius: var(--r);
  padding: 10px 12px; text-decoration: none; color: var(--ink); cursor: grab; position: relative;
}
.card:hover { border-color: var(--ink-3); }
.card.dragging { opacity: .45; }
.card.uncalled { border-left: 4px solid var(--yellow); padding-left: 9px; }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card-name { font-weight: 650; font-size: 14.5px; color: var(--ink); text-decoration: none; }
.card-name:hover { text-decoration: underline; }
.card-value { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.card-meta { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.card-move { display: none; }

/* ---------- Contact page ---------- */

.contact-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; margin-bottom: 18px; }
.contact-title { display: flex; align-items: center; gap: 14px; }
.contact-title .avatar { width: 52px; height: 52px; font-size: 18px; }
.contact-title h1 { font-size: 26px; font-weight: 700; font-variation-settings: "wdth" 110; }
.contact-sub { color: var(--ink-2); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.stage-track { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 20px; }
.stage-track form { display: contents; }
.stage-step {
  border: 0; padding: 10px 6px 8px; background: var(--white); color: var(--ink-3); font-weight: 600; font-size: 13px;
  border-top: 4px solid var(--line); cursor: pointer; text-align: center; border-radius: 0;
}
.stage-step:hover { color: var(--ink); background: var(--glass-3); }
.stage-step.done { border-top-color: var(--navy-3); color: var(--ink-2); }
.stage-step.current { border-top-color: var(--yellow); color: var(--ink); background: var(--white); }
.stage-step.current.won { border-top-color: var(--s-won); }
.stage-step.current.lost { border-top-color: var(--s-lost); }

.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 600; color: var(--ink-3); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--navy); }
.tab-panel[hidden] { display: none; }
.composer textarea { min-height: 96px; }
.composer-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.templates { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.templates button { font-size: 12.5px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass-3); cursor: pointer; color: var(--ink-2); }
.templates button:hover { border-color: var(--ink-3); color: var(--ink); }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 8px; bottom: 8px; width: 2px; background: var(--line-2); }
.ev { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 8px 0; }
.ev-ic { width: 32px; height: 32px; border-radius: 50%; background: var(--white); border: 2px solid var(--line); display: grid; place-items: center; color: var(--ink-3); position: relative; }
.ev-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13.5px; }
.ev-head strong { font-weight: 650; }
.ev-time { color: var(--ink-3); font-size: 12.5px; margin-left: auto; white-space: nowrap; }
.ev-body { margin-top: 4px; white-space: pre-wrap; word-break: break-word; font-size: 14px; color: var(--ink); }
.ev-bubble { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px; }
.ev.out .ev-bubble { background: var(--glass-3); border-color: var(--glass-2); }
.ev.in .ev-bubble { background: var(--yellow-soft); border-color: #f3e3a0; }
.ev.in .ev-ic { border-color: var(--yellow); color: var(--navy); background: var(--yellow); }
.ev.t-note .ev-bubble { background: #fffdf4; }
.ev.quiet .ev-body { color: var(--ink-2); font-size: 13.5px; margin-top: 0; }
.ev.quiet .ev-ic { width: 32px; height: 20px; border: 0; background: transparent; }
.ev.quiet .ev-ic::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.ev.quiet .ev-ic svg { display: none; }
.ev-status { font-size: 12px; color: var(--ink-3); }
.ev-status.bad { color: var(--red); }

.side-panel h2 { font-size: 15px; margin-bottom: 10px; }
.dl { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; margin: 0; font-size: 14px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; word-break: break-word; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.mini-list li:first-child { border-top: 0; padding-top: 0; }
.mini-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.mini-row b { font-variant-numeric: tabular-nums; }
.mini-actions { display: flex; gap: 10px; margin-top: 4px; font-size: 13px; }
.mini-actions form { display: inline; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 6px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 12px; }

dialog.sheet {
  border: 0; border-radius: var(--r-lg); padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  box-shadow: 0 20px 60px rgba(0, 25, 53, .3); color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(0, 25, 53, .45); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.sheet-head h2 { font-size: 17px; }
.sheet-body { padding: 18px 20px 8px; }
.sheet-foot { padding: 12px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Calendar ---------- */

.cal-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.cal-bar h1 { font-size: 24px; font-weight: 700; font-variation-settings: "wdth" 110; margin-right: auto; }
.week { display: grid; grid-template-columns: 52px repeat(7, minmax(110px, 1fr)); background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: auto; }
.week-head { position: sticky; top: 0; background: var(--white); border-bottom: 1px solid var(--line); padding: 8px; text-align: center; font-size: 13px; color: var(--ink-2); z-index: 2; }
.week-head b { display: block; font-size: 20px; color: var(--ink); font-variation-settings: "wdth" 90; }
.week-head.today b { background: var(--yellow); color: var(--navy); border-radius: 50%; width: 34px; height: 34px; line-height: 34px; margin: 0 auto; }
.hours { position: relative; }
.hour { height: 56px; border-top: 1px solid var(--line-2); font-size: 11px; color: var(--ink-3); text-align: right; padding: 2px 6px 0 0; }
.day-col { position: relative; border-left: 1px solid var(--line-2); }
.day-col .slot { height: 56px; border-top: 1px solid var(--line-2); }
.day-col.today { background: #fffdf2; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 3; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.appt {
  position: absolute; left: 3px; right: 3px; border-radius: 5px; padding: 4px 6px; overflow: hidden;
  background: color-mix(in srgb, var(--c) 14%, white); border-left: 4px solid var(--c);
  font-size: 12px; line-height: 1.3; color: var(--ink); text-decoration: none; z-index: 1;
}
.appt:hover { z-index: 4; box-shadow: 0 4px 12px rgba(0, 25, 53, .18); }
.appt b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.done { opacity: .6; }
.appt.cancelled { opacity: .45; text-decoration: line-through; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--white); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.month-dow { padding: 8px; font-size: 13px; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--line); background: var(--glass-3); }
.month-day { min-height: 112px; padding: 6px; border-top: 1px solid var(--line-2); border-left: 1px solid var(--line-2); font-size: 12.5px; }
.month-day:nth-child(7n + 1) { border-left: 0; }
.month-day.other { background: var(--paper); color: var(--ink-3); }
.month-day.today .mday { background: var(--yellow); color: var(--navy); }
.mday { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 600; }
.m-appt { display: block; margin-top: 3px; padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, var(--c) 14%, white); border-left: 3px solid var(--c); color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda { display: none; }
.cal-key { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.cal-key span { display: inline-flex; gap: 6px; align-items: center; }
.cal-key i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }

/* ---------- Settings ---------- */

.settings { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { display: grid; gap: 2px; position: sticky; top: 80px; }
.settings-nav a { padding: 9px 12px; border-radius: var(--r); text-decoration: none; color: var(--ink-2); font-weight: 600; }
.settings-nav a:hover { background: var(--white); color: var(--ink); }
.settings-nav a.on { background: var(--white); color: var(--ink); box-shadow: inset 3px 0 0 var(--navy); }
.settings-body { max-width: 860px; display: grid; gap: 16px; }
.settings-body .panel h2 { font-size: 17px; margin-bottom: 4px; }
.settings-body .panel > p { margin: 0 0 16px; color: var(--ink-2); }
.step-list { display: grid; gap: 10px; }
.step { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--white); display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; }
.step.off { background: var(--paper); }
.step.off textarea, .step.off input:not([type=checkbox]), .step.off select { opacity: .6; }
.step-when { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; font-size: 14px; }
.step-when input[type=number] { width: 70px; }
.step-when select, .step-when input { padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; margin-top: 4px; }
.vars { font-size: 13px; color: var(--ink-2); }
.vars code { font-size: 12px; margin: 2px 2px 0 0; display: inline-block; cursor: copy; }
.ol { margin: 0; padding-left: 20px; }
.ol li { margin-bottom: 8px; }

/* ---------- Login ---------- */

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px); background: var(--white); }
.login-art { background: var(--navy); color: var(--white); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art img { width: 200px; height: auto; position: relative; }
.login-art p { z-index: 1; text-shadow: 0 2px 12px rgba(0,25,53,.6); font-size: 34px; line-height: 1.15; font-weight: 700; font-variation-settings: "wdth" 115; max-width: 14ch; margin: 0; position: relative; }
.login-art .panes { position: absolute; right: -80px; bottom: -60px; width: 420px; height: 480px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 14px; border: 14px solid var(--yellow); transform: rotate(-6deg); opacity: .9; }
.login-art .panes i { background: linear-gradient(135deg, rgba(183, 219, 222, .55), rgba(183, 219, 222, .18) 55%, rgba(183, 219, 222, .4)); }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: 48px; }
.login-form h1 { font-size: 26px; margin-bottom: 6px; font-variation-settings: "wdth" 110; }
.login-form > p { color: var(--ink-2); margin: 0 0 24px; }
.login-form .btn { width: 100%; }
.err { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: var(--r); margin-bottom: 14px; font-size: 14px; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .dash { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--line-2); }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  body { font-size: 15.5px; }
  .side { display: none; }
  .main-wrap { margin-left: 0; padding-bottom: calc(var(--tab) + env(safe-area-inset-bottom)); }
  .top { padding: 10px 14px; gap: 10px; }
  .top-brand { display: block; }
  .top-brand img { display: block; border-radius: 6px; }
  .add-lead span { display: none; }
  .add-lead { padding: 9px 10px; }
  .main { padding: 16px 14px 40px; }
  .flashes { padding: 12px 14px 0; }
  .page-head h1 { font-size: 24px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--navy); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; color: #9fb7c8; text-decoration: none; font-size: 11px; font-weight: 600; position: relative; }
  .tabbar a.on { color: var(--white); box-shadow: inset 0 3px 0 var(--yellow); }
  .tabbar .pill-count { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }

  .wait { grid-template-columns: 6px minmax(0, 1fr) auto; gap: 10px; }
  .wait .btn-call span { display: none; }
  .wait-time { display: none; }
  .wait-meta .t-mobile { display: inline; color: var(--yellow); font-weight: 600; }
  .waiting-head h2 { font-size: 19px; }

  .table-leads { display: none; }
  .lead-cards { display: grid; gap: 0; }
  .lead-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 14px; border-top: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
  .lead-card:first-child { border-top: 0; }
  .lead-card strong { display: flex; gap: 8px; align-items: center; }
  .lead-card .meta { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); }

  .board { grid-auto-columns: 82vw; }
  .card-move { display: block; margin-top: 8px; width: 100%; padding: 6px; font-size: 13px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); }

  .contact-head { grid-template-columns: 1fr; }
  .actions { justify-content: flex-start; }
  .actions .btn { flex: 1; }
  .stage-track { grid-template-columns: repeat(3, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .week { display: none; }
  .month { display: none; }
  .agenda { display: block; }
  .settings { grid-template-columns: 1fr; }
  .settings-nav { position: static; grid-auto-flow: column; overflow-x: auto; }
  .settings-nav a { white-space: nowrap; }
  .step { grid-template-columns: 1fr auto; }
  .step-n { display: none; }

  .login-page { grid-template-columns: 1fr; }
  .login-art { padding: 28px; min-height: 220px; }
  .login-art p { font-size: 26px; }
  .login-art .panes { width: 170px; height: 220px; right: -50px; bottom: -90px; border-width: 9px; opacity: .55; }
  .login-form { padding: 28px; }
}

@media (min-width: 861px) {
  .wait-meta .t-mobile { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .wait-new { animation: arrive .6s ease-out; }
  @keyframes arrive { from { background: var(--navy-3); } to { background: transparent; } }
}

@media print {
  .side, .top, .tabbar, .actions, .composer { display: none !important; }
  .main-wrap { margin: 0; }
}
