/* Go CRM – same look as the Froad admin: Inter, soft cards, black buttons, orange accent. */
:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f2f2ef;
  --border: rgba(0, 0, 0, 0.08);
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #8a8983;
  --accent: #f26a1b;
  --accent-soft: rgba(242, 106, 27, 0.12);
  --grid: rgba(0, 0, 0, 0.06);
  --good: #008300;
  --good-soft: rgba(0, 131, 0, 0.1);
  --warn: #c98500;
  --warn-soft: rgba(237, 161, 0, 0.14);
  --bad: #d03b3a;
  --bad-soft: rgba(208, 59, 58, 0.1);
  --btn: #0b0b0b;
  --btn-text: #ffffff;
  /* chart series: validated categorical pair */
  --car: #2a78d6;
  --camper: #eb6834;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --surface-2: #242423;
    --border: rgba(255, 255, 255, 0.09);
    --text: #ffffff;
    --text-2: #c3c2b7;
    --text-3: #8d8c85;
    --accent: #ff8a3d;
    --accent-soft: rgba(255, 138, 61, 0.16);
    --grid: rgba(255, 255, 255, 0.07);
    --good: #3fb950;
    --good-soft: rgba(63, 185, 80, 0.14);
    --warn: #eda100;
    --warn-soft: rgba(237, 161, 0, 0.16);
    --bad: #e66767;
    --bad-soft: rgba(230, 103, 103, 0.14);
    --btn: #ffffff;
    --btn-text: #0b0b0b;
    --car: #3987e5;
    --camper: #d95926;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110;
  --surface: #1a1a19;
  --surface-2: #242423;
  --border: rgba(255, 255, 255, 0.09);
  --text: #ffffff;
  --text-2: #c3c2b7;
  --text-3: #8d8c85;
  --accent: #ff8a3d;
  --accent-soft: rgba(255, 138, 61, 0.16);
  --grid: rgba(255, 255, 255, 0.07);
  --good: #3fb950;
  --good-soft: rgba(63, 185, 80, 0.14);
  --warn: #eda100;
  --warn-soft: rgba(237, 161, 0, 0.16);
  --bad: #e66767;
  --bad-soft: rgba(230, 103, 103, 0.14);
  --btn: #ffffff;
  --btn-text: #0b0b0b;
  --car: #3987e5;
  --camper: #d95926;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }

/* ── Login ─────────────────────────────── */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form {
  width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px 28px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.06);
}
.login h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.login p { color: var(--text-2); font-size: 13px; margin-top: -8px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); }
.error { color: var(--bad); font-size: 13px; }

/* ── Form controls ─────────────────────── */
.input {
  width: 100%; padding: 10px 13px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); outline: none; min-height: 40px;
}
.input:focus { border-color: var(--accent); background: var(--surface); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.45; }
select.input { appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8983' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.field small { font-size: 11px; color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--btn); color: var(--btn-text); border: 0; border-radius: 12px;
  padding: 10px 16px; font-weight: 600; text-decoration: none; white-space: nowrap; min-height: 40px;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--surface); color: var(--bad); border: 1px solid var(--border); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.block { width: 100%; }
.btn.sm { padding: 6px 12px; min-height: 32px; font-size: 13px; border-radius: 10px; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; padding: 0; text-decoration: none; }
.link-btn.muted { color: var(--text-3); font-weight: 500; }
.link-btn.muted:hover { color: var(--bad); }

.seg {
  display: inline-flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 3px; overflow-x: auto; max-width: 100%; scrollbar-width: none;
}
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 9px;
  font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap;
}
.seg button[aria-pressed="true"] { background: var(--btn); color: var(--btn-text); }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar, .seg::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.chips button {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px;
  font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; flex-shrink: 0;
}
.chips button[aria-pressed="true"] { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }
.chips button .count { opacity: 0.6; margin-left: 4px; }

.icon-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 12px;
  padding: 7px 12px; font-size: 13px; font-weight: 500; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.round { padding: 7px; }

