/* Components. Every value comes from tokens.css — if you are about to type a hex code or
 * a pixel size, add a token instead. The house style is dense and calm: one accent colour
 * that means "act", colour otherwise reserved for meaning (reasoning in tokens.css).
 */

/* == 1. reset + base ====================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--text);
}
h2 { font-size: var(--text-xl); }
.page-header h2 { font-weight: var(--weight-medium); }
h3 { font-size: var(--text-lg); }
p { margin: 0 0 var(--space-3); }
p:last-child { margin-bottom: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

[hidden] { display: none !important; }

/* == 2. layout ============================================================ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 20;
}

.sidebar-brand { display: flex; align-items: center; justify-content: space-between;
                 gap: var(--space-2); margin-bottom: var(--space-6); }
/* The sidebar folded away gives the page its width; the tab at the window's edge brings it
   back. Below 1024px the sidebar is a drawer, so neither shows. */
.sidebar-collapse, .sidebar-expand { display: inline-flex; align-items: center;
  justify-content: center; width: var(--btn-sm-h); height: var(--btn-sm-h); padding: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text-muted); font: inherit; cursor: pointer; }
.sidebar-collapse:hover, .sidebar-expand:hover { background: var(--surface-hover); color: var(--text); }
/* Top left, where the collapse button was; the page and an editor's bar make room for it. */
.sidebar-expand { display: none; position: fixed; top: var(--space-4); left: 0; z-index: 20;
                  width: var(--space-6); border-left: 0;
                  border-radius: 0 var(--radius-md) var(--radius-md) 0; box-shadow: var(--shadow-sm); }
@media (min-width: 1024px) {
  .sidebar-collapsed .sidebar { display: none; }
  .sidebar-collapsed .main { margin-left: 0; }
  .sidebar-collapsed .sidebar-expand { display: inline-flex; }
  .sidebar-collapsed .container { --pad-x: calc(var(--space-6) + var(--space-8)); }
  .sidebar-collapsed .editor-bar { padding-left: calc(var(--space-6) + var(--space-4)); }
}
@media (max-width: 1023px) {
  .sidebar-collapse { display: none; }
}
.sidebar-logo-link { display: inline-block; }
.sidebar-logo-link:hover { text-decoration: none; }
.brand-wordmark {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--bc-navy);
  letter-spacing: -0.01em;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: var(--text-body);
  font-weight: var(--weight-medium);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
/* The notification bell is a <button> wearing .nav-link, so it needs the user-agent
   button chrome removed or it renders as a boxed control among plain links. */
button.nav-link {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--text-body);
  font-weight: var(--weight-medium);
  text-align: left;
  cursor: pointer;
}
.nav-link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav-group-toggle { justify-content: space-between; }
.nav-group-chevron { transition: transform var(--duration) var(--ease); }
.nav-group-toggle[aria-expanded="true"] .nav-group-chevron { transform: rotate(90deg); }
.nav-sub { list-style: none; margin: 0; padding: 0 0 0 var(--space-3);
           display: flex; flex-direction: column; gap: 2px; }
.nav-divider { border-top: 1px solid var(--border); margin: var(--space-2) var(--space-3); }
.nav-link.active { background: var(--action); color: var(--text-inverse); }
.nav-link.active:hover { background: var(--action-hover); color: var(--text-inverse); }

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-user { font-size: var(--text-base); font-weight: var(--weight-medium); min-width: 0; overflow-wrap: anywhere; }
.sidebar-user-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.sidebar-icons { display: inline-flex; align-items: center; gap: var(--space-1); flex: 0 0 auto; }
.sidebar-gear.active { background: var(--action); color: var(--text-inverse); }

/* Settings: its own list beside the page, sized to the page's width rather than the window's,
   since the sidebar comes and goes at 1024px. Narrow, the list sits above the page. */
.settings-shell { container: settings / inline-size; }
.settings-grid {
  display: grid;
  grid-template-columns: var(--settings-nav-w) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
.settings-nav { position: sticky; top: var(--space-4); }
.settings-nav-title { font-size: var(--text-lg); margin: 0 0 var(--space-3); }
.settings-nav-head { margin: var(--space-4) var(--space-3) var(--space-1); font-size: var(--text-lg);
                     font-weight: var(--weight-semibold); color: var(--text); }
.settings-page { min-width: 0; }
@container settings (max-width: 48rem) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; }
  .settings-nav .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
}
.sidebar-role { font-size: var(--text-sm); color: var(--text-subtle); }
.sidebar-logout {
  margin-top: var(--space-2);
  align-self: flex-start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-subtle);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.sidebar-logout:hover { color: var(--negative); text-decoration: underline; }

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

.container {
  --pad-top: var(--space-6);
  --pad-x: var(--space-8);
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--pad-top) var(--pad-x) var(--space-10);
}

/* == 3. typography utilities ============================================== */
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-size: var(--text-base); }

.empty {
  padding: var(--space-10) var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.status-msg {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info);
  font-size: var(--text-base);
}
.status-msg-error {
  background: var(--negative-bg);
  border-color: var(--negative-border);
  color: var(--negative);
}

.plain-list { list-style: none; margin: 0; padding: 0; }

/* == 4. buttons =========================================================== */
/* Pill-shaped, like HubSpot's. One primary per view; everything else is
 * secondary. Red is never a primary action — only a destructive one. */
.btn,
.btn-secondary,
.btn-ms {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--btn-h);
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--text-body);
  font-weight: var(--weight-normal);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.btn:hover, .btn-secondary:hover, .btn-ms:hover { text-decoration: none; }

.btn {
  background: var(--action);
  border-color: var(--action);
  color: var(--action-text);
}
.btn:hover { background: var(--action-hover); border-color: var(--action-hover); color: var(--action-text); }
.btn:active { background: var(--action-active); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--text-subtle); color: var(--text); }

/* Positive. For the action that is good news — closing a deal won, accepting a
 * hand-off. Distinct from the neutral primary so "won" never has to be read. */
.btn-positive {
  background: var(--positive);
  border-color: var(--positive);
  color: var(--text-inverse);
}
.btn-positive:hover { background: var(--positive-hover); border-color: var(--positive-hover); color: var(--text-inverse); }

/* Destructive. Outlined by default so it never competes with the primary
 * action; fills only on hover, at the moment of intent. */
.btn-danger {
  background: var(--surface);
  border-color: var(--negative-border);
  color: var(--negative);
}
.btn-danger:hover {
  background: var(--negative);
  border-color: var(--negative);
  color: var(--text-inverse);
}

.btn-sm { height: var(--btn-sm-h); padding: 0 var(--space-3); font-size: var(--text-body); }
/* A button that reads as a link, as HubSpot's "Preview" beside "Use template". */
.btn-link { padding: 0; border: 0; background: none; color: var(--action); font: inherit;
            font-weight: var(--weight-semibold); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--negative); }
/* An editor's top bar: HubSpot's larger, bolder buttons, wrapping when they outgrow it. */
.editor-actions { flex-wrap: wrap; }
.editor-actions .btn, .editor-actions .btn-secondary, .editor-actions .filter-menu-btn {
  height: var(--btn-editor-h); padding: 0 var(--space-4); font-size: var(--text-body);
  font-weight: var(--weight-semibold);
}

.btn:disabled,
.btn-secondary:disabled,
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-subtle);
  font-size: var(--text-body);
  line-height: 1;
  cursor: pointer;
}
.btn-icon:hover { background: var(--surface-hover); color: var(--text); }
.btn-icon:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-ms {
  width: 100%;
  height: 40px;
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  font-size: var(--text-body);
}
.btn-ms:hover { background: var(--surface-hover); color: var(--text); }

.row-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }
/* On a <td> the flex display stops it being a table cell: in a taller row it no longer
   stretches, so the row's border breaks and the buttons sit at the top. Keep it a cell. */
td.row-actions { display: table-cell; text-align: right; white-space: nowrap; }
td.row-actions > * + * { margin-left: var(--space-2); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-5); }
/* An inline row of controls. Inputs default to width:100%, which inside a flex row
   makes each one claim the whole line and stack the buttons beneath it. */
.det-actions-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.det-actions-row select,
.det-actions-row input { width: auto; min-width: 12rem; max-width: 100%; }
.det-actions-row input[type="checkbox"] { min-width: 0; }

/* == 5. forms ============================================================= */
label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: var(--text-body);
  font-weight: var(--weight-medium);
  color: var(--text-muted);
}

input, select, textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-body);
  line-height: 1.4;
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--action);
  box-shadow: 0 0 0 3px var(--action-ring);
}
textarea { min-height: 84px; resize: vertical; }

.input-sm { padding: var(--space-1) var(--space-2); font-size: var(--text-body); }
input[type="search"].input-sm { height: var(--search-h); padding: 0 var(--space-3);
                                border-radius: var(--radius-pill); font-size: var(--text-body); }

.form-card { max-width: 640px; }
.form-card label + input,
.form-card label + select,
.form-card label + textarea { margin-bottom: var(--space-4); }
/* A task's other deals, as chips, in its form. */
.task-deals { display: grid; gap: var(--space-2); margin-bottom: var(--space-4); }
.task-deals-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.task-deals-list:empty { display: none; }
.task-deal-chip { display: inline-flex; align-items: center; gap: var(--space-1); }
.task-deals > .btn-link { justify-self: start; }
/* "Set to repeat" and its every-so-often, on one line. */
.task-repeat { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
               margin-bottom: var(--space-4); }
.task-repeat-how { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.task-repeat-how[hidden] { display: none; }
.task-repeat-how > input { width: 5rem; margin: 0; }
.task-repeat-how > select { width: auto; margin: 0; }
/* A due date and its optional time, side by side under one label. */
.due-control { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.due-control > input { flex: 1 1 9rem; width: auto; min-width: 0; margin: 0; }
.form-card label + .due-control { margin-bottom: var(--space-4); }
.form-divider { height: 1px; background: var(--border); margin: var(--space-5) 0; }
.form-hint, .input-hint {
  display: block;
  margin: calc(var(--space-1) * -1) 0 var(--space-4);
  font-size: var(--text-body);
  color: var(--text-muted);
}

.activity-form { display: flex; flex-direction: column; gap: var(--space-3); max-width: 640px; }
/* A logged call's or meeting's outcome, type, direction and date, as many to a row as fit. */
.activity-details {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--space-3);
}

.search-box {
  width: 240px;
  height: 32px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-body);
}
.search-box:focus { width: 300px; }

/* The global bar's trigger: in the sidebar, and in the topbar where the sidebar is a drawer. */
.sidebar-search,
.topbar-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.sidebar-search { width: 100%; margin-bottom: var(--space-4); }
.topbar-search { margin-left: auto; }
.sidebar-search:hover,
.topbar-search:hover { background: var(--surface-hover); color: var(--text); }
.search-kbd {
  padding: 0 var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  color: var(--text-subtle);
}

.search-scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: var(--search-panel-top) var(--space-4) var(--space-4);
  background: var(--scrim);
}
.search-scrim[hidden] { display: none; }
.search-panel {
  display: flex;
  flex-direction: column;
  width: min(var(--search-panel-w), 100%);
  max-height: calc(100vh - var(--search-panel-top) - var(--space-8));
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-panel-input {
  width: auto;
  margin: var(--space-4) var(--space-4) var(--space-3);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: var(--text-body);
}
.search-panel-input:focus { outline: 2px solid var(--action-ring); outline-offset: 0; }
.search-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0 var(--space-4) var(--space-3); }
.search-chip {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}
.search-chip:hover { background: var(--surface-hover); }
.search-chip-active { border-color: var(--action); background: var(--action); color: var(--action-text); }
.search-chip-active:hover { background: var(--action-hover); }
.search-results { overflow-y: auto; border-top: 1px solid var(--border); }
.search-group { padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.search-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
}
.search-group-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-subtle);
}
.search-see-all { font-size: var(--text-sm); white-space: nowrap; }
.search-hit {
  display: flex;
  flex-direction: column;
  padding: var(--space-2) var(--space-4);
  color: var(--text);
}
.search-hit:hover,
.search-hit-active { background: var(--surface-hover); text-decoration: none; }
.search-hit-label { font-size: var(--text-base); overflow-wrap: anywhere; }
.search-hit-label strong { font-weight: var(--weight-semibold); }
.search-hit-detail { font-size: var(--text-sm); color: var(--text-muted); overflow-wrap: anywhere; }
.search-none { margin: 0; padding: var(--space-2) var(--space-4); font-size: var(--text-sm); color: var(--text-subtle); }
.search-hint { margin: 0; padding: var(--space-2) var(--space-4); font-size: var(--text-xs); color: var(--text-subtle); }

/* Prev / range / Next. Hidden entirely when there is only one page, so a short list
   does not carry furniture it has no use for. */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.pager-status {
  font-size: var(--text-body);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.pager-empty { display: none; }
.pager-current { border-color: var(--action); color: var(--action); }
.page-size { width: auto; }
.brand-images { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-3); }
.brand-image { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }
.brand-image img { width: var(--thumb-width); height: var(--thumb-height); object-fit: contain;
                   border: 1px solid var(--border); border-radius: var(--radius-sm);
                   background: var(--surface); }
.brand-colour { display: inline-flex; align-items: center; gap: var(--space-1); }
/* HubSpot's first-run page for a tool: a large headline, what it is for, one way in. */
.scoring-intro { max-width: 40rem; padding: var(--space-8) var(--space-4); }
.card > .scoring-intro h3 { font-size: var(--text-2xl); font-weight: var(--weight-normal); }
.scoring-intro ul { display: grid; gap: var(--space-2); margin: var(--space-5) 0 var(--space-6);
                    padding-left: var(--space-5); }
/* A CTA's thumbnail on its index row: its preview drawn six times larger and scaled down. */
.cta-index-name { display: flex; align-items: center; gap: var(--space-3); }
.cta-row-thumb { flex: none; width: var(--thumb-width); height: var(--thumb-height); overflow: hidden;
             pointer-events: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
             background: var(--surface); }
.cta-row-thumb iframe { width: calc(var(--thumb-width) * 6); height: calc(var(--thumb-height) * 6);
                    border: 0; transform: scale(calc(1 / 6)); transform-origin: top left; }
.text-negative { color: var(--negative); }
.quick-answers { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.insight-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2);
               padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.insight-row p { margin: 0; flex-basis: 100%; }

/* == 6. badges + chips ==================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  border: 1px solid var(--neutral-border);
  background: var(--neutral-bg);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.5;
  white-space: nowrap;
}

/* Meaning, not decoration. Won and active read positive; lost and blocked
 * read negative; open reads as "in flight". */
.badge-won,
.badge-active,
.badge-completed { background: var(--positive-bg); border-color: var(--positive-border); color: var(--positive); }

.badge-lost,
.badge-blocked { background: var(--negative-bg); border-color: var(--negative-border); color: var(--negative); }

