/* Wasla design tokens. Brand: Strait teal (the logo tile: the water between Tangier and Tarifa) + sunset coral
   (the logo's dot: "a message arriving"). Coral is a fill, never text on a light background; text on coral uses --coral-ink. */
:root {
  --brand-50: #ecf7f7; --brand-100: #d5eff0; --brand-400: #5fc4c9; --brand-500: #14939c; --brand-600: #0e7c86; --brand-700: #0a5f69; --brand-900: #08363d;
  --coral: #ff7a59; --coral-soft: #ffe9e2; --coral-ink: #3a0f04; --coral-text: #a8391b;
  --bg: #f5f9f9; --surface: #ffffff; --surface-2: #edf4f4; --line: #dce8e8; --text: #0f2226; --muted: #52706f;
  --accent: var(--brand-600); --accent-soft: var(--brand-50); --accent-text: #ffffff;
  --brand-grad: linear-gradient(135deg, #0e7f89 0%, #0a5f69 100%);
  --ok: #187a4e; --ok-soft: #e1f4ea; --warn: #a2560a; --warn-soft: #fdeedd; --bad: #c2333b; --bad-soft: #fde7e8;
  --r: 14px; --r-sm: 10px; --shadow: 0 1px 2px rgb(8 54 61 / 7%), 0 6px 20px rgb(8 54 61 / 6%);
  --ring: 0 0 0 3px rgb(14 124 134 / 24%);
  --f0: #b9d0d0; --f1: #8fcbce; --f2: #4fb6bc; --f3: #0e7c86; --f4: #ff7a59;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1416; --surface: #101d20; --surface-2: #16272a; --line: #22373a; --text: #e5f1f1; --muted: #8fadad;
    --accent: var(--brand-400); --accent-soft: #113a3d; --accent-text: #0a1416;
    --coral-soft: #3d1d14; --coral-text: #ff9a80;
    --ok: #4cc38a; --ok-soft: #14301f; --warn: #f0a25a; --warn-soft: #3a2614; --bad: #f2787e; --bad-soft: #3d1b20;
    --shadow: 0 1px 2px rgb(0 0 0 / 35%); --ring: 0 0 0 3px rgb(95 196 201 / 30%);
    --f0: #4a6a6e; --f1: #1f8189; --f2: #2fa3aa; --f3: #5fc4c9; --f4: #ff7a59;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1416; --surface: #101d20; --surface-2: #16272a; --line: #22373a; --text: #e5f1f1; --muted: #8fadad;
  --accent: var(--brand-400); --accent-soft: #113a3d; --accent-text: #0a1416;
  --coral-soft: #3d1d14; --coral-text: #ff9a80;
  --ok: #4cc38a; --ok-soft: #14301f; --warn: #f0a25a; --warn-soft: #3a2614; --bad: #f2787e; --bad-soft: #3d1b20;
  --shadow: 0 1px 2px rgb(0 0 0 / 35%); --ring: 0 0 0 3px rgb(95 196 201 / 30%);
    --f0: #4a6a6e; --f1: #1f8189; --f2: #2fa3aa; --f3: #5fc4c9; --f4: #ff7a59;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
::selection { background: var(--brand-100); color: var(--brand-900); }
a { color: var(--accent); }
h1 { font-size: 24px; margin: 0; letter-spacing: -.02em; font-weight: 750; }
h2 { font-size: 16px; margin: 0 0 10px; letter-spacing: -.01em; }
h3 { font-size: 14px; margin: 0 0 6px; }
.muted { color: var(--muted); }
small, .small { font-size: 12px; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 12px; font-size: 18px; letter-spacing: -.02em; border-bottom: 1px solid var(--line); }
.brand b { font-weight: 800; }
.logo { width: 32px; height: 32px; border-radius: 8px; display: block; flex: none; box-shadow: 0 4px 12px rgb(14 124 134 / 30%); }
nav { display: grid; gap: 2px; }
nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; }
nav a:hover { background: var(--surface-2); }
nav a { transition: background .15s, color .15s; }
nav a.on { background: var(--brand-grad); color: #fff; font-weight: 650; box-shadow: 0 4px 14px rgb(14 124 134 / 28%); }
nav a .count { margin-left: auto; background: var(--coral); color: var(--coral-ink); border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 750; }
nav a .count.warn { background: var(--bad); color: #fff; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--muted); padding: 0 8px; }
main { padding: 24px 28px 60px; min-width: 0; outline: none; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head .grow { flex: 1; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; align-content: start; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }

button, .btn { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: var(--r-sm); padding: 7px 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
button { transition: border-color .15s, box-shadow .15s, filter .15s; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--brand-grad); border-color: transparent; color: #fff; font-weight: 650; box-shadow: 0 2px 8px rgb(14 124 134 / 25%); }
button.primary:hover { filter: brightness(1.07); border-color: transparent; }
button.danger { color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; }
button.small { padding: 4px 9px; font-size: 13px; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
input[type=color] { padding: 2px; height: 36px; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.f > span { font-weight: 600; color: var(--text); }
label.chk { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.hint { font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters select, .filters input { width: auto; }
.filters input[type=search] { min-width: 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border-radius: 99px; padding: 4px 11px; font-size: 13px; }
.chip.on { background: var(--brand-grad); color: #fff; border-color: transparent; }

.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.acc { background: var(--accent-soft); color: var(--accent); }
.tag.spark { background: var(--coral); color: var(--coral-ink); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: 0; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }
.score.hi { color: var(--ok); } .score.mid { color: var(--warn); } .score.lo { color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--surface); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.tablewrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--muted); }

.stat .n { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.bars div { flex: 1; background: var(--brand-grad); border-radius: 6px 6px 2px 2px; min-height: 2px; position: relative; }
.bars div:last-child { background: var(--coral); }
.bars div span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.meter { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.meter > div { height: 100%; background: var(--brand-grad); border-radius: 99px; }

/* inbox */
.inbox { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 14px; height: calc(100vh - 168px); min-height: 480px; }
.inbox.wide.reading { grid-template-columns: minmax(0, 1fr); }
.inbox.wide.reading .mlist { display: none; }
.mlist { overflow-y: auto; overflow-x: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.mitem { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; display: grid; gap: 2px; }
.mitem:hover { background: var(--surface-2); }
.mitem.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.mitem.unread .who { font-weight: 700; }
.mitem.unread .who::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--coral); margin-right: 6px; vertical-align: 1px; }
.mitem .top { display: flex; gap: 8px; align-items: baseline; }
.mitem .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mitem .subj { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mitem .row { flex-wrap: nowrap; min-width: 0; }
.mitem .snip { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.mtext { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); padding: 12px; border-radius: var(--r-sm); }
.mhead { flex: none; padding: 14px 18px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.mhead h2 { font-size: 19px; line-height: 1.3; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mhead .ai-note { padding: 8px 12px; }
.sender { font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-weight: 750; font-size: 14px; flex: none; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.toolbar .btn.small { padding: 4px 9px; font-size: 13px; }
.mpanel { flex: none; max-height: 38%; overflow: auto; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.mbody { flex: 1; min-height: 0; display: flex; background: #fff; }
.mbody iframe { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.mbody .mtext { flex: 1; overflow: auto; margin: 0; border-radius: 0; background: var(--surface); color: var(--text); padding: 20px 28px; font-size: 15px; line-height: 1.65; }
.mcompose { flex: none; display: grid; gap: 8px; padding: 12px 18px 14px; border-top: 1px solid var(--line); background: var(--surface); max-height: 55%; overflow: auto; box-shadow: 0 -8px 20px rgb(8 54 61 / 8%); }
.mcompose textarea { min-height: 120px; }
.row.nowrap { flex-wrap: nowrap; min-width: 0; }
.ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd { font: 600 11px/1.6 ui-monospace, "Cascadia Mono", Consolas, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); color: var(--text); }
.kbd-hint { white-space: nowrap; }
.ai-note { background: var(--accent-soft); border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px; border-left: 3px solid var(--accent); }
.thread { display: grid; gap: 8px; }
.thread .t { border-left: 3px solid var(--line); padding: 4px 10px; font-size: 13px; }
.thread .t.out { border-color: var(--accent); }
.thread .t pre { white-space: pre-wrap; font: inherit; margin: 4px 0 0; color: var(--muted); max-height: 120px; overflow: hidden; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty::before { content: ""; display: block; width: 40px; height: 40px; margin: 0 auto 12px; background: url(/logo.svg) center / contain no-repeat; opacity: .35; filter: grayscale(.4); }
.empty:has(> button:only-child)::before { display: none; }

/* campaigns */
.step { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: grid; gap: 8px; background: var(--surface-2); }
.step .row label.f { flex: 1; }
.preview-frame { width: 100%; min-height: 380px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.ph { display: flex; flex-wrap: wrap; gap: 4px; }
.ph code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12px; cursor: pointer; }
.review-item { display: grid; gap: 8px; }
.review-item textarea { min-height: 160px; }

/* modal + toast */
.modal { position: fixed; inset: 0; background: rgb(14 14 40 / 50%); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal .box { background: var(--surface); border-radius: var(--r); width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 20px; box-shadow: 0 20px 60px rgb(0 0 0 / 30%); display: grid; gap: 14px; }
.modal .box.wide { width: min(980px, 100%); }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--brand-900); color: #fff; border-left: 4px solid var(--coral); padding: 10px 14px; border-radius: var(--r-sm); box-shadow: var(--shadow); max-width: 380px; }
.toast.err { background: var(--bad); color: #fff; }
.banner { border-radius: var(--r-sm); padding: 10px 14px; background: var(--coral-soft); color: var(--coral-text); margin-bottom: 14px; border-left: 3px solid var(--coral); }
.banner.info { background: var(--accent-soft); color: var(--accent); }
.needs { display: grid; gap: 10px; }
.needs-list { display: grid; }
.need { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; min-width: 0; }
.need + .need { border-top: 1px solid var(--line); }
.need:hover { background: var(--surface-2); }
.need-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.need-dot.bad { background: var(--bad); } .need-dot.spark { background: var(--coral); } .need-dot.ok { background: var(--ok); }
.all-clear { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.place { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.place.known { opacity: .6; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2s; } }

.modal.login { background: radial-gradient(1200px 600px at 20% 0%, #14939c 0%, transparent 60%), radial-gradient(900px 500px at 100% 100%, #ff7a59 0%, transparent 45%), #06282d; backdrop-filter: none; }
.modal.login .box { width: min(400px, 100%); padding: 28px; }
.modal.login .box h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }

/* thin, tinted scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  nav { display: flex; flex-wrap: wrap; }
  .side-foot { display: none; }
  main { padding: 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .mlist { max-height: 45vh; }
  .inbox.reading .mlist { display: none; }
  .mview { min-height: 80vh; }
  .kbd-hint { display: none; }
}

/* ---- icons + navigation ---- */
.ic { flex: none; display: inline-block; vertical-align: -3px; }
button .ic, .btn .ic { margin: 0 -1px; }
nav a .ic { opacity: .8; }
nav a.on .ic { opacity: 1; }
.nav-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 14px 10px 4px; opacity: .8; }
nav .nav-group:first-child { padding-top: 4px; }
.btn.primary { background: var(--brand-grad); border-color: transparent; color: #fff; font-weight: 650; box-shadow: 0 2px 8px rgb(14 124 134 / 25%); }
.btn.primary:hover { filter: brightness(1.07); }
.btn:hover { border-color: var(--accent); }

/* ---- dashboard ---- */
.dash-head { align-items: flex-end; gap: 10px; }
.dash-head h1 { font-size: 28px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; flex: 1; }
.pill { background: var(--coral); color: var(--coral-ink); font-weight: 750; font-size: 12px; border-radius: 99px; padding: 1px 9px; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 26px 0 12px; }
.section-title h2 { margin: 0; flex: 1; font-size: 18px; }

.setup { display: grid; gap: 12px; margin-bottom: 16px; border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.setup-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.setup-steps a { display: flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 13px; }
.setup-steps a.done { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.setup-steps .tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: #fff; }
.setup-steps a.done .tick { background: var(--ok); border-color: var(--ok); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "n ic" "l l" "sub sub"; gap: 2px 10px; box-shadow: var(--shadow); min-width: 0; }
.kpi-ic { grid-area: ic; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-n { grid-area: n; font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-l { grid-area: l; font-weight: 650; }
.kpi-sub { grid-area: sub; font-size: 12px; color: var(--muted); min-width: 0; }
.kpi .up { color: var(--ok); font-weight: 700; } .kpi .down { color: var(--bad); font-weight: 700; }
.kpi.hot .kpi-ic { background: var(--coral); color: var(--coral-ink); }
.kpi.hot { border-color: color-mix(in srgb, var(--coral) 55%, var(--line)); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.needs-list { display: grid; }
.need { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; min-width: 0; }
.need + .need { border-top: 1px solid var(--line); }
.need:hover { background: var(--surface-2); }
.need-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); }
.need-ic.bad { background: var(--bad-soft); color: var(--bad); }
.need-ic.spark { background: var(--coral-soft); color: var(--coral-text); }
.need-ic.ok { background: var(--ok-soft); color: var(--ok); }
.need-go { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 650; color: var(--accent); white-space: nowrap; }
.need:hover .need-go { text-decoration: underline; }
.all-clear { display: flex; align-items: center; gap: 14px; padding: 6px 2px; }
.all-clear > .ic { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); }

.box-row { display: grid; gap: 6px; padding: 10px 0; }
.box-row + .box-row { border-top: 1px solid var(--line); }
.health { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.health.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); } .health.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: inherit; }
.chart .axis.strong { fill: var(--text); font-weight: 700; }
.chart .bar { fill: var(--accent); opacity: .85; }
.chart .bar.today { fill: var(--coral); opacity: 1; }
.chart .dot-reply { fill: var(--surface); stroke: var(--coral); stroke-width: 3; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-bar { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); display: inline-block; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; border: 3px solid var(--coral); display: inline-block; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; min-width: 0; position: relative; }
.timeline li + li { border-top: 1px solid var(--line); }
.tl-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--muted); }
.tl-ic.acc { background: var(--accent-soft); color: var(--accent); } .tl-ic.ok { background: var(--ok-soft); color: var(--ok); }
.tl-ic.bad { background: var(--bad-soft); color: var(--bad); } .tl-ic.spark { background: var(--coral-soft); color: var(--coral-text); }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.project { display: grid; gap: 14px; border-top: 3px solid var(--pc, var(--accent)); }
.pc-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--pc, var(--accent)); flex: none; }
.funnel { display: flex; height: 12px; border-radius: 99px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.funnel .seg { min-width: 6px; }
.seg.s0, .funnel-legend i.s0 { background: var(--f0); } .seg.s1, .funnel-legend i.s1 { background: var(--f1); } .seg.s2, .funnel-legend i.s2 { background: var(--f2); }
.seg.s3, .funnel-legend i.s3 { background: var(--f3); } .seg.s4, .funnel-legend i.s4 { background: var(--f4); }
.seg.lost, .funnel-legend i.lost { background: repeating-linear-gradient(135deg, var(--line) 0 4px, transparent 4px 8px); }
.seg.empty { background: var(--surface-2); }
.funnel-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.funnel-legend span { display: inline-flex; align-items: center; gap: 6px; }
.funnel-legend b { color: var(--text); font-variant-numeric: tabular-nums; }
.funnel-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .kpis { grid-template-columns: minmax(0, 1fr); } .projects-grid { grid-template-columns: minmax(0, 1fr); } .dash-head .btn, .dash-head button { flex: 1; justify-content: center; } }
@media (max-width: 900px) { .nav-group { display: none; } }

/* ---- page header (every page) ---- */
.page-head { align-items: center; gap: 14px; margin-bottom: 20px; }
.ph-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-grad); color: #fff; flex: none; box-shadow: 0 6px 16px rgb(14 124 134 / 25%); }
.page-head h1 { font-size: 24px; line-height: 1.2; }
.ph-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.backlink { display: inline-block; font-size: 13px; margin-bottom: 10px; text-decoration: none; }
.backlink:hover { text-decoration: underline; }
.card-title { display: flex; align-items: center; gap: 10px; margin: 0; }
.ct-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }

/* ---- shared parts ---- */
.av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; font-weight: 750; font-size: 14px; color: #fff; background: var(--av, var(--brand-600)); }
.empty-state { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-state > .ic { width: 52px; height: 52px; padding: 13px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.empty-state b { color: var(--text); font-size: 16px; }
.empty-state p { margin: 0 0 8px; max-width: 52ch; }
.searchbox { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 10px; min-width: 240px; flex: 1 1 260px; color: var(--muted); }
.searchbox:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.searchbox input { border: 0; padding: 8px 0; background: transparent; box-shadow: none !important; }
.toolbar-card { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; }
.toolbar-card select { width: auto; flex: 0 1 auto; }
.status-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.stab { border: 0; background: transparent; border-radius: 0; padding: 9px 12px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; }
.stab:hover { color: var(--text); border-color: transparent; border-bottom-color: var(--line); }
.stab.on { color: var(--accent); border-bottom-color: var(--accent); }
.stab span { font-size: 11px; font-weight: 750; background: var(--surface-2); color: var(--muted); border-radius: 99px; padding: 0 7px; font-variant-numeric: tabular-nums; }
.stab.on span { background: var(--accent-soft); color: var(--accent); }
.stab span.bad { background: var(--bad-soft); color: var(--bad); }

/* ---- leads ---- */
.bulkbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 34px; margin-bottom: 8px; padding: 0 2px; }
.bulkbar.on { position: sticky; top: 8px; z-index: 4; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--r); padding: 8px 12px; box-shadow: 0 8px 24px rgb(8 54 61 / 14%); }
.ltable th.cb, .ltable td.cb { width: 36px; }
.who-cell { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 320px; }
.ci { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 260px; }
.ci .ic { color: var(--muted); }
tr.sel td { background: var(--accent-soft); }
.scorebar { width: 54px; height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 3px; }
.scorebar span { display: block; height: 100%; background: var(--brand-grad); }
th { text-transform: uppercase; letter-spacing: .05em; font-size: 11px; }

/* ---- find clients ---- */
.search-card { display: grid; gap: 14px; margin-bottom: 16px; }
.search-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.search-row .f { min-width: 180px; }
.search-go { height: 38px; }
.seg-ctl { display: inline-flex; background: var(--surface-2); border-radius: var(--r-sm); padding: 3px; gap: 3px; justify-self: start; }
.seg-ctl input { position: absolute; opacity: 0; pointer-events: none; }
.seg-ctl span { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13.5px; }
.seg-ctl span small { font-weight: 700; color: var(--ok); }
.seg-ctl input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(8 54 61 / 12%); }
.seg-ctl input:focus-visible + span { box-shadow: var(--ring); }
.results-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; position: sticky; top: 8px; z-index: 4; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.place-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; }
.place-card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; cursor: pointer; min-width: 0; transition: border-color .15s, background .15s; }
.place-card:hover { border-color: var(--accent); }
.place-card.sel { border-color: var(--accent); background: var(--accent-soft); }
.place-card.known { opacity: .6; cursor: default; }
.place-card > input { margin-top: 10px; }
.rating { font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--warn); }
.contacts { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12.5px; }
.contacts > * { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.contacts .ic { color: var(--muted); }

/* ---- campaigns ---- */
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.camp-card { display: grid; gap: 14px; text-decoration: none; color: inherit; border-top: 3px solid var(--pc, var(--accent)); transition: box-shadow .15s, transform .15s; }
.camp-card:hover { box-shadow: 0 10px 28px rgb(8 54 61 / 14%); }
.camp-card .pc-mark { background: var(--pc, var(--accent)); }
.camp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.camp-stats div { display: grid; }
.camp-stats b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.camp-stats span { font-size: 12px; color: var(--muted); }
.how { display: grid; gap: 4px; }
.how-steps { list-style: none; counter-reset: s; margin: 0; padding: 0 12px 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.how-steps li { counter-increment: s; background: var(--surface-2); border-radius: var(--r-sm); padding: 14px 14px 14px 52px; position: relative; display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.how-steps li::before { content: counter(s); position: absolute; left: 14px; top: 14px; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-grad); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 13px; }
.how-steps b { color: var(--text); font-size: 14px; }
.step { position: relative; }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
#steps .step + .step::before { content: ""; position: absolute; left: 24px; top: -11px; height: 10px; border-left: 2px dashed var(--line); }

/* ---- to approve ---- */
.review-item { display: grid; gap: 10px; }
.subject-input { font-weight: 650; }

/* ---- projects ---- */
.pitch { margin: 0; font-size: 13.5px; color: var(--text); }
.pitch.missing { color: var(--warn); }
.sig-box { border: 1px dashed var(--line); border-radius: var(--r-sm); overflow: hidden; position: relative; background: #fff; }
.sig-box .preview-frame { border: 0; border-radius: 0; display: block; }
.sig-label { position: absolute; top: 6px; right: 8px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8a9a9b; z-index: 1; }

/* ---- mailboxes ---- */
.mb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.mb-card { display: grid; gap: 12px; }
.mb-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.mb-ic.ok { background: var(--ok-soft); color: var(--ok); } .mb-ic.bad { background: var(--bad-soft); color: var(--bad); }

/* ---- settings ---- */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stop-switch { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; }
.stop-switch b { display: inline-flex; align-items: center; gap: 6px; }
.stop-switch .hint { display: block; }
.stop-switch input { margin-top: 3px; accent-color: var(--bad); }
.stop-switch.on { border-color: var(--bad); background: var(--bad-soft); }
.stop-switch.on b { color: var(--bad); }

@media (max-width: 1000px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .place-grid, .camp-grid, .mb-grid { grid-template-columns: minmax(0, 1fr); } .ph-actions { width: 100%; } .page-head { flex-wrap: wrap; } .camp-stats b { font-size: 18px; } }

/* ---- theme switch (theme.js): sun and moon turn and fade into each other ---- */
.brand .theme-toggle { margin-left: auto; }
.theme-toggle { position: relative; display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--text); cursor: pointer; transition: border-color .15s, transform .12s ease, box-shadow .15s; }
.theme-toggle:hover { border-color: var(--accent); box-shadow: var(--ring); }
.theme-toggle:active { transform: scale(.88); }
.theme-toggle svg { grid-area: 1 / 1; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 520ms cubic-bezier(.2, .8, .2, 1), opacity 280ms ease; }
.theme-toggle .t-sun { color: var(--coral); opacity: 0; transform: rotate(-120deg) scale(.3); }
.theme-toggle .t-moon { color: var(--accent); fill: color-mix(in srgb, currentColor 22%, transparent); opacity: 1; transform: none; }
:root[data-theme="dark"] .theme-toggle .t-sun { opacity: 1; transform: none; fill: color-mix(in srgb, currentColor 25%, transparent); }
:root[data-theme="dark"] .theme-toggle .t-moon { opacity: 0; transform: rotate(120deg) scale(.3); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .t-sun { opacity: 1; transform: none; fill: color-mix(in srgb, currentColor 25%, transparent); }
  :root:not([data-theme="light"]) .theme-toggle .t-moon { opacity: 0; transform: rotate(120deg) scale(.3); }
}

/* The new theme spreads in a circle from the button (theme.js); the old page stays still underneath. */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }
/* Browsers without View Transitions: colours ease across instead of snapping. */
html.theme-fade, html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
  transition: background-color .4s ease, color .4s ease, border-color .4s ease, fill .4s ease, stroke .4s ease, box-shadow .4s ease !important;
}
@media (prefers-reduced-motion: reduce) { .theme-toggle svg { transition: none; } }

/* ---- Settings → Appearance: three tiles, each a tiny picture of the app in that theme ---- */
.theme-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-tile { display: grid; gap: 8px; padding: 8px 8px 10px; border: 2px solid var(--line); border-radius: var(--r); background: var(--surface); text-align: left; align-content: start; white-space: normal; transition: border-color .15s, box-shadow .15s, transform .15s; }
.theme-tile:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); transform: translateY(-1px); }
.theme-tile.on { border-color: var(--accent); box-shadow: var(--ring); }
.tt-label { display: flex; align-items: center; gap: 8px; padding: 0 2px; }
.tt-radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); flex: none; transition: border-color .15s, border-width .15s; }
.theme-tile.on .tt-radio { border: 5px solid var(--accent); }
.tt-sub { font-size: 12px; color: var(--muted); padding: 0 2px; }
.tp { --p-bg: #f5f9f9; --p-side: #ffffff; --p-card: #ffffff; --p-line: #dce8e8; --p-text: #0f2226; --p-acc: #0e7c86;
  display: flex; gap: 5px; height: 78px; padding: 6px; border-radius: 9px; background: var(--p-bg); border: 1px solid var(--p-line); overflow: hidden; }
.tp-dark { --p-bg: #0a1416; --p-side: #101d20; --p-card: #16272a; --p-line: #22373a; --p-text: #e5f1f1; --p-acc: #5fc4c9; }
.tp-system { background: linear-gradient(135deg, #f5f9f9 0 50%, #0a1416 50% 100%); --p-side: rgb(255 255 255 / 55%); --p-card: rgb(127 160 162 / 28%); --p-line: rgb(127 160 162 / 45%); --p-text: #7fa0a2; border-color: #7fa0a2; }
.tp-side { width: 24%; background: var(--p-side); border-radius: 5px; display: grid; gap: 4px; padding: 5px; align-content: start; }
.tp-side i { height: 4px; border-radius: 2px; background: var(--p-line); }
.tp-side i:first-child { background: var(--p-acc); }
.tp-main { flex: 1; display: grid; gap: 5px; align-content: start; min-width: 0; }
.tp-h { display: block; height: 6px; width: 46%; border-radius: 3px; background: var(--p-text); opacity: .75; }
.tp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.tp-cards i { height: 26px; border-radius: 5px; background: var(--p-card); border: 1px solid var(--p-line); }
.tp-bar { display: block; height: 6px; width: 64%; border-radius: 3px; background: linear-gradient(90deg, var(--p-acc) 0 82%, #ff7a59 82% 100%); }
@media (max-width: 560px) { .theme-tiles { grid-template-columns: minmax(0, 1fr); } }