/* ── App shell ─────────────────────────── */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.app > main { min-width: 0; width: 100%; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
  padding: 22px 14px 18px; background: var(--surface); border-right: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 9px; padding: 2px 10px; text-decoration: none; color: var(--text); }
.logo img { height: 22px; width: auto; display: block; }
.logo span { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 2px; white-space: nowrap; }
:root[data-theme="dark"] .logo img { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo img { filter: invert(1); } }
.login .logo { padding: 0; margin-bottom: 4px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; text-decoration: none; font-size: 14px;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav a.active svg { color: var(--accent); }
.nav a .badge-count { margin-left: auto; font-size: 11px; font-weight: 700; color: #fff; background: var(--bad); border-radius: 999px; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.side-note { font-size: 12px; color: var(--text-3); padding: 0 12px 8px; }
.side-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 500; color: var(--text-2);
}
.side-btn:hover { background: var(--surface-2); color: var(--text); }
.side-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.mobile-top { display: none; }
.tabbar { display: none; }

/* ── Page header ───────────────────────── */
header.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.page-sub { color: var(--text-2); margin-top: 3px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.back { display: inline-flex; gap: 4px; color: var(--text-2); text-decoration: none; font-size: 13px; margin-bottom: 10px; }
.back:hover { color: var(--text); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; }
.toolbar .grow { flex: 1 1 220px; }

/* ── KPI tiles & cards ─────────────────── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; min-width: 0; }
.kpi .label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; margin: 6px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .delta { font-size: 12px; color: var(--text-3); }
.mini-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mini-kpi { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.mini-kpi .label { font-size: 11px; color: var(--text-2); }
.mini-kpi .value { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; white-space: nowrap; }
.mini-kpi .delta { font-size: 11px; color: var(--text-3); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; min-width: 0; }
.card + .card { margin-top: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.card h2 { font-size: 14px; font-weight: 700; }
.card .sub { font-size: 12px; color: var(--text-3); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 1fr) 340px; }
.grid > .card + .card, .stack > .card + .card { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.empty { color: var(--text-3); font-size: 13px; padding: 12px 0; }
.empty-box { border: 1px dashed var(--border); border-radius: 16px; padding: 40px 16px; text-align: center; color: var(--text-2); }
.empty-box b { display: block; color: var(--text); margin-bottom: 4px; }
.loading { padding: 60px 0; text-align: center; color: var(--text-3); }
.banner { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; color: var(--text-2); line-height: 1.5; }
.banner.error-banner { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

/* ── Tables & lists ────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; color: var(--text-3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 8px 8px; white-space: nowrap; }
td { padding: 8px; border-top: 1px solid var(--border); }
td.r, th.r { text-align: right; }
td.nowrap { white-space: nowrap; }
tr.cancelled td { color: var(--text-3); text-decoration: line-through; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2); padding: 2px 7px; border-radius: 6px; }

.plist { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.prow { display: flex; align-items: center; gap: 14px; padding: 12px 16px; text-decoration: none; color: inherit; border-top: 1px solid var(--border); }
.prow:first-child { border-top: 0; }
.prow:hover { background: var(--surface-2); }
.prow .main { flex: 1; min-width: 0; }
.prow .name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.prow .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .meta { font-size: 12px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.stars { color: var(--text-3); font-size: 11px; letter-spacing: 1px; }

.row { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 8px; font-size: 13px; text-decoration: none; color: inherit; }
a.row:hover { background: var(--surface-2); }
.row .fill { position: absolute; left: 0; top: 2px; bottom: 2px; border-radius: 6px; background: var(--accent-soft); }
.row .name { position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row .val { position: relative; font-weight: 600; flex-shrink: 0; }
.row .val small { font-weight: 400; color: var(--text-3); margin-left: 6px; }

/* ── Badges ────────────────────────────── */
.stage { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; background: var(--surface); }
.stage i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-3); }
.stage.contacted i { background: var(--car); }
.stage.in_talks i { background: var(--warn); }
.stage.accepted i { background: var(--good); }
.stage.declined i { background: var(--bad); }
.interest { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.interest .dots { display: inline-flex; gap: 2px; }
.interest .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); }
.interest .dots i.on { background: var(--accent); border-color: var(--accent); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; border-radius: 999px; padding: 2px 9px; background: var(--surface-2); color: var(--text-2); }
.pill.overdue { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.pill.today { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.pill.good { background: var(--good-soft); color: var(--good); font-weight: 600; }

/* ── Tabs (partner types) ──────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 9px 12px; font-weight: 600; color: var(--text-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--text); border-color: var(--accent); }
.tabs a .count { color: var(--text-3); font-weight: 500; margin-left: 4px; font-size: 12px; }

/* ── Partner detail ────────────────────── */
.detail-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.detail-head .badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.stage-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stage-picker button { border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 6px; font-weight: 600; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.stage-picker button[aria-pressed="true"] { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }
.line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.line > .lbl { font-size: 12px; color: var(--text-2); margin-right: 4px; }
.timeline { list-style: none; border-left: 2px solid var(--border); margin-left: 4px; padding-left: 16px; display: flex; flex-direction: column; gap: 14px; }
.timeline li { position: relative; }
.timeline li::before { content: ''; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.timeline .when { font-size: 12px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; }
.timeline .when b { color: var(--text-2); font-weight: 600; }
.timeline p { margin-top: 2px; white-space: pre-wrap; line-height: 1.45; }
.contacts { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.contacts .top-line { display: flex; gap: 8px; align-items: center; }
.contacts .top-line .actions { margin-left: auto; display: flex; gap: 10px; }
.contacts a { color: var(--accent); text-decoration: none; }
.tag-main { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 1px 6px; }
dl.details { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 8px 12px; font-size: 13px; }
dl.details dt { color: var(--text-3); }
dl.details dd { overflow-wrap: anywhere; }
dl.details a { color: var(--accent); text-decoration: none; }
.notes { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); white-space: pre-wrap; color: var(--text-2); line-height: 1.5; }
.fab { display: none; }

/* ── Pipeline board ────────────────────── */
.board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; }
.col { background: var(--surface-2); border-radius: 16px; padding: 10px; min-width: 0; }
.col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 2px; }
.col-head h3 { font-size: 13px; font-weight: 700; }
.col-hint { font-size: 11px; color: var(--text-3); padding: 0 4px 10px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 11px; margin-bottom: 8px; }
.kcard a { text-decoration: none; color: inherit; display: block; }
.kcard .name { font-weight: 600; font-size: 13px; }
.kcard .meta { font-size: 11px; color: var(--text-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.kcard .move { display: flex; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 6px; }
.kcard .move button { border: 0; background: transparent; color: var(--text-3); padding: 2px 8px; border-radius: 6px; font-size: 14px; }
.kcard .move button:hover { background: var(--surface-2); color: var(--text); }
.kcard .move button:disabled { visibility: hidden; }

/* ── Progress & funnel ─────────────────── */
.progress { position: relative; height: 8px; border-radius: 99px; background: var(--surface-2); }
.progress > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--accent); }
.progress.done > i { background: var(--good); }
.progress > b { position: absolute; top: -4px; width: 2px; height: 16px; border-radius: 2px; background: var(--text-2); }
.goal-row + .goal-row { margin-top: 14px; }
.goal-row .top-line { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; color: var(--text-2); }
.goal-row .top-line b { color: var(--text); font-weight: 600; }
.goal-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.goal-card .head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.goal-card .value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 4px 0 12px; }
.goal-card .value small { font-size: 15px; font-weight: 500; color: var(--text-3); }
.goal-card .status { font-size: 12px; font-weight: 600; }
.goal-card .status.ok { color: var(--good); }
.goal-card .status.behind { color: var(--warn); }
.goal-card .status.miss { color: var(--bad); }
.goal-card .target { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--text-3); }
.goal-card .target .input { width: 140px; min-height: 34px; padding: 6px 10px; }
.funnel { display: flex; flex-direction: column; gap: 7px; }
.funnel .f { display: grid; grid-template-columns: 82px minmax(0, 1fr) 28px; gap: 10px; align-items: center; font-size: 12px; color: var(--text-2); }
.funnel .bar { height: 18px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.funnel .bar i { display: block; height: 100%; background: var(--car); border-radius: 6px; }
.funnel .n { text-align: right; font-weight: 600; color: var(--text); }

/* ── Chart ─────────────────────────────── */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text-2); align-items: center; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.legend b { color: var(--text); font-weight: 600; margin-left: 4px; }
.chart { position: relative; height: 260px; margin-top: 12px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border); stroke-width: 1; }
.chart .car { fill: var(--car); }
.chart .camper { fill: var(--camper); }
.chart .hover { fill: var(--text); opacity: 0; }
.chart .hover.on { opacity: 0.05; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--text); color: var(--bg);
  padding: 8px 10px; border-radius: 10px; font-size: 12px; line-height: 1.5; white-space: nowrap;
  transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity 0.1s; z-index: 5;
}
.tooltip.show { opacity: 1; }
.tooltip .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.tooltip .t { display: flex; justify-content: space-between; gap: 14px; }