.badge-open { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.badge-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.form-badges { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }

.badge-inactive,
.badge-cancelled { background: var(--neutral-bg); border-color: var(--neutral-border); color: var(--text-subtle); }

.you {
  margin-left: var(--space-2);
  padding: 1px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--info-bg);
  color: var(--info);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

/* Chips — pill filters that toggle. Same pill geometry as a badge, but a badge
   states and a chip acts, so a chip is a <button> and carries a hover and an on
   state. */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.chip {
  padding: 2px var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1.6;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip-on {
  background: var(--action);
  border-color: var(--action);
  color: var(--action-text);
}
.chip-on:hover { background: var(--action-hover); color: var(--action-text); }

/* Saved-view tabs and the board toolbar. HubSpot puts its views ("My deals" /
   "All deals") on tabs above the filters, which is where people reach for them. */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.view-tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.view-tab {
  padding: var(--space-3) var(--tab-pad-x);
  border: 0;
  border-bottom: var(--tab-bar) solid transparent;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--text-body);
  font-weight: var(--weight-normal);
  cursor: pointer;
}
.view-tab:hover { color: var(--action); }
.view-tab-active { font-weight: var(--weight-medium); border-bottom-color: var(--action); }
/* An index's views, HubSpot's boxed tabs over a rule, the chosen one open onto the page. */
.view-tabs-boxed { gap: 0; align-items: flex-end; margin-bottom: var(--space-3);
                   border-bottom: 1px solid var(--border); }
.view-tabs-boxed .view-tab { margin: 0 -1px -1px 0; padding: var(--space-2) var(--space-4);
                             border: 1px solid var(--border);
                             border-radius: var(--radius-md) var(--radius-md) 0 0;
                             background: var(--surface-sunken); color: var(--text); }
.view-tabs-boxed .view-tab-active { background: var(--surface);
                                    border-bottom-color: var(--surface); }
.view-tabs-boxed .view-tab-close { align-self: center; margin: 0 var(--space-2) 0 0; }
.view-tab-add { padding: var(--space-2) var(--space-3); border: 0; background: none;
                color: var(--action); font: inherit; cursor: pointer; }
.all-views { flex-basis: 100%; margin: var(--space-2) 0; padding: var(--space-3);
             border: 1px solid var(--border); border-radius: var(--radius-md);
             background: var(--surface); }
.all-views h3 { margin-top: 0; }
/* A person as initials beside their name; the name ellipsises, the circle never shrinks. */
.person { display: inline-flex; align-items: center; gap: var(--space-1); max-width: 100%;
          vertical-align: middle; }
.avatar { flex: none; display: inline-grid; place-items: center; width: var(--space-5);
          height: var(--space-5); border-radius: var(--radius-pill); background: var(--info-bg);
          color: var(--info); font-size: var(--text-sm); font-weight: var(--weight-semibold);
          line-height: 1; }
.person-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot { display: inline-block; width: var(--space-2); height: var(--space-2);
              margin-right: var(--space-1); border-radius: 50%; vertical-align: middle;
              background: var(--text-subtle); }
.status-dot-good { background: var(--positive); }
.status-dot-wait { background: var(--warning); }
.status-dot-info { background: var(--info); }
.page-count { flex-basis: 100%; margin: 0; color: var(--text); font-size: var(--text-body);
              font-weight: var(--weight-semibold); }
/* A saved view's own delete, tucked against its tab. */
.view-tab-close { border: 0; background: none; color: var(--text-subtle); cursor: pointer;
                  padding: 0 var(--space-1); margin-left: calc(-1 * var(--space-1)); }
.view-tab-close:hover { color: var(--negative); }

/* --- board quick filters + layout toggle --- */
/* A row of its own under the tabs and search, as HubSpot's: a filter that names its value
   grows, and beside the search box it pushed the whole row onto a new line. */
.quick-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
                 flex-basis: 100%; }
.quick-filters select { width: auto; min-width: 9rem; }

/* HubSpot's quick-filter popover: a pill over a panel. */
.filter-menu { position: relative; }
.filter-menu-btn {
  height: var(--control-h);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-body);
  white-space: nowrap;
  cursor: pointer;
}
.filter-menu-btn:hover { background: var(--surface-hover); }
/* Beside the page's primary button, a menu or a small button is the same height as it. */
.page-header .filter-menu-btn, .page-header .btn-sm { height: var(--btn-h);
                                                      padding: 0 var(--space-4); }
.filter-menu-btn::after { content: " ▾"; color: var(--text-subtle); }
.filter-menu-active { border-color: var(--action); color: var(--action); }
.filter-menu-panel {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: var(--filter-menu-w);
  max-width: calc(100vw - var(--space-8));
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.filter-menu-panel .search-box { width: 100%; }
.filter-menu-list h4 { margin: var(--space-2) 0 0; font-size: var(--text-sm);
                      color: var(--text-muted); }
.filter-menu-list { display: flex; flex-direction: column; gap: var(--space-1);
                    max-height: var(--filter-list-max-h); overflow-y: auto; }
.filter-menu-actions { display: flex; gap: var(--space-2); }
.filter-menu-item { padding: var(--space-1) var(--space-2); border: 0; border-radius: var(--radius-sm);
                    background: none; color: var(--text); font: inherit; text-align: left;
                    cursor: pointer; }
.filter-menu-item:hover { background: var(--surface-hover); }
.filter-list { display: flex; flex-direction: column; gap: var(--space-1);
               max-height: 16rem; overflow-y: auto; margin: var(--space-2) 0; }
.filter-list-group { margin: var(--space-2) 0 0; font-size: var(--text-xs);
                     font-weight: var(--weight-semibold); color: var(--text-muted); }
.filter-list .check, .filter-list .filter-menu-item { display: flex; align-items: center;
                                                      gap: var(--space-2); text-align: left; }
.option-swatch { flex: none; width: var(--space-2); height: var(--space-2);
                 border-radius: 50%; }
.filter-menu-danger { color: var(--negative); }
/* A row's menu, placed by dom.js::hoverActions below its button. */
.filter-menu-floating { position: fixed; width: auto; min-width: var(--filter-menu-w); }
/* HubSpot's row actions: there while the row is hovered or focused, or its menu is open. */
.row-hover { display: inline-flex; gap: var(--space-2); align-items: center; visibility: hidden; }
tr:hover .row-hover, tr:focus-within .row-hover,
.row-hover:has(.filter-menu-panel:not([hidden])) { visibility: visible; }
@media (hover: none) { .row-hover { visibility: visible; } }
.advanced-filters { flex-basis: 100%; min-width: 0; }
.advanced-filters h4 { margin: var(--space-3) 0 var(--space-2); }
.advanced-assoc { display: flex; flex-direction: column; gap: var(--space-3); }
.advanced-assoc-block { display: flex; flex-direction: column; gap: var(--space-2);
                        padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }
.advanced-assoc + .btn-secondary { margin-top: var(--space-2); }

.layout-toggle {
  display: flex;
  margin-left: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.layout-btn {
  width: 30px;
  height: 28px;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--text-subtle);
  font-size: var(--text-body);
  line-height: 1;
  cursor: pointer;
}
.layout-btn + .layout-btn { border-left: 1px solid var(--border); }
.layout-btn:hover { background: var(--surface-hover); color: var(--text); }
.layout-btn-active { background: var(--action); color: var(--text-inverse); }
.layout-btn-active:hover { background: var(--action-hover); color: var(--text-inverse); }

.num { font-variant-numeric: tabular-nums; text-align: right; }
.row-pending td:first-child { box-shadow: inset 3px 0 0 var(--warning); }

.pager-filtered {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-right: auto;
}

/* == 7. cards, tables, page header ======================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}
.card > h3, .card > .rail-card-head h3 { font-size: var(--text-lg);
                                          font-weight: var(--weight-semibold); }
.card + .card { margin-top: var(--space-4); }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}
.page-header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.page-header-controls select,
.page-header-controls input { width: auto; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; }
th {
  padding: var(--space-3) var(--space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: var(--text-body);
  font-weight: var(--weight-normal);
  color: var(--text-muted);
  white-space: nowrap;
}
td {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-body);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-hover); }
td .input-sm { margin: 0; }
/* The custom fields list: each row edits in place, so its controls keep a readable width and
   the table scrolls in its frame rather than squeezing them. */
.fields-table td .input-sm { min-width: var(--index-name-min); }
.fields-table td.row-actions { white-space: nowrap; }

.detail-grid, .det-table {
  display: grid;
  /* minmax(0, 1fr), not 1fr: a bare 1fr track never shrinks below its longest word, so an
     email address pushed past the card's edge. */
  grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr);
  gap: var(--space-2) var(--space-5);
  align-items: baseline;
}
.detail-row { display: contents; }
/* A score breakdown: the rule is a sentence and the points are short, so the sentence wraps. */
.det-table-points { grid-template-columns: minmax(0, 1fr) max-content; }
/* HubSpot's About card: each label above its value. Side by side, the longest label sized the
   column, and one imported custom field's label left its values a letter wide. */
.det-table-stacked { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-1); }
.det-table-stacked .detail-label { margin-top: var(--space-3); }
.det-table-stacked > .detail-row:first-child > .detail-label { margin-top: 0; }
.detail-label {
  font-size: var(--text-body);
  color: var(--text-muted);
}
.det-val { font-size: var(--text-body); color: var(--text); overflow-wrap: anywhere; white-space: pre-line; }
/* Under its label, not beside it: the value column is narrower than the longest stage name. */
.det-val:has(> .stage-picker) { grid-column: 1 / -1; }
.det-val-invalid { text-decoration: underline wavy var(--negative); text-underline-offset: 3px; }
/* Property history: a field's own under its value in the About card, offered on hover as
   HubSpot does, and the record-wide table. */
.detail-label:has(.det-history-btn) {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2);
}
.det-history-btn {
  font-size: var(--text-body); font-weight: var(--weight-normal); text-transform: none;
  letter-spacing: normal; visibility: hidden;
}
.detail-row:hover .det-history-btn, .detail-row:focus-within .det-history-btn,
.det-history-btn[aria-expanded="true"] { visibility: visible; }
@media (hover: none) { .det-history-btn { visibility: visible; } }
.det-history {
  display: grid; gap: var(--space-2); padding: var(--space-3);
  background: var(--surface-sunken); border-radius: var(--radius-md);
}
.det-history-list { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.det-history-item { display: grid; gap: var(--space-1); }
.det-history-value, .history-cell { overflow-wrap: anywhere; white-space: pre-line; }
.det-history-meta, .det-history-empty { color: var(--text-subtle); }
.det-history .btn-link { justify-self: start; }
/* Association labels on a card's linked record. */
.assoc-labels { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.assoc-labels .config-panel { flex-basis: 100%; }
/* A contact's additional email addresses, under Email in the About card. */
.det-emails { display: grid; gap: var(--space-1); }
.det-emails:empty { display: none; }
.det-emails .btn-link { justify-self: start; }
.det-emails-label { font-size: var(--text-xs); color: var(--text-subtle); }
.det-email-list { display: grid; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.det-email { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.det-email-address { overflow-wrap: anywhere; }
.det-invalid { display: block; grid-column: 1 / -1; color: var(--negative); font-size: var(--text-xs);
               overflow-wrap: anywhere; }
.stage-picker { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }
.stage-picker select { width: auto; max-width: 100%; }
.stage-picker-days { font-size: var(--text-sm); color: var(--text-subtle); }

.det-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

/* HubSpot's figures: centred columns in one box, ruled apart. Each tile draws its own rules,
   so a short last row leaves white, not a grey gap; the box clips the outer ones. */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  margin-bottom: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.stat-card {
  container-type: inline-size;
  box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border);
  background: var(--surface);
  padding: var(--space-4);
  text-align: center;
}
.stat-label {
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  color: var(--text);
}
.stat-change { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--text-muted); }
.stat-change-up { color: var(--positive); }
.stat-value {
  margin-top: var(--space-1);
  /* Shrinks with its tile, so a money total fits instead of running into the next tile. */
  font-size: clamp(var(--text-lg), 10cqi, var(--text-2xl));
  overflow-wrap: anywhere;
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-value-alert { color: var(--negative); }

/* == 8. board ============================================================= */

/* Five figures in one row, or three and two once narrow: auto-fit left the fifth alone. */
.board-body { container: board-body / inline-size; }
.board-figures { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@container board-body (max-width: 56rem) {
  .board-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.board-scroll { position: relative; }
.board-scroll::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: var(--space-3);
  width: 64px;
  background: linear-gradient(to right, rgba(241, 243, 247, 0), var(--canvas) 85%);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}
.board-scroll-more::after { opacity: 1; }

.board-scroll-btn {
  position: absolute;
  top: 46px;
  z-index: 2;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-lg);
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}
.board-scroll-btn:hover { background: var(--surface-hover); }
/* Inside the board's edge, so they never reach past the page. */
.board-scroll-back { left: var(--space-2); }
.board-scroll-fwd { right: var(--space-2); }

.board {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-3);
  align-items: flex-start;
  scrollbar-width: thin;
}
.board-col {
  flex: 0 0 var(--board-col-w);
  display: flex;
  flex-direction: column;
  max-height: 72vh;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.board-col-won { border-color: var(--positive-border); }
.board-col-lost { border-color: var(--negative-border); }
.board-col-over { background: var(--info-bg); border-color: var(--info-border); }

.board-col-head {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px var(--space-2);
  align-items: baseline;
}
.board-col-name {
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  color: var(--text);
}
.board-col-role {
  grid-row: 2;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-subtle);
}
.board-col-stats {
  grid-column: 2;
  grid-row: 1 / span 2;
  text-align: right;
  font-size: var(--text-body);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.board-col-body {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  overflow-y: auto;
  min-height: 64px;
}
.board-col-more { align-self: center; }

.board-col-foot {
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.board-col-foot-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-body);
}
.board-col-foot-value {
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.board-col-foot-label { color: var(--text-subtle); }

/* Labelled key/value pairs on a deal card, HubSpot-style. A two-column grid keeps the
   values aligned down the card instead of ragged after labels of different lengths. */
.deal-card-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 1px var(--space-2);
  margin: var(--space-1) 0 0;
  font-size: var(--text-body);
}
.deal-card-fields dt { color: var(--text-subtle); }
.deal-card-fields dd {
  margin: 0;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}
.deal-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.deal-card:active { cursor: grabbing; }
/* The card left behind while its lifted copy is dragged: a dashed gap where it was. */
.deal-card-dragging { opacity: 0.45; border-style: dashed; box-shadow: none; }
/* Off screen, padded so the drag snapshot keeps the tilted copy's shadow. */
.deal-card-drag-holder { position: fixed; top: 0; right: 100%; padding: var(--space-4);
                         pointer-events: none; }
.deal-card-lifted { transform: rotate(2deg); border-color: var(--border-strong);
                    box-shadow: var(--shadow-lg); }
@media (prefers-reduced-motion: reduce) {
  .deal-card-lifted { transform: none; }
}
.deal-card-stage-time { white-space: normal; --report-bar-h: var(--space-1); }
.deal-card-stage-time .report-bar-track { margin-top: var(--space-1); }
.deal-card-pending { border-left: 3px solid var(--warning); }

.deal-card-name {
  font-size: var(--text-body);
  font-weight: var(--weight-semibold);
  color: var(--text);
}
.deal-card:hover .deal-card-name { text-decoration: underline; }
.deal-card-company { font-size: var(--text-body); color: var(--text-muted); }
.deal-card-flag {
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.deal-card-flag { margin-top: var(--space-1); align-self: flex-start; }

/* == 9. relay strip ======================================================= */
/* The stage stepper on a deal. Ours shows every stage with its owning role and
 * probability — more than HubSpot's record page does, and worth keeping. */
.relay-strip {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-5);
  scrollbar-width: thin;
}
.relay-step {
  flex: 0 0 auto;
  min-width: 132px;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.relay-step-role {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-subtle);
}
.relay-step-name { font-size: var(--text-body); font-weight: var(--weight-medium); color: var(--text); }
.relay-step-prob { font-size: var(--text-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.relay-step-current { border-color: var(--action); box-shadow: 0 0 0 1px var(--action); }
.relay-step-current .relay-step-name { font-weight: var(--weight-semibold); }
.relay-step-won { border-color: var(--positive-border); background: var(--positive-bg); }
.relay-step-won .relay-step-name { color: var(--positive); }
.relay-step-lost { border-color: var(--negative-border); background: var(--negative-bg); }
.relay-step-lost .relay-step-name { color: var(--negative); }

/* == 10. gates ============================================================ */
.gate-banner {
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-md);
  color: var(--warning);
  font-size: var(--text-body);
}
.gate-banner-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
.record-secondary { margin: calc(-1 * var(--space-3)) 0 var(--space-4); color: var(--text-muted);
                    overflow-wrap: anywhere; }
.approval-thread { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: flex;
                   flex-direction: column; gap: var(--space-2); color: var(--text);
                   overflow-wrap: anywhere; }

.gate-queue { margin-bottom: var(--space-5); }
.gate-queue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.gate-queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--warning-border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-md);
}
.gate-queue-title { font-size: var(--text-body); font-weight: var(--weight-semibold); }
.gate-queue-meta { font-size: var(--text-sm); color: var(--text-muted); }
.gate-queue-actions { display: flex; gap: var(--space-2); }

/* == 11. timeline ========================================================= */
.timeline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.timeline-head h3 { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
/* Walking back through a long history: the button sits under the list, centred, and is
   hidden once the reader has the whole timeline. */
.timeline-more {
  display: flex;
  justify-content: center;
  margin-top: var(--space-3);
}
/* A month label is a landmark, not an entry — it sits outside the two-column grid
   the items use. */
.timeline-month {
  padding: var(--space-4) 0 var(--space-2);
  font-size: var(--text-lg);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.timeline-month:first-child { padding-top: 0; }
/* HubSpot's tabs and toolbar sit between the heading and the entries. */
.timeline-head + .view-tabs { flex-wrap: wrap; margin-bottom: var(--space-3);
                              border-bottom: 1px solid var(--border); }
.timeline-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.timeline-tools .search-box { flex: 1 1 12rem; max-width: 20rem; }
/* Each entry is a card, as HubSpot's are: a header line, then what was said. */
.timeline-item {
  margin: var(--space-2) 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: var(--text-body);
}
.timeline-item-head { display: flex; align-items: flex-start; gap: var(--space-2); }
.timeline-toggle { flex: none; }
/* One line until opened. A line clamp, not an ellipsis: an ellipsis leaves the text wider
   than its box, which the overflow check counts as spilling. */
.timeline-title {
  flex: 1;
  min-width: 0;
  font-weight: var(--weight-semibold);
  overflow-wrap: anywhere;
}
.timeline-preview .timeline-title,
.timeline-collapsed .timeline-title {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.timeline-when { flex: none; font-size: var(--text-body); color: var(--text-subtle); white-space: nowrap; }
.timeline-transition .timeline-title { color: var(--info); }
/* anywhere: a pasted URL or a rule of underscores has no break to wrap at, and ran out of
   the card. */
.timeline-body { min-width: 0; margin-top: var(--space-2); padding-left: var(--space-6);
                 overflow-wrap: anywhere; }
.timeline-body p { white-space: pre-line; margin: var(--space-1) 0; }
.timeline-subtitle { font-weight: var(--weight-medium); }
.timeline-direction { display: flex; align-items: center; gap: var(--space-1);
                      color: var(--text-muted); }
.timeline-direction::before {
  content: "";
  width: var(--space-2);
  height: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--positive);
}
.timeline-quoted {
  padding-left: var(--space-3);
  border-left: 2px solid var(--border);
  color: var(--text-muted);
}
/* A link that acts on the page rather than leaving it: "See more", "View all attachments". */
.timeline-see {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-weight: var(--weight-semibold);
  cursor: pointer;
}
.timeline-see:hover { color: var(--link-hover); text-decoration: underline; }
.timeline-meta { color: var(--text-subtle); }
.timeline-steps { list-style: none; margin: var(--space-2) 0 0; padding: 0;
                  overflow-wrap: anywhere; }
/* An entry's footer: its actions, then its comment thread. */
.timeline-entry-tools { margin-top: var(--space-3); padding-top: var(--space-2);
                        border-top: 1px solid var(--border);
                        display: flex; flex-direction: column; gap: var(--space-2); }
.timeline-comments textarea { width: 100%; }
.timeline-comment, .timeline-deleted { padding: var(--space-2) 0;
                                       border-bottom: 1px solid var(--border);
                                       overflow-wrap: anywhere; }
/* The composer's To line and files: a chip per person or file, the picker after them. */
.email-recipients, .email-files { display: flex; flex-wrap: wrap; align-items: center;
                                  gap: var(--space-2); margin: 0 0 var(--space-2); padding: 0;
                                  list-style: none; }
.email-recipients select { flex: 1 1 12rem; min-width: 0; width: auto; }
/* "Send later": each quick pick names its time, so it wraps rather than leave the card. */
.send-later-pick { max-width: 100%; height: auto; min-height: var(--btn-sm-h);
                   padding-block: var(--space-1); white-space: normal; text-align: left; }
.email-chip { display: inline-flex; align-items: center; gap: var(--space-1); max-width: 100%;
              padding: var(--space-1) var(--space-2); border: 1px solid var(--border);
              border-radius: var(--radius-pill); overflow-wrap: anywhere; }
/* The activity feed keeps the plain two-column row: it lists many records' touches at a glance,
   with nothing to open. */
.timeline-feed .timeline-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-3) 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: none;
}
.timeline-feed .timeline-item:last-child { border-bottom: 0; }
.timeline-feed .timeline-body { margin-top: 0; padding-left: 0; }
.timeline-type {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-subtle);
}
.timeline-actions { display: flex; align-items: center; gap: var(--space-2);
                    margin: var(--space-1) 0; }
