/* The parts of a page: titled zones, two halves split by a line, a row of figures, a strip that needs the person,
   settings rows and a choice of one. None of them floats: each ends on a line of its own. */

/* ---------- A zone: a titled part of the page ---------- */
.zone { border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--topbar) + 10px); }
.zone-head { display: flex; align-items: center; gap: 12px; padding-top: 20px; }
.zone-head .head-ic { width: 34px; height: 34px; align-self: center; border-radius: var(--r-m); }
.zone-head .head-ic svg { width: 16px; height: 16px; }
.zone-head > .brandmark { flex: none; align-self: flex-start; margin-top: 2px; }
.zone-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-l); font-weight: 600; letter-spacing: var(--tr-snug); color: var(--ink); }
.zone-head p { margin: 1px 0 0; font-size: var(--fs-xs); color: var(--ink-4); }
.zone-head > div:not(.right) { flex: 1; min-width: 0; }
.zone-head .right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.zone-head .count { padding: 1px 8px; border-radius: var(--r-full); background: var(--panel-3); color: var(--ink-3); font-size: var(--fs-2xs); font-weight: 600; }
.zone-body { padding-top: 16px; padding-bottom: 22px; }
/* A list or a table runs to the edges of its zone; its rows carry the padding. */
.zone.flush .zone-body { padding: 14px 0 0; }
/* A list straight under its title, with no search bar between, keeps the same room a search bar would give. */
.zone-head + .rl-head, .zone-head + .toolbar[hidden] + .rl-head { margin-top: 18px; }
/* A zone inside a zone keeps the same edges, never a second indent. */
.zone-body .zone { --zl: 0px; --zr: 0px; }
.zone.danger .head-ic { --tone: var(--bad); --tone-base: var(--bad-base); }
.zone.danger h2 { color: var(--bad); }
.zone-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding-top: 14px; padding-bottom: 20px; font-size: var(--fs-xs); line-height: 1.5; color: var(--ink-4); }
.zone-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--ink-4); }
.empty-line { margin: 0; padding-top: 18px; padding-bottom: 18px; font-size: var(--fs-s); color: var(--ink-4); }

/* Two zones side by side, split by one line. */
.halves { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); border-bottom: 1px solid var(--line); padding-inline: var(--pad-x); }
.halves.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.halves > .zone { border-bottom: 0; }
.halves > :first-child { --zl: 0px; --zr: 28px; }
.halves > :last-child { --zl: 28px; --zr: 0px; border-left: 1px solid var(--line); }