/* ── Modal (bottom sheet on phones) ────── */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.4); animation: fadeIn 0.15s ease; }
.modal { background: var(--surface); border-radius: 20px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 20px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; }
.modal-head h2 { font-size: 17px; font-weight: 700; }
.modal-close { border: 0; background: var(--surface-2); border-radius: 50%; width: 30px; height: 30px; font-size: 18px; line-height: 1; color: var(--text-2); flex-shrink: 0; }
.modal form { display: flex; flex-direction: column; gap: 12px; }
html.modal-open { overflow: hidden; }

/* ── Toasts ────────────────────────────── */
.toasts { position: fixed; left: 0; right: 0; bottom: 24px; z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); animation: fadeIn 0.15s ease; max-width: 420px; }
.toast.error { background: var(--bad); color: #fff; }

/* ── Import ────────────────────────────── */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 2px dashed var(--border); border-radius: 16px; padding: 30px 16px; text-align: center; cursor: pointer; }
.drop:hover { background: var(--surface-2); }
.drop b { font-size: 14px; }
.drop span { font-size: 12px; color: var(--text-3); }
.code-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.code-chips span { font-size: 12px; border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; color: var(--text-2); }
.code-chips span.ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.steps { color: var(--text-2); line-height: 1.6; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

/* ── Responsive ────────────────────────── */
@media (max-width: 1080px) {
  .board { grid-template-columns: repeat(5, 240px); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .col { scroll-snap-align: start; }
  .grid-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .app > .sidebar { display: none; }
  .mobile-top {
    display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between; gap: 10px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
  }
  .mobile-top .logo { padding: 0 4px; }
  .mobile-top .logo img { height: 20px; }
  .mobile-top-actions { display: flex; gap: 8px; align-items: center; }
  .wrap { padding: 18px 16px calc(100px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border);
  }
  .tabbar a {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; position: relative;
    padding: 6px 2px 4px; color: var(--text-3); text-decoration: none; font-size: 10.5px; font-weight: 600;
  }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar .active { color: var(--accent); }
  .tabbar .active svg { background: var(--accent-soft); border-radius: 10px; padding: 3px 12px; width: 48px; height: 28px; margin: -3px 0; }
  .tabbar .badge-count { position: absolute; top: 0; left: calc(50% + 8px); font-size: 10px; font-weight: 700; color: #fff; background: var(--bad); border-radius: 999px; padding: 0 5px; }
  .fab {
    display: inline-flex; position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 35;
    background: var(--btn); color: var(--btn-text); border: 0; border-radius: 999px; padding: 13px 20px;
    font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  }
  .toasts { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .modal-wrap { align-items: flex-end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); animation: sheetUp 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); max-width: none; }
  /* iOS zooms into inputs below 16px */
  .input { font-size: 16px; }
}
@media (max-width: 680px) {
  .kpis, .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid, .grid-3, .goal-cards { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 22px; }
  .chart { height: 210px; }
  .form-grid, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
  .prow { flex-direction: column; align-items: stretch; gap: 8px; }
  .prow .tags { justify-content: flex-start; }
  .stage-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .opt { display: none; }
  .board { grid-template-columns: repeat(5, 78vw); }
  header.top .controls { width: 100%; }
}
td.mono { white-space: nowrap; }
.chips.wrap-chips { flex-wrap: wrap; overflow: visible; }

/* ── Tasks & calendar ──────────────────── */
.cal-card { margin-bottom: 12px; }
.cal-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cal-head b { min-width: 120px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-dows { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 4px; }
.cal-dows span { font-size: 11px; font-weight: 600; color: var(--text-3); text-align: center; text-transform: uppercase; letter-spacing: 0.04em; }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 3px; border: 1px solid var(--border); background: var(--surface);
  border-radius: 12px; padding: 8px 2px 7px; min-width: 0; color: var(--text);
}
.day:hover { background: var(--surface-2); }
.day .dow { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; }
.day .dn { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.day.today .dn { color: var(--accent); }
.day.sel { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }
.day.sel .dow, .day.sel .dn { color: var(--btn-text); }
.day.out { opacity: 0.4; }
.cal.month .day { padding: 6px 2px; min-height: 54px; justify-content: flex-start; }
.cal.month .day .dn { font-size: 14px; }
.marks { display: flex; gap: 3px; height: 6px; align-items: center; }
.marks i, .cal-legend i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.marks i.v, .cal-legend i.v { background: var(--accent); }
.marks i.t, .cal-legend i.t { background: var(--car); }
.marks i.f, .cal-legend i.f { background: var(--warn); }
.day.sel .marks i { box-shadow: 0 0 0 1.5px var(--btn); }
.cal-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 11px; color: var(--text-3); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.late-card { margin-bottom: 12px; border-color: var(--bad-soft); }
.late { color: var(--bad); font-weight: 600; }
h3.sec { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); margin: 14px 0 4px; }
h3.sec:first-child { margin-top: 0; }
h3.sec .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.tasks { list-style: none; display: flex; flex-direction: column; }
.task { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.task:first-child { border-top: 0; }
.task .tick {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--border); background: transparent;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; color: #fff; padding: 0;
}
button.tick:hover { border-color: var(--good); }
.task .tick.on { background: var(--good); border-color: var(--good); }
.task .tick.follow { border-color: var(--warn); color: var(--warn); font-size: 14px; }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 600; text-decoration: none; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .meta { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.task .meta a { color: var(--accent); text-decoration: none; }
.task .meta .stage { font-size: 11px; padding: 0 7px; }
.task.done .title { color: var(--text-3); text-decoration: line-through; }
.task .acts { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.icon-btn.sm { padding: 4px 9px; font-size: 14px; border-radius: 10px; }
a.pill { text-decoration: none; }
.pick-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 4px 10px; }
.pick-area { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 0 4px; }
.pick { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; cursor: pointer; }
.pick input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--btn); flex-shrink: 0; }
.pick .body { display: flex; flex-direction: column; min-width: 0; }
.pick .meta { font-size: 12px; color: var(--text-3); }
.pick .planned { color: var(--accent); font-weight: 600; }
@media (max-width: 680px) {
  .day { padding: 7px 0 6px; border-radius: 10px; }
  .day .dn { font-size: 15px; }
  .cal, .cal-dows { gap: 4px; }
  .cal.month .day { min-height: 44px; }
  .task { flex-wrap: wrap; }
  .task .acts { width: 100%; padding-left: 36px; }
  .task .acts .icon-btn { margin-left: auto; }
  .cal-head .controls { width: auto; }
}

/* ── Categories & channels ─────────────── */
:root { --ig: #e1306c; --fb: #1877f2; --tt: #111111; --gg: #34a853; --yt: #ff0000; --mkt: #8b5cf6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tt: #e5e5e5; --mkt: #a78bfa; } }
:root[data-theme="dark"] { --tt: #e5e5e5; --mkt: #a78bfa; }
.cat { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; border-radius: 6px; padding: 1px 6px; }
.cat-sales { background: var(--accent-soft); color: var(--accent); }
.cat-marketing { background: color-mix(in srgb, var(--mkt) 14%, transparent); color: var(--mkt); }
.cdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: 0; }
.cat-dot-sales { background: var(--accent); }
.cat-dot-marketing { background: var(--mkt); }
.c-instagram { background: var(--ig); } .c-facebook { background: var(--fb); } .c-tiktok { background: var(--tt); } .c-google { background: var(--gg); } .c-youtube { background: var(--yt); }
.ch { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.ch i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.ch-instagram i { background: var(--ig); } .ch-facebook i { background: var(--fb); } .ch-tiktok i { background: var(--tt); } .ch-google i { background: var(--gg); } .ch-youtube i { background: var(--yt); }
.marks i.p, .cal-legend i.p { background: var(--mkt); }
.status { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border-radius: 6px; padding: 1px 6px; white-space: nowrap; }
.status.st-idea { background: var(--surface-2); color: var(--text-3); }
.status.st-in_progress { background: var(--warn-soft); color: var(--warn); }
.status.st-scheduled { background: color-mix(in srgb, var(--mkt) 14%, transparent); color: var(--mkt); }
.status.st-published { background: var(--good-soft); color: var(--good); }
.task .tick.post { border-color: var(--mkt); }
.task .tick.post.st-published { background: var(--good); border-color: var(--good); }
.as-link { border: 0; background: none; padding: 0; text-align: left; font: inherit; cursor: pointer; }
.kpi .value .kpi-of, .kpi-of { font-size: 16px; font-weight: 600; color: var(--text-3); }
.star { color: #f5a623; }

/* ── Marketing calendar ────────────────── */
.sm-input { width: auto; min-height: 34px; padding: 6px 30px 6px 10px; }
.mcal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.mday { border: 1px solid var(--border); border-radius: 12px; padding: 6px; min-height: 104px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mcal.week .mday { min-height: 220px; }
.mday:hover { background: var(--surface-2); }
.mday.out { opacity: 0.45; }
.mday.sel { border-color: var(--btn); box-shadow: inset 0 0 0 1px var(--btn); }
.mday-h { display: flex; justify-content: space-between; align-items: center; }
.mday-h .dn { font-size: 12px; font-weight: 700; color: var(--text-2); }
.mday.today .mday-h .dn { color: #fff; background: var(--accent); border-radius: 999px; padding: 0 7px; }
.mday .add { border: 0; background: transparent; color: var(--text-3); font-size: 16px; line-height: 1; width: 22px; height: 22px; border-radius: 6px; opacity: 0; }
.mday:hover .add, .mday.sel .add { opacity: 1; }
.mday .add:hover { background: var(--surface); color: var(--text); }
.pchip { display: flex; align-items: center; gap: 5px; width: 100%; border: 0; border-radius: 7px; padding: 3px 6px; font-size: 11px; font-weight: 600; text-align: left; color: var(--text); background: var(--surface-2); min-width: 0; }
.pchip .dots { display: inline-flex; gap: 2px; flex-shrink: 0; }
.pchip .dots i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.pchip .tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip.st-in_progress { background: var(--warn-soft); }
.pchip.st-scheduled { background: color-mix(in srgb, var(--mkt) 16%, transparent); }
.pchip.st-published { background: var(--good-soft); }
.mday .more { font-size: 11px; color: var(--text-3); padding-left: 4px; }
.lg { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg.st-idea { background: var(--surface-2); border: 1px solid var(--border); }
.lg.st-in_progress { background: var(--warn); }
.lg.st-scheduled { background: var(--mkt); }
.lg.st-published { background: var(--good); }
.cal-legend .lg { width: 8px; height: 8px; }
.post-list { display: flex; flex-direction: column; gap: 10px; }
.post-card { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.pc-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.post-card h4 { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.post-card .caption { color: var(--text-2); margin-top: 8px; white-space: pre-wrap; line-height: 1.45; font-size: 13px; }
.pc-links { display: flex; gap: 14px; margin-top: 10px; font-size: 13px; }
.pc-links a { color: var(--accent); text-decoration: none; font-weight: 600; }
.status-list { display: flex; flex-direction: column; gap: 8px; }
.srow { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.srow b { color: var(--text); font-size: 15px; }
button.row { border: 0; background: transparent; width: 100%; text-align: left; cursor: pointer; }
button.row:hover { background: var(--surface-2); }

/* ── Idea bank ─────────────────────────── */
.quick-idea { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.quick-idea .input { flex: 1 1 260px; width: auto; }
.quick-idea select.input { flex: 0 1 200px; }
.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.idea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px;
  position: relative; overflow: hidden;
}
.idea::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--ig), var(--mkt), var(--accent)); }
.idea .theme { align-self: flex-start; font-size: 11px; font-weight: 700; color: var(--mkt); background: color-mix(in srgb, var(--mkt) 12%, transparent); border-radius: 999px; padding: 2px 9px; }
.idea h4 { font-size: 15px; font-weight: 700; line-height: 1.35; }
.idea p { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.idea-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; padding-top: 6px; }
.idea-acts { margin-left: auto; display: flex; gap: 6px; }

/* ── Google reviews ────────────────────── */
.setup ol { padding-left: 20px; margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.setup a { color: var(--accent); }
.setup code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.place-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.place .pl-top { display: flex; justify-content: space-between; gap: 10px; }
.place h3 { font-size: 16px; font-weight: 700; margin-top: 6px; }
.big-rating { display: flex; align-items: baseline; gap: 12px; margin: 14px 0 2px; }
.big-rating b { font-size: 48px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.stars-lg { color: #f5a623; font-size: 22px; letter-spacing: 2px; }
.stars-lg .off, .stars-sm .off { color: var(--surface-2); }
.stars-sm { color: #f5a623; letter-spacing: 1px; }
.up { color: var(--good); font-weight: 600; }
.pl-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.add-place { display: flex; flex-direction: column; justify-content: center; border-style: dashed; }
.spark { margin-top: 14px; }
.spark svg { width: 100%; height: 70px; display: block; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--accent-soft); stroke: none; }
.spark-lbl { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.review-list { display: flex; flex-direction: column; gap: 10px; max-height: 760px; overflow-y: auto; }
.review { border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.review.low { border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.rv-top { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.rv-top img, .rv-top .avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.rv-top .avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); font-weight: 700; color: var(--text-2); }
.review p { line-height: 1.5; white-space: pre-wrap; margin-bottom: 6px; }
.dist { display: grid; grid-template-columns: 36px 1fr 30px; gap: 8px; align-items: center; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.dist .bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.dist .bar i { display: block; height: 100%; background: #f5a623; border-radius: 99px; }
.dist b { text-align: right; color: var(--text); }
.sheet-nav { display: flex; flex-direction: column; gap: 2px; }
.sheet-nav a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; color: var(--text); text-decoration: none; font-size: 15px; font-weight: 500; }
.sheet-nav a:hover { background: var(--surface-2); }
.sheet-nav svg { width: 20px; height: 20px; color: var(--text-2); }
@media (max-width: 680px) {
  .mcal { gap: 3px; }
  .mday { min-height: 54px; padding: 4px; border-radius: 9px; }
  .mcal.week { grid-template-columns: minmax(0, 1fr); }
  .mcal.week .mday { min-height: 0; }
  .mcal.month .pchip { padding: 0; background: none !important; }
  .mcal.month .pchip .tx { display: none; }
  .mcal.month .mday .more, .mday .add { display: none; }
  .big-rating b { font-size: 40px; }
}
.place-grid > .card, .idea-grid > .card { margin-top: 0; }