.timeline-reason { color: var(--negative); }

/* == 12. tasks ============================================================ */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.task-row:last-child { border-bottom: 0; }
.task-row-done .task-main { opacity: 0.55; }
.task-row-done .task-main strong { text-decoration: line-through; }
.task-check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  color: var(--positive);
  font-size: var(--text-sm);
  line-height: 1;
}
.task-check:hover { border-color: var(--positive); }
.task-check-done { background: var(--positive-bg); border-color: var(--positive-border); }
.task-main { flex: 1 1 auto; min-width: 0; font-size: var(--text-body); }
.task-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); font-size: var(--text-sm); color: var(--text-subtle); }

/* == 13. notifications ==================================================== */
.notif-bell-icon-btn {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  padding: var(--space-1);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.notif-bell-icon-btn:hover,
.notif-bell-icon-btn[aria-expanded="true"] { background: var(--surface-hover); color: var(--text); }
.notif-bell-icon-btn:focus-visible { outline: 2px solid var(--action-ring); outline-offset: 1px; }
/* The count on the bell's corner rather than beside it. */
.notif-bell-count {
  position: absolute;
  top: calc(-1 * var(--space-1));
  right: calc(-1 * var(--space-1));
  margin-left: 0;
}
.notif-bell-icon { display: inline-flex; color: currentColor; }
.notification-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: auto;
  border-radius: var(--radius-pill);
  background: var(--bc-red);
  color: var(--text-inverse);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 16px;
  text-align: center;
}

.notification-dropdown {
  position: fixed;
  z-index: 40;
  width: 340px;
  max-height: 460px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
}
.notif-header-actions { display: flex; gap: var(--space-2); }
.notif-mark-all {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  cursor: pointer;
}
.notif-mark-all:hover { text-decoration: underline; }
.notification-list { overflow-y: auto; }
.notification-item,
.notif-page-item {
  display: block;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  color: inherit;
}
.notification-item:hover,
.notif-page-item:hover { background: var(--surface-hover); text-decoration: none; }
.notification-item.unread,
.notif-page-item.unread { background: var(--info-bg); }
.notif-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); }
.notif-title { font-size: var(--text-body); font-weight: var(--weight-semibold); color: var(--text); }
.notif-body { font-size: var(--text-sm); color: var(--text-muted); }
.notif-time { font-size: var(--text-body); color: var(--text-subtle); white-space: nowrap; }
.notif-chip {
  display: inline-block;
  padding: 1px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--neutral-bg);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.notif-chip-pending { background: var(--warning-bg); color: var(--warning); }
.notif-empty { padding: var(--space-6); text-align: center; color: var(--text-subtle); font-size: var(--text-body); }
.notification-dropdown-footer {
  display: block;
  padding: var(--space-3);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: var(--text-base);
  color: var(--link);
}
.notif-page-list { list-style: none; margin: 0; padding: 0; }

/* == 14. pipeline configuration =========================================== */
.pipeline-card { margin-bottom: var(--space-4); }
.pipeline-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.pipeline-card-head input {
  width: auto;
  min-width: 14rem;
  font-weight: var(--weight-semibold);
}
.pipeline-card-count, .stage-row-count {
  color: var(--text-subtle);
  white-space: nowrap;
}
.pipeline-card-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.pipeline-card-actions > span { color: var(--text-muted); }

/* One member table per team, stacked. Auto layout sizes each table's columns to its own
   names, so the Role column landed at a different x in every card. */
.team-members table { table-layout: fixed; }
.team-members th:nth-child(1) { width: 28%; }
.team-members th:nth-child(2) { width: 34%; }
.team-members th:nth-child(3) { width: 20%; }
.team-members td { overflow-wrap: anywhere; }

.stage-rows { margin: var(--space-3) 0; container: stage-rows / inline-size; }
/* Every track is fixed except the stage name, which takes the slack. An `auto`
   track sizes to content, so the header row — whose last cells are empty —
   would collapse them and shift every label one column right of its input. */
.stage-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(8rem, 1fr) 5rem 9rem 7.5rem 7.5rem 15rem;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
}
.stage-row > input, .stage-row > select { width: 100%; margin: 0; }
.deal-type-row { grid-template-columns: 4.5rem minmax(8rem, 1fr) 9rem 20rem; }
.stage-row-head {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-subtle);
  padding-bottom: var(--space-1);
  border-bottom: 1px solid var(--border);
}
.stage-row-box + .stage-row-box { border-top: 1px solid var(--surface-hover); }
.stage-row-move { display: flex; gap: 2px; }
.stage-row-flags { display: flex; align-items: center; gap: var(--space-2); }
.stage-row-actions { display: flex; gap: var(--space-2); justify-content: flex-end; }
/* A stage whose deals a background job is still walking (T8.3): its actions are
   replaced by how far the job has got. */
.stage-row-run {
  font-size: var(--text-sm);
  color: var(--text-subtle);
  white-space: nowrap;
  align-self: center;
}

/* Inline confirmation, in place of confirm(). Tinted so a destructive step
   looks different from the row it belongs to. */
.config-panel {
  margin: var(--space-2) 0 var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-left: 3px solid var(--negative);
  border-radius: var(--radius-md);
}
.config-panel-note { margin: 0 0 var(--space-2); color: var(--text-muted); }
.config-panel-row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.config-panel-row input, .config-panel-row select { width: auto; margin: 0; }
.config-panel-row > span { color: var(--text-muted); }
.config-panel-field { display: flex; flex-direction: column; gap: var(--space-1); }
.won-section { margin: var(--space-3) 0; padding: var(--space-3) 0;
               border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.won-section-title { margin: 0 0 var(--space-2); font-size: var(--text-body);
                     font-weight: var(--weight-semibold); }
.won-section-note { margin: var(--space-2) 0; color: var(--text-muted); }
.won-section-checklist { display: flex; flex-direction: column; gap: var(--space-1);
                         margin-bottom: var(--space-2); }
.won-section-checklist label { color: var(--text-muted); }
.attachment-list { display: flex; flex-direction: column; gap: var(--space-2); }
.attachment-rows { display: flex; flex-direction: column; gap: var(--space-2); }
.attachment-label { font-size: var(--text-sm); color: var(--text-muted); }
.attachment-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.attachment-more { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.attachment-text { flex: 1; min-width: 0; }
.attachment-name { display: block; overflow-wrap: anywhere; font-weight: var(--weight-semibold); }
.attachment-meta { font-size: var(--text-xs); color: var(--text-subtle); }
.checklist { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); }
.checklist-row { display: flex; flex-direction: column; gap: 2px; }
.checklist-meta { margin-left: var(--space-5); font-size: var(--text-xs); color: var(--text-subtle); }
.config-panel-field label { font-size: var(--text-sm); color: var(--text-muted); }

.input-num { width: 100%; min-width: 3.5rem; }

/* == 15. login ============================================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-4);
  background: var(--canvas);
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding: var(--space-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-title { margin: 0; font-size: var(--text-xl); font-weight: var(--weight-semibold); color: var(--bc-navy); }
.login-sub { margin: var(--space-2) 0 var(--space-6); font-size: var(--text-body); color: var(--text-muted); }
.login-error {
  margin-top: var(--space-4);
  padding: var(--space-3);
  background: var(--negative-bg);
  border: 1px solid var(--negative-border);
  border-radius: var(--radius-md);
  color: var(--negative);
  font-size: var(--text-base);
  text-align: left;
}

/* == 16. deal record layout + association rail ============================ */
/* Three columns: what it is, what happened, what it is connected to. The middle
   column is the flexible one because the timeline is what grows; the outer two
   are fixed so a card never reflows as history accumulates. */
.record {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 300px;
  gap: var(--space-4);
  align-items: start;
}
.record-col { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }

.rail-card { padding: var(--space-4); }
.rail-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.rail-card-head h3 { margin: 0; }
/* A card's row of actions (Reach out's three) drops under its title and wraps when the
   column is narrow, rather than running off the card. */
.rail-card-head > .row-actions { flex-wrap: wrap; justify-content: flex-start; }
.rail-action { font-size: var(--text-body); font-weight: var(--weight-semibold); }
.rail-body { display: flex; flex-direction: column; gap: var(--space-3); }
.add-module-group {
  margin: var(--space-3) 0 var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-subtle);
  text-transform: uppercase;
}
.rail-empty { margin: 0; color: var(--text-subtle); }
.rail-note {
  margin: 0;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  color: var(--text-subtle);
}
.rail-title { font-size: var(--text-body); font-weight: var(--weight-semibold); }
.rail-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-1) var(--space-3);
  margin: 0;
}
.rail-facts dt { color: var(--text-muted); }
.rail-facts dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.rail-list > li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.rail-list > li:first-child { padding-top: 0; }
.rail-list > li:last-child { border-bottom: 0; padding-bottom: 0; }

.rail-person-top { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.rail-person-name { min-width: 0; overflow-wrap: anywhere; font-size: var(--text-body); font-weight: var(--weight-semibold); }
.rail-person-title { color: var(--text-muted); }
.rail-person-detail { color: var(--text-muted); overflow-wrap: anywhere; }
.rail-person-role {
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-subtle);
}
.rail-person .btn-sm { margin-top: var(--space-2); }

.rail-task-title { font-size: var(--text-body); }
.rail-task-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-subtle);
}
.rail-task-done .rail-task-title { color: var(--text-subtle); text-decoration: line-through; }
.rail-task-overdue { color: var(--negative); font-weight: var(--weight-semibold); }

/* == responsive =========================================================== */
/* The record loses its rail before it loses its sidebar: at 1180px the three
   columns are already squeezing the timeline, so the rail drops under the
   middle column while the page is still wide. */
@media (max-width: 1180px) {
  .record { grid-template-columns: 280px minmax(0, 1fr); }
  .record-right {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;   /* or the short cards stretch to the tallest */
  }
  .record-right > .rail-card { flex: 1 1 260px; }
}

@media (max-width: 820px) {
  .record { grid-template-columns: 1fr; }
  /* Back to a plain stack. Both properties have to be undone: in a column
     container `flex: 1 1 260px` makes 260px a *height*, which left the Company
     card with a tall empty tail. */
  .record-right { flex-direction: column; align-items: stretch; }
  .record-right > .rail-card { flex: 0 0 auto; }
}

/* Only shown below 1024px, where the sidebar becomes a drawer behind it. */
.topbar { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 1279px) {
  .container { --pad-top: var(--space-5); --pad-x: var(--space-6); padding-bottom: var(--space-8); }
}

/* An iPad in portrait, or a narrow window: the page gets the width and the navigation slides
   in over it, rather than every link stacking above the page. */
@media (max-width: 1023px) {
  .topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    height: var(--topbar-h);
    padding: 0 var(--space-4);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .topbar .brand-wordmark:hover { text-decoration: none; }
  .topbar-menu {
    position: relative;
    width: var(--space-8);
    height: var(--space-8);
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font-size: var(--text-lg);
    line-height: 1;
    cursor: pointer;
  }
  .topbar-menu:hover { background: var(--surface-hover); }
  .topbar-count { position: absolute; top: calc(-1 * var(--space-2)); right: calc(-1 * var(--space-2)); }

  .sidebar {
    z-index: 30;
    visibility: hidden;
    transform: translateX(-100%);
    transition: transform var(--duration) var(--ease), visibility var(--duration);
  }
  .nav-open .sidebar { visibility: visible; transform: none; box-shadow: var(--shadow-lg); }
  .nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: var(--scrim); }
  .nav-open { overflow: hidden; }

  .main { margin-left: 0; min-height: calc(100vh - var(--topbar-h)); }
  .container { --pad-top: var(--space-4); --pad-x: var(--space-4); }
}

