:root {
  /* Palette (GoHighLevel-like blue and greys) */
  --brand: #155eef;          /* GHL primary blue */
  --brand-hover: #004eeb;
  --brand-ink: #ffffff;
  --bg: #f9fafb;             /* GHL page */
  --surface: #ffffff;
  --fill: #f2f4f7;           /* segmented-control track, soft fills */
  --ink: #101828;
  --ink-2: #344054;          /* labels, tab text */
  --muted: #667085;
  --line: #eaecf0;           /* card and table borders */
  --line-strong: #d0d5dd;    /* input and button borders */
  --action: #155eef;
  --action-ink: #ffffff;
  --tab-on-bg: #eff4ff;      /* selected chip */
  --tab-on-ink: #004eeb;
  --focus-ring: 0 0 0 4px #d1e0ff;
  --bar: rgba(21, 94, 239, 0.08);
  --money: #027a48;
  --danger: #b42318;
  --s1: #155eef;  /* chart series 1 (blue), 2 (amber), 3 (pink): checked for colour-blind separation */
  --s2: #f79009;
  --s3: #e06b98;
  --radius-lg: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  color-scheme: light;   /* GHL has no dark mode, so neither does this page */
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }

/* Header */
header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
h1 {
  margin: 0; font-size: 1.6rem; line-height: 1.1;
  font-weight: 800; letter-spacing: -0.01em;
}
.tabs {
  display: inline-flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.tabs button {
  border: 0; background: none; padding: 8px 12px; border-radius: 999px; cursor: pointer;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.tabs.sub { margin-bottom: 16px; }
.tabs.sub button { padding: 6px 14px; font-size: 0.9375rem; }

/* Toolbar (date / period navigation) */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.toolbar h2 { margin: 0 8px 0 0; font-size: 1.25rem; font-weight: 700; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.text-btn {
  height: 40px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600;
}
input[type="date"] {
  height: 40px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface);
}
.hint { color: var(--muted); font-size: 0.875rem; margin-left: auto; }
kbd {
  font-family: inherit; font-size: 0.75rem; font-weight: 700; min-width: 22px; height: 22px;
  display: inline-grid; place-items: center; padding: 0 5px; border-radius: 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; color: var(--muted); background: var(--bg);
}

/* Layout */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; min-width: 0;
}
.panel h2 { margin: 0 0 12px; font-size: 1.125rem; font-weight: 700; }
.panel-foot { margin: 14px 0 0; color: var(--muted); font-size: 0.9rem; }
.panel-foot strong { color: var(--ink); }
.span-2 { grid-column: 1 / -1; }
.note { color: var(--muted); margin: 0; font-size: 0.9375rem; }

/* Funnel rows: the bar behind each row shows its share of the first step */
.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.row {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: 12px; padding: 8px 8px 8px 12px; border-radius: var(--radius-sm); isolation: isolate;
}
.row::before, .bar-row::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  width: calc(var(--share, 0) * 100%); background: var(--bar);
  transition: width 220ms ease-out;
}
.row .label { font-weight: 600; }
.row .rate { display: block; color: var(--muted); font-size: 0.8125rem; font-weight: 400; }
.row .rate.neg { color: color-mix(in srgb, var(--danger) 75%, var(--muted)); }
.counter { display: flex; align-items: center; gap: 6px; }
.count {
  min-width: 2.6ch; text-align: center; font-size: 1.85rem; line-height: 1;
  font-weight: 750; font-variant-numeric: tabular-nums;
}
.count.bump { animation: bump 260ms ease-out; }
@keyframes bump { 40% { transform: scale(1.18); color: var(--action); } }
.step {
  width: 44px; height: 44px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 1.4rem; font-weight: 600; line-height: 1;
}
.step.minus { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.step.plus { background: var(--action); border: 1px solid var(--action); color: var(--action-ink); }
.step:active { transform: translateY(1px); }
.step:disabled { opacity: 0.35; cursor: default; }

/* Simple share bars (expense categories) */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bar-row {
  position: relative; isolation: isolate; display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 10px; border-radius: var(--radius-sm); font-variant-numeric: tabular-nums;
}
.bar-row span:first-child { font-weight: 600; }

/* Revenue */
.money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.money-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.money-head h3 { margin: 0; font-size: 1rem; font-weight: 600; color: var(--muted); }
.money-total {
  color: var(--money); font-size: 2.1rem; line-height: 1.1; font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.money-total.cost { color: var(--ink); }
.money-form { display: flex; gap: 8px; margin-top: 10px; }
.money-form .field {
  flex: 1; display: flex; align-items: center; gap: 4px; padding: 0 10px; height: 44px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg);
}
.money-form .field span { color: var(--muted); }
.money-form input { border: 0; background: none; width: 100%; height: 100%; outline: none; }
.money-form .field:focus-within { outline: 2px solid var(--action); outline-offset: 2px; }
.money-form button, .btn-primary {
  height: 44px; padding: 0 18px; border-radius: var(--radius-sm); border: 0; cursor: pointer;
  background: var(--money); color: var(--surface); font-weight: 700;
}
.entries { list-style: none; margin: 10px 0 0; padding: 0; font-size: 0.9375rem; }
.entries li {
  display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.entries .what { min-width: 0; }
.entries .what small { display: block; color: var(--muted); font-size: 0.8125rem; }
.entries time { color: var(--muted); font-size: 0.8125rem; margin-left: auto; white-space: nowrap; }
.entries button {
  border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 0.8125rem; padding: 4px;
}
.entries button.neutral { color: var(--action); }
.tag {
  font-size: 0.75rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.stat-line { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 16px; color: var(--muted); font-size: 0.9rem; }
.stat-line strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* Entry forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; align-items: end; }
.fld { display: grid; gap: 4px; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
.fld.wide { grid-column: span 2; }
.fld input, .fld select {
  height: 42px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font-weight: 400; font-size: 1rem; width: 100%;
}
.check { display: flex; align-items: center; gap: 8px; height: 42px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--action); }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.kpi h3 { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.kpi .big {
  display: block; font-size: 1.9rem; line-height: 1.2; font-weight: 750; margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.kpi .big.pos { color: var(--money); }
.kpi .big.neg { color: var(--danger); }
.kpi small { color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.welcome { margin-bottom: 20px; }

/* Trend chart: plain HTML bars on one shared axis */
.legend { display: flex; gap: 16px; font-size: 0.875rem; color: var(--muted); margin: -4px 0 12px; }
.legend span::before {
  content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 6px; background: var(--c);
}
.trend { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
.trend .axis {
  display: flex; flex-direction: column; justify-content: space-between; height: 200px;
  font-size: 0.75rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums;
}
.trend .axis span { transform: translateY(-50%); }
.trend .axis span:last-child { transform: translateY(50%); }
.plot {
  display: grid; grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr)); height: 200px; position: relative;
  background: linear-gradient(var(--line), var(--line)) 0 0 / 100% 1px no-repeat,
              linear-gradient(var(--line), var(--line)) 0 50% / 100% 1px no-repeat,
              linear-gradient(var(--ink), var(--ink)) 0 100% / 100% 1px no-repeat;
}
.tcol { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; border-radius: 4px; outline-offset: 0; }
.tcol:hover, .tcol:focus-visible { background: var(--bar); }
.tcol i { display: block; width: min(40%, 18px); border-radius: 4px 4px 0 0; }
.tcol i { background: var(--c); }
.months { grid-column: 2; display: grid; grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr)); white-space: nowrap; font-size: 0.75rem; color: var(--muted); text-align: center; }
#tip {
  position: fixed; z-index: 10; pointer-events: none; display: none; min-width: 150px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 0.8125rem; box-shadow: 0 6px 20px rgba(0,0,0,0.15); font-variant-numeric: tabular-nums;
}
#tip strong { display: block; margin-bottom: 2px; }
#tip div { display: flex; justify-content: space-between; gap: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.panel .table-wrap { border-radius: var(--radius-sm); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; font-size: 0.9375rem; }
th, td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
thead th { font-weight: 600; color: var(--muted); font-size: 0.8125rem; }
.history thead tr:first-child th { color: var(--ink); font-size: 0.875rem; border-bottom: 0; padding-bottom: 0; text-align: left; }
th.group-start, td.group-start { border-left: 1px solid var(--line); }
td.zero { color: var(--line); }
td.money { color: var(--money); font-weight: 600; }
tbody tr:hover td { background: var(--bg); }
tfoot td { font-weight: 750; border-bottom: 0; }
td button.linkish { border: 0; background: none; padding: 0; color: var(--action); cursor: pointer; font-weight: 600; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty button { margin-top: 12px; }

/* Clients */
.form-note { margin-top: 12px; font-size: 0.875rem; }
.form-gap { margin-top: 12px; }
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.list-head h2 { margin: 0; }
.grid > .list-head { margin: 4px 0 -8px; }
.grid > .list-head h2 { font-size: 1.125rem; }
.list-head .tabs.sub { margin: 0; }
table.clients td small { display: block; color: var(--muted); font-size: 0.8125rem; }
/* Separate borders stay visible on the sticky first column, so no extra line is needed */
table.clients tr.cancelled td { color: var(--muted); }
table.clients tr.cancelled td.money { color: var(--muted); font-weight: 400; }
.row-actions { display: flex; gap: 12px; justify-content: flex-end; }
button.linkish.danger { color: var(--danger); }
.entries .ltv { margin-left: auto; color: var(--money); font-weight: 650; font-variant-numeric: tabular-nums; }
.add-client { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Free trials */
.kind-switch {
  grid-column: 1 / -1; display: inline-flex; justify-self: start; gap: 4px; margin: 0; padding: 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg);
}
.kind-switch label { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--muted); }
.kind-switch input { position: absolute; opacity: 0; pointer-events: none; }
.kind-switch label:has(input:checked) { background: var(--ink); color: var(--bg); }
.kind-switch label:has(input:focus-visible) { outline: 2px solid var(--action); outline-offset: 2px; }
.warn { color: var(--danger) !important; font-weight: 600; }
table.clients tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.notice {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin-bottom: 20px; padding: 14px 20px; border-color: var(--danger);
}

/* Dashboard period picker */
.period-pick { position: relative; }
.period-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit; padding: 4px 8px; margin: 0 -8px; border-radius: var(--radius-sm);
}
.period-btn:hover, .period-btn[aria-expanded="true"] { background: var(--bar); }
.period-btn span[aria-hidden] { color: var(--muted); font-size: 0.8em; }
.picker {
  position: absolute; z-index: 5; top: calc(100% + 8px); left: -8px; width: 420px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.presets button {
  border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 6px 12px;
  font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
.presets button:hover { border-color: var(--action); color: var(--action); }
.range-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.range-form input { min-width: 0; }
.range-form .btn-primary { background: var(--action); color: var(--action-ink); height: 42px; }
@media (max-width: 480px) {
  .range-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .range-form .btn-primary { grid-column: 1 / -1; }
}

/* Planner: agenda on the left, board of lists on the right */
.planner { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 20px; align-items: start; }
.agenda { padding: 14px; position: sticky; top: 12px; }
.a-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.a-bar input[type="date"] { flex: 1; min-width: 0; padding: 0 6px; }
.a-bar .text-btn:disabled { opacity: 0.5; cursor: default; }
.a-days { max-height: calc(100vh - 140px); overflow-y: auto; margin: 0 -14px; padding: 0 14px; }
.a-day { padding: 12px 8px; margin: 0 -8px; border-top: 1px solid var(--line); border-radius: var(--radius-sm); }
.a-day:first-child { border-top: 0; }
.a-day h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 400; color: var(--muted); }
.a-day h3 strong { color: var(--ink); font-weight: 700; margin-right: 4px; }
.a-day.today h3 strong { color: var(--action); }
.a-day h4, .activity h4 { margin: 8px 0 2px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.a-list { list-style: none; margin: 0; padding: 0; }
.a-item { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; }
.a-title {
  flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; cursor: pointer;
  font-size: 0.9375rem; overflow-wrap: anywhere;
}
.a-title time { color: var(--muted); font-size: 0.8125rem; margin-right: 6px; font-variant-numeric: tabular-nums; }
.a-title small { display: block; color: var(--muted); font-size: 0.75rem; }
.done .a-title span, .card.done .card-body > span:first-child { text-decoration: line-through; color: var(--muted); }
.activity p { margin: 0; font-size: 0.875rem; }
.activity .linkish { font-size: 0.8125rem; }
.a-day .note { font-size: 0.875rem; }
.planner input[type="checkbox"] { width: 16px; height: 16px; margin: 3px 0 0; flex: none; accent-color: var(--action); cursor: pointer; }

.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; min-height: 200px; }
.list {
  flex: none; width: 272px; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px;
}
.list-top { display: flex; align-items: center; gap: 6px; padding: 2px 2px 0 4px; }
.list-top h3 { flex: 1; min-width: 0; margin: 0; font-size: 1rem; }
.list-name {
  border: 0; background: none; padding: 2px 4px; margin: 0 -4px; border-radius: 6px; cursor: text;
  font-weight: 700; text-align: left; max-width: 100%; overflow-wrap: anywhere;
}
.list-name:hover { background: var(--bar); }
.list-top .count { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.list-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.list-del:hover { color: var(--danger); background: var(--bar); }
.rename-form { flex: 1; }
.rename-form input, .inline-form input, .card-form input, .card-form textarea, .card-form select {
  width: 100%; height: 38px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); font-size: 0.9375rem;
}
.card-form textarea { height: auto; padding: 8px 10px; resize: vertical; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cards:empty { min-height: 4px; }
.card {
  display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: grab;
}
.card:hover { border-color: var(--action); }
.card.dragging { opacity: 0.4; }
.card.drop-before { box-shadow: 0 -3px 0 var(--action); }
.card.editing { display: block; cursor: default; border-color: var(--action); }
.card-body {
  flex: 1; min-width: 0; display: grid; gap: 4px; text-align: left; border: 0; background: none; padding: 0;
  cursor: pointer; font-size: 0.9375rem; overflow-wrap: anywhere;
}
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.75rem; color: var(--muted); }
.due.now { color: var(--action); font-weight: 600; }
.due.late { color: var(--danger); font-weight: 600; }
.card-form { display: grid; gap: 8px; }
.card-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.inline-form { display: grid; gap: 8px; }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-actions .btn-primary { height: 36px; padding: 0 14px; background: var(--action); color: var(--action-ink); }
.inline-actions .text-btn { height: 36px; }
.inline-actions .danger { margin-left: auto; }
.add-card, .done-toggle {
  border: 0; background: none; text-align: left; padding: 6px 4px; border-radius: 6px; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 0.875rem;
}
.add-card:hover, .done-toggle:hover { background: var(--bar); color: var(--ink); }
.a-day .add-card { margin-top: 4px; padding: 4px; }
.new-list { background: transparent; border-style: dashed; }
.title-time { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 6px; }
.toolbar .tabs.sub { margin: 0; }

/* Planner calendar: Day / Week hour grid */
.cal-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 20px; align-items: start; }
.cal-side { padding: 14px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.cal-side h4 { margin: 0 0 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.cal-side .a-list + h4 { margin-top: 14px; }
.cal-side .a-item { cursor: grab; }
.side-tip { margin-top: 14px; font-size: 0.8125rem; }
.cal-side.drop-target { outline: 2px dashed var(--action); outline-offset: -2px; background: var(--bar); }
.cal-bar { margin-bottom: 12px; }
.cal-bar h2 { margin-left: 8px; }
.cal-bar .text-btn:disabled { opacity: 0.5; cursor: default; }
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow-x: auto; }
.cal-inner.week { min-width: 680px; }
.cal-head, .cal-allday, .cal-grid { display: grid; }
.cal-head, .cal-allday { scrollbar-gutter: stable; overflow-y: hidden; }
.cal-head { border-bottom: 1px solid var(--line); }
.cal-dname {
  display: grid; justify-items: center; gap: 0; padding: 8px 0 6px; border: 0; background: none; cursor: pointer;
  border-left: 1px solid var(--line); color: var(--muted);
}
.cal-dname small { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.cal-dname strong { font-size: 1.35rem; line-height: 1.2; font-weight: 600; color: var(--ink); width: 2em; height: 1.6em; display: grid; place-items: center; border-radius: 999px; }
.cal-dname.today strong { background: var(--action); color: var(--action-ink); }
.cal-dname:hover strong { background: var(--bar); }
.cal-dname.today:hover strong { background: var(--action); }
.cal-allday { border-bottom: 1px solid var(--line); }
.cal-gutter { font-size: 0.6875rem; color: var(--muted); text-align: right; padding: 8px 8px 0 0; }
.cal-adcell { border-left: 1px solid var(--line); padding: 4px; min-height: 36px; display: grid; gap: 3px; align-content: start; cursor: copy; min-width: 0; }
.cal-chip, .cal-ev {
  display: flex; align-items: flex-start; gap: 5px; padding: 3px 6px; border-radius: 6px; min-width: 0; cursor: grab;
  background: color-mix(in srgb, var(--action) 16%, var(--surface)); border-left: 3px solid var(--action);
  font-size: 0.8125rem; line-height: 1.25;
}
.cal-chip.done, .cal-ev.done { background: var(--bg); border-left-color: var(--line); }
.cal-chip.done span, .cal-ev.done span { text-decoration: line-through; color: var(--muted); }
.cal-ev.late, .cal-chip.late { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.cal-chip input[type="checkbox"], .cal-ev input[type="checkbox"] { width: 13px; height: 13px; margin: 2px 0 0; flex: none; accent-color: var(--action); cursor: pointer; }
.cal-ev-body {
  flex: 1; min-width: 0; display: grid; text-align: left; border: 0; background: none; padding: 0; cursor: pointer;
  font-size: inherit; line-height: inherit;
}
.cal-ev-body span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cal-ev-body time { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.short .cal-ev-body { display: flex; gap: 6px; }
.cal-ev.short .cal-ev-body span { flex: 0 1 auto; min-width: 0; }
.cal-ev.short .cal-ev-body time { flex: 0 1000 auto; min-width: 0; }
.cal-act {
  border: 0; background: none; padding: 2px 2px 0; text-align: left; cursor: pointer;
  font-size: 0.6875rem; color: var(--money); font-weight: 600; line-height: 1.3;
}
.cal-act:hover { text-decoration: underline; }
.cal-scroll { max-height: calc(100vh - 300px); min-height: 360px; overflow-y: auto; scrollbar-gutter: stable; }
.cal-grid { position: relative; }
.cal-hours { display: grid; grid-template-rows: repeat(24, var(--hour)); }
.cal-hours span { font-size: 0.6875rem; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-0.6em); font-variant-numeric: tabular-nums; }
.cal-col {
  position: relative; height: calc(24 * var(--hour)); border-left: 1px solid var(--line); cursor: copy;
  background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hour));
}
.cal-col.today { background-color: color-mix(in srgb, var(--action) 4%, transparent); }
.cal-col.drop-target { background-color: var(--bar); }
.cal-ev { position: absolute; overflow: hidden; box-shadow: 0 0 0 1px var(--surface); }
.cal-ev:hover { z-index: 2; }
.cal-ev.narrow { padding: 3px 4px; }
.cal-ev.narrow input[type="checkbox"] { display: none; }
.cal-now { position: absolute; left: -1px; right: 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.cal-ghost {
  position: absolute; left: 2px; right: 4px; border-radius: 6px; border: 2px dashed var(--action); pointer-events: none;
  font-size: 0.75rem; font-weight: 700; color: var(--action); padding: 2px 6px; background: var(--surface); z-index: 4;
}
.cal-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; touch-action: none; }
.cal-resize::after {
  content: ""; position: absolute; left: 50%; bottom: 2px; width: 18px; height: 3px; margin-left: -9px;
  border-radius: 2px; background: var(--action); opacity: 0;
}
.cal-ev:hover .cal-resize::after, .cal-ev.resizing .cal-resize::after { opacity: 0.6; }
.cal-ev.resizing { z-index: 5; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }

/* Month view */
.cal-mhead { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.cal-mhead span {
  padding: 8px 0; text-align: center; font-size: 0.75rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.cal-mgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-mcell {
  min-width: 0; padding: 4px 4px 6px; display: flex; flex-direction: column; gap: 2px; cursor: copy;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.cal-mcell:nth-child(7n) { border-right: 0; }
.cal-mcell.out { background: color-mix(in srgb, var(--bg) 55%, transparent); }
.cal-mcell.out .cal-mnum { color: var(--muted); font-weight: 400; }
.cal-mcell.drop-target { background: var(--bar); outline: 2px dashed var(--action); outline-offset: -2px; }
.cal-mnum {
  align-self: center; border: 0; background: none; cursor: pointer; padding: 0 8px; min-width: 28px; height: 26px;
  border-radius: 999px; font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
}
.cal-mnum:hover { background: var(--bar); }
.cal-mcell.today .cal-mnum { background: var(--action); color: var(--action-ink); }
.cal-mitem {
  display: flex; align-items: center; gap: 4px; padding: 1px 5px; border-radius: 5px; min-width: 0; cursor: grab;
  font-size: 0.75rem; line-height: 1.35; background: color-mix(in srgb, var(--action) 16%, var(--surface));
}
.cal-mitem.timed { background: none; }
.cal-mitem.timed:hover { background: var(--bar); }
.cal-mitem.late { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.cal-mitem.timed.late { background: none; }
.cal-mitem.timed.late time { color: var(--danger); }
.cal-mitem.done span { text-decoration: line-through; color: var(--muted); }
.cal-mitem input[type="checkbox"] { width: 12px; height: 12px; margin: 0; flex: none; accent-color: var(--action); cursor: pointer; }
.cal-mitem .cal-ev-body { display: flex; gap: 5px; }
.cal-mitem .cal-ev-body time { flex: none; font-size: 0.6875rem; }
.cal-mitem .cal-ev-body span { font-weight: 500; }
.cal-more {
  align-self: flex-start; border: 0; background: none; cursor: pointer; padding: 1px 5px; border-radius: 5px;
  font-size: 0.75rem; font-weight: 700; color: var(--muted);
}
.cal-more:hover { background: var(--bar); color: var(--ink); }
.cal-mcell .cal-act { margin-top: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cal-month { overflow-x: auto; }
.cal-month > * { min-width: 640px; }

/* Pop-ups: a full-screen layer that scrolls, with the dialog inside it, so the wheel scrolls it wherever the pointer is */
.modal-layer { position: fixed; inset: 0; z-index: 20; display: flex; overflow-y: auto; overscroll-behavior: contain; padding: 32px 16px; background: rgba(0, 0, 0, 0.35); }
html { scrollbar-gutter: stable; }
body.modal-open { overflow: hidden; }
.modal {
  position: relative; margin: auto; width: min(400px, 100%); flex: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}
.modal h3 { margin: 0 0 12px; font-size: 1.05rem; }
@media (max-width: 760px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; max-height: none; order: 2; }
  .cal-scroll { max-height: 65vh; }
}

.list.drop-target, .a-day.drop-target { outline: 2px dashed var(--action); outline-offset: -2px; background: var(--bar); }
@media (max-width: 760px) {
  .planner { grid-template-columns: 1fr; }
  .agenda { position: static; }
  .a-days { max-height: none; }
  .list { width: 82vw; }
}

/* Sign in */
[hidden] { display: none !important; }
.login { max-width: 400px; margin: 8vh auto 0; display: grid; gap: 14px; }
.login h2 { margin: 0; }
.login-form { display: grid; gap: 12px; }
.login-form .btn-primary { background: var(--action); color: var(--action-ink); }
.login-form .btn-primary:disabled { opacity: 0.6; cursor: default; }
.login-msg { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bar); font-size: 0.9375rem; }
button.linkish { border: 0; background: none; padding: 0; color: var(--action); cursor: pointer; font-weight: 600; }

#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--danger); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
  font-weight: 600; display: none; max-width: calc(100% - 32px);
}
#toast.show { display: block; }

@media (max-width: 760px) {
  .grid, .money-grid { grid-template-columns: 1fr; }
  .hint { display: none; }
  .tabs button { padding: 8px 12px; }
  .row kbd { display: none; }
  .row { grid-template-columns: 1fr auto; }
  .fld.wide { grid-column: 1 / -1; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .big { font-size: 1.4rem; }
  .trend { grid-template-columns: 48px 1fr; }
  .months span:nth-child(odd) { visibility: hidden; }  /* keep the latest month labeled */
}
@media (prefers-reduced-motion: reduce) {
  .count.bump { animation: none; }
  .row::before, .bar-row::before { transition: none; }
}

/* Ads: creatives library, thumbnails, wide results table */
.upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.upload input[type="text"], .upload input:not([type]) {
  height: 40px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); min-width: 180px;
}
.upload-btn { display: inline-flex; align-items: center; height: 40px; background: var(--action); color: var(--action-ink); position: relative; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-btn.busy { opacity: 0.7; }
.upload-btn:focus-within { outline: 2px solid var(--action); outline-offset: 2px; }
.creatives { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.creative { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); display: flex; flex-direction: column; }
.creative .media { position: relative; aspect-ratio: 4 / 5; background: color-mix(in srgb, var(--ink) 8%, var(--bg)); display: grid; place-items: center; }
.creative .media img, .creative .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.creative .media a { display: contents; }
.creative .media .kind { position: absolute; top: 8px; left: 8px; background: var(--surface); }
.media-empty { color: var(--muted); font-size: 0.8125rem; }
.creative-body { padding: 10px 12px 12px; display: grid; gap: 2px; min-width: 0; }
.creative-body strong { font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creative-body small { color: var(--muted); font-size: 0.8125rem; }
.creative-stats { margin: 4px 0 6px; font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.creative .row-actions { justify-content: flex-start; font-size: 0.875rem; }
.thumb {
  flex: none; width: 34px; height: 34px; border-radius: 6px; overflow: hidden; display: inline-grid; place-items: center;
  background: color-mix(in srgb, var(--ink) 8%, var(--bg)); vertical-align: middle;
}
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.cell-flex { display: flex; align-items: center; gap: 8px; }
.cell-name small { display: block; color: var(--muted); font-size: 0.75rem; }
.muted { color: var(--muted); }
.entries .where { font-weight: 400; color: var(--muted); font-size: 0.875rem; }
.sub-head { margin: 16px 0 8px; font-size: 0.875rem; color: var(--muted); font-weight: 600; }
@media (min-width: 761px) { .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Shared pop-up, wide variant for clients */
.modal.wide { width: min(760px, 100%); padding: 22px 24px; }
.pop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pop-head h3 { margin: 0; font-size: 1.35rem; }
.pop-head .note { margin-top: 2px; }
.pop-x { flex: none; font-size: 1.3rem; }
.status-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.status-bar .text-btn { height: 36px; }
.on-date { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); font-size: 0.875rem; }
.on-date input[type="date"] { height: 36px; }
.pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 28px; }
.pop-section { padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.pop-section h4 { margin: 0 0 8px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.client-edit .pop-section { border-bottom: 0; padding: 8px 0; }
.client-edit textarea { width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); resize: vertical; }
.dl { margin: 0; display: grid; gap: 6px; }
.dl > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; font-size: 0.9375rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.dl a { color: var(--action); text-decoration: none; font-weight: 600; }
.dl a:hover { text-decoration: underline; }
button.add-detail { font-weight: 500; color: var(--muted); }
button.add-detail:hover { color: var(--action); }
.pop-notes { margin: 0; font-size: 0.9375rem; white-space: normal; }
.pop-actions { padding-top: 16px; }
.status-pill, .status-select {
  border-radius: 999px; font-size: 0.8125rem; font-weight: 700; padding: 4px 12px; border: 1px solid transparent;
}
.status-select { height: 30px; cursor: pointer; padding-right: 8px; }
.st-trial { background: color-mix(in srgb, var(--action) 14%, var(--surface)); color: var(--action); }
.st-active { background: color-mix(in srgb, var(--money) 16%, var(--surface)); color: var(--money); }
.st-cancelled, .st-lost { background: var(--bg); color: var(--muted); border-color: var(--line); }
.status-select option { color: var(--ink); background: var(--surface); font-weight: 400; }
.client-name { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-align: left; }
.client-name:hover { color: var(--action); text-decoration: underline; }
table.clients tbody tr { cursor: pointer; }
table.clients small.contact { color: var(--muted); }
.search {
  width: 100%; max-width: 420px; height: 40px; padding: 0 12px; margin-bottom: 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
#toast.ok { background: var(--money); }
@media (max-width: 760px) {
  .pop-grid { grid-template-columns: 1fr; }
  .on-date { margin-left: 0; }
  .dl > div { grid-template-columns: 110px minmax(0, 1fr); }
}

/* Chips: filters, expense categories, script picker */
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 999px; padding: 6px 12px; font-size: 0.875rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--action); }
.chip.on, .chip:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 2px solid var(--action); outline-offset: 2px; }
fieldset.chips { display: flex; flex-wrap: wrap; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.span-all { grid-column: 1 / -1; }
.expense-form .kind-switch label { padding: 8px 18px; }
.filters { display: grid; gap: 8px; margin-bottom: 12px; }
.filters .search { margin-bottom: 0; }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.flabel { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); min-width: 64px; }
.filter-row input[type="date"] { height: 34px; }
.filter-note { margin: 0; }
.grid > .filters { margin: -8px 0 0; }

/* Cold call scripts */
.script-bar { margin-bottom: 16px; padding: 14px 18px; }
.script-bar .script-toggle { margin-left: auto; }
.script-text {
  margin-top: 12px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line);
  max-height: 40vh; overflow-y: auto; font-size: 1rem; line-height: 1.6; white-space: normal;
}
.script-note { margin-top: 10px; font-size: 0.875rem; }
.scripts { list-style: none; margin: 0; padding: 0; }
.scripts li { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.scripts li:first-child { border-top: 0; }
.scripts .what { min-width: 0; }
.scripts .what small { display: block; color: var(--muted); font-size: 0.8125rem; margin-top: 2px; overflow-wrap: anywhere; }
.scripts li.archived .what strong { color: var(--muted); }
.new-script { height: 40px; margin-left: auto; background: var(--action); color: var(--action-ink); }
td.best { color: var(--money); font-weight: 750; }
.modal textarea { width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); color: var(--ink); resize: vertical; line-height: 1.5; }


/* $ / € switch on the Dashboard */
.cur-pick { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.cur-select { height: 40px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; }
.fx-note { color: var(--muted); font-size: 0.8125rem; white-space: nowrap; }

/* "+ Filter" builder */
.fbar { display: grid; gap: 8px; }
.filter-add { height: 34px; font-size: 0.875rem; }
.pill { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--bg); border-radius: 999px; overflow: hidden; }
.pill.open { border-color: var(--action); }
.pill.unset { border-style: dashed; }
.pill-main { border: 0; background: none; padding: 6px 4px 6px 12px; cursor: pointer; font-size: 0.875rem; color: var(--muted); }
.pill-main strong { color: var(--ink); font-weight: 650; }
.pill.unset .pill-main strong { color: var(--muted); font-weight: 400; }
.pill-x { border: 0; background: none; padding: 6px 10px 6px 6px; cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1; }
.pill-x:hover { color: var(--danger); }
.fmenu { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 20px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.fgroup { display: grid; gap: 2px; align-content: start; }
.fgroup h4 { margin: 0 0 4px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.fopt { border: 0; background: none; text-align: left; padding: 5px 8px; margin: 0 -8px; border-radius: 6px; cursor: pointer; font-size: 0.9375rem; }
.fopt:hover { background: var(--bar); color: var(--action); }
.feditor { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--action); border-radius: var(--radius-sm); background: var(--surface); }
.feditor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feditor-head span { display: inline-flex; align-items: center; gap: 12px; }
.feditor-head .text-btn { height: 32px; }
.feditor .search { margin: 0; max-width: 360px; }
.filter-range { display: grid; grid-template-columns: repeat(2, minmax(0, 180px)); gap: 10px; }

/* Script filter on Week / Month / History */
.script-filter { margin: -8px 0 16px; }

/* Pick-or-type chips (types, categories, tags) */
.chip-picker { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 6px; }
.chip-picker legend.flabel { padding: 0; margin-bottom: 6px; }
.chip-picker .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-new { border-style: dashed; color: var(--muted); }
.picker-new { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.picker-new input[type="text"], .picker-new input:not([type]) {
  height: 40px; min-width: 240px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.picker-new .check { height: auto; font-weight: 600; }
.picker-new .check small { font-weight: 400; }
.tag.soft { border-style: dashed; font-weight: 500; }

/* ---- Clean-up pass ---- */
/* Funnel rows: a thin progress line under each step instead of a half-filled block */
.row::before {
  inset: auto auto 2px 12px; height: 3px; border-radius: 2px;
  width: calc(var(--share, 0) * (100% - 24px));
  background: color-mix(in srgb, var(--action) 40%, transparent);
}
/* Script bar: chips on the left, quiet actions on the right */
.script-bar { padding: 12px 16px; }
.script-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.script-row .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.script-row .flabel { min-width: 0; }
.quiet-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.quiet {
  border: 0; background: none; padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 0.875rem;
}
.quiet:hover { background: var(--bar); color: var(--ink); }
.quiet.danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
button.chip-new { color: var(--muted); }
/* Dashboard cards in an even grid */
@media (min-width: 761px) { .kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Client names in lists read as names, not red action links */
.entries .client-name { color: var(--ink); font-size: inherit; padding: 0; font-weight: 700; }
.entries .client-name:hover { color: var(--action); }
/* Search and "+ Filter" share one row */
.fbar .filter-row .search { flex: 1 1 260px; max-width: 420px; margin: 0; }
.filters { gap: 6px; }
/* No doubled line where the last row meets the table's outer border */
.table-wrap table > :last-child > tr:last-child > td,
.table-wrap table > :last-child > tr:last-child > th { border-bottom: 0; }

/* Clients: plans, tags, upsells */
.chip-sub { color: inherit; opacity: 0.65; font-weight: 500; }
.tag-line { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag.up-open { color: var(--action); border-color: color-mix(in srgb, var(--action) 40%, var(--line)); }
.tag.up-won { color: var(--money); border-color: color-mix(in srgb, var(--money) 40%, var(--line)); }
.tag.up-lost { color: var(--muted); }
.pop-grid .wide-sec { grid-column: 1 / -1; }
.upsell-list li { gap: 8px; }
.upsell-list .status-pill { font-size: 0.75rem; padding: 2px 10px; }
.upsell-try { margin-top: 10px; height: 36px; }
.upsell-form { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.upsell-hint { margin-top: 8px; font-size: 0.8125rem; }
.plans-list li { gap: 4px; }
.plans-list .what { margin-right: auto; }

/* Managing tags and plans */
.picker-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.picker-head .flabel { min-width: 0; }
.quiet.small { padding: 2px 8px; font-size: 0.8125rem; }
.tag-btn { cursor: pointer; background: none; font: inherit; font-size: 0.75rem; }
.tag-btn:hover { border-color: var(--action); color: var(--action); }
.entries .tag-btn { color: var(--muted); padding: 1px 8px; }
.entries .tag-btn:hover { color: var(--action); }
.manage-list li { gap: 4px; }
.manage-list .what { margin-right: auto; }
.rename-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.rename-row input { flex: 1 1 180px; height: 38px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.rename-row .btn-primary { height: 38px; background: var(--action); color: var(--action-ink); }
.rename-row .text-btn { height: 38px; }
.plan-name { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; text-align: left; }
.plan-name:hover { color: var(--action); text-decoration: underline; }
.entries .plan-name { font-size: inherit; color: var(--ink); padding: 0; }
/* Quiet buttons inside lists stay grey; only Delete turns red on hover */
.entries .quiet { color: var(--muted); padding: 6px 10px; font-size: 0.875rem; }
.entries .quiet:hover { color: var(--ink); }
.entries .quiet.danger:hover { color: var(--danger); }
.entries .text-btn { color: var(--ink); font-size: 0.9375rem; padding: 0 14px; }
.entries .btn-primary { color: var(--action-ink); padding: 0 16px; font-size: 0.9375rem; }

/* Plan descriptions */
.plan-desc { display: block; color: var(--muted); font-size: 0.8125rem; white-space: pre-line; margin-top: 2px; }
.modal textarea[name="description"] { width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); color: var(--ink); resize: vertical; }

/* ==== GoHighLevel look ==== */
/* Sized like GHL's own pages: 14px text on desktop, 16px on phones so iOS doesn't zoom into fields */
html { font-size: 14px; }
body { font-size: 1rem; background: var(--bg); }
@media (max-width: 760px) { html { font-size: 16px; } }
.wrap { max-width: none; padding: 24px 24px 64px; }
h1, h2, h3, h4 { font-weight: 600; }
.panel h2, .toolbar h2, .list-head h2, .modal h3, .pop-head h3, .list-name { font-weight: 600; }
.toolbar h2 { font-size: 1.43rem; }   /* ~20px page title */
.kpi .big, .money-total, .count { font-weight: 600; letter-spacing: -0.02em; }
.kpi h3 { color: var(--ink-2); font-weight: 500; }

/* Top bar: GHL's sub-menu. Full width, white, plain text tabs, blue underline on the open one */
header.app-header {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 16px; margin: 0; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
header.app-header:has(nav[hidden]):has(#signout[hidden]) { display: none; }
header .tabs {
  flex: 1; min-width: 0; margin: 0; gap: 28px; padding: 0; border: 0; border-radius: 0; background: none;
}
header .tabs button {
  height: 52px; padding: 0 2px; border-radius: 0; border-bottom: 2px solid transparent;
  color: var(--muted); font-size: 14px; font-weight: 500; background: none; box-shadow: none;
}
header .tabs button:hover { color: var(--ink); background: none; }
header .tabs button[aria-selected="true"] {
  background: none; color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; box-shadow: none;
}
#signout { flex: none; height: 36px; }

/* Segmented controls (Week / Month, Board / Day…): grey track, the selected item raised in white */
.tabs, .kind-switch { background: var(--fill); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.tabs button, .kind-switch label { border-radius: 6px; color: var(--muted); font-weight: 600; font-size: 1rem; }
.tabs.sub button { padding: 6px 12px; font-size: 1rem; }
.tabs button:hover, .kind-switch label:hover { color: var(--ink); }
.tabs button[aria-selected="true"], .kind-switch label:has(input:checked) {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
}

/* Chips: white with grey border; selected ones light blue */
.chip { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); font-weight: 500; }
.chip:hover { border-color: var(--line-strong); background: var(--bg); }
.chip.on, .chip:has(input:checked) { background: var(--tab-on-bg); color: var(--tab-on-ink); border-color: #b2ccff; }
.presets button, .pill { background: var(--surface); border-color: var(--line-strong); }
.presets button:hover { background: var(--tab-on-bg); }

/* Buttons: primary solid blue, secondary white with a grey border */
.btn-primary, .money-form button, .step.plus, .inline-actions .btn-primary, .range-form .btn-primary, .login-form .btn-primary,
.upload-btn, .new-script, .rename-row .btn-primary, .entries .btn-primary {
  background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand); border-radius: var(--radius-sm);
  font-weight: 600; box-shadow: var(--shadow);
}
.btn-primary:hover, .money-form button:hover, .step.plus:hover, .upload-btn:hover, .new-script:hover,
.inline-actions .btn-primary:hover, .range-form .btn-primary:hover, .rename-row .btn-primary:hover {
  background: var(--brand-hover); border-color: var(--brand-hover);
}
.text-btn, .icon-btn, .step.minus {
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink-2); box-shadow: var(--shadow);
}
.text-btn { font-weight: 600; }
.text-btn:hover, .icon-btn:hover, .step.minus:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
a.linkish { color: var(--action); font-weight: 600; text-decoration: none; }
a.linkish:hover, button.linkish:hover { text-decoration: underline; }

/* Fields: white, grey border, blue ring on focus */
.fld input, .fld select, input[type="date"], .search, .cur-select, .rename-form input, .inline-form input,
.card-form input, .card-form textarea, .card-form select, .client-edit textarea, .modal textarea,
.upload input[type="text"], .upload input:not([type]), .picker-new input[type="text"], .picker-new input:not([type]),
.rename-row input, .money-form .field {
  background: var(--surface); border-color: var(--line-strong); box-shadow: var(--shadow);
}
.fld input:focus, .fld select:focus, input[type="date"]:focus, .search:focus, .cur-select:focus, .rename-form input:focus,
.inline-form input:focus, .card-form input:focus, .card-form textarea:focus, .card-form select:focus, .client-edit textarea:focus,
.modal textarea:focus, .upload input:focus, .picker-new input:focus, .rename-row input:focus {
  outline: none; border-color: #84adff; box-shadow: var(--focus-ring);
}
.money-form .field:focus-within { outline: none; border-color: #84adff; box-shadow: var(--focus-ring); }
.fld { color: var(--ink-2); font-weight: 500; }

/* Cards: white, thin grey border, 12px corners, faint shadow */
.panel, .kpi, .list, .table-wrap, .agenda, .cal-side, .cal { box-shadow: var(--shadow); }
.panel .table-wrap { box-shadow: none; }
.card { background: var(--surface); box-shadow: var(--shadow); }

/* Tables: grey header row like GHL's lists */
thead th, thead th:first-child { background: var(--bg); color: var(--muted); font-size: 0.857rem; font-weight: 500; }
th, td { padding: 11px 16px; }
tbody tr:hover td { background: var(--bg); }

/* Status badges in GHL colors */
.status-pill, .status-select { font-weight: 500; }
.st-trial { background: #eff8ff; color: #175cd3; }
.st-active { background: #ecfdf3; color: #027a48; }
.st-cancelled, .st-lost { background: var(--fill); color: var(--ink-2); border-color: transparent; }
.tag { color: var(--ink-2); border-color: var(--line); background: var(--bg); font-weight: 500; }

/* "Today" in the planner and calendars */
.cal-dname.today strong, .cal-mcell.today .cal-mnum, .cal-dname.today:hover strong { background: var(--brand); color: var(--brand-ink); }
.a-day.today h3 strong { background: var(--brand); color: var(--brand-ink); padding: 1px 8px; border-radius: 6px; }

/* Funnel progress lines */
.row::before { background: color-mix(in srgb, var(--brand) 55%, transparent); }

@media (max-width: 760px) {
  .wrap { padding: 16px 12px 48px; }
  header.app-header { padding: 0 12px; gap: 8px; }
  header .tabs { gap: 20px; }
  header .tabs button { height: 48px; }
  #signout { height: 34px; padding: 0 10px; }
}

/* Charts: one bar per column, stacked bars, and the line */
.plot.one .tcol i, .cstack { width: min(56%, 26px); }
.cstack { display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; }
.cstack i { width: 100%; flex: 0 1 0; min-height: 0; border-radius: 0; }
.cstack i + i { border-bottom: 2px solid var(--surface); }
.line-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.line-plot .stroke { fill: none; stroke: var(--c); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.line-plot .area { fill: color-mix(in srgb, var(--c) 12%, transparent); }
.line-plot .tcol { position: relative; }
.line-plot .tcol i.dot {
  position: absolute; left: 50%; width: 9px; height: 9px; border-radius: 50%; background: var(--c);
  box-shadow: 0 0 0 2px var(--surface); transform: translate(-50%, 50%); opacity: 0;
}
.line-plot .tcol:hover i.dot, .line-plot .tcol:focus-visible i.dot, .line-plot .tcol.last i.dot { opacity: 1; }
.chart-panel { margin-bottom: 20px; }
.grid.charts { margin-bottom: 20px; }
.glance { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.glance .sub-head:first-child { margin-top: 0; }
@media (max-width: 760px) { .glance { grid-template-columns: 1fr; } }


/* Google Calendar events in the Planner: read-only, pink edge, open in Google */
.cal-ev.ext, .cal-mitem.ext { cursor: pointer; }
.cal-ev.ext { background: color-mix(in srgb, var(--s3) 14%, var(--surface)); border-left-color: var(--s3); }
.cal-ev.ext a, .cal-mitem.ext a, .a-item.ext a { color: inherit; text-decoration: none; }
.cal-mitem.ext time { color: var(--s3); font-weight: 600; }
.a-item.ext { border-left: 3px solid var(--s3); padding-left: 8px; }

/* Photos, videos and PDFs (Supabase Storage) */
.media-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.m-item { position: relative; width: 84px; height: 84px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--bg); flex: none; }
.m-item a { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); text-decoration: none; }
.m-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-icon { font-size: 0.75rem; font-weight: 700; padding: 4px; text-align: center; overflow-wrap: anywhere; }
.m-item.video a::after {
  content: "▶"; position: absolute; left: 6px; bottom: 6px; font-size: 0.625rem; line-height: 1; padding: 4px 5px;
  border-radius: 999px; background: rgba(0, 0, 0, 0.6); color: #fff;
}
.m-item.video .m-icon { font-size: 1.2rem; }
.m-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 0.875rem; line-height: 1; opacity: 0; transition: opacity 0.15s;
}
.m-item:hover .m-del, .m-del:focus-visible { opacity: 1; }
@media (hover: none) { .m-del { opacity: 1; } }
.m-add {
  position: relative; display: grid; place-items: center; min-width: 84px; height: 84px; padding: 0 12px; cursor: pointer;
  border: 1px dashed color-mix(in srgb, var(--muted) 60%, transparent); border-radius: var(--radius-sm);
  font-size: 0.8125rem; font-weight: 600; color: var(--muted); text-align: center;
}
.m-add:hover { border-color: var(--brand); color: var(--ink); background: var(--bar); }
.m-add:focus-within { outline: 2px solid var(--action); outline-offset: 2px; }
.m-add.busy { cursor: progress; opacity: 0.7; }
.m-add input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.card-form .media-strip { margin-top: 4px; }
.card-form .m-item, .card-form .m-add { width: 64px; min-width: 64px; height: 64px; }
.neutral.faint { opacity: 0.55; }
.neutral.faint:hover { opacity: 1; }

@media (min-width: 761px) { .kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.faint-text { color: var(--muted); }

/* ---- Calendars ---- */
.g-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.g-panel h2 { margin-bottom: 4px; }
.g-panel > div { flex: 1 1 320px; }
.warn-panel { border-color: #fedf89; background: #fffcf5; }
.cal-cards { margin-bottom: 20px; }
.cal-card { display: grid; gap: 6px; align-content: start; }
.cal-card.off { opacity: .7; }
.cal-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-card-head h2 { margin: 0; }
.cal-link { margin: 4px 0 8px; font-size: .9375rem; overflow-wrap: anywhere; }
.cal-link a { color: var(--action); text-decoration: none; font-weight: 500; }
.cal-link a:hover { text-decoration: underline; }
table.bookings td small { display: block; color: var(--muted); font-size: .8125rem; }
table.bookings td .bk-notes { white-space: pre-line; max-width: 320px; }
table.bookings tbody tr { cursor: default; }
table.bookings a { color: var(--action); font-weight: 500; text-decoration: none; }
.danger-text { color: var(--danger) !important; }
.cal-form .four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cal-form textarea { width: 100%; }
.cal-form .check { height: auto; min-height: 42px; align-self: end; }
.hours { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px 12px; margin: 0; display: grid; gap: 6px; }
.hours legend { font-size: .8125rem; font-weight: 500; color: var(--ink-2); padding: 0 4px; }
.hours legend small { color: var(--muted); font-weight: 400; }
.hours-row { display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 10px; font-size: .875rem; font-weight: 500; color: var(--ink-2); }
.hours-row input { height: 36px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); }
.bk-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.slot-btn { height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--action); background: var(--surface); color: var(--action); font-weight: 600; cursor: pointer; }
.slot-btn:hover { background: var(--tab-on-bg); }
.slot-btn.on { background: var(--action); color: var(--action-ink); }
.bk-custom summary { cursor: pointer; color: var(--ink-2); font-size: .875rem; font-weight: 500; }
.bk-custom .fld { margin-top: 8px; max-width: 280px; }

/* ---- Pipeline ---- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kcol { background: var(--fill); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px; min-height: 160px; display: grid; gap: 8px; align-content: start; transition: background .12s, border-color .12s; }
.kcol.drop-target { background: var(--tab-on-bg); border-color: var(--action); }
.kcol header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 0; }
.kcol h3 { margin: 0; font-size: .9375rem; font-weight: 600; color: var(--ink-2); }
.kcol.k-won h3 { color: var(--money); }
.kcol.k-lost h3 { color: var(--muted); }
.kcol header .count { font-size: .8125rem; font-weight: 600; letter-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; color: var(--ink-2); }
.kcards:empty { display: none; }
.kcol-total { padding: 0 4px; color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.kcards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); cursor: grab; }
.kcard.dragging { opacity: .4; }
.kcard-body { all: unset; box-sizing: border-box; display: grid; gap: 4px; width: 100%; padding: 10px 12px; cursor: pointer; }
.kcard-body:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; border-radius: var(--radius-sm); }
.kcard-body strong { font-size: .9375rem; font-weight: 600; overflow-wrap: anywhere; }
.kcard-body small { color: var(--muted); font-size: .8125rem; }
.kcard-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .875rem; }
.kcard-meta .money { font-weight: 600; }
.kcard-next { color: var(--ink-2) !important; }
.kcard-age { font-size: .75rem !important; }
.deal-calls { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.deal-calls li { display: flex; justify-content: space-between; gap: 12px; font-size: .9375rem; }
.deal-calls a { color: var(--action); font-weight: 500; text-decoration: none; }
.stage-rows { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.stage-rows li { display: grid; grid-template-columns: 1fr 110px repeat(3, 36px); gap: 6px; align-items: center; }
.stage-rows input, .stage-rows select { height: 36px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); min-width: 0; }

@media (max-width: 760px) {
  .cal-form .four { grid-template-columns: 1fr 1fr; }
  .kanban { grid-auto-columns: minmax(230px, 85vw); }
}

/* ---- Website ---- */
.site-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border-radius: 999px; font-size: .875rem; font-weight: 600; background: var(--fill); color: var(--ink-2); }
.site-chip.on { background: #ecfdf3; color: var(--money); }
.site-chip.off { background: #fffaeb; color: #b54708; }
.site-chip.on::before, .site-chip.off::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.site-panel { margin-bottom: 20px; }
.site-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.site-bar .tabs.sub { margin: 0; }
.site-frame { background: var(--fill); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; overflow: auto; }
.site-frame iframe { display: block; width: 100%; height: 760px; border: 0; background: #fff; margin: 0 auto; border-radius: 6px; box-shadow: var(--shadow); }
.site-frame.tablet iframe { width: 820px; max-width: 100%; }
.site-frame.phone iframe { width: 390px; height: 760px; max-width: 100%; }
.site-asks { margin: 8px 0 12px; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }
.site-steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-2); }
.site-steps code { font-size: .85em; background: var(--fill); padding: 1px 5px; border-radius: 4px; }
