:root {
  --navy: #02204b; --navy-2: #0b2f63; --steel: #2a5d86; --orange: #e8620d; --orange-ink: #a34507;
  --ink: #132238; --muted: #56657a; --line: #dfe5ec; --line-2: #edf0f4; --bg: #f4f6f9; --card: #ffffff;
  --good: #1e7a3c; --good-bg: #e3f3e8; --warn: #7a5a00; --warn-bg: #fff4d6; --bad: #a8261b; --bad-bg: #fdecea;
  --soft: #fff8f2; --radius: 12px;
  --heading: #02204b; --solid: #02204b; --nav: #02204b; --ink-2: #33445a; --field: #ffffff; --field-line: #cfd7e2; --field-hover: #b7c3d2;
  --subtle: #f8fafc; --subtle-2: #f4f6f9; --track: #e8edf3; --chip: #eef2f7; --info-bg: #eaf1fa; --blue-bg: #e4edf7; --hot-bg: #fff0e4; --chart-s: #b7c7da; --call-line: #e8b48c; --link: #2a5d86;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Archivo', Arial, Helvetica, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--link); } a:hover { color: var(--heading); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.boot { padding: 40px; color: var(--muted); }

/* Layout */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.nav { flex: 1 1 230px; max-width: 100%; background-color: var(--nav);
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 20px 20px; color: #fff; padding: 22px 14px; display: flex; flex-direction: column; gap: 24px; }
.brand { font-weight: 800; font-size: 23px; letter-spacing: -.5px; padding: 0 10px; color: #fff; text-decoration: none; }
.brand span { color: #ff8a3d; }
.nav-links { display: flex; flex-direction: column; gap: 3px; }
.nav-links a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 8px; color: #c9d5e6; text-decoration: none; font-weight: 500; min-height: 44px; }
.nav-links a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-links a.on { background: rgba(255,255,255,.13); color: #fff; font-weight: 700; }
.nav-links .count { margin-left: auto; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.nav-foot { margin-top: auto; font-size: 12.5px; color: #c9d5e6; padding: 0 10px; display: flex; flex-direction: column; gap: 6px; }
.nav-foot strong { color: #fff; }
.nav-foot button { background: none; border: 0; color: #c9d5e6; padding: 0; text-align: left; cursor: pointer; text-decoration: underline; }
.main { flex: 999 1 560px; min-width: 0; padding: 30px 36px 60px; display: flex; flex-direction: column; gap: 22px; }
@media (max-width: 700px) { .main { padding: 20px 16px 48px; } .nav { padding: 14px; gap: 12px; } .nav-links { flex-direction: row; flex-wrap: wrap; } .nav-foot { display: none; } }

/* Headings */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.eyebrow { margin: 0 0 4px; font-size: 12.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.6px; color: var(--heading); text-wrap: balance; }
h2 { margin: 0; font-size: 17px; font-weight: 700; color: var(--heading); }
h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--heading); }
.sub { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }

/* Cards and grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .v { font-size: 30px; font-weight: 800; color: var(--heading); font-variant-numeric: tabular-nums; margin-top: 4px; }
.tile .n { font-size: 13px; color: var(--muted); margin-top: 6px; }
.bar { height: 6px; background: var(--track); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--orange); border-radius: 99px; }
.bar.steel > i { background: var(--steel); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.list > * + * { border-top: 1px solid var(--line-2); }
.list-item { padding: 12px 0; }
.empty { color: var(--muted); padding: 18px 0; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--heading); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--field-hover); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 700; }
.btn.primary:hover { background: #d5570a; }
.btn.dark { background: var(--solid); border-color: var(--solid); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: default; }
.chip-btn { min-height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--field-line); background: var(--card); color: var(--heading); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip-btn[aria-pressed="true"] { background: var(--solid); border-color: var(--solid); color: #fff; }
label.field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], input[type=tel], select, textarea {
  min-height: 44px; padding: 9px 12px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--field); width: 100%; font-weight: 400; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 20px; height: 20px; margin-top: 1px; flex: 0 0 auto; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.error-box { background: var(--bad-bg); color: var(--bad); border-radius: 8px; padding: 10px 14px; }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 12px 16px; }
.notice.good { background: var(--good-bg); color: var(--good); }
.notice.info { background: var(--info-bg); color: var(--heading); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }

/* Badges */
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--chip); color: var(--ink-2); white-space: nowrap; }
.b-good { background: var(--good-bg); color: var(--good); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-hot { background: var(--hot-bg); color: var(--orange-ink); }
.b-blue { background: var(--blue-bg); color: var(--heading); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 12px 14px; white-space: nowrap; }
td { padding: 11px 14px; border-top: 1px solid var(--line-2); vertical-align: top; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--subtle); }
td .sec { font-size: 12.5px; color: var(--muted); }

/* Chart */
.chart { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 6px; align-items: end; height: 170px; border-bottom: 1px solid var(--line); margin-top: 14px; }
.chart .col { display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.chart .s { flex: 1; background: var(--chart-s); border-radius: 3px 3px 0 0; min-height: 2px; }
.chart .r { flex: 1; background: var(--orange); border-radius: 3px 3px 0 0; min-height: 2px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Steps editor */
.steps { display: flex; flex-direction: column; gap: 12px; }
.step { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--card); display: flex; flex-direction: column; gap: 10px; }
.step.call { border-style: dashed; border-color: var(--call-line); background: var(--soft); }
.step-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.step-type { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--link); }
.step.call .step-type { color: var(--orange-ink); }
.delay { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.delay input { width: 80px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 12px; min-height: 44px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--heading); border-bottom-color: var(--orange); }
.pre { white-space: pre-wrap; background: var(--subtle); border: 1px solid var(--line-2); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; }

/* Calls */
.call-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 16px 0; }
.call-card .phone { font-weight: 700; color: var(--link); font-size: 15px; text-align: right; }
.outcomes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.script { grid-column: 1 / -1; }

/* Replies */
.inbox { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.thread-list { flex: 1 1 300px; display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.thread-btn { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px 14px; border-radius: 8px; border: 1px solid transparent; background: var(--card); cursor: pointer; width: 100%; }
.thread-btn[aria-pressed="true"] { border-color: var(--orange); background: var(--soft); }
.thread-btn .unread { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); display: inline-block; margin-right: 6px; }
.thread-view { flex: 2 1 460px; min-width: 0; }
.msg { border-radius: 10px; padding: 12px 14px; }
.msg.out { background: var(--subtle-2); }
.msg.in { border: 1px solid var(--line); }
.msg .meta { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.msg .body { white-space: pre-wrap; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(2, 32, 75, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--card); border-radius: 14px; padding: 24px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 16px; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background-color: var(--nav); background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 24px 24px; }
.auth-box { background: var(--card); border-radius: 16px; padding: 30px; width: min(440px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-box .brand { color: var(--heading); padding: 0; font-size: 26px; }
.auth-pitch { color: var(--muted); margin: -6px 0 0; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--solid); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 600; display: none; z-index: 60; max-width: calc(100% - 32px); }
#toast.show { display: block; }
#toast.err { background: var(--bad); }
@media (prefers-reduced-motion: no-preference) { .bar > i { transition: width .4s; } }

/* Dark mode: chosen in Settings → Display, or follows the device. */
:root[data-theme="dark"] { --bg: #0c1422; --card: #141f31; --line: #26354b; --line-2: #1d2a3e; --ink: #e2e8f1; --ink-2: #c3cedc; --muted: #9babbf;
  --heading: #f2f6fb; --solid: #2c5788; --nav: #08111f; --link: #86b8e6; --steel: #86b8e6; --orange-ink: #ffaa6e;
  --good: #74d69c; --good-bg: #133323; --warn: #f1cb69; --warn-bg: #362c10; --bad: #ff958b; --bad-bg: #3b1918; --soft: #261b12;
  --field: #0f1828; --field-line: #33445d; --field-hover: #4a5e7a; --subtle: #18253a; --subtle-2: #1a273b; --track: #24334a;
  --chip: #213047; --info-bg: #15263d; --blue-bg: #1b2d47; --hot-bg: #3a2414; --chart-s: #4d6585; --call-line: #7a4e2c;
  color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0c1422; --card: #141f31; --line: #26354b; --line-2: #1d2a3e; --ink: #e2e8f1; --ink-2: #c3cedc; --muted: #9babbf;
  --heading: #f2f6fb; --solid: #2c5788; --nav: #08111f; --link: #86b8e6; --steel: #86b8e6; --orange-ink: #ffaa6e;
  --good: #74d69c; --good-bg: #133323; --warn: #f1cb69; --warn-bg: #362c10; --bad: #ff958b; --bad-bg: #3b1918; --soft: #261b12;
  --field: #0f1828; --field-line: #33445d; --field-hover: #4a5e7a; --subtle: #18253a; --subtle-2: #1a273b; --track: #24334a;
  --chip: #213047; --info-bg: #15263d; --blue-bg: #1b2d47; --hot-bg: #3a2414; --chart-s: #4d6585; --call-line: #7a4e2c;
  color-scheme: dark; } }
.theme-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.theme-opt { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; text-align: left; font-weight: 700; color: var(--heading); }
.theme-opt[aria-pressed="true"] { border-color: var(--orange); }
.theme-opt .sw { height: 70px; border-radius: 8px; border: 1px solid var(--line); display: grid; grid-template-columns: 30% 1fr; overflow: hidden; }
.theme-opt .sw i { display: block; }
.sw.light i:first-child { background: #02204b; } .sw.light i:last-child { background: #f4f6f9; }
.sw.dark i:first-child { background: #08111f; } .sw.dark i:last-child { background: #141f31; }
.sw.system { grid-template-columns: 1fr 1fr; } .sw.system i:first-child { background: #f4f6f9; } .sw.system i:last-child { background: #141f31; }

/* Greeting and live clock */
.greet-time { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.greet-time .clock { font-size: 26px; font-weight: 800; color: var(--heading); font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.greet-time .date { color: var(--muted); font-size: 13.5px; }
.nav-clock { font-variant-numeric: tabular-nums; }

/* Griddy helper */
#griddy-btn { position: fixed; right: 20px; bottom: 20px; z-index: 55; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px 0 8px; border-radius: 99px; border: 0; background: var(--orange); color: #fff; font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: 0 6px 20px rgba(2,32,75,.28); }
#griddy-btn:hover { background: #d5570a; }
#griddy-btn[hidden], #griddy[hidden] { display: none; }
.griddy-face { width: 38px; height: 38px; flex: 0 0 auto; }
#griddy { position: fixed; right: 20px; bottom: 84px; z-index: 56; width: min(390px, calc(100vw - 32px)); height: min(580px, calc(100vh - 110px)); background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 48px rgba(2,32,75,.3); display: flex; flex-direction: column; overflow: hidden; }
.g-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; background: var(--nav); color: #fff; }
.g-head strong { display: block; font-size: 15px; } .g-head span { font-size: 12px; color: #c9d5e6; }
.g-head button { margin-left: auto; background: none; border: 0; color: #fff; width: 40px; height: 40px; border-radius: 8px; cursor: pointer; font-size: 22px; line-height: 1; }
.g-head button:hover { background: rgba(255,255,255,.1); }
.g-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.g-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.g-msg.bot { background: var(--subtle-2); border: 1px solid var(--line-2); align-self: flex-start; border-bottom-left-radius: 4px; }
.g-msg.me { background: var(--solid); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.g-msg.typing { color: var(--muted); font-style: italic; }
.g-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.g-sugg button { border: 1px solid var(--field-line); background: var(--card); color: var(--heading); border-radius: 99px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: left; }
.g-sugg button:hover { border-color: var(--orange); }
.g-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.g-form input { flex: 1; min-width: 0; }
.g-foot { font-size: 11px; color: var(--muted); padding: 0 12px 8px; }
@media (max-width: 700px) { #griddy-btn { right: 12px; bottom: 12px; } #griddy { right: 8px; bottom: 76px; width: calc(100vw - 16px); } #toast { bottom: 76px; } }

/* Plan banner and billing */
.plan-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px; border-radius: 10px; background: var(--info-bg); color: var(--heading); font-size: 13.5px; }
.plan-banner > span:first-child { flex: 1 1 260px; }
.plan-banner.locked { background: var(--warn-bg); color: var(--warn); }
.pb-bar { flex: 0 1 140px; height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.pb-bar i { display: block; height: 100%; background: var(--orange); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: stretch; }
.plan-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.plan-card.featured { border: 2px solid var(--orange); }
.plan-card.current::after { content: 'Current plan'; position: absolute; top: 14px; right: 14px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--good-bg); color: var(--good); }
.pc-tag { position: absolute; top: -12px; left: 18px; background: var(--orange); color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.pc-price { display: flex; align-items: baseline; gap: 4px; }
.pc-price strong { font-size: 32px; font-weight: 800; color: var(--heading); letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.pc-price span { color: var(--muted); }
.plan-card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.plan-card .btn { width: 100%; }
.seats { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper output { min-width: 28px; text-align: center; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.stepper .btn { width: 36px; padding: 0; font-size: 18px; }