/* The stage rows answer to their card's width, not the window's: a laptop with the sidebar
   open has less room than an iPad without it. */
@container stage-rows (max-width: 60rem) {
  .stage-row { grid-template-columns: 4.5rem minmax(8rem, 1fr) 5rem 9rem 7.5rem; }
  .stage-row-head > :nth-child(n+6) { display: none; }
  .stage-row-flags { grid-column: 2 / 4; }
  .stage-row-actions { grid-column: 4 / -1; }
  .deal-type-row { grid-template-columns: 4.5rem minmax(8rem, 1fr) 9rem; }
  .deal-type-row .stage-row-flags { grid-column: auto; }
  .deal-type-row .stage-row-actions { grid-column: 2 / -1; justify-content: flex-start; }
}
@container stage-rows (max-width: 36rem) {
  .stage-row, .deal-type-row { grid-template-columns: 4.5rem 1fr 5rem; }
  .stage-row > select, .stage-row > :nth-child(5),
  .stage-row-flags, .stage-row-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .stage-row-head { display: none; }
}
/* Its own rows, not the stage grid: a stage row's first track is the reorder arrows, and the
   stage grid's container queries would put each rule's sentence in it. */
.lifecycle-rules { margin: var(--space-3) 0; container: lifecycle-rules / inline-size; }
.lifecycle-rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16rem;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
}
.lifecycle-rule-row:first-child { border-top: 0; }
.lifecycle-rule-row > select { width: 100%; margin: 0; }
@container lifecycle-rules (max-width: 36rem) {
  .lifecycle-rule-row { grid-template-columns: 1fr; gap: var(--space-2); }
}

@media (max-width: 860px) {
  .detail-grid, .det-table { grid-template-columns: 1fr; gap: var(--space-1); }
  .detail-label { margin-top: var(--space-2); }
}

/* Association picker — a prefix search listing at most ten matches under the box. */
.lookup { display: flex; flex-direction: column; gap: var(--space-2); }
.lookup-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.lookup-hit {
  width: 100%;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-sm);
  text-align: left;
  cursor: pointer;
}
.lookup-hit:hover { background: var(--surface-hover); }

/* Tags — small neutral pills; the colour system reserves hue for meaning, and a tag's
   meaning is whatever the workspace gives it. */
.tag-list { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--text);
  font-size: var(--text-xs);
  line-height: 1.6;
}
.tag-remove {
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-subtle);
  font-size: var(--text-sm);
  line-height: 1;
  cursor: pointer;
}
.tag-remove:hover { color: var(--negative); }
.deal-card .tag-list { margin: var(--space-1) 0; }

/* == 17. SoW M1 / M3 / M7 / M17 / M19 ===================================== */

/* A field the reader may not see (M17). Muted, so it reads as "not yours", not "empty". */
.det-val-locked { color: var(--text-subtle); font-style: italic; }
.det-subhead { margin: var(--space-4) 0 var(--space-2); font-size: var(--text-sm); color: var(--text-subtle); }

/* A checkbox or radio with its text beside it. The global `label` rule makes labels block and
   muted; these are inline controls, and a 100%-wide checkbox is a bar. */
label.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-weight: var(--weight-normal);
  color: var(--text);
}
label.check input { width: auto; margin: 0; }
/* A table's select box, large enough to hit; its whole cell toggles it (`dom.js::pickCell`). */
td > input[type="checkbox"], th > input[type="checkbox"] {
  width: var(--check-size);
  height: var(--check-size);
  margin: 0;
  vertical-align: middle;
  accent-color: var(--action);
  cursor: pointer;
}
.pick-cell { width: 1%; cursor: pointer; }
.check-list { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4);
              margin-bottom: var(--space-4); }
/* One conditional-logic rule in the form editor: its If and Then kept together. */
.logic-rule { margin-bottom: var(--space-3); padding: var(--space-3); min-width: 0;
              border: 1px solid var(--border); border-radius: var(--radius-md); }

/* --- tasks (M7) --- */
.bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-md);
}
.bulk-count { font-size: var(--text-body); font-weight: var(--weight-semibold); color: var(--info); }
.bulk-bar .config-panel { flex-basis: 100%; }
tr.task-row-overdue td.task-title { box-shadow: inset 3px 0 0 var(--warning); }
.task-due-overdue { color: var(--warning); font-weight: var(--weight-medium); }
/* HubSpot's task navigation bar while working through tasks, above whichever record the
   current task is on. */
.task-queue-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  max-width: var(--content-max); margin: 0 auto; padding: var(--space-3) var(--space-8);
  background: var(--info-bg); border-bottom: 1px solid var(--info-border);
}
.task-queue-what { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3);
                   min-width: 0; }
.task-queue-count { font-size: var(--text-sm); color: var(--text-muted); }
.task-queue-title { font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.task-queue-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.task-queue-status:empty { display: none; }
.task-queue-status { flex-basis: 100%; color: var(--negative); font-size: var(--text-sm); }
.task-queue-bar > .config-panel { flex-basis: 100%; margin: 0; }
.queue-list { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); }
.queue-item { display: flex; align-items: center; gap: var(--space-3); }
.queue-item .task-meta { margin-right: auto; }

/* The month grid (M7 "Calendar view"). Seven equal tracks; a day holds its entries and
   scrolls rather than growing the row, so weeks stay aligned. */
.calendar-head { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.calendar-dow {
  padding: var(--space-1) var(--space-2);
  background: var(--surface-sunken);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-subtle);
}
.calendar-day {
  min-height: var(--calendar-cell-h);
  max-height: var(--calendar-cell-h);
  overflow-y: auto;
  padding: var(--space-1);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.calendar-pad { background: var(--surface-sunken); }
.calendar-today { background: var(--info-bg); }
.calendar-date { font-size: var(--text-xs); color: var(--text-subtle); }
.calendar-item {
  display: block;
  padding: 0 var(--space-1);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-task { background: var(--neutral-bg); color: var(--text); }
.calendar-task-done { background: var(--neutral-bg); color: var(--text-subtle);
                      text-decoration: line-through; }
.calendar-meeting { background: var(--info-bg); color: var(--info); }
.calendar-more { font-size: var(--text-xs); color: var(--text-subtle); padding: 0 var(--space-1); }
.calendar-legend { display: flex; gap: var(--space-2); margin-top: var(--space-3); }

/* --- prospecting home (M3) --- */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-4);
  align-items: start;
}
a.stat-card { color: inherit; }
a.stat-card:hover { border-color: var(--border-strong); text-decoration: none; }

/* @-mention suggestions under the note box (M19). */
.mention-results { margin-top: calc(var(--space-2) * -1); }

/* --- segments (M3): the rule builder --- */
.rule-groups { display: flex; flex-direction: column; gap: var(--space-2); }
.rule-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.rule-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.rule-row select, .rule-row input:not([type="checkbox"]) { width: auto; min-width: 10rem; }
.rule-value { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.rule-part { display: inline-flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.rule-part-label { font-size: var(--text-sm); color: var(--text-muted); }
.rule-choices { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3);
                max-width: 100%; max-height: var(--filter-list-max-h); overflow-y: auto; }
.rule-or, .rule-and {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  color: var(--text-subtle);
}
.rule-or { align-self: center; }
.rule-or .rule-logic, .rule-and .rule-logic { width: auto; margin: 0; }
/* A workflow's "Unenroll and suppression", between its conditions and its actions. */
.wf-exits { display: flex; flex-direction: column; gap: var(--space-3); margin: var(--space-3) 0; }
.wf-exits .form-hint { margin: 0; }
/* A picker in a record's side card (Segments, Workflows) keeps to the card's width, however
   long the names it offers. */
.rail-card .config-panel-row select { max-width: 100%; min-width: 0; }
.routing-rule { border-top: 1px solid var(--border); padding: var(--space-3) 0; }
.routing-rule-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.routing-rule-head .row-actions { margin-left: auto; }
.routing-rule-head select { width: auto; margin: 0; }
/* A workflow branch's path, indented under the branch card that leads to it. */
.wf-path {
  margin: var(--space-2) 0 var(--space-2) var(--space-4);
  padding-left: var(--space-3);
  border-left: 1px solid var(--border-strong);
}
.routing-rule-head .wf-branch-name { flex: 1; width: auto; margin: 0; }
.routing-rule-form {
  margin: var(--space-3) 0;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* --- forms (M3) --- */
.detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}
.form-field-list { display: flex; flex-direction: column; gap: var(--space-2); }
.embed-code { min-height: 0; font-size: var(--text-sm); }
.form-share { margin-top: var(--space-4); }
.form-share .view-tabs { margin-bottom: var(--space-3); }
.form-share .embed-code, .form-share-link { margin-bottom: var(--space-2); }

/* --- custom objects (M1) --- */
.object-settings { margin-top: var(--space-6); }
.stage-line { margin-bottom: var(--space-2); }
.relay-step { font: inherit; text-align: left; cursor: pointer; }

/* --- merge (M1) --- */
.merge-table td, .merge-table th { vertical-align: top; }
.merge-table td:first-child { width: 12rem; }

/* --- field access and audit (M17) --- */
.override-list { display: flex; flex-direction: column; gap: var(--space-2); }
.config-panel-row .override-list, .config-panel-row .check-list { flex-basis: 100%; }
td .badge + .badge { margin-left: var(--space-1); }
.audit-change { overflow-wrap: anywhere; }

/* --- the embedded lead form (M3), a document of its own --- */
.public-form-body { background: var(--surface); }
.public-form { max-width: var(--public-form-max); margin: 0 auto; padding: var(--space-5); }
.public-form h2 { margin-bottom: var(--space-4); }
.public-form-thanks { font-size: var(--text-lg); }
/* Each part takes its own `--fs-<part>-<control>`, which form.js sets from the server's
   resolved style; the fallbacks are what the page shows before it arrives. The Background
   part styles the form's own box, as HubSpot's does. */
.public-form {
  background: var(--fs-form-fill, var(--surface));
  padding: var(--fs-form-padding, var(--space-5));
  border: var(--fs-form-border_width, 0) var(--fs-form-border_style, none)
          var(--fs-form-border, transparent);
  border-radius: var(--fs-form-radius, 0);
}
.public-form h2, .public-form h3, .public-form-thanks {
  font-family: var(--fs-heading-font, inherit);
  color: var(--fs-heading-color, var(--text));
  text-shadow: var(--fs-heading-shadow, none);
}
.public-form h2 { font-size: var(--fs-heading-size, var(--text-xl)); }
.public-form h3 { font-size: calc(var(--fs-heading-size, var(--text-xl)) * 0.75); }
.public-form .form-heading { margin: 0 0 var(--space-3); }
.public-form .form-image { margin-bottom: var(--space-4); }
.public-form .form-image img { max-width: 100%; height: auto; }
.public-form .form-image-center { text-align: center; }
.public-form .form-image-right { text-align: right; }
.public-form .form-text { margin-bottom: var(--space-4); font-family: var(--fs-text-font, inherit);
                          font-size: var(--fs-text-size, var(--text-body));
                          color: var(--fs-text-color, var(--text)); }
.public-form .form-text > *, .public-form-thanks > * { margin: 0 0 var(--space-2); }
.public-form label {
  font-family: var(--fs-label-font, inherit);
  font-size: var(--fs-label-size, var(--text-sm));
  color: var(--fs-label-color, var(--text-muted));
}
.public-form input, .public-form select, .public-form textarea {
  font-family: var(--fs-input-font, inherit);
  font-size: var(--fs-input-size, var(--text-body));
  color: var(--fs-input-color, var(--text));
  background: var(--fs-input-background, var(--surface));
  border-color: var(--fs-input-border, var(--border-strong));
  border-style: var(--fs-input-border_style, solid);
  border-width: var(--fs-input-border_width, 1px);
  border-radius: var(--fs-input-radius, var(--radius-md));
  padding: var(--fs-input-padding, var(--space-2));
}
.public-form input::placeholder, .public-form textarea::placeholder {
  color: var(--fs-input-placeholder, var(--text-subtle));
}
.public-form input:focus, .public-form select:focus, .public-form textarea:focus {
  border-color: var(--fs-button-background, var(--action));
}
.public-form .form-hint {
  font-family: var(--fs-help-font, inherit);
  font-size: var(--fs-help-size, var(--text-sm));
  color: var(--fs-help-color, var(--text-subtle));
}
.public-form .status-msg-error {
  font-family: var(--fs-error-font, inherit);
  font-size: var(--fs-error-size, var(--text-body));
  color: var(--fs-error-color, var(--negative));
}
/* An error sits under its control and takes over the gap the control kept below it. */
.public-form :is(input, select, textarea, .form-phone, .form-date, .form-search-select,
                 .form-files, .check, .form-choices):has(+ .form-error:not([hidden])) {
  margin-bottom: 0;
}
.public-form .form-error {
  margin: var(--space-1) 0 var(--space-4);
  font-family: var(--fs-error-font, inherit);
  font-size: var(--fs-error-size, var(--text-sm));
  color: var(--fs-error-color, var(--negative));
}
.public-form .form-required { color: var(--fs-error-color, var(--negative)); }
.public-form [aria-invalid="true"] { border-color: var(--fs-error-color, var(--negative)); }
.public-form .btn, .public-form .btn:hover, .public-form .btn:active {
  font-family: var(--fs-button-font, inherit);
  font-size: var(--fs-button-size, var(--text-body));
  color: var(--fs-button-color, var(--action-text));
  background: var(--fs-button-fill, var(--action));
  border-color: var(--fs-button-background, var(--action));
  border-radius: var(--fs-button-radius, var(--radius-pill));
  box-shadow: var(--fs-button-shadow, none);
  padding-inline: var(--fs-button-padding, var(--space-5));
  flex: var(--fs-button-grow, 0 0 auto);
}
/* Previous is the same button drawn in outline, so it never competes with Next. */
.public-form .btn.btn-secondary, .public-form .btn.btn-secondary:hover {
  color: var(--fs-button-background, var(--action));
  background: transparent;
}
.form-progress .form-hint {
  font-family: var(--fs-progress-font, inherit);
  font-size: var(--fs-progress-size, var(--text-sm));
  color: var(--fs-progress-color, var(--text-muted));
  margin: 0;
}
/* Drawn rather than left to the browser, so the bar and its track take their own colours. */
.form-progress progress { appearance: none; height: var(--space-2); border: 0;
                          border-radius: var(--radius-pill);
                          background: var(--fs-progress-track, var(--border)); }
.form-progress progress::-webkit-progress-bar { background: var(--fs-progress-track, var(--border));
                                                border-radius: var(--radius-pill); }
.form-progress progress::-webkit-progress-value {
  background: var(--fs-progress-fill, var(--action));
  border-radius: var(--radius-pill);
}
.form-progress progress::-moz-progress-bar { background: var(--fs-progress-fill, var(--action));
                                             border-radius: var(--radius-pill); }
.public-form .form-actions { justify-content: var(--fs-button-align, flex-end); }
/* HubSpot's step layouts, named for where the form sits; the banner goes when the frame is
   too narrow to share, as HubSpot's does. */
.public-form[data-banner] { display: grid; gap: var(--space-5);
                            max-width: var(--public-form-banner-max); }
.public-form[data-banner="right"], .public-form[data-banner="left"] { grid-template-columns: 1fr 1fr; }
.public-form[data-banner="rightwide"] { grid-template-columns: 1fr 2fr; }
.public-form[data-banner="leftwide"] { grid-template-columns: 2fr 1fr; }
.public-form[data-banner^="left"] .form-banner, .public-form[data-banner="top"] .form-banner { order: 2; }
.form-banner { min-height: var(--form-banner-min); border-radius: var(--radius-md); }
.form-main { min-width: 0; }
@container public-form (max-width: 600px) {
  .public-form .form-banner { display: none; }
  .public-form .form-main { grid-column: 1 / -1; }
}
/* HubSpot's rows: up to three fields side by side, stacked when the form itself is narrow
   — the frame's width, not the visitor's window. */
.public-form { container: public-form / inline-size; }
.form-row { display: flex; gap: var(--space-4); }
.form-cell { flex: 1 1 0; min-width: 0; }
.form-cell > .form-hint { margin-top: var(--space-1); }
.form-phone, .form-date { display: flex; gap: var(--space-2); position: relative; }
/* The gap a bare control gets after its label (.form-card label + input), for the ones built
 * of several. */
.form-cell > .form-phone, .form-cell > .form-date, .form-cell > .form-search-select,
.form-cell > .form-files { margin-bottom: var(--space-4); }
.form-phone > input:first-child { flex: 0 1 40%; min-width: 0; }
.form-phone > input[type=tel], .form-date > input[type=text] { flex: 1 1 auto; min-width: 0; }
.form-date-pick { flex: none; }
/* The browser's own calendar, opened by the Calendar button: present, so it can open, but
 * never seen or reached by Tab. */
.form-date-native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0;
                    pointer-events: none; }
