/*
 * Kynvello CRM admin UI: the dark design of the ecosystem video (docs/UI.md), with Kynvello's teal as the only accent.
 * The tokens below are one of three copies of one table (this file, mobile/src/constants/theme.ts, desktop/start/index.html):
 * change them together, and change web/e2e/tests/design.spec.ts in the same commit. Colours live in the tokens, nowhere else.
 */
:root {
  color-scheme: dark;
  --bg: #0e1220;
  --panel: #1a2034;
  --panel-2: #212a47;
  --side: #0a0d18;
  --side-ink: #8d96b6;
  --ink: #e9ecf8;
  --muted: #8d96b6;
  --faint: #7380a3;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --field: rgba(255, 255, 255, 0.04);
  --accent: #26b29d;
  --accent-hover: #3cc9b3;
  --accent-ink: #0e1220; /* text on the accent: dark ink, never white (2.65:1) */
  --accent-fill: rgba(38, 178, 157, 0.16);
  --danger: #ff7f7f;
  --danger-fill: rgba(255, 127, 127, 0.12);
  --ok: #53c28b;
  --ok-fill: rgba(83, 194, 139, 0.14);
  --warn: #f3b94d;
  --warn-fill: rgba(243, 185, 77, 0.12);
  --info: #7c9bff;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.5);
  --primary: #26b29d; /* fill of the primary button (the brand teal in both themes) */
  --primary-hover: #3cc9b3;
  --brand-ink: #ffffff;
  --hover: rgba(255, 255, 255, 0.06);
  --row-hover: rgba(255, 255, 255, 0.025);
  --placeholder: #5f6987;
  --soon-fill: rgba(255, 255, 255, 0.08);
  --danger-line: rgba(255, 127, 127, 0.4);
  --dots: rgba(255, 255, 255, 0.07);
  --action-bg: #1d2234;
  --action-line: rgba(243, 185, 77, 0.45);
  --glow-indigo: #4f46e5;
  --purple: #a78bfa; /* process exit dots only (docs/UI.md, process canvas) */
  --pink: #ee8fb4;
  --orange: #f0805a; /* process exit dots only (docs/UI.md, process canvas) */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}

/* The light theme (docs/UI.md, "Light theme"): the same layout and the same teal, light surfaces.
   The accent darkens for text and lines (#0b6f60, 6.1:1 on white, 4.5:1 on the selected row); the primary button keeps the
   brand teal with dark ink. Chosen with the icon in the top bar (src/theme.rs, data-theme on <html>). */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #eef1f8;
  --side: #eceff6;
  --side-ink: #5a6482;
  --ink: #161b2e;
  --muted: #5a6482;
  --faint: #646e8c;
  --line: rgba(22, 27, 46, 0.1);
  --line-strong: rgba(22, 27, 46, 0.2);
  --field: #ffffff;
  --accent: #0b6f60;
  --accent-hover: #095c50;
  --accent-fill: rgba(11, 111, 96, 0.12);
  --danger: #c0392b;
  --danger-fill: rgba(192, 57, 43, 0.1);
  --ok: #1e7e52;
  --ok-fill: rgba(30, 126, 82, 0.12);
  --warn: #8a5a00;
  --warn-fill: rgba(138, 90, 0, 0.1);
  --info: #3b55c9;
  --shadow-pop: 0 24px 60px rgba(22, 27, 46, 0.18);
  --brand-ink: #161b2e;
  --hover: rgba(22, 27, 46, 0.05);
  --row-hover: rgba(22, 27, 46, 0.03);
  --placeholder: #8a93ad;
  --soon-fill: rgba(22, 27, 46, 0.06);
  --danger-line: rgba(192, 57, 43, 0.4);
  --dots: rgba(22, 27, 46, 0.12);
  --action-bg: #fff8ea;
  --action-line: rgba(138, 90, 0, 0.45);
  --glow-indigo: #818cf8;
  --purple: #6d4fd6;
  --pink: #c2417f;
  --orange: #b4491f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3, h4 { margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 22px; }
h3 { font-size: 16px; margin-top: 4px; }
h4 { font-size: 13px; margin-top: 16px; }
p { margin: 0 0 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
a { color: var(--accent); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
::selection { background: var(--accent-fill); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ---- shell ---- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex: none; background: var(--side); color: var(--side-ink);
  border-right: 1px solid var(--line);
  padding: 14px 10px; overflow-y: auto; position: sticky; top: 0; height: 100vh;
}
.brand { color: var(--brand-ink); font-weight: 700; font-size: 16px; padding: 4px 10px 14px; white-space: nowrap; }
.brand small { margin-left: auto; font-weight: 400; color: var(--side-ink); font-size: 12px; }
.nav-section h4 {
  color: var(--faint); font-size: 11px; text-transform: uppercase;
  letter-spacing: .12em; margin: 14px 10px 4px;
}
.nav-section ul { list-style: none; margin: 0; padding: 0; }
.nav-section a {
  display: flex; align-items: center; gap: 10px; padding: 0 10px; height: 32px;
  border-radius: var(--radius-md); color: var(--side-ink); text-decoration: none;
  transition: background 120ms, color 120ms;
}
.nav-section a:hover { background: var(--panel); color: var(--ink); }
.nav-section a[aria-current="page"] { background: var(--accent-fill); color: var(--accent); font-weight: 600; }
.nav-section .ico { width: 16px; text-align: center; opacity: .85; }
.nav-section .lbl { flex: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px; background: var(--side); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 16px; margin: 0; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.btn.icon { padding: 4px 8px; font-size: 16px; line-height: 1; }
.content { padding: 24px; }
.page-header { margin-bottom: 14px; }
.page-header p { margin: 0; }

/* ---- cards, layout ---- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px;
  overflow-x: auto; /* never let wide content spill past the border */
}
/* Templates: full-width stacked cards so the field table fits. */
.tpl-cards { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.tpl-cards .card { margin-bottom: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.cards .card { margin-bottom: 0; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 28px; }
.split { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.4fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 8px; }
fieldset.bare { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.bare:disabled { opacity: .6; }
.row { display: flex; gap: 8px; align-items: center; }
.bullets { margin: 0 0 8px; padding-left: 18px; }
.bullets li { margin: 3px 0; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.hint { color: var(--muted); font-size: 13px; }

/* ---- tables, lists ---- */
.table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; }
.table th, .table td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.table tbody tr:hover td { background: var(--row-hover); }
.table.disabled { opacity: .6; }
.list { list-style: none; margin: 0 0 16px; padding: 0; }
.list li {
  display: flex; flex-direction: column; padding: 8px 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-md); margin-bottom: 6px;
  transition: background 120ms, border-color 120ms;
}
.list li:hover { border-color: var(--line-strong); background: var(--panel-2); }
.list li.active { border-color: var(--accent); background: var(--accent-fill); }

/* ---- forms, buttons ---- */
.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.field > span { font-size: 12px; color: var(--muted); }
.input {
  padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  font: inherit; color: var(--ink); background: var(--field); min-width: 0;
  transition: border-color 120ms, box-shadow 120ms;
}
.input::placeholder { color: var(--placeholder); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fill); }
select.input option { background: var(--panel); color: var(--ink); }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.form-row .input { flex: 1; min-width: 120px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; margin: 12px 0 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 10px; }
.check input { accent-color: var(--accent); }
.btn {
  padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  background: transparent; color: var(--ink); cursor: pointer; font: inherit; font-weight: 600;
  text-decoration: none; display: inline-block;
  transition: background 120ms, border-color 120ms, transform 120ms;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-fill); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.block { width: 100%; text-align: left; }
.btn.wide { width: 100%; text-align: center; padding: 9px 12px; }
.btn-icon { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 14px; }
.btn-icon:hover { color: var(--danger); }
.alert { padding: 8px 10px; border-radius: var(--radius-md); font-size: 13px; }
.alert.error { background: var(--danger-fill); color: var(--danger); }
.alert.warn { background: var(--warn-fill); color: var(--warn); }
.alert.ok { background: var(--ok-fill); color: var(--ok); }
.alert.banner { margin: 12px 24px 0; }

.tag { font-size: 10px; padding: 1px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.tag.soon { background: var(--soon-fill); color: var(--muted); }
.tag.partial { background: var(--warn-fill); color: var(--warn); }
.tag.live { background: var(--ok-fill); color: var(--ok); }
.tag.danger { background: var(--danger-fill); color: var(--danger); }

/* ---- sign-in and registration: the video's backdrop (two soft glows) and a centred card ---- */
.login-wrap {
  position: relative; overflow: hidden; min-height: 100vh; padding: 24px 16px;
  display: grid; place-items: center; background: var(--bg);
}
.glow { position: absolute; border-radius: 50%; filter: blur(110px); pointer-events: none; }
.glow.teal { width: 560px; height: 560px; left: -170px; top: -210px; background: var(--accent); opacity: .32; }
.glow.indigo { width: 520px; height: 520px; right: -180px; bottom: -220px; background: var(--glow-indigo); opacity: .28; }
.login {
  position: relative; z-index: 1; width: min(380px, 100%); margin: 0; padding: 28px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-pop); overflow: visible;
}
.login .brand-logo { width: 200px; margin: 0 auto 18px; }
.login-title { font-size: 22px; margin: 0 0 4px; text-align: center; }
.login-lead { text-align: center; margin: 0 0 18px; }
.login .alert { margin-bottom: 10px; }
.login .btn.wide { margin-top: 4px; }
.login-links { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.login-links .btn { padding: 6px 8px; font-size: 13px; }

/* ---- workflow canvas ---- */
.wf { display: grid; grid-template-columns: 170px 1fr 320px; gap: 16px; align-items: start; }
.wf .card { margin-bottom: 0; }
.wf-canvas {
  position: relative; height: 620px; overflow: hidden; user-select: none;
  background-color: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background-image: radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: 20px 20px;
}
.wf-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.wf-edge { fill: none; stroke: var(--muted); stroke-width: 2.5; pointer-events: stroke; cursor: pointer; }

.wf-edge.draft { stroke: var(--accent); stroke-dasharray: 6 4; pointer-events: none; }
.wf-node {
  position: absolute; padding: 10px 14px; background: var(--panel);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-md); cursor: grab;
}
.wf-node.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fill); }
.wf-node.email { border-style: dashed; background: var(--action-bg); border-color: var(--action-line); }
.wf-title { font-weight: 600; padding-right: 4px; }
.wf-sub { font-size: 12px; color: var(--muted); }
.wf-port {
  position: absolute; top: 18px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--muted); cursor: crosshair;
}
.wf-port:hover { border-color: var(--accent); background: var(--accent-fill); }
.wf-port.in { left: -8px; }
.wf-port.out { right: -8px; }
.wf-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; pointer-events: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.field-row .check, .field-row .btn-icon { align-self: center; margin: 0; }

@media (max-width: 1100px) {
  .split, .wf { grid-template-columns: 1fr; }
}
/* Phone: the menu sits above the page instead of taking a third of the width. */
@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .topbar-user { flex-wrap: wrap; gap: 8px; }
  .content { padding: 16px; }
  .alert.banner { margin: 12px 16px 0; }
}

