/* CAE CRM: navy and teal on white and light grey. */

/* Plus Jakarta Sans, served from our own domain (SIL Open Font License, see fonts/OFL.txt). */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/plus-jakarta-sans-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/plus-jakarta-sans-latin-wght-italic.woff2") format("woff2");
}

:root {
  --canvas: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --ink: #0f1b2d;
  --ink-2: #334155;
  --muted: #5b6b80;
  --line: #e2e8f0;
  --line-soft: #edf1f6;

  --navy: #0f1f3d;
  --navy-deep: #0b1730;
  --on-navy: #eef3fb;
  --on-navy-muted: #9fb0cc;
  --primary: #0f766e;        /* teal for text and buttons, 5.4:1 on white */
  --accent: #14b8a6;         /* bright teal for fills and highlights */
  --accent-soft: #ccfbf1;
  --on-primary: #ffffff;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --warn-ink: #92400e;
  --ok: #0f766e;
  --ok-soft: #dcf5f1;
  --bad: #d23f57;
  --bad-soft: #fde8ec;

  /* Ordinal ramp for pipeline stages, from light teal (earliest) to navy (latest). */
  --stage-1: #c7ece7;
  --stage-2: #7fd3c8;
  --stage-3: #2bb3a6;
  --stage-4: #1d7f8c;
  --stage-5: #1d3f6e;

  --chart-hit: #0d9488;
  --chart-miss: #99e2d9;
  --chart-line: #0f766e;
  --chart-fill: rgba(20, 184, 166, .14);

  --shadow: 0 1px 2px rgba(15, 31, 61, .04), 0 6px 20px rgba(15, 31, 61, .06);
  --shadow-lift: 0 2px 4px rgba(15, 31, 61, .05), 0 14px 32px rgba(15, 31, 61, .10);

  --display: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-xl: 20px;
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 6px;
  --sidebar: 236px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0a1222; --surface: #111c31; --surface-2: #16233b; --ink: #e6edf7; --ink-2: #c3cfe0; --muted: #8b9ab2;
    --line: #22304a; --line-soft: #1a2740; --navy: #13264a; --navy-deep: #070e1c; --on-navy: #eef3fb; --on-navy-muted: #9fb0cc;
    --primary: #2dd4bf; --on-primary: #04211e; --accent: #2dd4bf; --accent-soft: #123b3d; --warn: #f5b041; --warn-soft: #3a2c12; --warn-ink: #fcd58b;
    --ok: #2dd4bf; --ok-soft: #10302f; --bad: #f2708a; --bad-soft: #3b1a24;
    --stage-1: #1d3a4a; --stage-2: #22616b; --stage-3: #2a8f8f; --stage-4: #3fc1b4; --stage-5: #8de8dc;
    --chart-hit: #2dd4bf; --chart-miss: #1f5f63; --chart-line: #2dd4bf; --chart-fill: rgba(45, 212, 191, .14);
    --shadow: none; --shadow-lift: 0 14px 32px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #0a1222; --surface: #111c31; --surface-2: #16233b; --ink: #e6edf7; --ink-2: #c3cfe0; --muted: #8b9ab2;
  --line: #22304a; --line-soft: #1a2740; --navy: #13264a; --navy-deep: #070e1c; --on-navy: #eef3fb; --on-navy-muted: #9fb0cc;
  --primary: #2dd4bf; --on-primary: #04211e; --accent: #2dd4bf; --accent-soft: #123b3d; --warn: #f5b041; --warn-soft: #3a2c12; --warn-ink: #fcd58b;
  --ok: #2dd4bf; --ok-soft: #10302f; --bad: #f2708a; --bad-soft: #3b1a24;
  --stage-1: #1d3a4a; --stage-2: #22616b; --stage-3: #2a8f8f; --stage-4: #3fc1b4; --stage-5: #8de8dc;
  --chart-hit: #2dd4bf; --chart-miss: #1f5f63; --chart-line: #2dd4bf; --chart-fill: rgba(45, 212, 191, .14);
  --shadow: none; --shadow-lift: 0 14px 32px rgba(0, 0, 0, .35); color-scheme: dark;
}

/* Base ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); margin: 0; font-weight: 650; letter-spacing: -.015em; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; }
small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; font-weight: 400; }
b { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.icon { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
kbd { font-family: var(--body); font-size: 11.5px; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: var(--muted); background: var(--surface); }

/* Sidebar -------------------------------------------------------------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
  background: var(--navy-deep); color: var(--on-navy);
  display: flex; flex-direction: column; padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 10px 22px; }
.mark { width: 32px; height: 32px; border-radius: 8px; display: block; flex: none; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.sidebar > nav { display: grid; gap: 2px; }
.sidebar > nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md);
  text-decoration: none; color: var(--on-navy-muted); font-weight: 700; font-size: 14.5px;
  transition: background .15s, color .15s;
}
.sidebar > nav a:hover { background: rgba(255, 255, 255, .06); color: var(--on-navy); }
.sidebar > nav a[aria-current="page"] { background: rgba(45, 212, 191, .14); color: #fff; box-shadow: inset 3px 0 0 #2dd4bf; }
.sidebar > nav a[aria-current="page"] .icon { color: #5eead4; }
.count {
  margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; text-align: center;
  font-size: 12px; background: rgba(255, 255, 255, .1); color: var(--on-navy);
}
.count.alert { background: var(--bad); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid rgba(255, 255, 255, .08); }
.me { display: flex; align-items: center; gap: 10px; }
.me .avatar { width: 32px; height: 32px; font-size: 11.5px; }
.me-name { font-weight: 700; font-size: 14px; color: var(--on-navy); }
.me-role { font-size: 12.5px; color: var(--on-navy-muted); }
.me-links { display: flex; gap: 4px 14px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.me-links a, .me-links button {
  color: var(--on-navy-muted); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
}
.me-links a:hover, .me-links button:hover, .me-links a[aria-current] { color: var(--on-navy); text-decoration: underline; }

/* Main column ---------------------------------------------------------- */
.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 14px 36px;
  background: color-mix(in srgb, var(--canvas) 86%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.search-trigger {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; text-align: left;
}
.search-trigger:hover { border-color: var(--muted); }
.search-trigger span { flex: 1; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
main { padding: 28px 36px 64px; }  /* full width: lists, boards and dashboards use big screens; forms set their own widths */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(28px, 3.4vw, 38px); font-weight: 700; letter-spacing: -.025em; }
.subtitle { color: var(--muted); margin-top: 6px; font-size: 15.5px; display: flex; gap: 8px; align-items: center; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Buttons & controls ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: var(--r-md);
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.sm .icon { width: 15px; height: 15px; }
.btn.danger { color: var(--bad); }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; padding: 0;
}
.icon-btn:hover { border-color: var(--muted); }
.icon-btn.sm { width: 30px; height: 30px; border-color: transparent; background: transparent; }
.icon-btn.sm:hover { background: var(--surface-2); border-color: var(--line); }
.only-mobile { display: none; }
.text-link {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--primary);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.text-link.sm { font-size: 13px; }
.text-link .icon { width: 14px; height: 14px; }

.segmented { display: inline-flex; padding: 3px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.segmented button {
  border: 0; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted);
  padding: 6px 12px; border-radius: 7px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(15, 31, 61, .10); }

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chips a {
  text-decoration: none; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line);
  font-weight: 700; font-size: 13.5px; color: var(--ink-2); background: var(--surface);
}
.filter-chips a[aria-current] { background: var(--navy); color: #fff; border-color: var(--navy); }

.search-field { position: relative; display: flex; align-items: center; }
.search-field .icon { position: absolute; left: 11px; color: var(--muted); }
.search-field input { padding-left: 36px; min-width: 260px; }

/* New menu ------------------------------------------------------------- */
.new-menu { position: relative; }
.new-menu summary { list-style: none; }
.new-menu summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 6px;
  box-shadow: 0 12px 32px rgba(15, 31, 61, .14); display: grid;
}
.menu button {
  border: 0; background: none; font: inherit; font-size: 14px; text-align: left; padding: 8px 10px;
  border-radius: var(--r-sm); cursor: pointer; color: var(--ink);
}
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu .won { color: var(--ok); font-weight: 700; }
.menu .lost { color: var(--bad); }