.form-file-list { margin: var(--space-1) 0 0; padding-left: var(--space-4); font-size: var(--text-sm);
                  color: var(--text-muted); overflow-wrap: anywhere; }
.form-choices { display: flex; flex-direction: column; gap: var(--space-1);
                margin-bottom: var(--space-4); }
.form-choices .check, .form-cell > .check { font-family: var(--fs-input-font, inherit);
                                            font-size: var(--fs-input-size, var(--text-body));
                                            color: var(--fs-input-color, var(--text)); }
.form-cell > .check { margin-bottom: var(--space-4); }
.form-privacy .check { font-family: var(--fs-input-font, inherit);
                      font-size: var(--fs-input-size, var(--text-body));
                      color: var(--fs-input-color, var(--text)); margin-bottom: var(--space-3); }
.form-privacy .form-text { margin-bottom: var(--space-3); }
@container public-form (max-width: 480px) {
  .form-row { flex-direction: column; gap: 0; }
}
.form-step h3 { margin-bottom: var(--space-4); }
.colour-row { display: flex; align-items: center; gap: var(--space-3);
              margin-bottom: var(--space-4); }
.colour-row input[type=color] { width: var(--space-10); padding: var(--space-1); }
.det-actions-row .form-hint { margin: 0; }
.form-card input[type=number][name=style_size] { width: var(--input-narrow-w); }
.form-step-block { border: 1px solid var(--border); border-radius: var(--radius-md);
                   padding: var(--space-3); display: flex; flex-direction: column;
                   gap: var(--space-2); }
.form-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.form-step-head input { flex: 1 1 12rem; min-width: 0; }
.form-step-tools { display: flex; align-items: center; gap: var(--space-2); }
.form-field-settings { display: flex; flex-direction: column; gap: var(--space-2);
                       margin: 0 0 var(--space-2) var(--space-4); padding: var(--space-3);
                       border-left: 1px solid var(--border-strong); }
.form-field-settings label + input, .form-field-settings label + select { margin-bottom: 0; }
/* In the editor's panel the field's settings are the panel, not a box under a row. */
.email-panel .form-field-settings { margin: var(--space-3) 0; padding: 0; border: 0; }
.email-panel > div > label + input { margin-bottom: var(--space-2); }
.form-image-chosen { max-width: 100%; max-height: 10rem; align-self: flex-start; }
.form-option-list { display: flex; flex-direction: column; gap: var(--space-1); }
.form-privacy-consent { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); }
.form-privacy-consent > div { flex: 1 1 12rem; min-width: 0; }
.form-privacy-types { display: flex; flex-direction: column; gap: var(--space-1); }
.form-option-row { display: flex; align-items: center; gap: var(--space-2); }
.form-option-row input { flex: 1 1 0; min-width: 0; }
.form-option-head { flex: 1; margin: 0; }
.form-css { font-family: var(--font-mono); font-size: var(--text-sm); width: 100%; }
.answer-share { display: flex; align-items: center; gap: var(--space-2); min-width: 10rem; }
.answer-bar { flex: 1; height: var(--space-2); border-radius: var(--radius-pill);
              background: var(--border); overflow: hidden; }
.answer-bar > span { display: block; height: 100%; background: var(--action); }
.answer-text { overflow-wrap: anywhere; white-space: pre-wrap; }
.submission-detail { margin-top: var(--space-4); padding-top: var(--space-4);
                     border-top: 1px solid var(--border); }
.submission-answers { display: grid; grid-template-columns: minmax(8rem, 1fr) 3fr;
                      gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-3); }
.submission-answers dt { color: var(--text-muted); }
.submission-answers dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* Under its label, as the stage picker is: beside the form's thumbnail the value column is
   narrower than its button. */
.form-automation { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
                   grid-column: 1 / -1; }
.form-automation > a { min-width: 0; overflow-wrap: anywhere; }
.form-index-tools { flex-wrap: wrap; margin-bottom: var(--space-3); }
.form-index-tools > input[type=search] { flex: 1 1 14rem; min-width: 0; max-width: 24rem; }
/* HubSpot's index box: the view tabs, the filter row and the search row sit in one card with
   the table, each row ruled off from the next. */
.index-card { margin-bottom: var(--space-3); background: var(--surface);
              border: 1px solid var(--border); border-radius: var(--radius-lg);
              box-shadow: var(--shadow-sm); }
.index-card > .view-tabs-boxed { margin: 0; padding: var(--space-2) var(--space-4) 0;
                                 background: var(--surface-sunken);
                                 border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.index-filters, .index-tools { display: flex; flex-wrap: wrap; align-items: center;
                               gap: var(--space-2); padding: var(--space-2) var(--space-4);
                               border-bottom: 1px solid var(--border); }
.index-filters:empty { display: none; }
.index-filters > .quick-filters { flex-basis: auto; }
/* An Analyze bar, HubSpot's: "Campaign: All campaigns ▾  Date range: [from] to [to]", with
   its Export or Actions as an outlined button at the far end. */
.bar-filters { align-items: center; }
.bar-filters input[type=date] { width: auto; }
.bar-label { color: var(--text); font-size: var(--text-body); white-space: nowrap; }
.bar-range { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.bar-filters > .bar-end { margin-left: auto; }
.bar-filters > .bar-end > .filter-menu-btn { height: var(--control-h);
  border-color: var(--border-strong); background: var(--surface);
  font-weight: var(--weight-normal); }
/* The filters themselves are HubSpot's: bold words with a caret, no pill around them. */
.index-filters .filter-menu-btn, .bar-filters .filter-menu-btn, .choice-filter > .filter-menu-btn {
  height: var(--filter-bar-h); padding: 0 var(--space-3); border-color: transparent;
  background: none; font-weight: var(--weight-semibold); }
.index-filters .filter-menu-btn:hover, .bar-filters .filter-menu-btn:hover,
.choice-filter > .filter-menu-btn:hover {
  background: var(--surface-hover); }
.index-filters .filter-menu-btn::after, .bar-filters .filter-menu-btn::after,
.choice-filter > .filter-menu-btn::after { color: var(--text); }
.index-filters .filter-menu-active, .bar-filters .filter-menu-active { color: var(--action); }
.index-tools { justify-content: space-between; }
.index-tools > input[type=search] { flex: 1 1 16rem; min-width: min(16rem, 100%); max-width: 24rem; }
.index-tools-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
                   gap: var(--space-2); margin-left: auto; }
.filter-slot { display: contents; }
.index-card > .advanced-filters, .index-card > .card { margin: var(--space-3) var(--space-4); }
.index-card > .bulk-bar { margin: var(--space-2) var(--space-4); }
.index-card .table-wrap { border: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
                          box-shadow: none; }
.index-card .pager { padding: 0 var(--space-4) var(--space-3); }
.index-card .folder-layout { margin: 0; }
.index-note { margin: var(--space-2) 0 0; }
/* An index's rows keep to one line, as HubSpot's: the table scrolls in its frame instead. */
.index-table td { height: var(--index-row-h); padding-top: var(--space-1);
                  padding-bottom: var(--space-1); white-space: nowrap; }
.index-table td.index-name { min-width: var(--index-name-w); }
.index-table td.index-name > a { display: inline-block; max-width: var(--index-name-max);
                                 overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.index-table td.index-name > .status-dot { margin-right: var(--space-2); }
.bulk-bar select { width: auto; max-width: 100%; }
.form-comment-write { position: relative; display: flex; flex-direction: column;
                      align-items: flex-start; gap: var(--space-2); margin-bottom: var(--space-4); }
.form-comment-write textarea { width: 100%; }
.form-comments { display: flex; flex-direction: column; gap: var(--space-3); }
.form-comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.form-comment-body { margin: var(--space-1) 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.style-part { border-top: 1px solid var(--border); padding: var(--space-2) 0; }
.style-part summary { cursor: pointer; font-weight: var(--weight-medium); }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
              gap: var(--space-3); margin-top: var(--space-3); }
.style-control label { margin-bottom: var(--space-1); }
.style-control .colour-row { margin-bottom: 0; }
/* The form editor's preview, edited on: each field outlined on hover and when picked, its
   boxes taking no typing, and a line where a drag would drop. */
.form-editing .form-edit-cell { border-radius: var(--radius-md); outline: 1px dashed transparent;
                                outline-offset: var(--space-1); cursor: pointer; }
.form-editing .form-edit-cell * { pointer-events: none; }
.form-editing .form-edit-cell:hover { outline-color: var(--border-strong); }
.form-editing .form-edit-selected, .form-editing .form-edit-selected:hover {
  outline: 2px solid var(--action); }
.form-drop-before { box-shadow: 0 calc(-1 * var(--space-1)) 0 var(--action); }
.form-drop-after { box-shadow: 0 var(--space-1) 0 var(--action); }
.form-preview { display: block; width: 100%; max-width: 100%; margin: var(--space-3) auto 0;
                border: 1px solid var(--border); border-radius: var(--radius-md);
                background: var(--surface); }
.btn-secondary[aria-pressed=true] { border-color: var(--action); color: var(--action); }
.form-range { margin: var(--space-3) 0; }
.form-range input { width: auto; min-width: 0; }
.form-overview { display: flex; flex-wrap: wrap; gap: var(--space-5); align-items: flex-start;
                 margin-bottom: var(--space-4); }
.form-overview > * { flex: 1 1 16rem; min-width: 0; }
.form-thumb-wrap { flex: 0 1 18rem; height: 12rem; overflow: hidden; pointer-events: none;
                   border: 1px solid var(--border); border-radius: var(--radius-md); }
/* Drawn at twice the size and halved, so the whole form fits as a thumbnail. */
.form-thumb { width: 200%; height: 200%; border: 0; transform: scale(0.5);
              transform-origin: top left; }
.form-tabs { margin-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
.form-performance, .form-analyze { display: flex; flex-direction: column; gap: var(--space-4); }
.form-performance-pair { display: grid; gap: var(--space-4);
                         grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
.form-performance .card h3 { margin-bottom: var(--space-3); }
.form-progress-setting { display: flex; flex-wrap: wrap; align-items: center;
                         gap: var(--space-3); }
.form-progress-setting select { width: auto; }
.form-step-block .det-actions-row { flex-wrap: wrap; }
.form-step-block .det-actions-row input { width: auto; flex: 1 1 8rem; min-width: 0; }
.form-progress { display: flex; flex-direction: column; gap: var(--space-1);
                 margin-bottom: var(--space-4); }
.form-progress progress { width: 100%; height: var(--space-2); }
/* The honeypot: off-screen rather than display:none, which some bots know to skip. */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; opacity: 0; }

@media (max-width: 860px) {
  .detail-columns { grid-template-columns: 1fr; }
  .calendar-item { white-space: normal; }
}
/* `.card + .card` spaces stacked cards; in a grid or a gapped column the gap already does. */
.home-grid > .card + .card, .dashboard-grid > .card + .card,
.detail-columns .card + .card { margin-top: 0; }
.queues-card { margin-top: var(--space-4); }

/* ------------------------------------------------ products and line items (SoW M9) */
.line-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
}
.line-row-name { min-width: 0; overflow-wrap: anywhere; }
.line-row .num { white-space: nowrap; }
.line-narrow { width: var(--input-narrow-w); }
.line-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: var(--line-summary-w);
  max-width: 100%;
  margin: var(--space-4) 0 var(--space-4) auto;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
/* The editor's table: the name gets the room, numbers never wrap. */
.line-table td:first-child { width: 22%; }
.line-table td input { width: 100%; }
.line-table td.num { white-space: nowrap; }
.line-row-amount { padding-top: var(--space-2); border-top: 1px solid var(--border); }

/* ------------------------------------------------ meetings and booking pages (SoW M18) */
.meeting-day { display: flex; flex-direction: column; gap: var(--space-1); }
.booking-week { display: flex; flex-direction: column; gap: var(--space-2); }
.booking-day { display: flex; align-items: center; gap: var(--space-3); }
.booking-day .check { flex: 0 0 var(--booking-day-label-w); }
.booking-day input[type="time"] { width: auto; }
.booking-days { display: flex; flex-direction: column; gap: var(--space-5); margin: var(--space-5) 0; }
.booking-slot-day h3 { margin: 0 0 var(--space-2); font-size: var(--text-body); }
.booking-slots { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.timeline-link { display: inline-block; font-weight: var(--weight-semibold); color: var(--link); }
.timeline-link:hover { color: var(--link-hover); }
.timeline-download { margin-left: var(--space-2); }
.timeline-title-link { display: block; color: var(--text); text-decoration: none; }
.timeline-title-link:hover { color: var(--link); text-decoration: underline; }
/* The records an entry is on: a line of names, each removable, with "+ Contact" and the like. */
.timeline-records {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin-bottom: var(--space-2);
}
.timeline-records-label { color: var(--text-subtle); }
.timeline-record { display: inline-flex; align-items: center; gap: var(--space-1); min-width: 0; overflow-wrap: anywhere; }
.timeline-records .lookup { flex-basis: 100%; }

/* HubSpot's file boxes under an email: bordered, the name a link, the size beside it. */
.timeline-files {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.timeline-file {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  max-width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: var(--text-sm);
  text-decoration: none;
}
.timeline-file-name { min-width: 0; overflow-wrap: anywhere; font-weight: var(--weight-semibold); color: var(--link); }
.timeline-file:hover .timeline-file-name { color: var(--link-hover); text-decoration: underline; }
.timeline-file-size { flex: none; color: var(--text-subtle); }


/* ======================================================================
 * Reports and dashboards (SoW M13)
 *
 * Charts are hand-drawn because the CSP (`script-src 'self'`) rules out a
 * charting library and there is no bundler to inline one. A bar is a track and
 * a fill whose size JavaScript sets through the CSSOM; the line chart is SVG.
 * Series colours are classes here, never values in JavaScript.
 * ====================================================================== */
.report-head { margin-bottom: var(--space-4); }
.report-head h2 { margin: 0 0 var(--space-1); font-size: var(--text-xl);
                  font-weight: var(--weight-medium); }
.report-head .form-hint { margin: 0 0 var(--space-3); }

.report-filters { display: flex; flex-wrap: wrap; gap: var(--space-2);
                  margin-bottom: var(--space-3); }
/* `.input` is width:100%, which a filter chip must not be — these sit side by side and
 * size to their own content, as HubSpot's report chips do. */
.report-filters select { width: auto; }

.report-body { display: flex; flex-direction: column; gap: var(--space-4); }

.report-chart { background: var(--surface); border: 1px solid var(--border);
                border-radius: var(--radius-lg); padding: var(--space-4); }

.chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-3);
                margin-bottom: var(--space-3); font-size: var(--text-sm);
                color: var(--text-muted); }
.chart-legend-item { display: inline-flex; align-items: center; gap: var(--space-2); }
.chart-swatch { width: var(--space-3); height: var(--space-3);
                border-radius: var(--radius-sm); display: inline-block; }

/* --- the series ramp. Categorical, never semantic: see tokens.css. --- */
.series-1 { background: var(--series-1); }
.series-2 { background: var(--series-2); }
.series-3 { background: var(--series-3); }
.series-4 { background: var(--series-4); }
.series-5 { background: var(--series-5); }
.series-6 { background: var(--series-6); }
.report-donut { display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }
.report-donut-ring { width: 10rem; height: 10rem; flex: none; }
.report-donut-slice { fill: none; stroke-width: 6; }
.report-donut-slice.series-1 { stroke: var(--series-1); }
.report-donut-slice.series-2 { stroke: var(--series-2); }
.report-donut-slice.series-3 { stroke: var(--series-3); }
.report-donut-slice.series-4 { stroke: var(--series-4); }
.report-donut-slice.series-5 { stroke: var(--series-5); }
.report-donut-slice.series-6 { stroke: var(--series-6); }
.chart-legend-column { flex-direction: column; align-items: flex-start; }
.report-line-path.series-1 { stroke: var(--series-1); }
.report-line-path.series-2 { stroke: var(--series-2); }
.report-line-path.series-3 { stroke: var(--series-3); }
.report-line-path.series-4 { stroke: var(--series-4); }
.report-line-path.series-5 { stroke: var(--series-5); }
.report-line-path.series-6 { stroke: var(--series-6); }
.series-previous { background: var(--series-previous); }
.report-line-path.series-previous { stroke: var(--series-previous); stroke-dasharray: 6 4; }
.report-area.series-previous { fill: var(--series-previous); }
/* A figure that opens its records (the drill-down). */
.is-drillable { cursor: pointer; }
.report-bar-fill.is-drillable:hover, .report-column.is-drillable:hover { opacity: 0.8; }
.report-tile.is-drillable:hover { background: var(--surface-sunken); }
.report-drill { margin-top: var(--space-4); }
.report-body td .btn-link { text-align: left; }
.report-body td.num .btn-link { text-align: right; }
.dashboard-filters { padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }
.report-area { stroke: none; opacity: 0.18; }
.report-area.series-1 { fill: var(--series-1); }
.report-area.series-2 { fill: var(--series-2); }
.report-area.series-3 { fill: var(--series-3); }
.report-area.series-4 { fill: var(--series-4); }
.report-area.series-5 { fill: var(--series-5); }
.report-area.series-6 { fill: var(--series-6); }

/* --- horizontal bars --- */
.report-bar-row { display: grid;
                  grid-template-columns: var(--report-label-w) 1fr var(--report-value-w);
                  align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
.report-bar-row:last-child { margin-bottom: 0; }
/* In a narrow card — a form page's half-width pair, a small dashboard card — the fixed label
   column left the bar no room and the row spilled out; label and bar share the width there. */
.report-body { container: report-body / inline-size; }
@container report-body (max-width: 400px) {
  .report-bar-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
}
.report-bar-label { font-size: var(--text-base); color: var(--text);
                    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-bar-stack { display: flex; flex-direction: column; gap: 2px; }
.report-bar-track { background: var(--surface-sunken); border-radius: var(--radius-pill);
                    height: var(--report-bar-h); overflow: hidden; }
.report-bar-track-stacked { display: flex; }
.report-bar-fill { background: var(--action); height: 100%;
                   border-radius: var(--radius-pill);
                   transition: width var(--duration) var(--ease); }
.report-bar-fill.is-calm { background: var(--info); }
.report-bar-fill.is-warning { background: var(--warning); }
.report-bar-fill.is-negative { background: var(--negative); }
.report-bar-track-stacked .report-bar-fill { border-radius: 0; }
.funnel { display: flex; flex-direction: column; gap: var(--space-3);
          margin-bottom: var(--space-4); }
.funnel-step { display: grid;
               grid-template-columns: minmax(0, 12rem) minmax(0, 1fr) minmax(0, 8rem);
               gap: var(--space-3); align-items: center; }
.funnel-label { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.funnel-count { font-size: var(--text-sm); color: var(--text-muted); text-align: right;
                font-variant-numeric: tabular-nums; }
.report-bar-value { font-size: var(--text-base); color: var(--text-muted);
                    text-align: right; font-variant-numeric: tabular-nums; }

/* --- vertical columns --- */
.report-columns { display: flex; align-items: flex-end; gap: var(--space-2);
                  height: var(--report-chart-h); overflow-x: auto; }
.report-column-slot { display: flex; flex-direction: column; justify-content: flex-end;
                      align-items: center; gap: var(--space-2); flex: 1 1 0;
                      min-width: var(--report-col-min-w); height: 100%; }
/* Capped, so a chart with two buckets draws two columns rather than two slabs the width
 * of the card. `flex: 1 1 0` alone makes a single column fill everything. */
.report-column-bars { display: flex; align-items: flex-end; gap: 2px; width: 100%;
                      max-width: var(--report-col-max-w); flex: 1 1 auto;
                      justify-content: center; margin: 0 auto; }
/* Its colour is its series class; a background here would paint every series alike. */
.report-column { flex: 1 1 0; border-radius: var(--radius-sm);
                 min-height: 1px; transition: height var(--duration) var(--ease); }
.report-column-label { font-size: var(--text-xs); color: var(--text-subtle);
                       white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
                       max-width: 100%; align-self: flex-start; }

/* --- line --- */
.report-line { width: 100%; height: var(--report-chart-h); display: block; }
.report-line-path { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke;
                    stroke-linejoin: round; stroke-linecap: round; }
.report-line-axis { display: flex; justify-content: space-between;
                    font-size: var(--text-xs); color: var(--text-subtle);
                    margin-top: var(--space-2); }

/* --- KPI tiles --- */
/* As .stat-cards: each tile draws its own rules, so a short last row is white, not grey. */
.report-tiles { display: grid;
                grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
                background: var(--surface); border: 1px solid var(--border);
                border-radius: var(--radius-xl); overflow: hidden; }
.report-tile { container-type: inline-size; background: var(--surface); padding: var(--space-4);
               box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border);
               display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
               text-align: center; }
.report-tile-label { font-size: var(--text-body); font-weight: var(--weight-semibold);
                     color: var(--text); }
.report-tile-value { font-size: clamp(var(--text-lg), 10cqi, var(--text-2xl));
                     overflow-wrap: anywhere; font-weight: var(--weight-medium);
                     color: var(--text); font-variant-numeric: tabular-nums; }
/* Neutral on purpose: a fall in deals lost is good news, so the arrow states the
 * direction and the colour does not judge it. */
.report-tile-change { font-size: var(--text-sm); color: var(--text-muted); }

.report-chart-empty { margin: 0; padding: var(--space-5); text-align: center;
                      color: var(--text-subtle); font-size: var(--text-base);
                      background: var(--surface); border: 1px solid var(--border);
                      border-radius: var(--radius-lg); }

.report-total td { font-weight: var(--weight-semibold); color: var(--text);
                   border-top: 1px solid var(--border-strong);
                   background: var(--surface-sunken); }

.report-list { display: flex; flex-direction: column; }
.report-list-item { display: block; padding: var(--space-3) 0;
                    border-top: 1px solid var(--border); text-decoration: none; }
.report-list-item:first-child { border-top: 0; }
.report-list-item:hover { background: var(--surface-hover); }
.report-list-title { display: block; color: var(--link);
                     font-weight: var(--weight-semibold); font-size: var(--text-body); }
.report-list-desc { display: block; color: var(--text-muted); font-size: var(--text-base); }

/* Two across on a wide screen, one on a narrow one. `auto-fill` with a minimum rather
 * than fixed columns, so a single card does not stretch to the full width. */
.dashboard-grid { display: grid; gap: var(--space-4);
                  grid-template-columns: repeat(auto-fill,
                                                minmax(var(--dashboard-card-w), 1fr)); }
.dashboard-card { margin: 0; }
.dashboard-card .report-chart { padding: 0; border: 0; background: transparent; }
.report-card-foot { margin: var(--space-3) 0 0; font-size: var(--text-base); }
.text-warning { color: var(--warning); }

/* --- sequences (M6) --- */
/* The contact's sequence, as HubSpot's record banner shows it. */
.sequence-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius-md);
  color: var(--info);
  font-size: var(--text-base);
}
.sequence-banner .row-actions { margin-left: auto; }
.sequence-banner-error { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }

/* A DNS value is one long token: it wraps inside its column rather than widening the table. */
.dns-records table { table-layout: fixed; }
.dns-records th:first-child { width: 25%; }
.dns-records td { vertical-align: top; }
.dns-records td.mono { overflow-wrap: anywhere; }

/* The marketing email editor (Phase MK2.3): panel beside the canvas, stacked when the editor
   itself is narrow — sized to its container, since the sidebar comes and goes at 1024px. */
.index-name { min-width: var(--index-name-min); }
.index-name > a { font-weight: var(--weight-semibold); }
.share-dialog { width: min(36rem, calc(100vw - var(--space-8))); padding: var(--space-5);
                 border: 1px solid var(--border); border-radius: var(--radius-lg);
                 background: var(--surface); color: var(--text); }
.share-dialog::backdrop { background: color-mix(in srgb, var(--text) 40%, transparent); }
.column-editor { width: min(48rem, calc(100vw - var(--space-8)));
                  container: column-editor / inline-size; }
.column-editor-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
                      gap: var(--space-5); margin: var(--space-4) 0; }
@container column-editor (max-width: 32rem) {
  .column-editor-body { grid-template-columns: minmax(0, 1fr); }
}
.column-editor-list { display: flex; flex-direction: column; gap: var(--space-1);
                      max-height: 22rem; overflow-y: auto; margin-top: var(--space-2); }
.column-editor-row { display: flex; align-items: center; gap: var(--space-1); }
.column-editor-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere;
                      font-size: var(--text-sm); }