/* ---------- A strip: something that needs the person, as a full width line ---------- */
.strip {
  --tone: var(--brand-text);
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding-top: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--tone) 7%, var(--tone-base, var(--panel)));
  font-size: var(--fs-s); color: var(--ink-2);
}
.strip::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tone); }
.strip.ok { --tone: var(--ok); }
.strip.warn { --tone: var(--warn); }
.strip.bad { --tone: var(--bad); --tone-base: var(--bad-base); }
.strip > svg { width: 17px; height: 17px; flex: none; color: var(--tone); }
.strip > .brandmark { flex: none; }
.strip b { color: var(--ink); }
.strip .right { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Figures: one row, divided by lines ---------- */
/* As many equal columns as there are figures, so the row always ends on the right edge with no empty cell. */
.figs { border-bottom: 1px solid var(--line); }
.figs-in { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 1px; background: var(--line); }
.fig { position: relative; overflow: hidden; min-width: 0; padding: 20px 22px; background: var(--panel); }
.fig:first-child { padding-left: 0; }
.fig:last-child { padding-right: 0; }
.fig-label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-s); font-weight: 500; color: var(--ink-3); }
.fig-label svg { width: 15px; height: 15px; color: var(--ink-4); }
.fig-big { margin-top: 8px; font-family: var(--mono); font-size: 30px; line-height: 1.05; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.fig-big small { margin-left: 3px; font-family: var(--sans); font-size: .5em; font-weight: 500; color: var(--ink-4); }
.fig-sub { margin-top: 4px; font-size: var(--fs-xs); color: var(--ink-4); }
.fig-sub a { font-weight: 500; }
.fig-row { display: flex; align-items: center; gap: 14px; }
.fig-ring { position: relative; flex: none; width: 54px; height: 54px; margin-top: 8px; }
.fig-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.fig-ring circle { fill: none; stroke-width: 6; stroke: var(--panel-3); }
.fig-ring circle.on { stroke: var(--brand); stroke-linecap: round; }
.fig-ring circle.on.ok { stroke: var(--ok); }
.fig-ring circle.on.warn { stroke: var(--warn); }
.fig-ring circle.on.bad { stroke: var(--bad); }
.fig-spark { display: block; width: 100%; height: 34px; margin-top: 10px; }
.fig-spark .fill { fill: var(--brand-soft); }
.fig-spark .line { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; }
.fig-meter { display: block; height: 6px; margin-top: 12px; border-radius: var(--r-full); background: var(--panel-3); overflow: hidden; }
.fig-meter > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.fig.tone { --tone: var(--brand-text); background: color-mix(in srgb, var(--tone) 6%, var(--panel)); }
.fig.tone.warn { --tone: var(--warn); }
.fig.tone.bad { --tone: var(--bad); --tone-base: var(--bad-base); background: color-mix(in srgb, var(--tone) 6%, var(--tone-base)); }
.fig.tone .fig-big { color: var(--tone); }

/* ---------- Settings: what a setting does on the left, its control on the right ---------- */
.frows { display: grid; }
.frow { display: grid; grid-template-columns: minmax(200px, 340px) minmax(0, 560px); gap: 8px 40px; align-items: start; padding: 16px 0; border-top: 1px solid var(--line-soft); }
.frow:first-child { border-top: 0; padding-top: 4px; }
.frow > div:first-child b { display: flex; align-items: center; gap: 6px; font-size: var(--fs-s); font-weight: 600; color: var(--ink); }
.frow > div:first-child span { display: block; margin-top: 2px; font-size: var(--fs-xs); line-height: 1.5; color: var(--ink-4); }
.frow .field { margin: 0; }
.frow .find-field.pick { width: 300px; max-width: 100%; }
.frow .find-field.pick select { width: 100%; }
.frow.act { align-items: center; grid-template-columns: minmax(200px, 340px) minmax(0, 1fr); }
.frow.act > :last-child:not(:first-child) { justify-self: end; }
.frow .btn { min-width: 128px; }

/* ---------- A choice of one: the options side by side in one strip, split by lines like the figures ---------- */
/* The picked one gets the brand edge on top, the way an open tab gets it underneath. */
.optstrip {
  --opt-pad: 20px;
  margin-top: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding-left: max(0px, calc(var(--zl, var(--pad-x)) - var(--opt-pad))); padding-right: max(0px, calc(var(--zr, var(--pad-x)) - var(--opt-pad)));
}
.optstrip-in { display: grid; grid-template-columns: repeat(var(--opts, 3), minmax(0, 1fr)); }
.opt {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-content: start; gap: 4px 11px;
  padding: 18px var(--opt-pad) 20px; cursor: pointer; transition: background .15s ease;
}
.opt + .opt { border-left: 1px solid var(--line); }
.opt::before { content: ""; position: absolute; inset: -1px 0 auto; height: 2px; background: transparent; transition: background .15s ease; }
.opt:hover { background: var(--panel-2); }
.opt input { position: absolute; opacity: 0; }
.opt .dotpick { width: 18px; height: 18px; margin-top: 1px; border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--panel); transition: border-color .15s ease, box-shadow .15s ease; }
.opt b { display: flex; align-items: center; gap: 6px; font-size: var(--fs-m); font-weight: 600; color: var(--ink); }
.opt b img, .opt b svg { width: 18px; height: 18px; border-radius: 5px; }
.opt .opt-desc { grid-column: 2; font-size: var(--fs-xs); line-height: 1.5; color: var(--ink-4); }
.opt:has(input:checked) { background: color-mix(in srgb, var(--brand-text) 7%, var(--panel)); }
.opt:has(input:checked)::before { background: var(--brand); }
.opt:has(input:checked) .dotpick { border-color: var(--brand); box-shadow: inset 0 0 0 4px var(--panel), inset 0 0 0 9px var(--brand); }
.opt:has(input:focus-visible) { box-shadow: inset var(--focus-ring); }
.opt:has(input:disabled) { cursor: not-allowed; opacity: .55; }