/* Canvas connections: automated ones are green; the middle handle opens the panel. */
.wf-edge:hover { stroke: var(--accent); }
.wf-edge.auto { stroke: var(--ok); stroke-width: 3; }
.wf-edge.selected { stroke: var(--accent); stroke-width: 3.5; }
.wf-edge-handle {
  position: absolute; z-index: 3; transform: translate(-50%, -50%);
  width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--muted); background: var(--panel); color: var(--muted);
  font-size: 12px; line-height: 19px; text-align: center; cursor: pointer;
}
.wf-edge-handle:hover { border-color: var(--accent); color: var(--accent); }
.wf-edge-handle.auto { border-color: var(--ok); color: var(--ok); }
.wf-edge-handle.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

/* ---- process editor and run viewer (sales plan 01, phase 2A) ----
   Same dotted canvas as the workflow builder; a node has one input dot on the left
   and one output dot per exit on the right, in the exit's colour (`--dot`). */
.pr { display: grid; grid-template-columns: 170px minmax(480px, 1fr) 320px; gap: 16px; align-items: start; }
.pr .card { margin-bottom: 0; }
.pr.pr-viewer { grid-template-columns: minmax(480px, 1fr) 320px; }
.pr-palette .input { width: 100%; }
.pr-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pr-toolbar .input { flex: 1; min-width: 160px; }
.pr-toolbar-links { margin-left: auto; display: flex; gap: 4px; }
.pr-version { white-space: nowrap; }
.pr-issues { margin-bottom: 16px; }
.pr-issues ul { margin: 6px 0 0; padding-left: 18px; }
.pr-issues li { margin: 2px 0; }
.pr-issues code { font-family: var(--mono); font-size: 12px; }
.pr-canvas {
  position: relative; height: 620px; overflow: hidden; user-select: none;
  background-color: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background-image: radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: 20px 20px;
}
.pr-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.pr-edge { fill: none; stroke: var(--dot, var(--muted)); stroke-width: 2.5; pointer-events: stroke; cursor: pointer; }
.pr-edge:hover { stroke-width: 4; }
.pr-edge.draft { stroke: var(--accent); stroke-dasharray: 6 4; pointer-events: none; }
.pr-edge.taken { stroke-width: 4; }
.pr-canvas.readonly .pr-edge { cursor: default; }
.pr-canvas.readonly .pr-edge:not(.taken) { opacity: .45; }
.pr-node {
  position: absolute; padding: 0 0 6px; background: var(--panel);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-md); cursor: grab;
}
.pr-canvas.readonly .pr-node { cursor: default; }
.pr-node.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fill); }
.pr-node.is-start { border-color: var(--accent); }
.pr-node[data-kind="end"] { border-style: dashed; }
/* The run's path: a state is a colour plus the status text in the steps list. */
.pr-node[data-state="done"] { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-fill); }
.pr-node[data-state="waiting"], .pr-node[data-state="running"] { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-fill); }
.pr-node[data-state="failed"] { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-fill); }
.pr-node[data-state="skipped"] { border-style: dashed; opacity: .7; }
.pr-head { height: 46px; padding: 7px 14px 0; box-sizing: border-box; overflow: hidden; }
.pr-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-title .tag { vertical-align: middle; }
.pr-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-exits { display: flex; flex-direction: column; }
.pr-exit {
  position: relative; height: 22px; box-sizing: border-box; padding: 0 14px;
  display: flex; align-items: center; justify-content: flex-end;
  font-size: 12px; color: var(--muted);
}
.pr-port {
  position: absolute; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box;
  background: var(--panel); border: 2px solid var(--muted); cursor: crosshair;
}
.pr-port.in { left: -7px; top: 17px; }
.pr-port.in:hover { border-color: var(--accent); background: var(--accent-fill); }
.pr-port.out { right: -7px; top: 50%; transform: translateY(-50%); background: var(--dot, var(--muted)); border-color: var(--dot, var(--muted)); }
.pr-port.out:hover { box-shadow: 0 0 0 3px var(--accent-fill); }
.pr-canvas.readonly .pr-port { cursor: default; }
.pr-c-green { --dot: var(--ok); }
.pr-c-red { --dot: var(--danger); }
.pr-c-grey { --dot: var(--muted); }
.pr-c-amber { --dot: var(--warn); }
.pr-c-blue { --dot: var(--info); }
.pr-c-teal { --dot: var(--accent); }
.pr-c-purple { --dot: var(--purple); }
.pr-c-pink { --dot: var(--pink); }
.pr-c-yellow { --dot: var(--warn); }
.pr-c-orange { --dot: var(--orange); }
.pr-edge-handle {
  position: absolute; z-index: 3; transform: translate(-50%, -50%);
  width: 20px; height: 20px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--muted); background: var(--panel); color: var(--muted);
  font-size: 11px; line-height: 17px; text-align: center; cursor: pointer;
}
.pr-edge-handle:hover { border-color: var(--danger); color: var(--danger); }
.pr-edge-label {
  position: absolute; z-index: 3; transform: translate(-50%, -50%);
  padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--panel); border: 1px solid var(--line-strong); color: var(--ink); white-space: nowrap;
}
.pr-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; pointer-events: none; }
.pr-exit-row { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.pr-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.pr-form-row .check, .pr-form-row .btn-icon { align-self: center; margin: 0; }
.pr-form-exits { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.pr-form-exits .check { margin: 0; }
.pr-task { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-md); margin-bottom: 8px; }
.pr-task h4 { margin-top: 0; }
.pr-task-exits { flex-wrap: wrap; }
.pr-exit-chip { background: var(--panel-2); color: var(--ink); border-left: 8px solid var(--dot, var(--muted)); }
.pr-steps td { font-size: 12px; }

@media (max-width: 1100px) {
  .pr, .pr.pr-viewer { grid-template-columns: 1fr; }
}

/* Automation form (module editor and connection panel). */
.trigger-card { margin-bottom: 10px; }
.assign-row, .assign-add { margin-left: 16px; }

/* Kynvello brand (assets/brand) */
.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { width: 28px; height: 28px; flex: none; }
.brand-logo { display: block; width: 220px; max-width: 100%; height: auto; margin: 0 auto 12px; }

/* Reports (plain SVG charts; text in text colours, marks in the series colour) */
.report-chart { display: block; max-width: 640px; margin: 8px 0 12px; }
.report-chart .chart-label { font-size: 12px; fill: var(--muted); }
.report-chart .chart-value { font-size: 12px; fill: currentColor; }
.report-chart .chart-axis { stroke: var(--line-strong); stroke-width: 1; }
.report-chart .chart-dot { stroke: var(--panel); }
.pie { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; }
.legend { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.legend .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Plugin field widgets: a sandboxed frame, no border of its own. */
.widget-frame { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--panel); }

/* Message templates: the HTML preview is a page of its own (white, like the e-mail the customer sees). */
.tpl-preview { width: 100%; height: 260px; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: #fff; }

/* Contracts: template list, editor with a toolbar over the HTML text, variable rows. */
.ct-layout { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.ct-tabs { margin-bottom: 12px; }
.ct-row { padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.ct-row.sel { background: var(--accent-fill); border-color: var(--accent); }
.ct-toolbar { flex-wrap: wrap; margin-bottom: 8px; }
.ct-toolbar .input { width: auto; }
.ct-html { width: 100%; }
.ct-var { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.ct-var .check, .ct-var .btn-icon { align-self: center; margin: 0; }
.ct-preview { height: 480px; }
@media (max-width: 1100px) {
  .ct-layout { grid-template-columns: 1fr; }
}