.frozen-col { position: sticky; z-index: 1; background: var(--surface); }
thead .frozen-col { background: var(--surface-sunken); }
tbody tr:hover .frozen-col { background: var(--surface-hover); }
.forms-index { container: forms-index / inline-size; }
.folder-layout:has(> .folder-tree:not([hidden])) {
  display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: var(--space-4);
  align-items: start;
}
@container forms-index (max-width: 48rem) {
  .folder-layout:has(> .folder-tree:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
}
.folder-tree { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3);
               border: 1px solid var(--border); border-radius: var(--radius-lg);
               background: var(--surface); }
.folder-tree h3 { margin: 0 0 var(--space-2); }
.folder-tree-item { padding: var(--space-2); border: 0; border-radius: var(--radius-sm);
                    background: none; color: var(--text); font: inherit; text-align: left;
                    cursor: pointer; overflow-wrap: anywhere; }
.folder-tree-item:hover { background: var(--surface-hover); }
.folder-tree-active { background: var(--surface-sunken); font-weight: var(--weight-semibold); }
.send-method-head { margin: var(--space-4) 0 var(--space-3); }
.send-method { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.send-method-card { flex: 1 1 14rem; display: flex; flex-direction: column; align-items: flex-start;
                    gap: var(--space-1); padding: var(--space-4); border: 1px solid var(--border);
                    border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
                    font: inherit; text-align: left; cursor: pointer; }
.send-method-on { border-color: var(--action); box-shadow: 0 0 0 1px var(--action); }
.form-page-shell { container: form-page / inline-size; }
.form-page { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: var(--space-4);
             align-items: start; }
@container form-page (max-width: 60rem) {
  .form-page { grid-template-columns: minmax(0, 1fr); }
}
/* A record shown beside its list, as HubSpot's submission panel: the window's right edge. */
.side-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
              width: min(28rem, 100vw); overflow: auto; padding: var(--space-5);
              background: var(--surface); border-left: 1px solid var(--border);
              box-shadow: var(--shadow-lg); }
.side-panel h3 { margin-top: 0; }
.email-editor-shell { container: email-editor / inline-size; }
.email-editor { display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
                gap: var(--space-4); align-items: start; }
.email-panel-railed { display: grid; grid-template-columns: auto minmax(0, 1fr);
                      gap: var(--space-3); align-items: start; }
.icon { flex: none; width: var(--icon-size); height: var(--icon-size); }
/* HubSpot's editor rail: a round icon button for each panel, the chosen one filled. */
.panel-rail { position: sticky; top: 0; display: flex; flex-direction: column; gap: var(--space-1);
              padding-right: var(--space-2); border-right: 1px solid var(--border); }
.panel-rail-btn { display: inline-flex; align-items: center; justify-content: center;
                  width: var(--btn-editor-h); height: var(--btn-editor-h); padding: 0; border: 0;
                  border-radius: var(--radius-pill); background: none; color: var(--text-muted);
                  cursor: pointer; }
.panel-rail-btn:hover { background: var(--surface-hover); color: var(--text); }
.panel-rail-active, .panel-rail-active:hover { background: var(--action); color: var(--action-text); }
/* HubSpot's module tiles: an icon over the name, as many to a row as fit. */
.module-tiles { display: grid; gap: var(--space-2); margin: var(--space-2) 0;
                grid-template-columns: repeat(auto-fill, minmax(var(--module-tile-w), 1fr)); }
.module-tile { display: flex; flex-direction: column; align-items: center; justify-content: center;
               gap: var(--space-1); min-width: 0; min-height: var(--module-tile-w);
               padding: var(--space-2); border: 1px solid var(--border-strong);
               border-radius: var(--radius-md); background: var(--surface); color: var(--text);
               font: inherit; font-size: var(--text-body); text-align: center; cursor: grab;
               overflow-wrap: break-word; }
.module-tile:hover { border-color: var(--action); background: var(--surface-hover); }
.module-tile .icon { width: var(--icon-size-lg); height: var(--icon-size-lg); }
.layout-cols { display: flex; gap: var(--space-1); width: 100%; height: var(--space-6); }
.layout-col { min-width: 0; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
              background: var(--neutral-bg); }
/* The canvas: "Preview and test" above it, and HubSpot's toolbar floating at its foot. */
.canvas-head { display: flex; justify-content: center; gap: var(--space-2);
               margin-bottom: var(--space-2); }
.canvas-tools { position: sticky; bottom: var(--space-4); z-index: 5; display: flex;
                align-items: center; gap: var(--space-2); width: fit-content; max-width: 100%;
                margin: var(--space-3) auto 0; padding: var(--space-1) var(--space-2);
                background: var(--surface); border: 1px solid var(--border);
                border-radius: var(--radius-pill); box-shadow: var(--shadow-md); }
.canvas-tools-group { display: flex; align-items: center; gap: var(--space-1); }
.canvas-tools-group + .canvas-tools-group { padding-left: var(--space-2);
                                            border-left: 1px solid var(--border); }
.canvas-tool { display: inline-flex; align-items: center; justify-content: center;
               width: var(--control-h); height: var(--control-h); padding: 0; border: 0;
               border-radius: var(--radius-pill); background: none; color: var(--text-muted);
               cursor: pointer; }
.canvas-tool:hover { background: var(--surface-hover); color: var(--text); }
.canvas-tool[aria-pressed="true"] { background: var(--neutral-bg); color: var(--text); }
.canvas-tool:disabled { opacity: 0.35; cursor: not-allowed; }
.canvas-tools .filter-menu-btn { height: var(--control-h); border-color: transparent; }
.canvas-tools .filter-menu-panel { top: auto; bottom: calc(100% + var(--space-2)); }
/* HubSpot's editor bar: dark, edge to edge across the page (its margins undo .container's
   padding), the name in the middle. */
.email-editor-shell > .editor-bar { margin: calc(-1 * var(--pad-top)) calc(-1 * var(--pad-x))
                                            var(--space-4); }
.editor-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
              align-items: center; gap: var(--space-3); min-height: var(--topbar-h);
              padding: var(--space-2) var(--space-4); background: var(--editor-bar-bg);
              color: var(--text-inverse); }
.editor-bar-start, .editor-bar-end, .editor-bar-title { display: flex; flex-wrap: wrap;
                                                        align-items: center; gap: var(--space-2);
                                                        min-width: 0; }
.editor-bar-end { justify-content: flex-end; }
.editor-bar-title { justify-content: center; }
.editor-back { display: inline-flex; align-items: center; height: var(--btn-editor-h);
               padding: 0 var(--space-4); border: 1px solid var(--editor-bar-line);
               border-radius: var(--radius-pill); color: var(--text-inverse);
               font-weight: var(--weight-semibold); }
.editor-bar .filter-menu-btn, .editor-bar .btn, .editor-bar .btn-secondary, .editor-bar-link {
  display: inline-flex; align-items: center; height: var(--btn-editor-h);
  padding: 0 var(--space-3); border: 1px solid transparent; border-radius: var(--radius-md);
  background: none; color: var(--text-inverse); font-weight: var(--weight-semibold); }