/* Chips ---------------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  font-size: 12.5px; font-weight: 700; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.chip.stage::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 15%, transparent); }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.delta { font-weight: 700; padding: 1px 7px; border-radius: 6px; font-size: 13px; }
.delta.up { background: var(--ok-soft); color: var(--ok); }
.delta.down { background: var(--bad-soft); color: var(--bad); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; background: hsl(var(--h) 30% 38%);
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px; flex: none; display: inline-grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 14px;
  background: hsl(var(--h) 28% 92%); color: hsl(var(--h) 35% 28%);
}
:root[data-theme="dark"] .logo { background: hsl(var(--h) 20% 20%); color: hsl(var(--h) 40% 80%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo { background: hsl(var(--h) 20% 20%); color: hsl(var(--h) 40% 80%); } }
.logo.sm { width: 32px; height: 32px; font-size: 12px; border-radius: 8px; }
.logo.lg { width: 48px; height: 48px; font-size: 18px; border-radius: 13px; }

/* The month track: the one bold moment ---------------------------------- */
.track {
  background: radial-gradient(90% 160% at 100% 0%, rgba(45, 212, 191, .22), transparent 60%), var(--navy);
  color: var(--on-navy); border-radius: var(--r-xl); box-shadow: var(--shadow-lift);
  padding: 28px 32px 22px; margin-bottom: 28px; position: relative; overflow: hidden;
}
.track-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; }
.track-label { color: var(--on-navy-muted); font-weight: 700; }
.track-figure { font-family: var(--display); line-height: 1; margin-top: 6px; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.track-figure > span:first-child { font-size: clamp(44px, 6vw, 72px); font-weight: 750; letter-spacing: -.04em; }
.track-of { font-size: 20px; color: var(--on-navy-muted); font-weight: 500; letter-spacing: -.01em; }
.track-verdict { max-width: 340px; text-align: right; color: var(--on-navy-muted); font-size: 14.5px; }
.verdict-main { font-family: var(--display); font-size: 22px; font-weight: 650; color: var(--on-navy); margin-bottom: 4px; }
.track-verdict.ahead .verdict-main { color: #5eead4; }
.track-verdict.behind .verdict-main { color: #fcd34d; }

.rail { position: relative; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, .08); }
.rail-fill {
  position: absolute; inset: 0 auto 0 0; width: var(--won); border-radius: 12px;
  background: linear-gradient(90deg, #0d9488, #2dd4bf); box-shadow: 0 0 24px rgba(45, 212, 191, .35);
  transition: width 1.1s cubic-bezier(.2, .8, .2, 1);
}
.rail-pace { position: absolute; top: -8px; bottom: -8px; left: var(--expected); width: 2px; background: var(--on-navy); border-radius: 2px; }
.rail-pace span {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  font-size: 12px; font-weight: 700; white-space: nowrap; color: var(--on-navy);
}
.rail-ticks { position: absolute; inset: 0; display: flex; pointer-events: none; }
.rail-ticks i { flex: 1; border-right: 1px solid rgba(255, 255, 255, .14); }
.rail-ticks i:last-child { border-right: 0; }
.rail-ticks i.now { background: rgba(255, 255, 255, .07); }
.rail-scale { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--on-navy-muted); }
.js .track:not(.is-ready) .rail-fill { width: 0; }

/* Stat cards ----------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stats.compact { grid-template-columns: repeat(3, 1fr); }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 18px 20px; position: relative; overflow: hidden; display: flex; flex-direction: column;
}
.stat-head { display: flex; align-items: center; gap: 10px; }
.stat-icon {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--primary);
}
.stat-icon .icon { width: 17px; height: 17px; }
.stat-label { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.stat-value { font-family: var(--display); font-size: 28px; font-weight: 750; letter-spacing: -.025em; margin-top: 12px; }
.stat-value.is-bad { color: var(--bad); }
.stat-note { color: var(--muted); font-size: 13px; margin-top: 4px; }
.winbar { height: 8px; border-radius: 4px; background: var(--line-soft); margin-top: auto; overflow: hidden; }
.winbar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #0d9488, #2dd4bf); }
.stat .winbar { margin-top: 22px; }
.spark { display: block; width: 100%; height: 38px; margin-top: auto; padding-top: 12px; overflow: visible; }
.spark .spark-area { fill: var(--chart-fill); }
.spark .spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* Panels & layouts ------------------------------------------------------ */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 22px 24px; box-shadow: var(--shadow); }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head.pad { padding: 20px 24px 4px; }
.panel-head h2, .panel-title { font-size: 18px; }
.panel-title { margin-bottom: 14px; }
.panel-note { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.layout-main { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; align-items: start; }
.layout-aside { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.layout-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.empty-line { color: var(--muted); padding: 14px 0; list-style: none; }

/* Revenue chart -------------------------------------------------------- */
.chart { position: relative; height: 290px; margin: 0 -6px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid { stroke: var(--line-soft); }
.chart .axis { fill: var(--muted); font-size: 12px; font-family: var(--body); }
.chart .target { stroke: var(--target, var(--navy)); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: .7; }
.chart .target-label { fill: var(--target, var(--navy)); font-size: 11.5px; font-weight: 700; font-family: var(--body); }
.chart .bar { fill: var(--chart-miss); transition: fill .12s, opacity .12s; }
.chart .bar.hit { fill: var(--chart-hit); }
.chart .bar.partial { fill: url(#partial-hatch); stroke: var(--chart-hit); stroke-width: 1.2; stroke-dasharray: 3 3; }
.chart.hovering .bar { opacity: .45; }
.chart.hovering .bar.active { opacity: 1; }
:root[data-theme="dark"] { --target: var(--on-navy-muted); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --target: var(--on-navy-muted); } }
.chart-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -110%); white-space: nowrap;
  background: var(--navy); color: #fff; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; opacity: 0; transition: opacity .1s;
  box-shadow: var(--shadow-lift);
}
.chart-tip b { display: block; font-family: var(--display); font-size: 16px; }
.chart.hovering .chart-tip { opacity: 1; }
.chart-legend { display: flex; gap: 20px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.key-hit, .key-miss { width: 12px; height: 12px; border-radius: 3px; background: var(--chart-hit); }
.key-miss { background: var(--chart-miss); }
.key-target { width: 18px; border-top: 2px dashed var(--target, var(--navy)); opacity: .7; }

/* Timeline -------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 68px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.timeline li { display: grid; grid-template-columns: 58px 1fr; gap: 22px; padding: 8px 0; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: 64px; top: 15px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary);
}
.timeline li.done::before { background: var(--primary); }
.timeline li.done .tl-title { color: var(--muted); text-decoration: line-through; }
.timeline li.empty-line { display: block; padding-left: 80px; }
.timeline time small { margin: 0; font-weight: 400; }
.timeline li.empty-line::before { display: none; }
.timeline time { font-weight: 700; font-size: 13px; color: var(--ink-2); padding-top: 2px; }
.tl-title { font-weight: 700; }
.tl-meta { color: var(--muted); font-size: 13.5px; }
.tl-meta a { color: inherit; }

/* Deal list ----------------------------------------------------------- */
.deal-list { list-style: none; margin: 0; padding: 0; }
.deal-list li {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto 112px 96px auto; gap: 14px; align-items: center;
  padding: 11px 0; border-top: 1px solid var(--line-soft);
}
.deal-list li:first-child { border-top: 0; }
.deal-list li.empty-line { display: block; }
.deal-main { min-width: 0; display: grid; }
.deal-title { font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-title:hover { text-decoration: underline; }
.deal-company { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deal-when { color: var(--muted); font-size: 13.5px; }
.deal-when.soon { color: var(--warn-ink); font-weight: 700; }
.deal-value { font-family: var(--display); font-weight: 700; font-size: 16px; text-align: right; }

/* Stage bars & quota ---------------------------------------------------- */
.mix { display: grid; grid-template-columns: 1fr; justify-items: center; gap: 18px; margin-bottom: 20px; }
.mix .stage-bars { width: 100%; }
.donut-wrap { position: relative; width: 150px; height: 150px; }
.donut { width: 150px; height: 150px; display: block; }
.donut circle { fill: none; }
.donut .seg { transition: stroke-width .15s; }
.donut .seg:hover { stroke-width: 22; }
.donut-centre { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-centre b { font-family: var(--display); font-size: 19px; letter-spacing: -.02em; }
.donut-centre span { color: var(--muted); font-size: 12px; }
.stage-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stage-bars li { display: grid; grid-template-columns: 12px 1fr auto 22px; gap: 10px; align-items: center; font-size: 14px; }
.sb-swatch { width: 12px; height: 12px; border-radius: 4px; }
.sb-name { font-weight: 700; }
.sb-value { text-align: right; font-weight: 700; }
.sb-n { text-align: right; color: var(--muted); font-size: 13px; }
.quota { display: flex; gap: 16px; align-items: center; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.quota-ring { position: relative; width: 84px; height: 84px; flex: none; }
.quota-ring .ring { width: 84px; height: 84px; }
.quota-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 18px; }
.ring circle { fill: none; }
.ring-track { stroke: var(--line-soft); }
.ring-fill { stroke: var(--accent); stroke-linecap: round; }
.quota-title { font-weight: 700; }

/* Tables ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th {
  text-align: left; font-weight: 700; color: var(--muted); font-size: 13px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
}
td { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
.num { text-align: right; white-space: nowrap; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th[aria-sort]::after { content: " ↓"; color: var(--primary); }
th[aria-sort="ascending"]::after { content: " ↑"; }
.row-link { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.row-link:hover b { text-decoration: underline; }
form.inline { display: flex; align-items: center; gap: 10px; }
.panel table:not(.cal-grid) th:first-child, .panel table:not(.cal-grid) td:first-child { padding-left: 24px; }
.panel table:not(.cal-grid) th:last-child, .panel table:not(.cal-grid) td:last-child { padding-right: 24px; }
[role="tabpanel"] table th:first-child, [role="tabpanel"] table td:first-child { padding-left: 0; }
[role="tabpanel"] table th:last-child, [role="tabpanel"] table td:last-child { padding-right: 0; }

/* Pipeline board ------------------------------------------------------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(196px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 90px; align-items: start; }
.column { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 14px 10px 10px; min-height: 200px; }
.column header { padding: 0 6px 12px; border-bottom: 3px solid var(--c); margin-bottom: 10px; }
.col-title { display: flex; align-items: center; gap: 8px; }
.col-title i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.col-title h2 { font-size: 16px; }
.col-prob { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 700; }
.col-total { font-family: var(--display); font-weight: 700; font-size: 20px; margin-top: 6px; display: flex; align-items: baseline; gap: 8px; }
.col-count { font-family: var(--body); font-size: 13px; color: var(--muted); font-weight: 400; }
.col-count::after { content: " deals"; }
.col-body { display: grid; gap: 8px; min-height: 80px; border-radius: var(--r-lg); transition: background .15s; }
.col-body.over { background: color-mix(in srgb, var(--accent) 14%, transparent); outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; display: none; }
.col-body:not(:has(.card)) .col-empty { display: block; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px;
  cursor: grab; display: grid; gap: 4px;
}
.card:hover { border-color: color-mix(in srgb, var(--muted) 60%, var(--line)); }
.card.dragging { opacity: .45; }
.card-top { display: flex; align-items: flex-start; gap: 4px; }
.card-title { flex: 1; font-weight: 700; text-decoration: none; line-height: 1.3; }
.card-title:hover { text-decoration: underline; }
.card-company { color: var(--muted); font-size: 13px; }
.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.card-value { font-family: var(--display); font-weight: 700; font-size: 16px; }
.card-date { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.card-menu { position: relative; }
.card-menu summary { list-style: none; }
.card-menu summary::-webkit-details-marker { display: none; }
.card-menu .menu { min-width: 170px; }
.dock {
  position: fixed; left: calc(var(--sidebar) + 36px); right: 36px; bottom: 20px; z-index: 25;
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  transform: translateY(140%); transition: transform .2s ease;
}
.dock.show { transform: none; }
.dock-zone {
  height: 64px; border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--display); font-weight: 700; font-size: 18px; border: 2px dashed;
  background: var(--surface);
}
.dock-zone.won { color: var(--ok); border-color: var(--ok); }
.dock-zone.lost { color: var(--bad); border-color: var(--bad); }
.dock-zone.over.won { background: var(--ok-soft); }
.dock-zone.over.lost { background: var(--bad-soft); }

/* Company ---------------------------------------------------------------- */
.company-heading { display: inline-flex; align-items: center; gap: 14px; }
.facts { display: grid; gap: 4px 0; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; font-weight: 700; margin-top: 10px; }
.facts dt:first-child { margin-top: 0; }
.facts dd { margin: 0; }
.facts.tight { grid-template-columns: auto auto; gap: 6px 18px; }
.facts.tight dt { margin: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -6px 0 16px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; font: inherit; font-weight: 700; color: var(--muted); padding: 10px 14px; cursor: pointer;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button span { font-weight: 400; margin-left: 4px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line-soft); align-items: flex-start; }
.people li:first-child { border-top: 0; padding-top: 4px; }
.person { flex: 1; min-width: 0; display: grid; gap: 4px; }
.person-links { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.person-links a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-2); }
.person-links a:hover { text-decoration: underline; }
.person-links .icon { width: 15px; height: 15px; color: var(--muted); }
.consent { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.person-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Schedule ------------------------------------------------------------- */
.calendar { position: sticky; top: 86px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head h2 { font-size: 17px; }
.cal-grid { table-layout: fixed; font-size: 14px; }
.cal-grid th { text-align: center; padding: 4px 0 8px; border: 0; background: none; }
.cal-grid td { padding: 2px; border: 0; text-align: center; }
.cal-grid tbody tr:hover td { background: none; }
.cal-grid td > * {
  display: grid; place-items: center; aspect-ratio: 1; border-radius: 9px; text-decoration: none; position: relative;
}
.cal-grid td a { font-weight: 700; }
.cal-grid td a:hover { background: var(--surface-2); }
.cal-grid td a i { position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal-grid td.out { color: var(--line); }
.cal-grid td.weekend { color: var(--muted); }
.cal-grid td.holiday > * { background: var(--warn-soft); color: var(--warn-ink); }
.cal-grid td.today > * { background: var(--primary); color: var(--on-primary); }
.cal-grid td.today a i { background: #fff; }
.cal-key { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; margin-top: 12px; }
.cal-key span { display: inline-flex; align-items: center; gap: 6px; }
.k-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.k-hol { width: 12px; height: 12px; border-radius: 3px; background: var(--warn-soft); border: 1px solid var(--accent); }
.agenda { display: grid; gap: 22px; }
.agenda-day { scroll-margin-top: 90px; }
.day-head { font-size: 19px; display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.day-head small { display: inline; font-family: var(--body); }
.day-head.is-today { color: var(--primary); }
.tasks { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); }
.tasks li { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line-soft); }
.tasks li:first-child { border-top: 0; }
.tasks time { width: 44px; font-weight: 700; font-size: 13.5px; color: var(--ink-2); }
.tasks li.late time { color: var(--bad); }
.task-main { flex: 1; min-width: 0; }
.tasks li.done .tl-title { text-decoration: line-through; color: var(--muted); }
.tick {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; padding: 0; color: transparent;
}
.tick:hover { border-color: var(--primary); }
.tick .icon { width: 15px; height: 15px; }
.done .tick { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* Finance -------------------------------------------------------------- */
.aging-bar { display: flex; height: 18px; gap: 3px; border-radius: 6px; overflow: hidden; margin-bottom: 16px; }
.aging-bar span { min-width: 6px; }
.age-1 { background: var(--accent); }
.age-2 { background: #fbbf24; }
.age-3 { background: #f97316; }
.age-4 { background: var(--bad); }
.aging-key { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.aging-key li { display: grid; grid-template-columns: 12px 1fr; gap: 2px 8px; align-items: center; font-size: 13.5px; color: var(--muted); }
.aging-key i { width: 12px; height: 12px; border-radius: 3px; }
.aging-key b { grid-column: 2; font-family: var(--display); font-size: 17px; color: var(--ink); }
#invoices td:first-child { white-space: nowrap; }
main > .panel + .panel { margin-top: 20px; }

.invoice { max-width: 840px; padding: 36px 40px; }
.invoice-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 30px; }
.invoice-brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 20px; margin-bottom: 6px; }
.bill-to { margin-bottom: 26px; line-height: 1.6; }
.invoice-lines td, .invoice-lines th { padding-left: 0 !important; padding-right: 0 !important; }
.invoice-lines td + td, .invoice-lines th + th { padding-left: 16px !important; }
tfoot td { border: 0; padding-top: 6px; padding-bottom: 6px; }
tfoot .total td { font-family: var(--display); font-weight: 700; font-size: 19px; border-top: 2px solid var(--ink); padding-top: 12px; }
.invoice > .muted { margin-top: 26px; }

/* Growth ----------------------------------------------------------------- */
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.rank li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.rank-name { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.rank-value { font-family: var(--display); font-weight: 700; font-size: 17px; text-align: right; }
.rank-bar { grid-column: 1 / -1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.rank li:first-child .rank-bar i { background: var(--accent); }
.rank-meta { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }

/* Projects --------------------------------------------------------------- */
.project-board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 16px; overflow-x: auto; align-items: start; }
.project-col h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-left: 12px; border-left: 4px solid var(--c, var(--line)); }
.project-col h2 span { color: var(--muted); font-family: var(--body); font-size: 13px; font-weight: 400; }
.status-on-track { --c: var(--ok); }
.status-at-risk { --c: var(--warn); }
.status-blocked { --c: var(--bad); }
.status-complete { --c: var(--stage-2); }
.project { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; margin-bottom: 10px; display: grid; gap: 6px; }
.project-name { font-weight: 700; }
.project-co { color: var(--muted); font-size: 13.5px; text-decoration: none; }
.project-co:hover { text-decoration: underline; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.progress i { display: block; height: 100%; background: var(--c); border-radius: 3px; transition: width .2s; }
.project-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.range { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.range span { width: 38px; }
.range input { flex: 1; accent-color: var(--primary); padding: 0; border: 0; background: none; min-width: 0; }
.project-form select { padding: 5px 8px; font-size: 13px; }
.project-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.saved-flash { animation: saved 1s ease; }
@keyframes saved { 0% { box-shadow: 0 0 0 0 var(--ok); } 100% { box-shadow: 0 0 0 6px transparent; } }

/* Forms & dialogs ------------------------------------------------------- */
input, select, textarea {
  font: inherit; font-size: 14.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 9px 11px; min-width: 0; width: 100%;
}
input:hover, select:hover { border-color: color-mix(in srgb, var(--muted) 50%, var(--line)); }
input:focus, select:focus { outline: 2.5px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[aria-invalid="true"] { border-color: var(--bad); }
.field { display: grid; gap: 5px; align-content: start; }
.field-label { font-weight: 700; font-size: 13.5px; }
.optional { font-weight: 400; color: var(--muted); }
.field-hint { color: var(--muted); font-size: 12.5px; }
.field-error { color: var(--bad); font-size: 13px; font-weight: 700; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 16px; font-size: 14.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-alert { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: var(--r-md); font-weight: 700; margin-bottom: 16px; }

dialog.sheet {
  width: min(620px, calc(100vw - 32px)); border: 0; padding: 0; border-radius: var(--r-xl);
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(10, 22, 48, .30);
}
dialog::backdrop { background: rgba(10, 22, 48, .45); backdrop-filter: blur(2px); }
dialog.sheet form { padding: 22px 26px 22px; }
dialog.sheet header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
dialog.sheet h2 { font-size: 22px; }
dialog.sheet header .icon-btn { border-color: transparent; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .field:first-child { grid-column: 1 / -1; }
dialog.sheet footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
dialog[open] { animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.invoice-preview { margin-top: 14px; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-2); font-size: 14px; }

/* Sign-in pages ---------------------------------------------------------- */
.auth-page { background: var(--navy-deep); min-height: 100vh; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 22px; padding: 32px 16px; }
.auth-brand { display: flex; align-items: center; gap: 10px; color: var(--on-navy); text-decoration: none; font-weight: 700; font-size: 20px; }
.auth-card { width: min(440px, 100%); background: var(--surface); border-radius: var(--r-xl); padding: 32px 30px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.auth-card h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.auth-lede { color: var(--muted); margin: 6px 0 20px; }
.auth-form { display: grid; gap: 16px; }
.auth-note { color: var(--muted); font-size: 13.5px; margin-top: 18px; }
.auth-foot { color: var(--on-navy-muted); font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; padding: 11px 16px; margin-top: 4px; }
.form-alert.is-ok { background: var(--ok-soft); color: var(--ok); }
.settings-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.settings-list li { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.settings-list span { color: var(--ink-2); font-size: 14px; }
.settings-list code { font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.panel.narrow { max-width: 520px; }
td form.inline input { width: 220px; padding: 6px 10px; font-size: 13.5px; }

/* Command palette ------------------------------------------------------ */
dialog.palette {
  width: min(600px, calc(100vw - 32px)); margin-top: 12vh; border: 1px solid var(--line); padding: 0;
  border-radius: var(--r-xl); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(10, 22, 48, .30);
}
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette-input .icon { color: var(--muted); }
.palette-input input { border: 0; padding: 4px 0; font-size: 17px; background: none; }
.palette-input input:focus { outline: 0; }
#palette-results { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow-y: auto; }
#palette-results li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--r-md); cursor: pointer; }
#palette-results li[aria-selected="true"] { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
#palette-results .kind { font-size: 12px; font-weight: 700; color: var(--muted); width: 66px; flex: none; }
#palette-results .title { font-weight: 700; }
#palette-results .detail { color: var(--muted); font-size: 13px; margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#palette-results .none { color: var(--muted); cursor: default; }

/* Toasts ---------------------------------------------------------------- */
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  background: var(--ink); color: var(--canvas); padding: 12px 16px; border-radius: var(--r-lg); font-weight: 700; font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .2); border-left: 4px solid var(--accent); animation: rise .2s ease-out;
}
.toast.error { border-left-color: var(--bad); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .25s; }

.scrim { display: none; }

/* Responsive ------------------------------------------------------------ */
/* Navigation groups ------------------------------------------------------ */
.brand-text { display: grid; min-width: 0; }
.brand-ws { font-size: 12px; color: var(--on-navy-muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.main-nav { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.sidebar > nav.main-nav a { padding: 8px 12px; font-size: 14px; }
.nav-heading { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--on-navy-muted); opacity: .7; padding: 14px 12px 4px; }
.admin-links { display: grid; gap: 1px; margin: -4px -6px 12px; }
.admin-links a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r-sm); color: var(--on-navy-muted); text-decoration: none; font-size: 13.5px; font-weight: 700; }
.admin-links a:hover, .admin-links a[aria-current] { background: rgba(255, 255, 255, .06); color: var(--on-navy); }
.admin-links .icon { width: 16px; height: 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.crumbs { display: flex; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--primary); font-weight: 700; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.span-2 { grid-column: 1 / -1; }
.form-hint { color: var(--muted); font-size: 13px; margin-top: 12px; }
.bad-text { color: var(--bad); font-weight: 700; }
.btn.big { padding: 13px 22px; font-size: 16px; }
.stat-link { text-decoration: none; transition: border-color .15s, transform .15s; }
.stat-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.stats:has(> :nth-child(5)) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stats.stacked { grid-template-columns: 1fr; gap: 10px; margin: 0; }
.stats.stacked .stat { padding: 12px 16px; }
.stats.stacked .stat-value { font-size: 20px; margin-top: 2px; }

/* Layout switch and saved views ----------------------------------------- */
.layout-switch { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.layout-switch a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 7px; font-size: 13.5px; font-weight: 700; color: var(--muted); text-decoration: none; }
.layout-switch a[aria-current] { background: var(--accent-soft); color: var(--primary); }
.layout-switch .icon { width: 16px; height: 16px; }
.view-tabs { display: flex; gap: 2px; align-items: flex-end; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.view-tab { display: inline-flex; align-items: center; border-bottom: 2.5px solid transparent; margin-bottom: -1px; }
.view-tab a { padding: 9px 12px; font-weight: 700; font-size: 14px; color: var(--muted); text-decoration: none; }
.view-tab a:hover { color: var(--ink); }
.view-tab.is-active { border-color: var(--primary); }
.view-tab.is-active a { color: var(--ink); }
.view-tab form { display: inline; }
.view-remove { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; margin-right: 4px; border-radius: 4px; display: grid; }
.view-remove .icon { width: 13px; height: 13px; }
.view-remove:hover { color: var(--bad); background: var(--bad-soft); }
.save-view { position: relative; margin: 0 0 6px auto; }
.save-view summary { list-style: none; }
.save-view summary::-webkit-details-marker { display: none; }
.save-view-form { right: 0; left: auto; padding: 14px; width: 260px; display: grid; gap: 10px; }

/* List pages ------------------------------------------------------------ */
.list-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.list-toolbar .search-field { flex: 1 1 240px; }
.list-toolbar .search-field input { min-width: 0; width: 100%; }
.filter-select select { width: auto; padding: 7px 30px 7px 10px; font-size: 13.5px; font-weight: 600; background-color: var(--surface-2); }
.filter-select select:has(option:checked:not([value=""])) { border-color: var(--primary); background-color: var(--accent-soft); color: var(--primary); }
table.records td { padding-top: 10px; padding-bottom: 10px; }
table.records td > small { margin-top: 0; }
.records .pick { width: 36px; padding-right: 0 !important; }
.records .pick input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.records tr.is-picked td { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.row-link { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0; }
.row-link > span:last-child { min-width: 0; }
.row-actions { white-space: nowrap; }
.row-actions > * + * { margin-left: 4px; }
.ticket-no { font-family: var(--display); font-weight: 700; color: var(--muted); font-size: 13px; min-width: 34px; }
.product-mark { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--primary); flex: none; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; color: var(--ink-2); }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 18px; background: var(--navy); color: var(--on-navy); font-size: 14px; }
.bulk-bar[hidden] { display: none; }
.bulk-bar select { width: auto; padding: 6px 10px; font-size: 13.5px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.pager nav { display: flex; align-items: center; gap: 10px; }

/* Lifecycle, status, priority and service-level chips --------------------- */
.chip[class*="lifecycle-"] { border-color: transparent; }
.lifecycle-subscriber { background: var(--surface-2); color: var(--ink-2); }
.lifecycle-lead { background: color-mix(in srgb, var(--stage-1) 60%, var(--surface)); color: var(--ink); }
.lifecycle-marketing-qualified-lead, .lifecycle-sales-qualified-lead { background: color-mix(in srgb, var(--stage-2) 45%, var(--surface)); color: var(--ink); }
.lifecycle-opportunity { background: color-mix(in srgb, var(--stage-3) 30%, var(--surface)); color: var(--ink); }
.lifecycle-customer { background: var(--ok-soft); color: var(--ok); }
.lifecycle-evangelist { background: var(--navy); color: var(--on-navy); }
.lifecycle-other { background: var(--surface-2); color: var(--muted); }
.funnel-bar .lifecycle-lead, .funnel-bar .lifecycle-subscriber { background: var(--stage-1); }
.funnel-bar .lifecycle-marketing-qualified-lead { background: var(--stage-2); }
.funnel-bar .lifecycle-sales-qualified-lead { background: var(--stage-3); }
.funnel-bar .lifecycle-opportunity { background: var(--stage-4); }
.funnel-bar .lifecycle-customer, .funnel-bar .lifecycle-evangelist { background: var(--stage-5); }
.chip.status-new { background: var(--accent-soft); color: var(--primary); border-color: transparent; }
.chip.status-waiting-on-us { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.chip.status-waiting-on-contact { background: var(--surface-2); color: var(--ink-2); }
.chip.status-closed { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.prio::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--muted); }
.prio-urgent { color: var(--bad); }
.prio-urgent::before { background: var(--bad); }
.prio-high::before { background: var(--warn); }
.prio-medium::before { background: var(--accent); }
.prio-low::before { background: var(--line); }
.sla { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.sla .icon { width: 14px; height: 14px; }
.sla-met { color: var(--ok); }
.sla-breached, .sla-overdue { color: var(--bad); font-weight: 700; }
.sla-soon { color: var(--warn-ink); font-weight: 700; }

/* Record pages: three columns like HubSpot ------------------------------- */
.record { display: grid; grid-template-columns: 300px minmax(0, 1fr) 290px; gap: 20px; align-items: start; }
.record-left, .record-right, .record-mid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.record-left > *, .record-mid > *, .record-right > * { min-width: 0; }
.record-left .panel, .record-mid .panel { padding: 18px 20px; }
.record-card { text-align: center; display: grid; justify-items: center; gap: 6px; }
.record-card h1 { font-size: 22px; letter-spacing: -.02em; margin-top: 6px; overflow-wrap: anywhere; }
.record-card .muted { font-size: 14px; }
.record-card .muted a { color: var(--primary); font-weight: 700; text-decoration: none; }
.record-amount { font-family: var(--display); font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.record-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 2px; }
.avatar.xl { width: 64px; height: 64px; font-size: 22px; }
.logo.xl { width: 64px; height: 64px; font-size: 22px; border-radius: 16px; }
.deal-badge { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--primary); }
.deal-badge .icon { width: 28px; height: 28px; }
.deal-badge.won { background: var(--ok-soft); color: var(--ok); }
.deal-badge.lost { background: var(--bad-soft); color: var(--bad); }
.quick-actions { display: flex; justify-content: center; gap: 2px; margin-top: 12px; flex-wrap: wrap; }
.quick-actions > * {
  display: grid; justify-items: center; gap: 4px; width: 46px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 11.5px; font-weight: 700; color: var(--muted); text-decoration: none;
}
.quick-actions .icon { width: 38px; height: 38px; padding: 10px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--primary); transition: background .15s, border-color .15s; }
.quick-actions > *:hover .icon { background: var(--accent-soft); border-color: var(--accent); }
.props { margin: 0; display: grid; gap: 12px; }
.prop dt { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.prop dd { margin: 2px 0 0; font-size: 14.5px; overflow-wrap: anywhere; }
.prop dd .icon { width: 13px; height: 13px; vertical-align: -1px; }
.danger-zone, .gdpr-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.gdpr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.ghost.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.assoc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow); }
.assoc header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.assoc h3 { font-size: 14.5px; display: flex; gap: 6px; align-items: center; }
.assoc h3 span { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 0 7px; font-weight: 700; }
.assoc .text-link .icon { width: 14px; height: 14px; }
.assoc-item { display: flex; gap: 10px; align-items: center; padding: 8px; margin: 0 -8px; border-radius: var(--r-md); text-decoration: none; min-width: 0; }
.assoc-item:hover { background: var(--surface-2); }
.assoc-item > span:last-child { min-width: 0; }
.assoc-item b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assoc-item small { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-desc { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: 14px; white-space: pre-line; }

/* Composer -------------------------------------------------------------- */
.composer { padding: 0 !important; overflow: hidden; }
.composer form { display: grid; }
.composer-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--surface-2); overflow-x: auto; }
.composer-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 11px 16px; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.composer-tab input { position: absolute; opacity: 0; pointer-events: none; }
.composer-tab .icon { width: 16px; height: 16px; }
.composer-tab:has(input:checked) { color: var(--ink); border-color: var(--primary); background: var(--surface); }
.composer-tab:has(input:focus-visible) { outline: 2.5px solid var(--accent); outline-offset: -3px; }
.composer-body { padding: 16px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.composer-body .c-subject, .composer-body .c-body, .composer-row { grid-column: 1 / -1; }
.composer textarea { resize: vertical; min-height: 76px; }
.composer-row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.composer-row .field { flex: 0 1 160px; }
.composer-row .c-owner { flex: 1 1 180px; }
.composer-save { margin-left: auto; }
.composer .c-outcome, .composer .c-tasktype, .composer .c-owner { display: none; }
.composer form[data-kind="call"] .c-outcome, .composer form[data-kind="task"] .c-tasktype, .composer form[data-kind="task"] .c-owner { display: grid; }
.composer form[data-kind="note"] .c-subject { display: none; }
.composer form[data-kind="task"] .c-body { display: none; }

/* Timeline -------------------------------------------------------------- */
.timeline-panel .segmented { flex-wrap: wrap; }
.timeline-panel .segmented button { padding: 5px 10px; font-size: 12.5px; }
.feed { list-style: none; margin: 0; padding: 0; position: relative; }
.feed-month { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 14px 0 8px; }
.feed-month:first-child { padding-top: 0; }
.feed-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); align-items: start; }
.feed-month + .feed-item { border-top: 0; }
.feed-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.feed-icon .icon { width: 16px; height: 16px; }
.kind-note .feed-icon { background: var(--warn-soft); color: var(--warn-ink); }
.kind-email .feed-icon, .kind-meeting .feed-icon { background: var(--accent-soft); color: var(--primary); }
.kind-call .feed-icon { background: color-mix(in srgb, var(--stage-5) 14%, var(--surface)); color: var(--stage-5); }
.kind-task .feed-icon { background: var(--ok-soft); color: var(--ok); }
.feed-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14.5px; }
.feed-body { margin-top: 4px; color: var(--ink-2); font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.feed-meta { margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.kind-system .feed-title b { font-weight: 600; }
.feed-item form { opacity: 0; transition: opacity .15s; }
.feed-item:hover form, .feed-item form:focus-within { opacity: 1; }
@media (hover: none) { .feed-item form { opacity: 1; } }
.tasks.compact li { padding: 10px 0; }
.upcoming .tasks { margin: 0; }

/* Stage path ------------------------------------------------------------ */
.stage-path-panel { padding: 10px !important; }
.stage-path { display: flex; gap: 3px; overflow-x: auto; }
.stage-path button {
  flex: 1 1 0; min-width: 92px; border: 0; padding: 10px 14px 10px 20px; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}
.stage-path button:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 8px 0 0 8px; padding-left: 14px; }
.stage-path button:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%); border-radius: 0 8px 8px 0; }
.stage-path button .icon { width: 15px; height: 15px; }
.stage-path button:hover { background: var(--line); color: var(--ink); }
.stage-path button.done { background: var(--accent-soft); color: var(--primary); }
.stage-path button.current { background: var(--primary); color: var(--on-primary); }
.stage-path button.won.current { background: var(--ok); color: var(--on-primary); }
.stage-path button.lost.current { background: var(--bad); color: #fff; }
.stage-path button.won:not(.current):hover { background: var(--ok-soft); color: var(--ok); }
.stage-path button.lost:not(.current):hover { background: var(--bad-soft); color: var(--bad); }

/* Line items ------------------------------------------------------------ */
table.lines { font-size: 14px; }
table.lines td, table.lines th { padding: 9px 10px; }
.panel table.lines th:first-child, .panel table.lines td:first-child { padding-left: 0; }
.panel table.lines th:last-child, .panel table.lines td:last-child { padding-right: 0; }
table.lines tfoot td { border-bottom: 0; padding-top: 6px; padding-bottom: 6px; }
.add-line { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.add-line-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.add-line-form .grow { flex: 1 1 220px; }
.add-line-form .qty { flex: 0 0 84px; }
.add-line-form > .field:not(.grow):not(.qty) { flex: 0 1 130px; }
.custom-line { margin-top: 10px; }
.custom-line summary { cursor: pointer; display: inline-block; margin-bottom: 10px; }
.custom-line summary::-webkit-details-marker { display: none; }

/* Tickets --------------------------------------------------------------- */
.ticket-board { grid-template-columns: repeat(4, minmax(220px, 1fr)); padding-bottom: 24px; }
.ticket-board .column header { border-bottom-color: var(--c, var(--line)); }
.column.status-new { --c: var(--accent); }
.column.status-waiting-on-us { --c: var(--warn); }
.column.status-waiting-on-contact { --c: var(--stage-4); }
.column.status-closed { --c: var(--ok); }
.ticket-card { border-left: 3px solid transparent; }
.ticket-board .col-total { font-size: 14px; font-weight: 700; }
.ticket-board .col-count::after { content: " tickets"; }
.list-toolbar .filter-select select { max-width: 180px; }
.ticket-card.sla-edge-breached { border-left-color: var(--bad); }
.ticket-card.sla-edge-soon { border-left-color: var(--warn); }
.ticket-card .card-foot { flex-wrap: wrap; }
.ticket-card .card-foot .avatar { margin-left: auto; }
.sla-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px !important; }
.sla-box { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line-soft); }
.sla-box .stat-label { display: flex; align-items: center; gap: 6px; }
.sla-box .stat-label .icon { width: 15px; height: 15px; }
.sla-state { font-family: var(--display); font-size: 19px; font-weight: 750; margin: 4px 0 2px; }
.sla-box.sla-met { background: var(--ok-soft); border-color: transparent; }
.sla-box.sla-met .sla-state { color: var(--ok); }
.sla-box.sla-breached, .sla-box.sla-overdue { background: var(--bad-soft); border-color: transparent; }
.sla-box.sla-breached .sla-state, .sla-box.sla-overdue .sla-state { color: var(--bad); }
.sla-box.sla-soon { background: var(--warn-soft); border-color: transparent; }
.sla-box.sla-soon .sla-state { color: var(--warn-ink); }
.sla-box .muted { color: var(--ink-2); }

/* Reports --------------------------------------------------------------- */
.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.funnel li { display: grid; grid-template-columns: 180px minmax(0, 1fr) 40px; gap: 12px; align-items: center; font-size: 14px; }
.funnel b { text-align: right; font-family: var(--display); }
.funnel-name { font-weight: 600; }
.funnel-bar { height: 22px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.funnel-bar i { display: block; height: 100%; min-width: 3px; border-radius: 6px; }
.sla-rates { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.sla-rates .stat-value { margin-top: 2px; font-size: 24px; }
.sla-rates .winbar { margin-top: 8px; }
.sub-head { font-size: 14.5px; margin: 6px 0 10px; }
.rank.compact li { padding-top: 8px; padding-bottom: 8px; }

/* Import ---------------------------------------------------------------- */
.steps { list-style: none; margin: 0 0 20px; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.steps li { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--muted); padding-right: 18px; }
.steps span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; }
.steps .current { color: var(--ink); }
.steps .current span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.steps .done span { background: var(--accent-soft); color: var(--primary); border-color: transparent; }
.import-form { display: grid; gap: 18px; }
.choice-cards { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-cards legend { margin-bottom: 8px; }
.choice-card { position: relative; }
.choice-card input { position: absolute; opacity: 0; }
.choice-card > span { display: grid; gap: 4px; padding: 14px; border: 1.5px solid var(--line); border-radius: var(--r-md); cursor: pointer; height: 100%; }
.choice-card > span .icon { color: var(--primary); }
.choice-card small { margin: 0; }
.choice-card input:checked + span { border-color: var(--primary); background: var(--accent-soft); }
.choice-card input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.dropzone-file { display: grid; justify-items: center; gap: 6px; padding: 28px 18px; text-align: center; border: 2px dashed var(--line); border-radius: var(--r-lg); cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone-file .icon { width: 28px; height: 28px; color: var(--primary); }
.dropzone-file:hover, .dropzone-file.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-file.has-file { border-style: solid; border-color: var(--primary); }
.dropzone-file input { width: auto; max-width: 100%; border: 0; background: none; padding: 0; font-size: 13px; }
.js .dropzone-file input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.form-actions.pad { padding: 16px 24px 20px; border-top: 1px solid var(--line-soft); }
.tips { margin-top: 16px; }
.tips h2 { font-size: 16px; margin-bottom: 10px; }
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); }
.ticks li { padding-left: 24px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 2px; color: var(--primary); font-weight: 800; }
.mapping tr.is-matched td:last-child select { border-color: var(--primary); }
.mapping select { min-width: 200px; }
.samples { color: var(--muted); font-size: 13px; max-width: 360px; }
.samples span { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; background: var(--surface-2); border-radius: 5px; padding: 1px 7px; margin: 2px 4px 2px 0; }
.import-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; padding-top: 18px; padding-bottom: 18px; border-top: 1px solid var(--line-soft); }
.pad { padding-left: 24px; padding-right: 24px; }
.import-options fieldset { border: 0; margin: 0; padding: 0; }
.import-options .check { margin-top: 8px; }
.import-done { text-align: center; display: grid; justify-items: center; gap: 6px; }
.done-mark { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.done-mark .icon { width: 28px; height: 28px; }
.done-figures { display: flex; gap: 12px; margin: 14px 0; }
.done-figures div { padding: 10px 18px; border-radius: var(--r-md); background: var(--surface-2); min-width: 96px; }
.done-figures dt { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.done-figures dd { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 750; }
.import-errors { width: 100%; text-align: left; margin: 6px 0 14px; font-size: 13.5px; }
.import-errors summary { cursor: pointer; font-weight: 700; }
.import-errors ul { margin: 8px 0 0; padding-left: 18px; max-height: 260px; overflow: auto; }
.import-done .form-actions { justify-content: center; }

/* Settings and welcome -------------------------------------------------- */
.settings { display: grid; gap: 18px; max-width: 760px; }
.settings .check { margin: 0 0 14px; }
.form-end { display: flex; justify-content: flex-end; }
.welcome { display: flex; justify-content: space-between; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; background: linear-gradient(120deg, var(--surface) 55%, var(--accent-soft)); }
.welcome h2 { font-size: 20px; margin-bottom: 4px; }
.welcome-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }


/* Record and list responsiveness --------------------------------------- */
@media (max-width: 1520px) {
  /* Two columns on laptops: linked records become a row of cards above the timeline, visible without scrolling. */
  .record { grid-template-columns: 280px minmax(0, 1fr); }
  .record-left { grid-column: 1; grid-row: 1 / span 2; }
  .record-right { grid-column: 2; grid-row: 1; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
  .record-mid { grid-column: 2; grid-row: 2; }
}
@media (max-width: 900px) {
  .record-left, .record-mid, .record-right { grid-column: auto; grid-row: auto; }
  .record-right { order: 1; }
  .record-mid { order: 2; }
}
/* Very wide screens (a 4K monitor, a 1440p ultrawide). Stretching to the edge makes pages hard to read, so content
   stays in a 2000px block beside the sidebar, boards keep card-sized columns, and on high-resolution screens everything is drawn
   a little larger, so a 4K display at 100% scaling isn't all tiny text. */
@media (min-width: 2200px) {
  main { max-width: 2000px; padding-left: 48px; padding-right: 48px; }  /* beside the sidebar, like most apps */
  .record { grid-template-columns: 340px minmax(0, 1fr) 380px; gap: 24px; }
  .board { grid-template-columns: repeat(5, minmax(196px, 360px)); }
  .ticket-board { grid-template-columns: repeat(4, minmax(220px, 420px)); }
  .project-board { grid-template-columns: repeat(4, minmax(240px, 420px)); }
  .stats:has(> :nth-child(5)) { gap: 20px; }
}
@media (min-width: 2600px) { html { zoom: 1.15; } }
@media (min-width: 3400px) { html { zoom: 1.35; } }

/* Notifications, mentions and getting started ----------------------------------- */
.bell { position: relative; }
.bell > summary { list-style: none; position: relative; cursor: pointer; }
.bell > summary::-webkit-details-marker { display: none; }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.bell-menu { right: 0; left: auto; width: min(340px, calc(100vw - 32px)); display: grid; gap: 2px; padding: 6px; }
.bell-menu a { display: grid; gap: 2px; padding: 9px 10px; border-radius: var(--r-md); text-decoration: none; color: var(--ink); font-size: 13.5px; }
.bell-menu a:hover { background: var(--surface-2); }
.bell-menu a.unread b::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 1px; }
.bell-menu small { color: var(--muted); font-size: 12px; }
.bell-menu .bell-all { text-align: center; color: var(--primary); font-weight: 700; border-top: 1px solid var(--line-soft); border-radius: 0; margin-top: 2px; }
.bell-empty { padding: 10px; }
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list li { border-top: 1px solid var(--line-soft); }
.notice-list li:first-child { border-top: 0; }
.notice-list a { display: grid; gap: 3px; padding: 14px 22px; text-decoration: none; color: var(--ink); }
.notice-list a:hover { background: var(--surface-2); }
.notice-list li.unread a { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.notice-list span { color: var(--ink-2); font-size: 14px; }
.notice-list small { color: var(--muted); font-size: 12.5px; }
mark.mention { background: var(--accent-soft); color: var(--primary); font-weight: 700; padding: 0 3px; border-radius: 4px; }
.mention-pick { position: absolute; z-index: 70; list-style: none; margin: 0; padding: 4px; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 12px 32px rgba(15, 31, 61, .16); }
.mention-pick li { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.mention-pick li[aria-selected="true"], .mention-pick li:hover { background: var(--accent-soft); color: var(--primary); }
.getting-started { margin-bottom: 20px; }
.gs-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: -4px 0 14px; }
.gs-bar span { display: block; height: 100%; background: var(--accent); }
.gs-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 8px; }
.gs-steps li { font-size: 14px; font-weight: 700; }
.gs-steps a, .gs-steps li.done { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: var(--ink); }
.gs-steps a:hover { border-color: var(--accent); }
.gs-steps li.done { color: var(--muted); text-decoration: line-through; background: var(--surface-2); }
.gs-tick { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center; }
.gs-steps li.done .gs-tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.gs-tick .icon { width: 12px; height: 12px; }

/* Documents: logo, sending ------------------------------------------------------ */
.doc-logo { height: 40px; width: auto; max-width: 220px; object-fit: contain; display: block; }
.invoice-brand .doc-logo { margin-right: 4px; }
.public-brand .doc-logo { height: 34px; }
.invoice-sending { max-width: 840px; margin-top: 16px; }
.invoice-sending p { font-size: 14.5px; }
.logo-field { margin-top: 16px; display: grid; gap: 6px; }
.logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-preview { height: 48px; width: auto; max-width: 240px; object-fit: contain; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; }
.logo-empty { color: var(--muted); font-size: 13.5px; }
.logo-row label.btn { cursor: pointer; }

/* Two-factor sign-in --------------------------------------------------------- */
.code-input { font-size: 22px; letter-spacing: .25em; font-variant-numeric: tabular-nums; max-width: 220px; }
.setup-steps { margin: 0 0 16px; padding-left: 22px; }
.setup-steps li { padding-left: 4px; margin-bottom: 24px; }
.two-factor-setup .inline-form { justify-content: flex-start; margin-top: 10px; }
.two-factor-setup .inline-form .field { flex: 0 0 220px; }
.qr { margin: 12px 0 8px; display: block; width: fit-content; border: 1px solid var(--line); border-radius: var(--r-md); line-height: 0; overflow: hidden; }
.secret { word-break: break-all; }
.recovery-codes { columns: 2; gap: 24px; margin: 16px 0; padding-left: 22px; font-size: 16px; line-height: 2; }
.recovery-codes code { font-size: 16px; letter-spacing: .05em; }

/* Settings hub and tabs ------------------------------------------------------ */
.settings-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: -6px 0 22px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.settings-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: var(--r-md); font-size: 14px; font-weight: 700; color: var(--muted); text-decoration: none; }
.settings-tabs a:hover { background: var(--surface-2); color: var(--ink); }
.settings-tabs a[aria-current] { background: var(--accent-soft); color: var(--primary); }
.settings-tabs .icon { width: 16px; height: 16px; }
.hub-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.hub-card { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
.hub-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.hub-card b { display: block; font-size: 16px; }
.hub-card small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 3px; }
@media (max-width: 640px) {
  .settings-tabs { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 0 16px 10px; }
  .settings-tabs a { white-space: nowrap; }
}

/* Integrations and VAT ------------------------------------------------------ */
.integration-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.integration { display: grid; gap: 12px; align-content: start; }
.integration-head { display: flex; gap: 12px; align-items: center; }
.integration-head > div { flex: 1; min-width: 0; }
.integration-head h2 { font-size: 17px; }
.integration-mark { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; }
.mark-google { background: #ea4335; }
.mark-microsoft { background: #0078d4; }
.mark-xero { background: #13b5ea; }
.mark-hmrc { background: #00703c; }
.integration-blurb { font-size: 14px; color: var(--ink-2); }
.integration-props { gap: 8px; }
.bad-text { color: var(--bad); }
.vat-form { max-width: 860px; display: grid; gap: 18px; }
.vat-boxes { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.vat-box { display: grid; grid-template-columns: 64px minmax(0, 1fr) 180px; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.vat-box:first-child { border-top: 0; }
.vat-box:nth-child(3), .vat-box:nth-child(5) { background: var(--surface-2); }
.vat-box-n { font-weight: 800; font-size: 13px; color: var(--primary); }
.vat-box label { font-weight: 700; font-size: 14.5px; display: grid; }
.vat-box label small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.vat-input { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.vat-input input { text-align: right; font-variant-numeric: tabular-nums; }
.vat-input input[readonly] { background: transparent; border-color: transparent; font-weight: 800; }
.vat-declaration { align-items: flex-start; font-weight: 600; }
@media (max-width: 640px) {
  .vat-box { grid-template-columns: 1fr; gap: 6px; }
}

/* Billing ---------------------------------------------------------------- */
.plan-banner { display: block; margin: 16px 36px 0; padding: 10px 16px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; text-decoration: none; }
.plan-banner.bad { background: var(--bad-soft); color: var(--bad); }
.plan-banner:hover { text-decoration: underline; }
.billing-summary h2 { font-size: 22px; letter-spacing: -.01em; }
.billing-summary > .muted { margin-top: 6px; }
.billing-facts { margin-top: 18px; }
.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 14px; color: var(--ink-2); }

/* Email campaigns -------------------------------------------------------- */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin-bottom: 18px; border-radius: var(--r-lg); background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; }
.notice .icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.campaign-body { font-family: inherit; line-height: 1.55; resize: vertical; }
.stage-picks { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.pick-chip { position: relative; cursor: pointer; }
.pick-chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pick-chip span { display: block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--ink-2); }
.pick-chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--primary); }
.pick-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.audience-count { margin-top: 14px; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: 14px; }
.email-preview { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: var(--r-md); background: #f1f4f8; }
.sending-panel { margin-bottom: 20px; display: grid; gap: 10px; justify-items: start; }
.sending-panel h2 { font-size: 18px; }
.send-progress { width: 100%; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.send-progress span { display: block; height: 100%; background: var(--primary); transition: width .3s; }

/* Quotes and forms ------------------------------------------------------- */
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.chip.sm { font-size: 11px; padding: 0 7px; vertical-align: 1px; }
.heading-chip { font-family: var(--body, inherit); font-size: 13px; vertical-align: middle; margin-left: 6px; letter-spacing: 0; }
a.segmented, .segmented a { text-decoration: none; }
.segmented a { font-size: 13px; font-weight: 700; color: var(--muted); padding: 6px 12px; border-radius: 7px; }
.segmented a[aria-current] { background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(15, 31, 61, .10); }
nav.segmented { flex-wrap: wrap; }
.segmented.compact label { position: relative; cursor: pointer; }
.segmented.compact input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented.compact label span { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 5px 10px; border-radius: 7px; }
.segmented.compact input:checked + span { background: var(--surface); color: var(--primary); box-shadow: 0 1px 2px rgba(15, 31, 61, .10); }
.segmented.compact input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.head-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.quote-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.quote-main, .quote-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.quote-main .invoice { max-width: none; }
.quote-title { font-size: 20px; margin: -8px 0 18px; }
.quote-terms { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.quote-terms h3 { font-size: 14px; margin-bottom: 6px; }
.quote-terms p { white-space: pre-line; color: var(--ink-2); font-size: 14px; }
.quote-signed { margin-top: 22px; padding: 16px 18px; border-radius: var(--r-md); background: var(--ok-soft); }
.quote-signature { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 30px; line-height: 1.2; color: var(--ink); }
.copy-field { display: flex; gap: 8px; margin: 10px 0; }
.copy-field input { flex: 1; min-width: 0; font-size: 13px; }
.quote-steps { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 12px; }
.quote-steps li { position: relative; padding-left: 26px; display: grid; }
.quote-steps li::before { content: ""; position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.quote-steps li.done::before { background: var(--ok); border-color: var(--ok); }
.quote-steps li.bad::before { background: var(--bad); border-color: var(--bad); }
.quote-steps small { color: var(--muted); font-size: 13px; }
.quote-reason { font-style: italic; }
.panel-gap { margin-top: 12px; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
.form-section { font-size: 15px; margin: 26px 0 6px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.field-modes { display: grid; gap: 8px; margin-top: 10px; }
.field-mode { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 700; font-size: 14px; }
.form-footer-row { margin-top: 20px; }
.code-box { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 12px; margin: 10px 0; resize: vertical; }
.submission-message { color: var(--ink-2) !important; margin-top: 2px; }
/* Public pages: quotes and forms that customers and website visitors see */
.public-page { background: var(--surface-2); min-height: 100vh; display: flex; flex-direction: column; }
.public-page.is-embed { background: transparent; min-height: 0; }
.public-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px max(16px, calc((100% - 880px) / 2)); background: var(--surface); border-bottom: 1px solid var(--line); }
.public-brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; }
.public-main { width: 100%; max-width: 880px; margin: 0 auto; padding: 28px 16px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; flex: 1; align-content: start; }
.public-main > * { min-width: 0; }
.public-main.is-narrow { max-width: 620px; }
.is-embed .public-main { padding: 4px; max-width: none; }
.is-embed .public-form-card { box-shadow: none; }
.public-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 0 16px 28px; }
.public-banner { padding: 14px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.public-banner.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.public-banner.ok b, .public-banner.warn b { color: inherit; }
.public-banner.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-ink); }
.public-decide h2 { font-size: 20px; margin-bottom: 4px; }
.public-sign { display: grid; gap: 4px; margin-top: 16px; }
.public-actions { margin-top: 18px; }
.public-actions .btn { min-width: 180px; justify-content: center; }
.public-decline { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.public-decline form { margin-top: 12px; }
.public-form-card h1 { font-size: 26px; letter-spacing: -.02em; }
.public-intro { margin: 6px 0 18px; }
.public-privacy { margin-top: 14px; }
.public-note { margin: 0; }
.public-done { text-align: center; padding: 20px 0; display: grid; gap: 8px; justify-items: center; }
.done-tick { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; background: var(--ok-soft); color: var(--ok); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media print {
  .public-head .btn, .public-decide, .public-foot, .quote-side, .public-note { display: none !important; }
  .quote-layout { display: block; }
  .public-page { background: #fff; }
}

/* Team and profiles ------------------------------------------------------ */
img.avatar { object-fit: cover; background: var(--surface-2); }
.avatar.xxl { width: 112px; height: 112px; font-size: 36px; }
a.me { text-decoration: none; color: inherit; border-radius: var(--r-md); margin: -6px; padding: 6px; transition: background .15s; }
a.me:hover { background: rgba(255, 255, 255, .07); }
a.me > div { min-width: 0; }
.me-name, .me-role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel-intro { margin: 4px 0 18px; }
.panel.narrow-wide { max-width: 780px; }
.profile-form { display: grid; gap: 20px; }
.photo-field { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.photo-controls { display: grid; gap: 8px; justify-items: start; flex: 1 1 220px; }
.photo-controls label.btn { cursor: pointer; }
.photo-controls label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo-controls .photo-remove { margin-top: 0; }
.photo-preview img { display: block; }
.team-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 16px; }
.team-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow);
  padding: 22px 18px 18px; display: grid; justify-items: center; gap: 10px; text-align: center; min-width: 0;
}
.team-card-link { display: grid; justify-items: center; gap: 6px; text-decoration: none; color: inherit; min-width: 0; max-width: 100%; }
.team-card-link:hover .team-card-name { color: var(--primary); text-decoration: underline; }
.team-card-name { font-weight: 750; font-size: 16px; margin-top: 4px; overflow-wrap: anywhere; }
.team-card-title { color: var(--muted); font-size: 13.5px; }
.team-card-contact { display: grid; gap: 4px; width: 100%; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.team-card-contact a { display: flex; gap: 6px; align-items: center; justify-content: center; color: var(--muted); text-decoration: none; min-width: 0; }
.team-card-contact a:hover { color: var(--primary); }
.team-card-contact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-card-contact .icon { width: 14px; height: 14px; flex: none; }
.profile-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-side, .profile-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.profile-card { padding-top: 26px; }
.profile-bio { white-space: pre-line; margin: 0 0 16px; font-size: 14.5px; }
.profile-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0; }
.profile-list { list-style: none; margin: 0; padding: 0; }
.profile-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.profile-list li:first-child { border-top: 0; padding-top: 0; }
.profile-list li > a, .profile-list li > span:first-child { display: grid; min-width: 0; text-decoration: none; color: inherit; }
.profile-list li > a:hover b { color: var(--primary); text-decoration: underline; }
.profile-list b { overflow-wrap: anywhere; }
.profile-list small { color: var(--muted); font-size: 13px; }
.profile-list li.late small { color: var(--bad); font-weight: 700; }
.profile-list-end { display: flex; align-items: center; gap: 10px; flex: none; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.inline-form .field { flex: 1 1 170px; }

@media (max-width: 1180px) {
  .stats:has(> :nth-child(5)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .account-grid { grid-template-columns: minmax(0, 1fr); }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .record, .profile-layout, .quote-layout { grid-template-columns: 1fr; }
  .record-right { grid-template-columns: minmax(0, 1fr); }
  .funnel li { grid-template-columns: 130px minmax(0, 1fr) 34px; }
}
@media (max-width: 640px) {
  .stats:has(> :nth-child(5)) { grid-template-columns: 1fr 1fr; }
  .sla-panel, .sla-rates, .choice-cards { grid-template-columns: 1fr; }
  .composer-body { grid-template-columns: 1fr; padding: 14px; }
  .composer-save { margin-left: 0; width: 100%; justify-content: center; }
  .ticket-board { grid-template-columns: repeat(4, 84vw); }
  .list-toolbar { padding: 12px; }
  .filter-select { flex: 1 1 45%; }
  .filter-select select { width: 100%; }
  .done-figures { flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 1180px) {
  .layout-main { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats.compact { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .sidebar { width: 260px; transform: translateX(-100%); transition: transform .22s ease; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(10, 22, 48, .45); }
  .only-mobile { display: inline-grid; }
  .topbar, main { padding-left: 16px; padding-right: 16px; }
  .plan-banner { margin: 12px 16px 0; }
  .search-trigger kbd, .search-trigger span { display: none; }
  .search-trigger { flex: 0; }
  .layout-aside, .layout-even { grid-template-columns: 1fr; }
  .calendar { position: static; }
  .dock { left: 16px; right: 16px; }
  .aging-key { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .track { padding: 22px 18px 18px; border-radius: var(--r-lg); }
  .track-verdict { text-align: left; }
  .rail-scale span:nth-child(2) { display: none; }
  .stats, .stats.compact { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-stats .stat-value { font-size: 22px; }
  .avatar.xxl { width: 88px; height: 88px; font-size: 28px; }
  .panel { padding: 18px; border-radius: var(--r-lg); }
  .deal-list li { grid-template-columns: auto minmax(0, 1fr) auto; }
  .deal-list .chip, .deal-list .avatar { display: none; }
  .deal-when { grid-column: 2; grid-row: 2; margin-top: -8px; font-size: 12.5px; }
  .deal-value { grid-row: 1 / span 2; grid-column: 3; }
  .board { grid-template-columns: repeat(5, 84vw); scroll-snap-type: x mandatory; }
  .column { scroll-snap-align: start; }
  .project-board { grid-template-columns: repeat(4, 84vw); scroll-snap-type: x mandatory; }
  .project-col { scroll-snap-align: start; }
  .form-grid { grid-template-columns: 1fr; }
  .search-field input { min-width: 0; }
  .page-actions, .search-field { width: 100%; }
  .people li { flex-wrap: wrap; }
  .person-actions { width: 100%; justify-content: flex-start; padding-left: 48px; }
  .invoice { padding: 22px; }
  .invoice-lines-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
  .invoice-lines thead { display: none; }
  .invoice-lines, .invoice-lines tbody, .invoice-lines tfoot, .invoice-lines tr { display: block; width: 100%; }
  .invoice-lines tbody tr { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
  .invoice-lines td, .invoice-lines td + td { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0 !important; border: 0; text-align: right; }
  .invoice-lines tbody td:first-child { display: block; text-align: left; font-weight: 700; padding-bottom: 4px !important; }
  .invoice-lines tbody td:first-child small { display: block; font-weight: 400; }
  .invoice-lines td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; }
  .invoice-lines tfoot tr { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
  .invoice-lines tfoot td { display: block; padding: 0 !important; }
  .invoice-lines tfoot td[colspan] { text-align: left; }
  table.stack-sm thead { display: none; }
  table.stack-sm, table.stack-sm tbody, table.stack-sm tr { display: block; width: 100%; }
  table.stack-sm tr { position: relative; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
  table.stack-sm tr:has(td.pick) { padding-left: 50px; }
  table.stack-sm td { display: flex; gap: 12px; align-items: baseline; padding: 3px 0 !important; border: 0; text-align: left !important; min-width: 0; }
  table.stack-sm td::before { content: attr(data-label); flex: 0 0 38%; color: var(--muted); font-size: 12.5px; font-weight: 700; }
  table.stack-sm td > * { min-width: 0; overflow-wrap: anywhere; }
  table.stack-sm td.cell-main { padding-bottom: 8px !important; }
  table.stack-sm td.cell-main::before, table.stack-sm td.pick::before, table.stack-sm td[colspan]::before,
  table.stack-sm td[data-label=""]::before { content: none; }
  table.stack-sm td[data-empty] { display: none; }
  table.stack-sm td.pick { position: absolute; left: 16px; top: 14px; padding: 0 !important; }
  table.stack-sm td.row-actions { justify-content: flex-start; flex-wrap: wrap; padding-top: 8px !important; }
  table.stack-sm td { flex-wrap: wrap; }
  table.stack-sm td.num small { margin-left: 6px; }
  table.stack-sm td:not(.num):not(.cell-main) > small { flex-basis: 100%; margin: -2px 0 0 calc(38% + 12px); }
  table.stack-sm td.cell-main small { display: block; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .sidebar, .topbar, .page-actions, .toasts { display: none !important; }
  .main { margin: 0; }
  main { padding: 0; }
  body { background: #fff; color: #000; }
  .panel { border: 0; padding: 0; }
}

/* Files and custom fields */
.files-panel .file-row { display: flex; align-items: center; gap: 6px; margin: 0 -8px; }
.file-link { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: var(--r-md); text-decoration: none; min-width: 0; flex: 1; }
.file-link:hover { background: var(--surface-2); }
.file-link .icon { flex: none; width: 18px; height: 18px; color: var(--muted); }
.file-link > span { min-width: 0; }
.file-link b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-link small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; }
.file-upload small { font-size: 12px; }
.file-upload label { cursor: pointer; }
.custom-inputs { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.field-list { list-style: none; margin: 0; padding: 0; }
.field-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 24px; border-top: 1px solid var(--line); }
.field-list li span b { display: block; font-size: 14px; }
.field-list li span small { color: var(--muted); font-size: 12.5px; }
.custom-field-form .btn { margin-top: 12px; }
.panel.flush > .panel-title.pad { padding-top: 18px; padding-bottom: 6px; margin: 0; }

/* API, webhooks and workflows */
.key-reveal { border-color: var(--primary); }
.key-reveal .copy-field input { font-family: ui-monospace, Consolas, monospace; }
.panel.flush > p.pad { margin: 0 0 12px; }
.inline-add { padding-top: 16px; padding-bottom: 20px; border-top: 1px solid var(--line); }
.inline-add > .btn, .rule-form > .btn { margin-top: 12px; }
.hook { padding: 14px 24px; border-top: 1px solid var(--line); }
.hook > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.hook > header > span:first-child { min-width: 0; }
.hook-url { display: block; font-size: 14px; overflow-wrap: anywhere; }
.hook small { color: var(--muted); font-size: 12.5px; }
.hook-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hook details { margin-top: 8px; font-size: 13px; }
.hook summary { cursor: pointer; color: var(--muted); }
.records.compact { margin-top: 10px; font-size: 13px; }
.records.compact td, .records.compact th { padding: 6px 8px; }
.event-choices { border: 0; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 16px; }
.event-choices legend { margin-bottom: 6px; }
.event-choices code { font-size: 11.5px; color: var(--muted); }
.how-to { margin: 8px 0 14px; padding-left: 20px; line-height: 1.6; }
.rule-form .form-grid + .form-grid { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.field-list li.paused b { color: var(--muted); }
[data-show-when][hidden] { display: none !important; }

/* Legal pages */
.legal-page { background: var(--canvas); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; }
.legal-top { background: var(--navy-deep); padding: 14px 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; }
.legal-top nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.legal-top nav a { color: var(--on-navy-muted); text-decoration: none; font-size: 14px; font-weight: 600; padding: 4px 0; border-bottom: 2px solid transparent; }
.legal-top nav a:hover, .legal-top nav a[aria-current] { color: var(--on-navy); border-bottom-color: var(--primary); }
.legal-body { width: 100%; max-width: 780px; margin: 0 auto; padding: 28px 16px 48px; flex: 1; }
.legal-draft { background: var(--warn-soft); color: var(--ink); border: 1px solid var(--warn); border-radius: var(--r-md); padding: 12px 14px; font-size: 14px; margin: 0 0 22px; }
.legal-doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 28px 32px; box-shadow: var(--shadow); line-height: 1.65; font-size: 15px; }
.legal-doc h1 { font-size: 28px; margin: 0 0 6px; }
.legal-doc h2 { font-size: 18px; margin: 28px 0 8px; scroll-margin-top: 16px; }
.legal-doc p, .legal-doc ul { margin: 0 0 12px; }
.legal-doc ul { padding-left: 20px; }
.legal-doc li { margin-bottom: 6px; }
.legal-doc a { color: var(--primary); }
.legal-meta { color: var(--muted); font-size: 13px; margin-bottom: 18px !important; }
.legal-lead { font-size: 16px; color: var(--ink-2); }
.legal-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 6px 0 14px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.legal-table th { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.legal-dl dt { font-weight: 700; margin-top: 12px; }
.legal-dl dd { margin: 4px 0 0; }
.legal-list { list-style: none; padding: 0 !important; }
.legal-list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.legal-list span { display: block; color: var(--muted); font-size: 14px; }
mark.to-confirm { background: var(--warn-soft); color: var(--warn-ink, var(--ink)); border: 1px dashed var(--warn); border-radius: 4px; padding: 0 4px; font-size: .92em; }
.legal-foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px 16px 26px; }
.auth-legal { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 12px 0 0; }
.auth-legal-links { display: flex; justify-content: center; gap: 16px; font-size: 13px; }
.auth-legal-links a { color: var(--on-navy-muted); }
@media (max-width: 600px) { .legal-doc { padding: 20px 16px; } .legal-doc h1 { font-size: 24px; } }

/* AI assistant --------------------------------------------------------------------------------------------------- */
.plain-list { margin: 0 0 4px; padding-left: 20px; display: grid; gap: 6px; }
.chip-btn {
  font: inherit; font-size: 13.5px; text-align: left; padding: 8px 12px; border-radius: var(--r-md); cursor: pointer;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
}
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.ai-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.ai-history-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 14px 16px; }
.ai-history-box summary { font-weight: 700; cursor: pointer; }
.ai-history-box form { margin-top: 10px; }
.ai-chats { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; max-height: 60vh; overflow-y: auto; }
.ai-chats a { display: grid; gap: 1px; padding: 8px 10px; border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.ai-chats a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.ai-chats a small { color: var(--muted); font-size: 12px; }
.ai-chats a:hover { background: var(--surface-2); }
.ai-chats a[aria-current] { background: var(--accent-soft); }
.ai-chat { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; }
.ai-thread { display: flex; flex-direction: column; gap: 12px; min-height: 240px; }
.ai-msg { max-width: 46rem; overflow-wrap: anywhere; }
.ai-msg p, .ai-msg ul, .ai-msg ol { margin: 0 0 8px; }
.ai-msg > :last-child { margin-bottom: 0; }
.ai-msg ul, .ai-msg ol { padding-left: 20px; }
.ai-msg code { font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: var(--r-sm); }
.ai-question {
  align-self: flex-end; background: var(--navy); color: var(--on-navy); padding: 9px 14px;
  border-radius: var(--r-lg) var(--r-lg) var(--r-sm) var(--r-lg); white-space: pre-wrap;
}
.ai-answer { align-self: flex-start; padding: 2px 2px; color: var(--ink); }
.ai-answer a { color: var(--primary); font-weight: 700; }
.ai-notice { align-self: flex-start; margin: 0; padding: 8px 12px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; }
.ai-thinking { margin: 0; color: var(--muted); font-size: 14px; }
.ai-thinking::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: ai-dots 1.2s steps(4) infinite; }
@keyframes ai-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@media (prefers-reduced-motion: reduce) { .ai-thinking::after { animation: none; } }
.ai-pending { display: flex; flex-direction: column; gap: 10px; }
.ai-card {
  align-self: stretch; max-width: 34rem; display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r-lg);
  border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--surface-2);
}
.ai-card-head { margin: 0; display: flex; align-items: center; gap: 8px; }
.ai-card-head .icon { width: 17px; height: 17px; color: var(--primary); }
.ai-card-links { margin: -4px 0 0; }
.ai-card-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ai-card p.small { margin: 0; }
.ai-card-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ai-ask { display: flex; gap: 10px; align-items: flex-end; }
.ai-ask textarea { flex: 1; resize: vertical; min-height: 46px; max-height: 40vh; }
.ai-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.ai-empty { display: grid; justify-items: start; gap: 10px; padding: 12px 0; }
.ai-empty p { margin: 0; }
.ai-starters { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(420px, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lift);
}
.ai-panel[hidden] { display: none; }
.ai-panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line-soft); }
.ai-panel-head b { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; }
.ai-panel-head b .icon { width: 18px; height: 18px; color: var(--primary); }
.ai-panel .ai-thread { flex: 1; overflow-y: auto; padding: 16px 18px; min-height: 0; }
.ai-panel .ai-ask { padding: 12px 14px 16px; border-top: 1px solid var(--line-soft); }
.ai-panel .ai-card-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ai-panel .ai-card-row .field:first-child { grid-column: 1 / -1; }
.ai-panel-hint { margin: 0; }
@media (min-width: 1181px) { body.ai-open .main { margin-right: 420px; } }
@media (max-width: 900px) {
  .ai-layout { grid-template-columns: minmax(0, 1fr); }
  .ai-chats { max-height: 40vh; }
}
@media (max-width: 640px) {
  .ai-chat { padding: 14px; }
  .ai-card-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ai-card-row .field:first-child { grid-column: 1 / -1; }
  .ai-ask { flex-direction: column; align-items: stretch; }
  .ai-panel { width: 100vw; border-left: 0; }
}

/* Account security ------------------------------------------------------------------------------------------------ */
.invite-logo { max-height: 48px; max-width: 180px; object-fit: contain; margin-bottom: 14px; }
.verify-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.verify-banner form { margin: 0; }
.team-card-invite { display: flex; gap: 14px; flex-wrap: wrap; }
.session-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.session-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); }
.session-list li > div { display: grid; gap: 2px; min-width: 0; justify-items: start; }
.session-list small { font-size: 12.5px; overflow-wrap: anywhere; }
.session-list form { margin: 0; flex-shrink: 0; }

/* Deals: gone quiet and reasons ---------------------------------------------------------------------------------- */
.chip.quiet { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.chip.quiet .icon { width: 13px; height: 13px; }
.card-quiet { margin: 6px 0 0; }
.quiet-note { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; }
.quiet-note .icon { flex-shrink: 0; width: 17px; height: 17px; margin-top: 2px; }
.reason-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.reason-inline .field { flex: 1 1 180px; }
.reason-form { display: grid; gap: 16px; }
.reason-choices { border: 0; margin: 0; padding: 0; display: grid; gap: 2px; }
.reason-choices .check { margin-top: 8px; }

/* Tags ------------------------------------------------------------------------------------------------------------- */
.tag { display: inline-flex; align-items: center; gap: 2px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  background: var(--accent-soft); color: var(--primary); text-decoration: none; white-space: nowrap; }
a.tag:hover, .tag a:hover { text-decoration: underline; }
.tag a { color: inherit; text-decoration: none; }
.tag form { display: inline; margin: 0; }
.tag button { border: 0; background: none; color: inherit; font: inherit; font-size: 15px; line-height: 1; padding: 0 0 0 4px; cursor: pointer; opacity: .7; }
.tag button:hover { opacity: 1; }
.tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0 42px; }
.tag-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-add { display: flex; gap: 8px; margin-top: 10px; }
.tag-add input { flex: 1; min-width: 0; }

/* Duplicates ------------------------------------------------------------------------------------------------------- */
.dup-pair { display: grid; gap: 12px; }
.dup-pair + .dup-pair { margin-top: 16px; }
.dup-why { margin: 0; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 600; }
.dup-why .icon { width: 17px; height: 17px; color: var(--primary); }
.dup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dup-card { display: grid; gap: 10px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); cursor: pointer; }
.dup-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.dup-choose { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14px; }
.dup-choose input { width: auto; margin: 0; accent-color: var(--primary); }
.dup-name { display: flex; gap: 10px; align-items: center; }
.props.compact .prop { padding: 4px 0; }
.dup-form .form-actions { justify-content: flex-start; margin-top: 4px; }
.dup-dismiss { margin: -6px 0 0; }
@media (max-width: 640px) { .dup-grid { grid-template-columns: minmax(0, 1fr); } }

/* Companies House suggestions ------------------------------------------------------------------------------------ */
.field:has(.ch-suggest) { position: relative; }
.ch-suggest { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin: 4px 0 0; padding: 4px; list-style: none; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-lift); }
.ch-suggest li { display: grid; gap: 1px; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.ch-suggest li:hover, .ch-suggest li:focus { background: var(--surface-2); outline: none; }
.ch-suggest small { color: var(--muted); font-size: 12.5px; }
.ch-suggest small.bad { color: var(--bad); }
.ch-refresh { margin-top: 12px; }

/* Support: replies, saved replies and the survey ----------------------------------------------------------------- */
.reply-panel .panel-head h2 { display: flex; align-items: center; gap: 8px; }
.reply-panel .panel-head h2 .icon { width: 18px; height: 18px; color: var(--primary); }
.reply-form { display: grid; gap: 12px; }
.reply-form p { margin: 0; }
.reply-form textarea { resize: vertical; min-height: 120px; }
.saved-picker { margin-bottom: 12px; }
.saved-picker select { max-width: 340px; }
.saved-reply-list { list-style: none; margin: 0; padding: 0; }
.saved-reply-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.saved-reply-list li:last-child { border-bottom: 0; }
.saved-reply-list p { margin: 4px 0 0; }
.survey-form { display: grid; gap: 16px; }
.survey-choices { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.survey-choice { display: grid; place-items: center; padding: 14px 8px; border: 1px solid var(--line); border-radius: var(--r-lg); cursor: pointer; font-weight: 700; }
.survey-choice input { width: auto; margin: 0 0 6px; accent-color: var(--primary); }
.survey-choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--accent-soft); }
.csat-score { font-size: 34px; font-weight: 700; margin: 0; }
.csat-bars { display: grid; gap: 6px; margin: 12px 0; }

/* AI helpers ----------------------------------------------------------------------------------------------------- */
.ai-helpers { display: grid; gap: 12px; padding: 14px 18px; }
.ai-helper-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.ai-helper-buttons form { margin: 0; }
.ai-output { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.ai-output-head { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ai-output-head .icon { width: 16px; height: 16px; color: var(--primary); }
.ai-output .ai-msg { max-width: none; }
.triage-card { max-width: none; margin-top: 16px; }
.triage-ask, .draft-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 16px 0 0; }

/* Support email ------------------------------------------------------------------------------------------------- */
.inbound-address code { display: inline-block; padding: 8px 12px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; word-break: break-all; }
.narrow-field { max-width: 360px; margin-top: 14px; }
.panel-head.pad { padding: 16px 20px 0; }

/* Website chat and help articles ---------------------------------------------------------------------------------- */
.snippet { margin: 10px 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); overflow-x: auto; font-size: 13px; }
.help-list { margin: 12px 0 18px; padding-left: 20px; display: grid; gap: 8px; }
.help-body { line-height: 1.65; }
.chat-main { max-width: 560px; }
.is-embed .chat-main { padding: 0; max-width: none; }
.chat-window { display: grid; gap: 12px; padding: 16px; }
.is-embed .chat-window { border: 0; border-radius: 0; box-shadow: none; min-height: 100vh; align-content: start; }
.chat-head { display: flex; align-items: center; justify-content: space-between; }
.chat-head b { font-size: 16px; }
.chat-ai { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--primary); font-size: 12px; font-weight: 700; }
.chat-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.chat-thread { display: flex; flex-direction: column; gap: 10px; max-height: 52vh; overflow-y: auto; padding: 2px; }
.is-embed .chat-thread { max-height: calc(100vh - 330px); min-height: 140px; }
.chat-msg { max-width: 88%; padding: 9px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-msg p, .chat-msg ul { margin: 0 0 6px; }
.chat-msg > :last-child { margin-bottom: 0; }
.chat-msg ul { padding-left: 18px; }
.chat-msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line-soft); }
.chat-msg.visitor { align-self: flex-end; background: var(--primary); color: var(--on-primary); white-space: pre-wrap; }
.chat-msg.thinking { color: var(--muted); }
.chat-sources { font-size: 12.5px; color: var(--muted); }
.chat-sources a { color: var(--primary); }
.chat-notice { align-self: stretch; margin: 0; padding: 8px 12px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn-ink); font-size: 13.5px; }
.chat-ask { display: flex; gap: 8px; align-items: flex-end; }
.chat-ask textarea { flex: 1; resize: none; min-height: 44px; }
.chat-person summary { cursor: pointer; font-weight: 700; color: var(--primary); font-size: 14px; }
.chat-person-form { display: grid; gap: 10px; margin-top: 10px; }
.chat-person-form p { margin: 0; }
.chat-articles ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.chat-articles p { margin: 0; }

/* Getting paid: payments, credit notes, late charges, the payment page and recurring invoices --------------------- */
.late-claim { padding: 14px 16px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--ink); }
.late-claim h3 { margin: 0 0 6px; font-size: 15px; }
.late-claim p { margin: 0 0 8px; }
.reminder-wording { border-top: 1px solid var(--line-soft); padding: 10px 0; }
.reminder-wording summary { cursor: pointer; font-weight: 700; }
.reminder-wording .form-grid { margin-top: 10px; }
.recurring-lines input, .recurring-lines select { width: 100%; min-width: 0; }
.recurring-lines td:first-child { min-width: 200px; }
.pay-card h1 { margin: 4px 0 14px; }
.pay-totals { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px; }
.pay-totals td { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.pay-totals tfoot td { border-bottom: 0; padding-top: 12px; font-weight: 800; font-size: 18px; }
.pay-action { margin: 6px 0 18px; display: grid; gap: 8px; justify-items: start; }
.pay-action .btn { font-size: 16px; padding: 12px 20px; }
.pay-bank { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-2); margin-bottom: 16px; }
.pay-bank h2 { margin: 0 0 8px; font-size: 15px; }
@media (max-width: 520px) { .pay-action .btn { width: 100%; justify-content: center; } }