/* Which side leads: the two systems as small picks. */
.lead-pick { display: inline-flex; gap: 8px; }
.lead-pick label { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: var(--r-l); cursor: pointer; }
.lead-pick input { position: absolute; opacity: 0; }
.lead-pick .brandmark { width: 92px; height: 26px; padding: 0 7px; }
.lead-pick svg { width: 15px; height: 15px; color: var(--ink-5); }
.lead-pick label:has(input:checked) { border-color: var(--brand-line); background: color-mix(in srgb, var(--brand-text) 8%, var(--panel)); }
.lead-pick label:has(input:checked) svg { color: var(--accent-gold); }

/* ---------- Columns of switches, split by lines instead of boxed sections ---------- */
.colsplit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; border-top: 1px solid var(--line); }
.zone > .colsplit { padding-left: var(--zl, var(--pad-x)); padding-right: var(--zr, var(--pad-x)); }
.colsplit-col { min-width: 0; padding: 16px 24px 18px; }
.colsplit-col:first-child { padding-left: 0; }
.colsplit-col:last-child { padding-right: 0; }
.colsplit-col + .colsplit-col { border-left: 1px solid var(--line); }
/* As many columns as there are parts, for a split of one or two. */
.colsplit.cols-1 { grid-template-columns: minmax(0, 1fr); }
.colsplit.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.colsplit-h { margin: 0 0 6px; font-size: var(--fs-2xs); font-weight: 600; letter-spacing: var(--tr-caps); text-transform: uppercase; color: var(--ink-4); }
.act-line { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.act-line:first-of-type { border-top: 0; }
.act-line .rl-name { flex: 1; }
.act-line .rl-name b { font-size: var(--fs-s); }
.act-line .rt-ic { width: 30px; height: 30px; }
.act-line:has(input:disabled) { opacity: .5; }
.act-line:has(input:disabled) .switch { cursor: not-allowed; }

/* ---------- Smaller pieces ---------- */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 24px; margin: 0; font-size: var(--fs-s); }
.kv dt { color: var(--ink-4); }
.kv dd { margin: 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.dir-word { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-s); color: var(--ink-2); white-space: nowrap; }
.dir-word svg { width: 15px; height: 15px; color: var(--brand-text); }
.dir-word.one svg { color: var(--ink-4); }
.muted-link { color: var(--ink-3); font-weight: 500; }
.muted-link:hover { color: var(--brand-text); }

/* A numbered how-to, a sample of what an assistant answers, and a prompt to copy. */
.howto { display: grid; margin: 0 0 16px; padding: 0; list-style: none; counter-reset: howto; }
.howto li { counter-increment: howto; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.howto li:first-child { border-top: 0; padding-top: 0; }
.howto li::before { content: counter(howto); grid-row: span 2; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: color-mix(in srgb, var(--brand-text) 14%, var(--panel)); color: var(--brand-text); font-size: var(--fs-xs); font-weight: 700; }
.howto li b { font-size: var(--fs-s); color: var(--ink); }
.howto li span { grid-column: 2; font-size: var(--fs-xs); color: var(--ink-4); }
.howto li .btn { grid-column: 3; grid-row: 1 / span 2; }
.chat-demo { margin: 0 0 16px; padding: 12px 16px; border-left: 3px solid var(--line-strong); background: var(--panel-2); }
.chat-who { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.chat-who img { width: 18px; height: 18px; border-radius: 5px; }
.chat-who em { font-style: normal; font-weight: 400; color: var(--ink-4); }
.chat-demo p { margin: 6px 0 0; font-size: var(--fs-s); line-height: 1.55; color: var(--ink-2); }
.prompt-box { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--panel-2); }
.prompt-box p { flex: 1; margin: 0; font-family: var(--mono); font-size: var(--fs-xs); line-height: 1.6; color: var(--ink-2); }
.ai-mark { width: 18px; height: 18px; margin-right: 6px; vertical-align: -4px; border-radius: 5px; }
.ai-mark.solo { width: 20px; height: 20px; margin: 0; vertical-align: 0; }
.tag .ai-mark.solo, .ph-badge .ai-mark.solo { width: 14px; height: 14px; border-radius: 3px; }

/* A buy line: a pick, a quantity and the button on one row. */
.buyline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.buyline .find-field.pick { flex: 0 1 380px; }
.buyline .find-field.qty { flex: 0 0 120px; }
.buyline .btn { height: 44px; }

/* An app installed on many sub-accounts: one bar of where they stand. */
.inst-bar { display: flex; gap: 3px; height: 8px; margin-top: 4px; border-radius: var(--r-full); overflow: hidden; }
.inst-bar span { min-width: 6px; }
.inst-bar .ok { background: var(--ok); }
.inst-bar .warn { background: var(--warn); }
.inst-bar .info { background: var(--brand-text); }
.inst-bar .bad { background: var(--bad); }
.inst-bar .mute { background: var(--panel-3); box-shadow: inset 0 0 0 1px var(--line); }
.inst-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 12px; font-size: var(--fs-xs); color: var(--ink-3); }
.inst-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.inst-legend .right { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; font-weight: 600; }
.inst-legend .right svg { width: 14px; height: 14px; }