.editor-back:hover, .editor-bar .filter-menu-btn:hover, .editor-bar .btn:hover,
.editor-bar .btn-secondary:hover, .editor-bar-link:hover {
  background: var(--editor-bar-hover); border-color: transparent; color: var(--text-inverse);
  text-decoration: none; }
.editor-bar .filter-menu-btn::after { color: var(--text-inverse); }
.editor-bar .editor-primary, .editor-bar .editor-primary:hover {
  padding: 0 var(--space-5); border-radius: var(--radius-pill); background: var(--surface);
  color: var(--text); }
.editor-bar .editor-primary:hover { background: var(--surface-hover); }
.editor-bar .btn:disabled { opacity: 0.45; }
.editor-bar .email-title-name { color: var(--text-inverse); font-weight: var(--weight-normal); }
.editor-bar .email-title .input { width: auto; color: var(--text); }
.editor-bar select { width: auto; }
.editor-bar-note { color: var(--editor-bar-muted); }
/* HubSpot's Edit, Targeting and Options under the bar, centred on a white strip. */
.email-editor-shell > .editor-bar + .editor-tabs { justify-content: center;
  margin: calc(-1 * var(--space-4)) calc(-1 * var(--pad-x)) var(--space-4);
  background: var(--surface); border-bottom: 1px solid var(--border); }
@container email-editor (max-width: 56rem) {
  .editor-bar { grid-template-columns: minmax(0, 1fr) auto; }
  .editor-bar-title { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
}
.email-panel-body > h3:first-child { margin-top: 0; }
.email-panel-title { margin: 0 0 var(--space-3); padding-bottom: var(--space-2);
                     border-bottom: 1px solid var(--border); font-size: var(--text-lg); }
.email-panel-title + h3 { margin-top: 0; }
/* A card of the form editor's shown as a panel: the panel is its frame, and the panel's title
   its name, so neither is drawn twice. */
.email-panel-body > .card { padding: 0; border: 0; background: none; }
.email-panel-body > .email-panel-title + .card > h3:first-child { display: none; }
/* The form editor's Layers: each step's fields, a row each, opening the field. */
.form-layer { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
              gap: var(--space-2); width: 100%; margin: 0 0 var(--space-1);
              padding: var(--space-2) var(--space-3); border: 1px solid var(--border);
              border-radius: var(--radius-md); background: var(--surface); color: var(--text);
              font: inherit; text-align: left; cursor: pointer; }
.form-layer:hover { border-color: var(--action); background: var(--surface-hover); }
.form-layer .form-hint { margin: 0; }
.form-step-block > .input { margin: 0 0 var(--space-2); }
.trigger-card { margin: var(--space-2) 0 var(--space-3); padding: var(--space-3);
                border: 1px solid var(--border); border-radius: var(--radius-md); }
.trigger-card .form-hint { margin: var(--space-1) 0 0; }
.email-panel { scroll-margin-top: calc(var(--topbar-h) + var(--space-2)); }
.email-panel { position: sticky; top: var(--space-4); max-height: calc(100vh - var(--space-8));
               overflow: auto; }
.email-panel h3 { margin-top: var(--space-4); }
.email-panel .det-actions-row { margin: var(--space-2) 0; }
.email-canvas { display: block; width: 100%; max-width: 100%; min-height: 30rem;
                margin: var(--space-3) auto 0; border: 1px solid var(--border);
                border-radius: var(--radius-md); background: var(--surface); }
.email-tree-row { display: flex; align-items: center; gap: var(--space-1);
                  padding: var(--space-1) 0; border-bottom: 1px solid var(--border); }
.email-tree-module { padding-left: var(--space-4); }
.email-tree-col { margin: var(--space-1) 0 0 var(--space-2); }
/* --- a sent email's page (Phase MK2.7) --- */
.perf-tabs { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
             gap: var(--space-2); margin: var(--space-4) 0 var(--space-3);
             border-bottom: 1px solid var(--border); }
.perf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
             gap: var(--space-3); margin: var(--space-3) 0 var(--space-5); }
.perf-grid .report-bar-track { margin: var(--space-1) 0 var(--space-2); }
.perf-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
              gap: var(--space-4); align-items: start; }
.perf-cards .card, .perf-cards + .card, .perf-cards + .card + .card { margin: 0 0 var(--space-4); }
.perf-url { overflow-wrap: anywhere; }
/* The categories beside the list, as HubSpot's; above it once the page is too narrow. */
.recipient-shell { container: recipients / inline-size; }
.recipient-layout { display: grid; gap: var(--space-4); }
@container recipients (min-width: 44rem) {
  .recipient-layout { grid-template-columns: 12rem minmax(0, 1fr); }
}
.recipient-rail { display: flex; flex-direction: column; gap: var(--space-1); }
.recipient-rail-item { display: flex; justify-content: space-between; gap: var(--space-2);
                       padding: var(--space-2) var(--space-3); border: 0;
                       border-left: 2px solid transparent; background: none; font: inherit;
                       color: var(--text); text-align: left; cursor: pointer; }
.recipient-rail-item.view-tab-active { border-left-color: var(--action); border-bottom: 0; }
.recipient-history td { background: var(--surface-sunken); }
.email-tree-name { flex: 1 1 auto; min-width: 0; padding: 0; border: 0; background: none;
                   color: var(--action); font: inherit; text-align: left; cursor: pointer;
                   overflow-wrap: anywhere; }
.rte-box { margin-bottom: var(--space-3); }
.rte-box .colour-row { margin-bottom: 0; }
/* A swatch in a toolbar row: the row gives its inputs a reading width a swatch has no use for. */
.det-actions-row .colour-row input[type=color] { min-width: 0; }
.rte { min-height: 8rem; margin-top: var(--space-2); padding: var(--space-3);
       border: 1px solid var(--border); border-radius: var(--radius-md);
       background: var(--surface); overflow-wrap: anywhere; }
.rte.rte-line { min-height: 0; padding: var(--space-2); }
.rte:focus { outline: 2px solid var(--action); outline-offset: -1px; }
@container email-editor (max-width: 56rem) {
  .email-editor { grid-template-columns: minmax(0, 1fr); }
  .email-panel { position: static; max-height: none; }
}
.style-image-thumb { width: var(--space-10); height: var(--space-10); object-fit: cover;
                     border: 1px solid var(--border); border-radius: var(--radius-md); }
.image-library { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
                 gap: var(--space-2); margin-top: var(--space-3); }
.image-tile { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0;
              padding: var(--space-1); border: 1px solid var(--border);
              border-radius: var(--radius-md); background: var(--surface); cursor: pointer;
              text-align: left; }
.image-tile:hover { border-color: var(--action); }
.image-tile img { width: 100%; height: 5rem; object-fit: cover; }
.image-tile .form-hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-title { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.email-title-name { padding: 0; border: 0; background: none; color: var(--text); font: inherit;
                    font-size: var(--text-xl); font-weight: var(--weight-semibold);
                    text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.email-inbox { display: flex; flex-direction: column; gap: var(--space-1); width: 100%;
               margin-top: var(--space-3); padding: var(--space-3); text-align: left;
               border: 1px solid var(--border); border-radius: var(--radius-md);
               background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.email-inbox:hover { border-color: var(--action); }
.email-inbox-row { overflow-wrap: anywhere; }
.email-plain { margin: var(--space-3) 0 0; padding: var(--space-4); border: 1px solid var(--border);
               border-radius: var(--radius-md); background: var(--surface);
               font-size: var(--text-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.email-plain-edit { margin: var(--space-3) 0 0; }
.email-review-item { flex: 1 1 auto; min-width: 0; font-size: var(--text-sm);
                     overflow-wrap: anywhere; }
/* HubSpot's template galleries: the groups down the left, the cards beside them. */
.gallery-shell { container: gallery / inline-size; }
.gallery-layout { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: var(--space-5);
                  align-items: start; }
@container gallery (max-width: 44rem) {
  .gallery-layout { grid-template-columns: minmax(0, 1fr); }
}
.gallery-rail { gap: var(--space-1); }
.gallery-rule { width: 100%; margin: var(--space-2) 0; border: 0;
                border-top: 1px solid var(--border); }
.gallery-group { display: flex; justify-content: space-between; gap: var(--space-2); }
.gallery-count { color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.gallery-main { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.gallery-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.gallery-head .input { width: auto; max-width: 100%; }
.gallery-head h3 { margin: 0 auto 0 0; font-size: var(--text-2xl);
                   font-weight: var(--weight-normal); }
/* Each email template drawn at 600px and shown at 40% of it. */
.template-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
                    gap: var(--space-4); }
.template-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3);
                 border: 1px solid var(--border); border-radius: var(--radius-lg);
                 background: var(--surface); color: var(--text); min-width: 0; }
.template-card:hover, .template-card:focus-within { border-color: var(--action); }
.template-card-name { display: flex; align-items: center; gap: var(--space-2); min-width: 0;
                      overflow-wrap: anywhere; }
.template-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
                         margin-top: auto; }
.template-thumb { width: 100%; height: 18rem; overflow: hidden; pointer-events: none;
                  border: 1px solid var(--border); border-radius: var(--radius-md);
                  background: var(--surface-sunken); }
.template-thumb iframe { width: 37.5rem; height: 45rem; border: 0; transform: scale(0.4);
                         transform-origin: top left; }
/* A CTA is drawn on the editor's stand-in page, a laptop's width, shown at 25% of it. */
.cta-thumb { height: 10rem; }
.cta-thumb iframe { width: 64rem; height: 40rem; transform: scale(0.25); }
.template-thumb-blank { display: flex; align-items: center; justify-content: center;
                        color: var(--text-subtle); }
/* A template shown whole beside the gallery, as HubSpot's Preview. */
.side-panel-wide { width: min(42rem, 100vw); }
.template-preview { width: 100%; height: 70vh; border: 1px solid var(--border);
                    border-radius: var(--radius-md); }
.email-tree-row[draggable=true] { cursor: grab; }
.email-tree-drop { box-shadow: inset 0 2px 0 var(--action); }
.email-tree-label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }

/* Settings › Privacy & consent (MK5.4). The preview takes the banner's own colours as CSS
 * variables set from the saved style, as the site script does. */
.consent-preview { display: flex; min-height: 12rem; padding: var(--space-4);
                   margin: var(--space-4) 0; background: var(--surface-sunken);
                   border: 1px solid var(--border); border-radius: var(--radius-lg); }
.consent-preview-bottom { align-items: flex-end; }
.consent-preview-top { align-items: flex-start; }
.consent-preview-center { align-items: center; justify-content: center; }
.consent-preview-bottom_left { align-items: flex-end; justify-content: flex-start; }
.consent-preview-bottom_right { align-items: flex-end; justify-content: flex-end; }
.consent-preview-box { position: relative; width: 100%; padding: var(--space-4);
                       background: var(--cp-bg); color: var(--cp-fg);
                       box-shadow: var(--shadow-lg); font-size: var(--text-sm); }
.consent-preview-center .consent-preview-box,
.consent-preview-bottom_left .consent-preview-box,
.consent-preview-bottom_right .consent-preview-box { max-width: 22rem; }
.consent-preview-box p { margin: 0 0 var(--space-3); }
.consent-preview-actions { display: flex; flex-wrap: wrap; gap: var(--space-2);
                           justify-content: flex-end; }
.consent-preview-btn { padding: var(--space-1) var(--space-4); background: var(--cp-btn-bg);
                       color: var(--cp-btn-fg); border: 1px solid var(--cp-btn-border); }
.consent-preview-close { position: absolute; top: var(--space-1); right: var(--space-2); }
.consent-shape-rounded { border-radius: var(--radius-md); }
.consent-shape-square { border-radius: 0; }
.consent-shape-pill { border-radius: var(--radius-pill); }
.consent-preview-box.consent-shape-pill { border-radius: var(--radius-xl); }
.consent-types { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.consent-countries { min-height: 10rem; }

/* A returning visitor's "Not you?" above a form filled in with what is known about them. */
.form-not-you { display: block; margin: 0 0 var(--space-3); padding: 0; border: 0;
                background: none; color: var(--link); font: inherit; font-size: var(--text-sm);
                text-decoration: underline; cursor: pointer; }

/* == campaigns (MK6) ======================================================= */
.campaign-name { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }
.campaign-color { flex: 0 0 auto; width: var(--space-1); align-self: stretch;
                  min-height: var(--space-4); border-radius: var(--radius-sm); }
/* The details card beside the tabs, stacked when the content area is narrower than both. */
.campaign-shell { container: campaign / inline-size; }
/* Sized to the tabs' own column: beside the details card it is narrower on a laptop than
   the page, so the tabs close up rather than wrap. */
.campaign-main { container: campaign-main / inline-size; }
@container campaign-main (max-width: 34rem) {
  .campaign-main .view-tab { padding-inline: var(--space-3); }
}
.budget-row { cursor: grab; }
/* Campaign steps and templates (MK6.8). */
.campaign-progress { display: flex; flex-direction: column; gap: var(--space-1); }
.campaign-progress progress { width: 100%; height: var(--space-2); appearance: none; border: 0;
                              border-radius: var(--radius-pill); background: var(--border); }
.campaign-progress progress::-webkit-progress-bar { background: var(--border);
                                                    border-radius: var(--radius-pill); }
.campaign-progress progress::-webkit-progress-value { background: var(--positive);
                                                      border-radius: var(--radius-pill); }
.campaign-progress progress::-moz-progress-bar { background: var(--positive);
                                                 border-radius: var(--radius-pill); }
.campaign-editor-shell { container: campaign-editor / inline-size; }
.campaign-editor { display: grid; grid-template-columns: 18rem minmax(0, 1fr);
                   gap: var(--space-4); align-items: start; }
@container campaign-editor (max-width: 44rem) {
  .campaign-editor { grid-template-columns: minmax(0, 1fr); }
}
.campaign-editor-side { min-width: 0; }
.campaign-editor-side h3 { margin-top: var(--space-3); }
.campaign-editor-shell .page-header .row-actions { align-items: center; }
.campaign-editor-shell .page-header .form-hint { white-space: nowrap; }
.campaign-editor-main { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.campaign-step { cursor: grab; padding: 0; overflow: hidden; }
.campaign-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
                      padding: var(--space-2) var(--space-3); background: var(--surface-sunken); }
.campaign-step-head strong { margin-right: auto; }
.campaign-step-body { display: flex; align-items: center; gap: var(--space-3);
                      padding: var(--space-3); }
.campaign-step-name { display: flex; flex-direction: column; gap: var(--space-1);
                      flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.campaign-step-choices { list-style: none; margin: 0; padding: 0; display: flex;
                         flex-direction: column; }
.campaign-step-choice { display: flex; align-items: center; gap: var(--space-2);
                        padding: var(--space-2) 0; border-bottom: 1px solid var(--border); }
.campaign-templates { display: grid; gap: var(--space-3); margin-top: var(--space-3);
                      grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.campaign-template { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.campaign-template h3 { margin: 0; overflow-wrap: anywhere; }
.campaign-templates > .card { margin: 0; }
.campaign-template .row-actions { margin-top: auto; flex-wrap: wrap; justify-content: flex-start; }
.campaign-template-search { max-width: 24rem; }
.campaign-create-choice .row-actions { justify-content: flex-start; flex-wrap: wrap; }
.campaign-tasks .report-filters { margin: var(--space-3) 0; align-items: center; }
.campaign-tasks .report-filters input[type=search] { flex: 0 1 16rem; width: auto; }
.campaign-tasks .report-filters > .btn-secondary { margin-left: auto; }
/* The marketing calendar (MK6.9). */
.mcal-filters { margin: var(--space-3) 0; align-items: center; }
.mcal-filters > .btn-secondary { margin-left: auto; }
.mcal-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
            margin: var(--space-3) 0; }
.mcal-title { margin: 0 auto 0 0; }
.mcal-moves { display: flex; gap: var(--space-1); }
.mcal-nav input[type=date] { width: auto; }
.mcal-nav select { width: auto; }
.mcal-month, .mcal-hours-view { border: 1px solid var(--border); border-radius: var(--radius-md);
                                background: var(--surface); overflow: hidden; }
.mcal-row { display: grid; }
.mcal-cols-7 .mcal-row { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mcal-cols-5 .mcal-row { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.mcal-cols-1 .mcal-row { grid-template-columns: minmax(0, 1fr); }
.mcal-cols-7 .mcal-gutter { grid-template-columns: 4rem repeat(7, minmax(0, 1fr)); }
.mcal-cols-5 .mcal-gutter { grid-template-columns: 4rem repeat(5, minmax(0, 1fr)); }
.mcal-cols-1 .mcal-gutter { grid-template-columns: 4rem minmax(0, 1fr); }
.mcal-head { background: var(--surface-sunken); border-bottom: 1px solid var(--border); }
.mcal-dow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
            gap: var(--space-1); padding: var(--space-2) var(--space-1);
            font-size: var(--text-xs); font-weight: var(--weight-semibold);
            color: var(--text-muted); text-transform: uppercase; min-width: 0; }
.mcal-week { min-height: 8rem; border-top: 1px solid var(--border); }
.mcal-week:first-of-type { border-top: 0; }
.mcal-day { border-right: 1px solid var(--border); }
.mcal-day-last { border-right: 0; }
.mcal-today { background: var(--surface-hover); }
.mcal-date { display: flex; align-items: center; justify-content: space-between;
             padding: var(--space-1) var(--space-2); font-size: var(--text-sm); min-width: 0; }
.mcal-out .mcal-date, .mcal-out + .mcal-date { color: var(--text-subtle); }
.mcal-add { border: 0; background: none; color: var(--action); cursor: pointer; padding: 0;
            font-weight: var(--weight-semibold); opacity: 0; }
.mcal-date:hover .mcal-add, .mcal-dow:hover .mcal-add, .mcal-add:focus-visible { opacity: 1; }
@media (hover: none) { .mcal-add { opacity: 1; } }
.mcal-items { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0;
              padding: 0 var(--space-1) var(--space-2); }
.mcal-event, .mcal-bar { display: block; width: 100%; min-width: 0; text-align: left;
                         padding: var(--space-1) var(--space-2); border: 1px solid var(--border);
                         border-radius: var(--radius-sm); background: var(--surface);
                         font: inherit; font-size: var(--text-xs); color: var(--text);
                         white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
                         cursor: pointer; }
.mcal-event:hover, .mcal-bar:hover { background: var(--surface-hover); }
.mcal-bar { margin: var(--space-1) 0 0; background: var(--surface-sunken);
            font-weight: var(--weight-medium); }
.mcal-bar .campaign-color { display: inline-block; width: var(--space-2);
                            height: var(--space-2); margin-right: var(--space-1);
                            border-radius: var(--radius-sm); vertical-align: middle; }
.mcal-more { border: 0; background: none; padding: 0 var(--space-1); text-align: left;
             color: var(--action); font: inherit; font-size: var(--text-sm);
             font-weight: var(--weight-semibold); cursor: pointer; }
.mcal-more:hover { text-decoration: underline; }
.mcal-allday { border-bottom: 1px solid var(--border); padding-bottom: var(--space-1); }
.mcal-allday .mcal-bar { margin: var(--space-1) var(--space-1) 0; width: auto; }
.mcal-hours { position: relative; max-height: 36rem; overflow-y: auto; }
.mcal-hour { padding: var(--space-1) var(--space-2); font-size: var(--text-xs);
             color: var(--text-muted); text-align: right; border-top: 1px solid var(--border);
             white-space: nowrap; }
.mcal-slot { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0;
             min-height: 3rem; padding: var(--space-1); border-top: 1px solid var(--border);
             border-left: 1px solid var(--border); }
.mcal-drawer-head { display: flex; align-items: center; justify-content: space-between;
                    gap: var(--space-2); margin-bottom: var(--space-3); }
.mcal-drawer-head h3 { margin: 0; }
.mcal-drawer-close { border: 0; background: none; font-size: var(--text-lg); cursor: pointer;
                     color: var(--text-muted); }
.mcal-day-list { display: flex; flex-direction: column; gap: var(--space-2); }
.mcal-day-row { display: flex; flex-direction: column; align-items: flex-start;
                gap: var(--space-1); padding: var(--space-2) var(--space-3); text-align: left;
                border: 1px solid var(--border); border-radius: var(--radius-md);
                background: var(--surface); font: inherit; cursor: pointer; }
.mcal-day-row:hover { background: var(--surface-hover); }
.mcal-day-row strong { overflow-wrap: anywhere; }
.mcal-details h3 { margin: 0 0 var(--space-2); overflow-wrap: anywhere; }
.mcal-status { margin: 0 0 var(--space-3); }
.mcal-facts { margin: 0 0 var(--space-3); }
.mcal-facts dt { font-size: var(--text-sm); color: var(--text-muted); }
.mcal-facts dd { margin: 0 0 var(--space-2); overflow-wrap: anywhere; }
.mcal-list { display: flex; flex-direction: column; gap: var(--space-3); }
.mcal-list-day { border: 1px solid var(--border); border-radius: var(--radius-md);
                 background: var(--surface); padding: var(--space-3); }
.mcal-list-day h4 { margin: 0 0 var(--space-2); }
.mcal-list-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
                 padding: var(--space-1) 0; border-top: 1px solid var(--border); min-width: 0; }
.mcal-list-time { flex: 0 0 5rem; font-size: var(--text-sm); color: var(--text-muted); }
.mcal-list-row .form-hint { margin: 0; }
.mcal-list .mcal-event, .mcal-list .mcal-bar { width: auto; max-width: 100%; margin: 0;
                                               flex: 0 1 auto; }
.campaign-record { display: grid; grid-template-columns: 300px minmax(0, 1fr);
                   gap: var(--space-4); align-items: start; }
@container campaign (max-width: 40rem) {
  .campaign-record { grid-template-columns: minmax(0, 1fr); }
}
.campaign-adder { container: campaign-adder / inline-size; }
.campaign-adder-body { display: grid; grid-template-columns: 12rem minmax(0, 1fr);
                       gap: var(--space-4); margin-bottom: var(--space-3); }
.campaign-adder-types { display: flex; flex-direction: column; gap: var(--space-1); }
/* Narrow, the types become a row of choices above the list. */
@container campaign-adder (max-width: 36rem) {
  .campaign-adder-body { grid-template-columns: minmax(0, 1fr); }
  .campaign-adder-types { flex-direction: row; flex-wrap: wrap; }
}
.campaign-adder-type { padding: var(--space-1) var(--space-2); border: 0;
                       border-radius: var(--radius-sm); background: none; color: var(--text);
                       font: inherit; text-align: left; cursor: pointer; }
.campaign-adder-type:hover { background: var(--surface-hover); }
.campaign-adder-type-active { background: var(--surface-sunken);
                              font-weight: var(--weight-semibold); }
.campaign-adder-list { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.campaign-adder-list td:first-child, .campaign-adder-list th:first-child { width: 1%; }
/* A colour field in a form: the text inputs' padding would cover its swatch. */
.form-card input[type=color] { width: var(--space-10); height: var(--control-h);
                               padding: var(--space-1); }
.campaign-field { display: flex; flex-direction: column; gap: var(--space-2);
                  margin-bottom: var(--space-4); }
.campaign-field-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.campaign-field select { max-width: 24rem; }
.campaign-field-chip { display: inline-flex; align-items: center; gap: var(--space-2);
                       padding: var(--space-1) var(--space-2); border: 1px solid var(--border);
                       border-radius: var(--radius-pill); }

/* A campaign's Performance tab (MK6.5): the range above the cards, and the asset groups,
   each a disclosure whose summary carries the type's totals. */
.campaign-perf-range { align-items: center; margin-bottom: var(--space-4); }
.campaign-perf-range input[type=date] { width: auto; }
.campaign-perf-range .form-hint { margin: 0; }
.campaign-perf .perf-cards { margin-top: var(--space-4);
                             grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.campaign-perf .report-filters input[type=search] { flex: 0 1 16rem; width: auto; }
.campaign-perf-groups { display: flex; flex-direction: column; gap: var(--space-3);
                        margin-top: var(--space-3); }
.campaign-perf-group { min-width: 0; padding: var(--space-3) var(--space-4);
                       border: 1px solid var(--border); border-radius: var(--radius-md); }
.campaign-perf-group > summary { cursor: pointer; }
.campaign-perf-label { font-weight: var(--weight-semibold); }
.campaign-perf-summary .report-body { margin-top: var(--space-2); }
.campaign-perf-summary .report-tiles { margin: 0; }
.campaign-analytics > .chips, .campaign-analytics > .card { margin-bottom: var(--space-4); }
.compare-pickers { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3);
                   margin-bottom: var(--space-4); }
.compare-slot { display: flex; flex-direction: column; gap: var(--space-1);
                flex: 0 1 16rem; min-width: 0; }
.compare-slot > button { align-self: flex-start; }
.compare-table td, .compare-table th { min-width: 12rem; }
.compare-table .compare-section th { padding-top: var(--space-5); font-size: var(--text-lg); }
.compare-table .compare-group th { font-weight: var(--weight-semibold); }
.compare-label { color: var(--text-muted); }
.compare-toggle { border: 0; background: none; padding: 0; color: var(--action);
                  font: inherit; cursor: pointer; text-align: left; }
.compare-toggle::before { content: "▸ "; }
.compare-toggle[aria-expanded="true"]::before { content: "▾ "; }
.compare-assets td { vertical-align: top; }
.compare-asset-list { margin: 0; padding: 0; list-style: none; }
.compare-asset-list li { display: flex; justify-content: space-between; gap: var(--space-2); }

/* A campaign's goals (MK6.6): each its title and actions over its figures. */
.campaign-goal { padding-top: var(--space-4); margin-top: var(--space-4);
                 border-top: 1px solid var(--border); min-width: 0; }
.campaign-goal-head { display: flex; flex-wrap: wrap; align-items: flex-start;
                      justify-content: space-between; gap: var(--space-2);
                      margin-bottom: var(--space-3); }
.campaign-goal-head h4 { margin: 0; font-size: var(--text-lg);
                         font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.campaign-goal-head .form-hint { margin: var(--space-1) 0 0; }
.campaign-goal .stat-cards { margin-bottom: var(--space-3); }
.campaign-goal-form { margin: var(--space-3) 0; }

/* A tracking URL just made, shown whole to copy (MK6.3). */
.tracking-url-text { min-width: 0; overflow-wrap: anywhere; font-size: var(--text-sm); }
.tracking-url-actions { justify-content: flex-start; margin-top: var(--space-1); }

tr.is-current td { background: var(--surface-sunken); }

/* Marketing › Ads › Manage (MK4.5): six figures in one row, or two rows of three once the page
   is narrow, never one left alone on a row of its own. */
.ads-figures-shell { container: ads-figures / inline-size; margin: var(--space-3) 0 var(--space-4); }
.ads-figures-shell .stat-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 0; }
@container ads-figures (max-width: 48rem) {
  .ads-figures-shell .stat-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.ads-delay { margin: 0 0 0 auto; }
.ads-drill-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
                  margin: var(--space-3) 0; }
.ads-drill-title { display: flex; align-items: center; gap: var(--space-2); margin: 0; }
.ads-drill-head .stat-label { flex-basis: 100%; margin: 0; }
.ads-table-tools { justify-content: space-between; margin: var(--space-3) 0; }
.ads-name { min-width: 14rem; }
/* Create audience and Create conversion event: HubSpot's type cards, the whole card the button. */
.ads-type-card { display: flex; flex-direction: column; gap: var(--space-1); width: 100%;
                 margin-bottom: var(--space-3); padding: var(--space-4); text-align: left;
                 background: var(--surface); border: 1px solid var(--border);
                 border-radius: var(--radius-md); cursor: pointer; }
.ads-type-card:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.ads-type-card .badge { align-self: flex-start; }
.ads-checks { display: flex; flex-direction: column; gap: var(--space-2);
                     margin-bottom: var(--space-4); }
.ads-name .btn-link { text-align: left; }
.ads-row-name { font-weight: var(--weight-medium); }
.ads-totals th, .ads-totals td { font-weight: var(--weight-semibold);
                                 border-top: 1px solid var(--border); }
.ad-preview { margin: var(--space-2) 0; padding: var(--space-3);
              border: 1px solid var(--border); border-radius: var(--radius-md);
              overflow-wrap: anywhere; }
.ad-preview-row { padding: var(--space-2); max-width: 32rem; }
.ad-preview-headline { color: var(--action); font-weight: var(--weight-medium); }
.ads-recommendation { padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.ads-recommendation p { margin: var(--space-1) 0; overflow-wrap: anywhere; }
.ads-type-card-on { border-color: var(--action); box-shadow: 0 0 0 1px var(--action); }
.ads-name-head { display: flex; align-items: center; gap: var(--space-2); }
/* HubSpot's Off/On switch: a pill track whose knob slides right, navy when on. */
.ads-switch { position: relative; flex: none; width: var(--space-8); height: var(--space-5);
              padding: 0; border: 0; border-radius: var(--radius-pill);
              background: var(--border-strong); cursor: pointer;
              transition: background var(--duration) var(--ease); }
.ads-switch::after { content: ""; position: absolute; top: calc(var(--space-1) / 2);
                     left: calc(var(--space-1) / 2);
                     width: calc(var(--space-5) - var(--space-1));
                     height: calc(var(--space-5) - var(--space-1));
                     border-radius: 50%; background: var(--surface);
                     transition: transform var(--duration) var(--ease); }
.ads-switch-on { background: var(--action); }
.ads-switch-on::after { transform: translateX(calc(var(--space-8) - var(--space-5))); }
.ads-switch:focus-visible { outline: 2px solid var(--action-ring); outline-offset: 2px; }
.ads-switch:disabled { opacity: 0.6; cursor: progress; }
.ads-builder-shell { container: ads-builder / inline-size; }
.ads-builder-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
                    gap: var(--space-4); align-items: start; }
@container ads-builder (max-width: 46rem) {
  .ads-builder-grid { grid-template-columns: minmax(0, 1fr); }
}
.ads-counted { display: flex; flex-direction: column; margin-bottom: var(--space-3); }
.ads-counted > .form-hint { align-self: flex-end; }
.ads-asset-row { display: flex; align-items: flex-start; gap: var(--space-2); }
.ads-asset-row > .ads-counted { flex: 1; min-width: 0; }
.ads-asset-row > .btn-link { margin-top: var(--space-6); }
.ads-path-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: var(--space-3); }
.ads-keyword-row { justify-content: space-between; padding: var(--space-1) 0;
                   border-bottom: 1px solid var(--border); }
.ads-keyword-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ads-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.ads-chips .btn-link { margin-left: var(--space-1); }
.ads-date { max-width: 12rem; }
.ads-image-kind { margin-bottom: var(--space-4); }
.ads-image-kind .image-library { margin-bottom: var(--space-2); }
.image-library > .form-hint:only-child { grid-column: 1 / -1; }
.ads-preview-image { display: block; width: 100%; margin: var(--space-2) 0;
                     border-radius: var(--radius-sm); }
.ads-preview-foot { display: flex; align-items: center; justify-content: space-between;
                    gap: var(--space-2); }
.filter-menu-item-on { font-weight: var(--weight-semibold); }
.filter-menu-sub { display: block; max-width: 20rem; white-space: normal; }
.filter-list .filter-menu-item:has(.filter-menu-sub) { flex-direction: column;
                                                       align-items: flex-start; gap: 0; }

/* Marketing › Ads › Analyze: HubSpot's dashboard grid, sized to its container. */
.ads-analyze-page { container: ads-analyze / inline-size; }
.ads-analyze { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-4); }
.ads-analyze-card { grid-column: span 3; min-width: 0; margin: 0; }
.ads-analyze-wide { grid-column: span 4; }
.ads-analyze-wide + .ads-analyze-card { grid-column: span 2; }
.ads-analyze-full { grid-column: 1 / -1; }
@container ads-analyze (max-width: 48rem) {
  .ads-analyze-card, .ads-analyze-wide, .ads-analyze-wide + .ads-analyze-card {
    grid-column: 1 / -1; }
}