/* The AI Agent app is white label: its sub-accounts show as "Your CRM", never with the logo of a system. */
.crm-plate { display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none; width: 110px; height: 26px; border-radius: 7px; background: var(--panel-3); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.crm-plate svg { width: 13px; height: 13px; color: var(--ink-3); }
.crm-plate.xs { width: 96px; height: 22px; font-size: 10.5px; }
.crm-plate.lg { width: auto; height: 34px; padding: 0 14px; font-size: var(--fs-s); }

/* The rule of an automation as lines of the page, not a box. */
.zone .rule-rows { margin-top: 16px; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
.zone .rule-row { padding-top: 14px; padding-bottom: 14px; border-top: 1px solid var(--line-soft); }
.zone .rule-row:first-child { border-top: 0; }

@container page (max-width: 1180px) {
  .halves, .halves.even { grid-template-columns: minmax(0, 1fr); }
  .halves > :first-child { --zr: 0px; }
  .halves > :last-child { --zl: 0px; border-left: 0; border-top: 1px solid var(--line); }
  /* Four figures or more fold into two columns; an odd last one takes the whole row, so no cell stays empty. */
  .figs-in:has(> .fig:nth-child(4)) { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :where(.figs-in:has(> .fig:nth-child(4))) > .fig:nth-child(odd) { padding-left: 0; padding-right: 22px; }
  :where(.figs-in:has(> .fig:nth-child(4))) > .fig:nth-child(even) { padding-left: 22px; padding-right: 0; }
  :where(.figs-in:has(> .fig:nth-child(4))) > .fig:last-child:nth-child(odd) { grid-column: 1 / -1; padding-right: 0; }
  .colsplit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .colsplit-col:nth-child(3) { grid-column: 1 / -1; padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .inst-legend .right { margin-left: 0; }
}

@container page (max-width: 820px) {
  .frow, .frow.act { grid-template-columns: minmax(0, 1fr); }
  .frow.act > :last-child:not(:first-child) { justify-self: start; }
}

@container page (max-width: 640px) {
  .howto li { grid-template-columns: 30px minmax(0, 1fr); }
  .howto li .btn { grid-column: 2; grid-row: auto; justify-self: start; margin-top: 6px; }
  .optstrip-in { grid-template-columns: minmax(0, 1fr); }
  .opt + .opt { border-left: 0; border-top: 1px solid var(--line); }
  .colsplit, .colsplit.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .colsplit-col, .colsplit-col:nth-child(3) { padding-left: 0; padding-right: 0; }
  .colsplit-col + .colsplit-col { border-left: 0; border-top: 1px solid var(--line); }
  .figs-in, .figs-in:has(> .fig:nth-child(4)) { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); }
  .figs-in > .fig.fig { grid-column: auto; padding-left: 0; padding-right: 0; }
  .fig-big { font-size: 26px; }
  .strip { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .strip > svg { margin-top: 2px; }
  .strip .right { grid-column: 2; }
}
