/* EngageCycle's own design system for staff pages (Milestone 8): the business admin, the ops
   console, and sign-in. Loaded after styles.css only on those pages (<html class="ui">), so
   client-facing pages (signing, offers, business home) keep their look.
   Visual reference: docs/design/admin-dashboard.html. Colors are tokens; nothing is inline. */

@font-face {
  font-family: "Sora";
  src: url("/static/fonts/sora-latin-wght.woff2?v=714cfbc8e4") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/static/fonts/atkinson-hyperlegible-latin-400.woff2?v=b09653e3ba") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/static/fonts/atkinson-hyperlegible-latin-700.woff2?v=d8e8b1e0e9") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------ tokens */
:root.ui {
  --canvas: #f6f8fc;
  --paper: #ffffff;
  --sunken: #f6f8fc;
  --ink: #0f172a;
  --deep: #10245e;
  --body: #3b4558;
  --muted: #5f687a;
  --line: #e3e8f1;
  --line-strong: #c9d1de;
  --primary: #2459e0;
  --primary-ink: #ffffff;
  --primary-soft: #e8efff;
  --amber: #f0a020;
  --amber-soft: #fff4e0;
  --good: #14804a;
  --good-soft: #e5f5ec;
  --warn: #a35a00;
  --warn-soft: #fff1dc;
  --bad: #c0362c;
  --bad-soft: #fdeceb;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.06);
  --font-display: "Sora", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-lg: 16px;
  --r-md: 10px;
  --side: 248px;
  --side-collapsed: 76px;

  /* The older names styles.css uses, pointed at the new set. */
  --bg: var(--canvas);
  --surface: var(--sunken);
  --text: var(--ink);
  --border: var(--line);
  --border-strong: var(--line-strong);
  --danger: var(--bad);
  --danger-soft: var(--bad-soft);
  --success: var(--good);
  --success-soft: var(--good-soft);
  --focus: var(--amber);
  --brand: var(--primary);
  --brand-ink: var(--primary-ink);
  --brand-text: var(--primary);
  --brand-soft: var(--primary-soft);
  --brand-border: color-mix(in srgb, var(--primary) 45%, var(--paper));
  --brand-dark: color-mix(in srgb, var(--primary) 85%, black);
  --highlight: var(--amber);
  --radius: var(--r-lg);
  --radius-sm: var(--r-md);
  --sans: var(--font-body);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root.ui:not([data-theme="light"]) {
    --canvas: #0b1020;
    --paper: #121a2e;
    --sunken: #0e1527;
    --ink: #eef2fb;
    --deep: #eef2fb;
    --body: #c3cbd9;
    --muted: #8b95a8;
    --line: #243049;
    --line-strong: #34425f;
    --primary: #7196ff;
    --primary-ink: #0b1020;
    --primary-soft: #1a2747;
    --amber: #f5b544;
    --amber-soft: #33270f;
    --good: #5fd08f;
    --good-soft: #10291c;
    --warn: #f2b35c;
    --warn-soft: #33240e;
    --bad: #ff8f86;
    --bad-soft: #3a1917;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --brand-dark: color-mix(in srgb, var(--primary) 85%, white);
    color-scheme: dark;
  }
}
:root.ui[data-theme="dark"] {
  --canvas: #0b1020;
  --paper: #121a2e;
  --sunken: #0e1527;
  --ink: #eef2fb;
  --deep: #eef2fb;
  --body: #c3cbd9;
  --muted: #8b95a8;
  --line: #243049;
  --line-strong: #34425f;
  --primary: #7196ff;
  --primary-ink: #0b1020;
  --primary-soft: #1a2747;
  --amber: #f5b544;
  --amber-soft: #33270f;
  --good: #5fd08f;
  --good-soft: #10291c;
  --warn: #f2b35c;
  --warn-soft: #33240e;
  --bad: #ff8f86;
  --bad-soft: #3a1917;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --brand-dark: color-mix(in srgb, var(--primary) 85%, white);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
.ui body {
  background: var(--canvas);
  color: var(--body);
  font: 15px/1.5 var(--font-body);
}
.ui h1,
.ui h2,
.ui h3 {
  font-family: var(--font-display);
  color: var(--ink);
  text-wrap: balance;
}
.ui h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.ui h2 {
  font-size: 1.15rem;
  font-weight: 600;
}
.ui h3 {
  font-size: 1rem;
  font-weight: 600;
}
.ui p,
.ui ul,
.ui ol {
  color: var(--body);
}
.ui a {
  color: var(--primary);
}
.ui :focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
.ui .num {
  font-variant-numeric: tabular-nums;
}
.ui .muted {
  color: var(--muted);
}
/* Hidden but read by screen readers, even where a page's table or list rules would size it.
   Contents are taken out of flow too, so they never stretch a page or a screenshot. */
.ui .visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}
.ui .visually-hidden table {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.6rem 1rem;
  font-weight: 600;
}
.skip-link:focus {
  top: 1rem;
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
  display: block;
}

/* ------------------------------------------------------------------ shell */
.app {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}
.side-collapsed .app {
  grid-template-columns: var(--side-collapsed) minmax(0, 1fr);
}
.app-side {
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  min-width: 0;
}
.app-side-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ui .app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  text-decoration: none;
  min-width: 0;
  flex: 1;
}
.app-brand .brand-logo-full img {
  height: 30px;
}
/* Ops adds its badge beside the logo; a little smaller, both fit next to the phone menu's close. */
.is-ops .app-brand .brand-logo-full img {
  height: 26px;
}
.app-brand .brand-logo-mark img {
  height: 32px;
}
.app-biz {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sunken);
  color: var(--ink);
  width: 100%;
  text-align: left;
  min-width: 0;
}
summary.app-biz {
  cursor: pointer;
  list-style: none;
}
summary.app-biz::-webkit-details-marker {
  display: none;
}
summary.app-biz:hover {
  border-color: var(--line-strong);
}
.app-biz-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--biz-chip, var(--primary));
  color: var(--biz-chip-ink, var(--primary-ink));
  font: 600 12px/30px var(--font-display);
  text-align: center;
  flex: none;
  overflow: hidden;
}
.app-biz-logo.has-image {
  background: #ffffff;
  border: 1px solid var(--line);
}
.app-biz-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.app-biz-text {
  min-width: 0;
  flex: 1;
}
.app-biz-text b {
  display: block;
  font: 600 14px/1.2 var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-biz-text span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-biz-caret {
  color: var(--muted);
}
.app-biz-caret .icon {
  width: 16px;
  height: 16px;
}
.app-biz-menu,
.app-me-menu {
  position: relative;
}
.app-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-nav-label {
  font: 600 11px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 10px 6px;
}
.ui .app-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--body);
  font-weight: 500;
  text-decoration: none;
  min-height: 42px;
}
.ui .app-nav a:hover {
  background: var(--sunken);
  color: var(--ink);
}
.ui .app-nav a.is-active {
  background: var(--primary);
  color: var(--primary-ink);
}
.app-nav-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-count {
  font: 600 12px/1 var(--font-display);
  font-style: normal;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 999px;
}
.app-nav a.is-active .app-count {
  background: color-mix(in srgb, var(--primary-ink) 22%, transparent);
  color: var(--primary-ink);
}
/* Requests waiting for review on an offer (ARCHITECTURE 37.6): asks for attention. */
.app-count.app-count-attention,
.app-nav a.is-active .app-count.app-count-attention {
  background: var(--warn-soft);
  color: var(--warn);
}
.app-side-foot {
  margin-top: auto;
}
.side-collapsed .app-brand .brand-logo-full,
.side-collapsed .app-biz-text,
.side-collapsed .app-biz-caret,
.side-collapsed .app-nav-label,
.side-collapsed .app-nav-text,
.side-collapsed .app-count {
  display: none;
}
.side-collapsed .app-brand .brand-logo-mark {
  display: inline-flex;
}
.side-collapsed .app-nav a,
.side-collapsed .app-biz {
  justify-content: center;
}
.side-collapsed .app-brand {
  justify-content: center;
  padding: 4px 0;
}
.side-collapsed .app-biz {
  padding: 8px;
}
.ui .app-close,
.ui .app-scrim,
.ui .app-menu-btn,
.ui .app-search-link {
  display: none;
}

.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.app-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.app-top .spacer {
  flex: 1;
}
.icon-btn,
.ui .theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--body);
  display: grid;
  place-items: center;
  flex: none;
  position: relative;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}
.icon-btn:hover,
.ui .theme-toggle:hover,
.icon-btn.is-active {
  color: var(--ink);
  border-color: var(--muted);
}
.icon-btn .icon {
  width: 19px;
  height: 19px;
}
.ui .app-collapse-btn {
  display: none;
}
.ui.js .app-collapse-btn {
  display: grid;
}
.app-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--paper);
}
.app-search {
  position: relative;
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sunken);
  color: var(--muted);
  min-width: 0;
}
.app-search:focus-within {
  border-color: var(--primary);
  background: var(--paper);
}
.app-search .icon {
  width: 18px;
  height: 18px;
}
.ui .app-search input[type="search"] {
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  outline: none;
}
.kbd {
  font: 500 12px/1 var(--font-body);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 6px;
  color: var(--muted);
  background: var(--paper);
  white-space: nowrap;
}
.app-search-pop {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 8px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 40;
}
.app-search-empty {
  margin: 0;
  padding: 8px;
  font-size: 14px;
}
.search-results section + section {
  margin-top: 8px;
}
.ui .search-group {
  font: 600 11px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 6px 8px;
}
.search-results ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.search-results li {
  margin: 0;
}
.ui .search-results a {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
}
.ui .search-results a:hover,
.ui .search-results a:focus-visible {
  background: var(--sunken);
  outline-offset: -2px;
}
.search-results b {
  font: 600 14px/1.3 var(--font-display);
}
.search-results span {
  font-size: 12px;
  color: var(--muted);
}
.app-me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  max-width: 14rem;
}
.app-me::-webkit-details-marker {
  display: none;
}
.app-me:hover {
  border-color: var(--muted);
}
.app-me b {
  font: 600 14px/1 var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font: 600 12px/1 var(--font-display);
  flex: none;
}
.app-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 14rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.app-pop-right {
  left: auto;
  right: 0;
}
.app-pop form {
  margin: 0;
}
.ui .app-pop-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: 500 14px/1.3 var(--font-body);
  text-decoration: none;
  cursor: pointer;
}
.ui .app-pop-item:hover,
.ui .app-pop-item.is-active {
  background: var(--sunken);
}
.app-pop-note {
  margin: 0;
  padding: 6px 10px 8px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.ui .app-content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: none;
  width: 100%;
  min-width: 0;
  margin: 0;
  box-sizing: border-box;
}
.app-content:focus {
  outline: none;
}
/* Page sections that set their own bottom margins keep their rhythm inside the flex column. */
.app-content > * {
  margin-top: 0;
  margin-bottom: 0;
}
.app-content > .toast-region {
  margin: 0;
}

/* ------------------------------------------------------------------ components */

/* Page head: title, one line of context, actions on the right. */
.ui .page-head {
  display: flex;
  align-items: flex-end;
  gap: 12px 16px;
  flex-wrap: wrap;
}
.ui .page-head h1 {
  margin: 0;
  font-size: 1.75rem;
}
.ui .page-sub,
.ui .page-head > div > p {
  margin: 4px 0 0;
  color: var(--muted);
}
.ui .page-head .inline-form {
  margin: 0;
}
/* One box and its one button (a code, a secret, a file): the same height, like ReasonAction.
   More than one button together goes in an Actions group instead (actions-guard.test.ts). */
.ui .inline-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.ui .inline-form select,
.ui .inline-form .btn {
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  margin: 0;
}

/* Cards */
.ui .card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}
.ui .card-head h2 {
  font-size: 1rem;
  margin: 0;
}
.ui .card-head p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.card-head .spacer {
  flex: 1;
  min-width: 8px;
}
.card-more {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}
.span-3 {
  grid-column: span 3;
}
.span-4 {
  grid-column: span 4;
}
.span-5 {
  grid-column: span 5;
}
.span-6 {
  grid-column: span 6;
}
.span-7 {
  grid-column: span 7;
}
.span-8 {
  grid-column: span 8;
}
.span-12 {
  grid-column: span 12;
}
@media (max-width: 1180px) {
  .span-3 {
    grid-column: span 6;
  }
  .span-4,
  .span-5,
  .span-7,
  .span-8 {
    grid-column: span 12;
  }
}
@media (max-width: 560px) {
  .span-3,
  .span-6 {
    grid-column: span 12;
  }
}

/* Stat tiles: label, icon chip, value, trend. The older .stat and .count read the same way. */
.stat-tile {
  gap: 14px;
}
.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.stat-tile-label,
.ui .stat-label {
  font: 600 13px/1.3 var(--font-display);
  color: var(--muted);
}
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
}
.stat-icon .icon {
  width: 21px;
  height: 21px;
}
.stat-tile-value,
.ui .stat-value {
  font: 600 30px/1 var(--font-display);
  color: var(--ink);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-tile-value small {
  font: 600 15px/1 var(--font-display);
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 4px;
}
.stat-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.trend {
  font: 600 12px/1 var(--font-display);
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--body);
}
.trend.is-up {
  background: var(--good-soft);
  color: var(--good);
}
.trend.is-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.trend.is-down {
  background: var(--bad-soft);
  color: var(--bad);
}
.tone-blue {
  background: var(--primary-soft);
  color: var(--primary);
}
.tone-amber {
  background: var(--amber-soft);
  color: var(--warn);
}
.tone-good {
  background: var(--good-soft);
  color: var(--good);
}
.tone-bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.stat-strip,
.ui .stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 16px;
}
.ui .stat-row .stat,
.stat-strip > .card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 6px;
}
.stat-strip > .card {
  flex-direction: column;
  justify-content: flex-start;
}
.ui .stat-row .stat-value,
.stat-strip .stat-tile-value {
  font-size: 24px;
}
.ui .admin .counts {
  gap: 12px;
}
.ui .admin .count {
  border-radius: var(--r-md);
  border-color: var(--line);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
}
.ui .admin .count b {
  font: 600 20px/1.2 var(--font-display);
  color: var(--ink);
}

/* Pills */
.ui .admin .pill,
.ui .pill {
  display: inline-block;
  white-space: nowrap;
  font: 600 11px/1 var(--font-display);
  letter-spacing: 0.02em;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--sunken);
  color: var(--body);
}
.ui .admin .pill-signed,
.ui .admin .pill-campaign-completed {
  background: var(--good-soft);
  border-color: transparent;
  color: var(--good);
}
.ui .admin .pill-sent,
.ui .admin .pill-viewed,
.ui .admin .pill-default,
.ui .admin .pill-campaign-ready,
.ui .admin .pill-campaign-sending {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}
.ui .admin .pill-declined,
.ui .admin .pill-revoked,
.ui .admin .pill-campaign-cancelled {
  background: var(--bad-soft);
  border-color: transparent;
  color: var(--bad);
}
.ui .admin .pill-expired,
.ui .admin .pill-offer-not_taking,
.ui .admin .pill-campaign-paused,
.ui .admin .pill-soon {
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
}
.ui .admin .pill-draft,
.ui .admin .pill-archived,
.ui .admin .pill-offer-archived,
.ui .admin .pill-campaign-draft,
.ui .admin .pill-superseded {
  background: var(--sunken);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
}

/* Segmented control */
.seg {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--paper);
  border: 1px solid var(--line);
  gap: 2px;
  flex-wrap: wrap;
}
.ui .seg a,
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 7px;
  font: 600 13px/1.2 var(--font-display);
  text-decoration: none;
  cursor: pointer;
}
.ui .seg a[aria-current="true"],
.ui .seg a[aria-current="page"],
.seg button[aria-pressed="true"] {
  background: var(--primary-soft);
  color: var(--primary);
}
.ui .editor-switch {
  border-color: var(--line);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
  background: var(--paper);
  font: 600 13px/1.2 var(--font-display);
}
.ui .editor-switch-item {
  border-radius: 7px;
  border: 0;
  color: var(--muted);
  background: transparent;
}
.ui .editor-switch-item + .editor-switch-item {
  border-left: 0;
}
.ui .editor-switch-item.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* Buttons */
.ui .btn,
.ui .admin .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font: 600 14px/1.2 var(--font-display);
  text-decoration: none;
  text-align: center;
  /* Long labels (an email address in a button) wrap rather than widen the page. */
  max-width: 100%;
  overflow-wrap: anywhere;
}
.ui .btn .icon {
  width: 17px;
  height: 17px;
}
.ui .btn-primary,
.ui .admin .btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
}
.ui .btn-primary:hover {
  background: var(--brand-dark);
}
.ui .btn-secondary,
.ui .admin .btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line-strong);
}
.ui .btn-secondary:hover {
  border-color: var(--muted);
}
.ui .btn-small,
.ui .admin .btn-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 8px;
}
.ui .btn-block {
  display: flex;
  width: 100%;
}
.ui .btn-link-danger,
.ui .admin .btn-secondary.btn-link-danger {
  color: var(--bad);
}

/* Forms */
.ui input[type="email"],
.ui input[type="url"],
.ui input[type="tel"],
.ui input[type="search"],
.ui input[type="date"],
.ui input[type="datetime-local"],
.ui input[type="text"],
.ui input[type="password"],
.ui input[type="number"],
.ui select,
.ui textarea {
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  font: 15px/1.4 var(--font-body);
}
.ui input:focus-visible,
.ui select:focus-visible,
.ui textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 0;
  border-color: var(--primary);
}
.ui input[type="checkbox"],
.ui input[type="radio"] {
  accent-color: var(--primary);
}
.ui label,
.ui .form-field > label {
  color: var(--ink);
}
.ui .form-help {
  color: var(--muted);
}
.ui .form-section {
  border-top-color: var(--line);
}
.ui .form-section-intro h2 {
  font-size: 1rem;
}
.ui .form-section-intro p {
  color: var(--muted);
}
.ui .form-card,
.ui .getting-started,
.ui .funnel,
.ui .auth-card {
  border-color: var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.ui .form-save-bar {
  background: color-mix(in srgb, var(--canvas) 92%, transparent);
  backdrop-filter: blur(6px);
}

/* Tables: paper, a sunken header row, rows that highlight. */
.ui .admin table,
.ui table.data {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: 14px;
}
.ui .admin th,
.ui table.data th {
  font: 600 11px/1.2 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--sunken);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.ui .admin td,
.ui table.data td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.ui .admin tbody tr:last-child td {
  border-bottom: 0;
}
.ui .admin tbody tr:hover td {
  background: var(--sunken);
}
.ui .admin tr.has-problem td {
  background: var(--bad-soft);
}
.ui .table-scroll {
  border-radius: var(--r-lg);
}
.ui .form-card > table {
  box-shadow: none;
}

/* Tabs */
.ui .tabs {
  border-bottom-color: var(--line);
  gap: 4px;
}
.ui .tab {
  font: 600 14px/1 var(--font-display);
  padding: 10px 14px;
  border-bottom-width: 2px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ui .tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.ui .tab-count {
  font: 600 12px/1 var(--font-display);
  padding: 3px 7px;
  border-color: var(--line);
  background: var(--sunken);
}
.ui .tab.is-active .tab-count {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary);
}
.ui .bulk-bar {
  border-color: transparent;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: var(--r-md);
  box-shadow: none;
  font: 600 13px/1.2 var(--font-display);
}

/* Alerts and toasts */
.ui .alert {
  border-radius: var(--r-md);
  font-family: var(--font-body);
  border-color: var(--line);
  color: var(--ink);
}
.ui .alert-error {
  background: var(--bad-soft);
  border-color: color-mix(in srgb, var(--bad) 40%, transparent);
}
.ui .alert-success {
  background: var(--good-soft);
  border-color: color-mix(in srgb, var(--good) 40%, transparent);
}
.ui .alert-info {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}
.ui .toast {
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
}

/* Empty states */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 28px 16px;
  color: var(--muted);
}
.empty-state p {
  margin: 0;
  max-width: 34rem;
  color: var(--muted);
}
.empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--sunken);
  border: 1px solid var(--line);
  color: var(--muted);
}

/* Lists inside cards: notifications */
.notice-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notice-list li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  margin: 0;
}
/* Unread notices (Milestone 11c): a dot before the text. */
.ui .notice-list li.is-unread .notice-text b::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--primary);
  vertical-align: middle;
}
.ui .notice-choices .group-row th {
  padding-top: 18px;
  font: 600 11px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
}
.ui .notice-choices select {
  min-width: 13rem;
}
.ui .notice-choices .cell-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
/* On a phone each notice is a block: what it is, then How and About full width. */
@media (max-width: 700px) {
  .ui .notice-choices,
  .ui .notice-choices tbody,
  .ui .notice-choices tr,
  .ui .notice-choices td,
  .ui .notice-choices th {
    display: block;
    width: 100%;
  }
  .ui .notice-choices thead {
    display: none;
  }
  .ui .notice-choices tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }
  .ui .notice-choices tr.group-row {
    padding: 0;
    border-bottom: 0;
  }
  .ui .notice-choices td {
    padding: 4px 0;
    border: 0;
  }
  .ui .notice-choices td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    color: var(--muted);
  }
  .ui .notice-choices select {
    width: 100%;
    min-width: 0;
  }
  .ui .notice-choices td.about-none {
    display: none;
  }
}
.notice-list li:first-child {
  border-top: 0;
  padding-top: 0;
}
.notice-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.notice-mark .icon {
  width: 18px;
  height: 18px;
}
.notice-text b {
  display: block;
  color: var(--ink);
  font: 600 14px/1.3 var(--font-display);
}
.notice-text span {
  font-size: 13px;
  color: var(--muted);
}
.search-page-form {
  gap: 8px;
}
.search-page-form input[type="search"] {
  flex: 1;
  min-width: 12rem;
}

/* ------------------------------------------------------------------ charts (phase 2) */
.fill-primary {
  fill: var(--primary);
}
.fill-amber {
  fill: var(--amber);
}
.fill-good {
  fill: var(--good);
}
.fill-bad {
  fill: var(--bad);
}
.fill-muted {
  fill: var(--line-strong);
}
.stroke-primary {
  stroke: var(--primary);
}
.stroke-amber {
  stroke: var(--amber);
}
.stroke-good {
  stroke: var(--good);
}
.stroke-bad {
  stroke: var(--bad);
}
.stroke-muted {
  stroke: var(--line-strong);
}
.bg-primary {
  background: var(--primary);
}
.bg-amber {
  background: var(--amber);
}
.bg-good {
  background: var(--good);
}
.bg-bad {
  background: var(--bad);
}
.bg-muted {
  background: var(--line-strong);
}
.chart-wrap {
  overflow-x: auto;
}
.chart-wrap .chart {
  width: 100%;
  min-width: 560px;
  height: auto;
  display: block;
}
.chart .gridline {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .axis {
  fill: var(--muted);
  font: 500 11px var(--font-body);
}
.chart .axis-strong {
  fill: var(--ink);
  font-weight: 700;
}
.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--body);
}
.key {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
  flex: none;
}
.chart-empty {
  margin: 0;
  font-size: 14px;
}
.donut-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.donut-row .donut {
  width: 170px;
  height: 170px;
  flex: none;
}
.donut .ring {
  stroke: var(--sunken);
}
.donut-center {
  fill: var(--ink);
  font: 600 26px var(--font-display);
}
.donut-sub {
  fill: var(--muted);
  font: 500 12px var(--font-body);
}
.ui .donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 180px;
}
.donut-legend li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  margin: 0;
  color: var(--body);
}
.donut-legend .key {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  margin: 0;
}
.donut-legend b {
  font: 600 14px var(--font-display);
  color: var(--ink);
}
.donut-legend span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.hbars-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hbar {
  display: grid;
  grid-template-columns: minmax(64px, 110px) minmax(0, 1fr) minmax(56px, auto);
  gap: 12px;
  align-items: center;
  font-size: 14px;
}
.hbar-name {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hbar-track {
  width: 100%;
  height: 12px;
  display: block;
}
.hbar-track .track {
  fill: var(--sunken);
  stroke: var(--line);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
}
.hbar-n {
  text-align: right;
  font: 600 14px var(--font-display);
  color: var(--ink);
  white-space: nowrap;
}
.hbar-n span {
  color: var(--muted);
  font: 500 12px var(--font-body);
}
.sparkline .chart {
  width: 120px;
  height: 32px;
}

/* ------------------------------------------------------------------ dashboard (phase 2) */
.ui .page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}
/* A form here (a button that posts, the settings search) lines up with plain links: as a flex
   box it has no inline line box adding space under its button. */
.ui .page-actions > form {
  display: flex;
  align-items: center;
  margin: 0;
}
/* A segmented nav inside .admin mustn't pick up the older ".admin nav" bar style. */
.ui .admin nav.seg {
  padding: 4px;
  margin: 0;
  border: 1px solid var(--line);
  gap: 2px;
}
.tiles-note {
  margin: -8px 0 0;
  font-size: 13px;
}
.mini-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ui .mini {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
}
.ui a.mini:hover {
  border-color: var(--line-strong);
}
.mini b {
  display: block;
  font: 600 18px var(--font-display);
  color: var(--ink);
}
.ui .row-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.row-list li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  margin: 0;
}
.row-list li:first-child {
  border-top: 0;
  padding-top: 0;
}
.row-list .avatar {
  width: 36px;
  height: 36px;
}
.row-list form {
  margin: 0;
}
.row-who {
  min-width: 0;
}
.ui .row-who a {
  text-decoration: none;
  color: var(--ink);
}
.ui .row-who a:hover b {
  text-decoration: underline;
}
.row-who b {
  display: block;
  font: 600 14px/1.3 var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-who > span {
  font-size: 12px;
  color: var(--muted);
}
.row-amt {
  text-align: right;
  font: 600 14px var(--font-display);
  color: var(--ink);
}
.row-amt span {
  display: block;
  font: 500 12px var(--font-body);
  color: var(--muted);
}
.ui .deliveries {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 20px;
}
.ui .deliveries.is-warning {
  border-color: color-mix(in srgb, var(--bad) 45%, var(--line));
  background: color-mix(in srgb, var(--bad-soft) 55%, var(--paper));
}
.deliveries-text {
  flex: 1;
  min-width: 220px;
}
.deliveries-text b {
  color: var(--ink);
  font: 600 15px var(--font-display);
  display: block;
}
.deliveries-text span {
  font-size: 13px;
  color: var(--muted);
}
.rate-bar {
  display: block;
  width: 100%;
  max-width: 360px;
  height: 6px;
  margin-top: 8px;
  border-radius: 999px;
  overflow: hidden;
}
.ui .deliveries-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 0;
}
.deliveries-stats div {
  display: flex;
  flex-direction: column-reverse;
}
.deliveries-stats dt {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.deliveries-stats dd {
  margin: 0;
  font: 600 18px var(--font-display);
  color: var(--ink);
}
.deliveries-stats dd.is-good {
  color: var(--good);
}
.deliveries-stats dd.is-bad {
  color: var(--bad);
}
@media (max-width: 560px) {
  .mini-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .hbar {
    grid-template-columns: 72px minmax(0, 1fr) 64px;
  }
}

/* ------------------------------------------------------------------ list pages (phase 3) */
/* A table inside a card: toolbar on top, the table edge to edge, a pager below. */
.ui .table-card {
  padding: 0;
  gap: 0;
  overflow: hidden;
}
.ui .table-card .table-scroll {
  border-radius: 0;
}
.ui .table-card table,
.ui .card .table-scroll > table {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  width: 100%;
}
.ui .card > .table-scroll {
  border: 1px solid var(--line);
}
.ui .table-card > .table-scroll,
.ui .table-card form > .table-scroll {
  border: 0;
}
.ui .toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.ui .toolbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--muted);
  flex: 1 1 14rem;
  max-width: 320px;
  min-width: 0;
}
.ui .toolbar-search .icon {
  width: 16px;
  height: 16px;
}
.ui .toolbar-search input[type="search"] {
  border: 0;
  background: transparent;
  min-height: 0;
  padding: 0;
  flex: 1;
  min-width: 0;
  outline: none;
}
.ui .toolbar-search:focus-within {
  border-color: var(--primary);
}
.ui .chip-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
  font: 600 13px/1 var(--font-display);
  color: var(--body);
}
.ui .chip-select select {
  border: 0;
  min-height: 0;
  height: 34px;
  padding: 0 6px;
  background: transparent;
  color: var(--primary);
  font: 600 13px/1 var(--font-display);
}
/* Ops > Logins: checkbox and date filters as chips, sortable headers, the No business note. */
.ui .chip-check {
  padding: 0 12px;
  cursor: pointer;
}
.ui .chip-check input {
  margin: 0;
  min-height: 0;
}
.ui .chip-check:has(input:checked) {
  border-color: var(--primary);
  color: var(--primary);
}
.ui .chip-select input[type="date"] {
  border: 0;
  min-height: 0;
  height: 34px;
  padding: 0 6px;
  background: transparent;
  color: var(--primary);
  font: 600 13px/1 var(--font-display);
}
.ui .sort-link {
  color: inherit;
  text-decoration: none;
}
.ui .sort-link.is-active,
.ui .sort-link:hover {
  color: var(--primary);
}
.ui .logins-note {
  margin: 12px 16px 0;
}
.ui .count-note {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}
.ui.js [data-auto-submit] button[type="submit"] {
  display: none;
}
.ui .table-card .bulk-bar {
  position: static;
  margin: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}
.ui table.data .right,
.ui .admin th.right,
.ui .admin td.right {
  text-align: right;
}
.ui .nowrap {
  white-space: nowrap;
}
.client-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 12rem;
}
.ui .client-cell a {
  text-decoration: none;
  color: var(--ink);
}
.ui .client-cell a:hover b {
  text-decoration: underline;
}
.client-cell b {
  display: block;
  font: 600 14px/1.3 var(--font-display);
}
.client-cell > div > span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
/* Business clients (ARCHITECTURE 45.2): the name with its Business tag. */
.client-cell .client-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.ui .client-type-tag {
  vertical-align: middle;
}
.ui .bd-client .client-name,
.ui .client-name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.ui .client-type-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}
.money {
  font: 600 14px var(--font-display);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.money span {
  display: block;
  font: 500 12px var(--font-body);
  color: var(--muted);
}
.season-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ui .season-cell a.pill {
  text-decoration: none;
}
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  font: 600 11px/1 var(--font-display);
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--sunken);
  border: 1px solid var(--line);
  color: var(--body);
  white-space: nowrap;
}
.ui .admin .pill-none {
  background: var(--sunken);
  border: 1px solid var(--line);
  color: var(--muted);
}
.ui a.stat-link {
  text-decoration: none;
  color: inherit;
}
.ui a.stat-link:hover {
  border-color: var(--line-strong);
}
.ui .pager {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
  margin: 0;
  border-bottom: 0;
}
.pager .spacer {
  flex: 1;
  min-width: 8px;
}
.ui .pager a {
  min-width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--body);
  font: 600 13px/1 var(--font-display);
  text-decoration: none;
}
.ui .pager a[aria-current="page"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.ui .btn-link {
  color: var(--primary);
  font-weight: 600;
}

/* ------------------------------------------------------------------ detail pages (phase 3) */
/* Summary first: the facts staff look for, in a card, then the page's sections as cards. */
.ui .facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 14px 20px;
  margin: 0;
}
.ui .facts div {
  min-width: 0;
}
.ui .facts dt {
  font: 600 12px/1.3 var(--font-display);
  color: var(--muted);
  margin: 0 0 4px;
}
.ui .facts dd {
  margin: 0;
  color: var(--ink);
  font: 600 15px/1.35 var(--font-display);
  overflow-wrap: anywhere;
}
.ui .summary-card .counts {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.ui .admin .two-col {
  gap: 20px;
  align-items: start;
}
.ui .admin .two-col > section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}
.ui .admin .two-col > section > h2:first-child {
  margin-top: 0;
}
.ui .admin .two-col > section > h2 {
  font-size: 1rem;
  margin: 1.5rem 0 0.75rem;
}
.ui .admin .two-col > section .form-card {
  border: 0;
  box-shadow: none;
  padding: 0;
}
.ui .admin .two-col > section > table,
.ui .admin .two-col > section .table-scroll > table {
  box-shadow: none;
}

/* ------------------------------------------------------------------ settings (phase 3) */
.settings-layout {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.ui .admin nav.section-menu {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 0;
  margin: 0;
  border: 0;
}
.section-menu-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.section-menu-label {
  font: 600 11px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 10px 6px;
}
.ui .section-menu a {
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--body);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.ui .section-menu a:hover {
  background: var(--paper);
  color: var(--ink);
}
/* Settings search (Milestone 12): the box sits in the page head; matches drop below it. */
.settings-search {
  position: relative;
  width: 18rem;
  max-width: 100%;
}
.ui .settings-search input[type="search"] {
  width: 100%;
}
.settings-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  min-width: 18rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 6px;
  max-height: 60vh;
  overflow-y: auto;
  z-index: 40;
}
.ui .settings-search-results ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ui .settings-search-results a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
}
.ui .settings-search-results a:hover,
.ui .settings-search-results a:focus {
  background: var(--sunken);
  outline: none;
}
.ui .settings-search-results a .muted {
  display: block;
  font-size: 12px;
}
.settings-search-none {
  margin: 0;
  padding: 8px 10px;
  font-size: 14px;
}
.ui .settings-search-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-left: 18px;
}
.ui .form-section.is-found,
.ui .setting.is-found {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  transition: outline-color 0.3s;
}
.settings-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.settings-body > form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
/* Each settings section is one card: its title and note on top, the fields below. */
.ui .settings-body .form-section {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
  scroll-margin-top: 84px;
}
.ui .settings-body .form-section .form-card {
  border: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}
@media (max-width: 1024px) {
  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .ui .admin nav.section-menu {
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
  }
  .section-menu-group {
    flex-direction: row;
    flex: none;
  }
  .section-menu-label {
    display: none;
  }
  .ui .section-menu a {
    white-space: nowrap;
    background: var(--paper);
    border: 1px solid var(--line);
  }
}

/* ------------------------------------------------------------------ sign-in (phase 3) */
.ui main.page.admin:has(.auth-wrap) {
  max-width: none;
  padding: 0 16px 48px;
  min-height: 100vh;
}
.auth-wrap {
  max-width: 28rem;
  margin: 0 auto;
  padding-top: 8vh;
}
.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.ui .auth-card.card {
  margin: 0;
  max-width: none;
  padding: 28px;
  gap: 12px;
}
.ui .auth-card h1 {
  font-size: 1.5rem;
  margin: 0 0 4px;
}
.ui .auth-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ui .auth-card .btn-primary {
  width: 100%;
}
.ui .auth-card input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
}

/* ------------------------------------------------------------------ ops console (phase 4) */
/* Same shell as a business's admin, marked so nobody mistakes one for the other. */
.ops-badge {
  font: 600 11px/1 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
}
.ops-note {
  margin: -6px 6px 0;
  font-size: 12px;
  color: var(--muted);
}
.ops-top-label {
  font: 600 13px/1 var(--font-display);
  color: var(--warn);
  background: var(--amber-soft);
  padding: 7px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.ui .is-ops .app-side {
  border-right-color: color-mix(in srgb, var(--amber) 35%, var(--line));
}
.side-collapsed .ops-badge,
.side-collapsed .ops-note {
  display: none;
}
.ui .is-ops .app-content > .form-section,
.ui .is-ops .app-content > form > .form-section {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.ui .is-ops .app-content > form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ui .is-ops .form-section .form-card {
  border: 0;
  box-shadow: none;
  padding: 0;
  background: transparent;
}
.ui .health-tile.is-warn {
  border-color: color-mix(in srgb, var(--bad) 45%, var(--line));
  background: color-mix(in srgb, var(--bad-soft) 55%, var(--paper));
}
.ui .health-tile.is-warn .stat-tile-value {
  color: var(--bad);
}
@media (max-width: 560px) {
  .ops-top-label {
    display: none;
  }
}

/* ------------------------------------------------------------------ small screens */
@media (max-width: 860px) {
  .app,
  .side-collapsed .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .app-side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(288px, 86vw);
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
    visibility: hidden;
  }
  /* Opened by the menu button: #app-menu without scripts, .menu-open with them. */
  .app-side:target,
  .menu-open .app-side {
    transform: none;
    visibility: visible;
  }
  .ui .app-side:target ~ .app-scrim,
  .ui.menu-open .app-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 49;
    background: rgba(12, 17, 29, 0.45);
  }
  /* A collapsed choice from a wide screen doesn't apply to the phone menu. */
  .side-collapsed .app-biz-text,
  .side-collapsed .app-biz-caret,
  .side-collapsed .app-nav-label,
  .side-collapsed .app-nav-text,
  .side-collapsed .app-count {
    display: revert;
  }
  .side-collapsed .app-brand .brand-logo-full {
    display: inline-flex;
  }
  .side-collapsed .app-brand .brand-logo-mark {
    display: none;
  }
  .side-collapsed .app-nav a,
  .side-collapsed .app-biz,
  .side-collapsed .app-brand {
    justify-content: flex-start;
  }
  .ui .app-close,
  .ui .app-menu-btn {
    display: grid;
  }
  .ui.js .app-collapse-btn {
    display: none;
  }
  .app-top {
    padding: 10px 16px;
    gap: 8px;
  }
  .ui .app-content {
    padding: 20px 16px 48px;
  }
  .app-me b,
  .kbd {
    display: none;
  }
  .app-me {
    padding: 4px;
  }
}
@media (max-width: 560px) {
  /* Phones get a search button that opens the search page instead of the box. */
  .ui .app-search {
    display: none;
  }
  .ui .app-search-link {
    display: grid;
  }
  .ui .page-head h1 {
    font-size: 1.5rem;
  }
  .ui .card:not(.table-card) {
    padding: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .app,
  .app-side {
    transition: none;
  }
}
@media print {
  .app-side,
  .app-top,
  .skip-link {
    display: none;
  }
  .app {
    display: block;
  }
}

/* ------------------------------------------------------------------ catalog (Milestone 10) */
.ui .check-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 6px 16px;
}
.ui .check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: 14px;
}
.ui .check-row input {
  margin-top: 3px;
  accent-color: var(--primary);
}
.ui .catalog-suggest {
  padding: 16px 20px;
}
.ui .catalog-suggest summary {
  cursor: pointer;
  font-family: var(--font-display);
}
.ui .catalog-suggest-set {
  border: 0;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0 16px;
}
.ui .catalog-suggest-set legend {
  font: 600 13px/1 var(--font-display);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0 6px;
}
.ui .card-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}
/* A table card with a heading (the catalog's categories): the heading keeps the card's padding. */
.ui .table-card > .card-head {
  padding: 16px 20px 12px;
}

/* ------------------------------------------------------------------ proposal builder (Milestone 10) */
.ui .bd-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-bottom: 14px;
}
.ui .bd-crumbs {
  font: 600 13px/1 var(--font-display);
  color: var(--muted);
}
.ui .bd-crumbs a {
  color: var(--muted);
}
.ui .bd-client {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ui .bd-client > span:last-child {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}
.ui .bd-client strong {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
}
.ui .bd-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
}
.ui .bd-steps li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--sunken);
  font: 600 12px/1 var(--font-display);
  color: var(--muted);
}
.ui .bd-steps b {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--line);
  color: var(--body);
  font-size: 11px;
}
.ui .bd-steps .is-on {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}
.ui .bd-steps .is-on b {
  background: var(--primary);
  color: var(--primary-ink);
}
.ui .bd-status {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}
.ui .bd-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (min-width: 1100px) {
  .ui .bd-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
  .ui .bd-side {
    position: sticky;
    top: 84px;
  }
}
.ui .bd-main,
.ui .bd-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.ui .bd-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ui .bd-mode button {
  font: inherit;
}
.ui .bd-mode-note {
  margin: 0;
  font-size: 13px;
}
.ui .bd-pkg {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--sunken);
}
.ui .bd-pkg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ui .bd-pkg-name {
  font: 600 15px var(--font-display);
  flex: 1 1 10rem;
  min-width: 0;
}
.ui .bd-pkg-badge {
  flex: 0 1 11rem;
  min-width: 0;
}
.ui .bd-pkg-total {
  font: 600 16px var(--font-display);
  color: var(--ink);
  white-space: nowrap;
}
.ui .bd-pkg-tools {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.ui .bd-lines,
.ui .bd-addons {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ui .bd-line {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto 7rem 6.5rem 1.9rem;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.ui .bd-line.is-ref {
  grid-template-columns: 1.5rem minmax(0, 1fr) 6.5rem 1.9rem;
  border-style: dashed;
}
.ui .bd-line-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ui .bd-line-main input {
  font-weight: 600;
  width: 100%;
  min-width: 0;
}
.ui .bd-line-main .muted {
  font-size: 12px;
}
/* A typed line's description and what it includes (2026-10-24): a row of their own under the
   line, as wide as everything after the move buttons; side by side, stacked on a phone. */
.ui .bd-line-words {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}
.ui .bd-line-words textarea {
  width: 100%;
  min-width: 0;
  font-size: 14px;
}
.ui .bd-tag {
  display: inline-block;
  font: 600 10px/1 var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--sunken);
  border: 1px solid var(--line);
  color: var(--muted);
}
.ui .bd-stepper {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}
.ui .bd-stepper button {
  width: 30px;
  border: 0;
  background: var(--sunken);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}
.ui .bd-stepper input {
  width: 3rem;
  border: 0;
  border-radius: 0;
  text-align: center;
  padding: 6px 2px;
}
.ui .bd-price {
  width: 100%;
  min-width: 0;
  text-align: right;
}
.ui .bd-line-amount {
  text-align: right;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.ui .bd-line-amount.is-unpriced {
  color: var(--warn);
}
.ui .bd-x {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
}
/* Move an item or add-on up or down: the order here is the order the client sees. */
.ui .bd-move {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ui .bd-move button {
  width: 1.5rem;
  height: 1.2rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.ui .bd-move button:hover:not([disabled]) {
  color: var(--ink);
  border-color: var(--ink);
}
.ui .bd-move button[disabled] {
  opacity: 0.35;
  cursor: default;
}
.ui .bd-x:hover {
  color: var(--bad);
  border-color: var(--bad);
}
.ui .bd-empty {
  padding: 6px 2px;
  font-size: 13px;
}
.ui .bd-fixed-total {
  margin: 0;
  text-align: right;
}
.ui .bd-picker {
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 10px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui .bd-picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 18rem;
  overflow: auto;
}
.ui .bd-picker-list button {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0 10px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  padding: 8px 6px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.ui .bd-picker-list button:hover {
  background: var(--primary-soft);
}
.ui .bd-picker-list .muted {
  grid-column: 1;
  font-size: 12px;
}
.ui .bd-picker-list .num {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}
.ui .bd-addon {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--paper);
}
.ui .bd-addon-row {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) minmax(0, 12rem) minmax(0, 11rem) 7rem 1.9rem;
  gap: 8px;
  align-items: center;
}
.ui .bd-addon-row input,
.ui .bd-addon-row select {
  min-width: 0;
  width: 100%;
}
/* Billing (Milestone 24): a typed item's frequency or "Billed as used", and a rate's unit. */
.ui .bd-addon-terms {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.ui .bd-addon-terms .muted,
.ui .bd-addon-kind-none {
  font-size: 12px;
}
.ui .bd-line-main select {
  align-self: flex-start;
  max-width: 100%;
  font-size: 12px;
  padding: 3px 6px;
}
.ui .bd-line-main .bd-unit,
.ui .bd-addon-terms .bd-unit {
  font-weight: 400;
  font-size: 12px;
  max-width: 12rem;
}
.ui .bd-per {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.ui .bd-term {
  display: block;
  text-align: right;
  white-space: nowrap;
}
.ui .bd-units {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.ui .bd-units .bd-unit {
  width: 8.5rem;
  max-width: 100%;
}
.ui .bd-need-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--warn);
}
.ui .bd-no-qty {
  border: 0;
  font-size: 12px;
  padding: 0 4px;
}
.ui .bd-addon-rate {
  margin: 4px 0 0 2rem;
  font-size: 12px;
}
.ui .bd-addon-range {
  display: flex;
  gap: 12px;
  font-size: 13px;
}
.ui .bd-addon-range input {
  width: 4rem;
}
.ui .bd-addon-with {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  font-size: 13px;
}
.ui .bd-looks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 10px;
}
.ui .bd-look {
  position: relative;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  background: var(--paper);
}
.ui .bd-look input {
  position: absolute;
  opacity: 0;
}
.ui .bd-look.is-on,
.ui .bd-look:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.ui .bd-look:has(input:focus-visible) {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
.ui .bd-look-thumb {
  height: 4.5rem;
  border-radius: 8px;
  background: var(--sunken);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
}
.ui .bd-look-thumb i {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--line-strong);
}
.ui .bd-look-thumb i:first-child {
  height: 12px;
  background: var(--biz-chip, var(--primary));
}
.ui .bd-look-thumb i:last-child {
  width: 60%;
}
.ui .bd-look-name {
  font: 600 13px/1.3 var(--font-display);
  color: var(--ink);
}
.ui .bd-sum-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.ui .bd-sum-total {
  border-bottom: 0;
  font: 600 15px var(--font-display);
  color: var(--ink);
}
.ui .bd-checks {
  list-style: none;
  margin: 8px 0 4px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.ui .bd-checks .is-good span {
  color: var(--good);
  font-weight: 800;
}
.ui .bd-checks .is-bad {
  color: var(--bad);
}
.ui .bd-checks .is-warn span {
  color: var(--warn);
  font-weight: 800;
}
.ui .bd-wide {
  width: 100%;
  justify-content: center;
}
.ui .bd-side-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}
.ui .bd-previewed {
  margin: 0;
  color: var(--good);
  font-weight: 600;
}
.ui .bd-doc-frame {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.ui .bd-doc-frame iframe {
  display: block;
  width: 100%;
  height: 78vh;
  border: 0;
}
.ui .bd-dialog {
  width: min(64rem, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: var(--paper);
  color: var(--body);
}
.ui .bd-dialog::backdrop {
  background: rgba(12, 17, 29, 0.55);
}
.ui .bd-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.ui .bd-dialog-search {
  width: 100%;
  margin: 10px 0;
}
.ui .bd-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 14px;
}
.ui .bd-tpl {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: var(--sunken);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--ink);
}
.ui .bd-tpl.is-on {
  border-color: var(--primary);
}
.ui .bd-tpl-frame {
  height: 16rem;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper);
  position: relative;
}
/* A template that can't be used: greyed, not a button, with why under its name. */
.ui .bd-tpl.is-excluded {
  cursor: default;
  border-style: dashed;
  color: var(--muted);
}
.ui .bd-tpl-blank {
  height: 5rem;
  background: repeating-linear-gradient(
    -45deg,
    var(--sunken),
    var(--sunken) 8px,
    var(--line) 8px,
    var(--line) 9px
  );
}
.ui .bd-tpl-why {
  font-size: 0.85rem;
}
.ui .bd-tpl-frame iframe {
  width: 400%;
  height: 400%;
  border: 0;
  transform: scale(0.25);
  transform-origin: 0 0;
  pointer-events: none;
}
.ui .bd-start {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui .bd-start-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}
.ui .bd-start-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.ui .bd-start-option > span {
  display: flex;
  flex-direction: column;
}
/* "Start from a preset" next to "Start from scratch"; stacked on a phone. */
.ui .bd-start-pair {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 8px;
}
.ui .bd-start-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.ui .bd-start-group h3 {
  margin: 0;
  font: 600 14px/1.3 var(--font-display);
}
.ui .bd-start-empty {
  margin: 0;
  padding: 12px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
}
@media (max-width: 700px) {
  .ui .bd-start-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}
.ui .bd-draft-list,
.ui .bd-usage {
  margin: 0;
  padding-left: 18px;
}
.ui .bd-draft-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.ui .bd-new-saved {
  display: flex;
  /* A row, though it's a .card (a column): the name grows beside its label and Create. */
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
}
.ui .bd-new-saved input {
  flex: 1 1 14rem;
}
@media (max-width: 700px) {
  .ui .bd-line {
    grid-template-columns: 1.5rem minmax(0, 1fr) auto 1.9rem;
  }
  .ui .bd-line .bd-move {
    grid-column: 1;
    grid-row: 1 / span 3;
    align-self: start;
  }
  .ui .bd-line .bd-line-main {
    grid-column: 2 / -1;
  }
  .ui .bd-line .bd-line-words {
    grid-template-columns: minmax(0, 1fr);
  }
  .ui .bd-line .bd-stepper {
    grid-column: 2;
  }
  .ui .bd-line .bd-price {
    grid-column: 2;
  }
  .ui .bd-line .bd-line-amount {
    grid-column: 3;
  }
  .ui .bd-line.is-ref .bd-line-amount {
    grid-column: 2;
  }
  .ui .bd-addon-row {
    grid-template-columns: 1.5rem minmax(0, 1fr) 1.9rem;
  }
  .ui .bd-addon-row .bd-move {
    grid-column: 1;
    grid-row: 1 / span 3;
    align-self: start;
  }
  .ui .bd-addon-row select,
  .ui .bd-addon-row .bd-addon-terms,
  .ui .bd-addon-row .bd-addon-kind-none,
  .ui .bd-addon-row .bd-price {
    grid-column: 2 / -1;
  }
  .ui .bd-addon-row .bd-x {
    grid-column: 3;
    grid-row: 1;
  }
  .ui .bd-steps li {
    padding: 5px 8px;
  }
}

/* A warning pill: a template that still sets its own prices (Milestone 10, until phase 3). */
.ui .pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}

/* Moving templates' prices into saved builds (Milestone 10 phase 3). */
.ui .admin .mg-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ui .admin .mg-list li.action-row {
  display: grid;
}
.ui .admin .mg-compare {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr));
}
.ui .admin .mg-client {
  min-width: 0;
}
.ui .admin .mg-client h3 {
  font-size: 14px;
  margin: 0 0 6px;
}
.ui .admin .mg-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.ui .admin .mg-differs td {
  background: var(--warn-soft);
}
.ui .admin .mg-blockers {
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}
.ui .admin .mg-notes li + li,
.ui .admin .mg-blockers li + li {
  margin-top: 6px;
}
.ui .admin .mg-warn {
  color: var(--warn);
}

/* Campaigns on builds (Milestone 10 phase 4). */
.ui .admin .cp-review ul {
  margin: 0 0 12px;
}
.ui .admin .cp-flagged td {
  background: var(--warn-soft);
}
.ui .admin .form-sub {
  font-size: 15px;
  margin: 18px 0 4px;
}

/* Ops Controls on a business (Milestone 9f phase 2). */
.ui .ctl-row {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}
.ui .ctl-row:first-child {
  border-top: 0;
  padding-top: 0;
}
.ui .ctl-head h3 {
  font-size: 15px;
  margin: 0 0 2px;
}
.ui .ctl-head p {
  margin: 0 0 8px;
}
.ui .ctl-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
}
.ui .ctl-form input[type="text"] {
  flex: 1 1 220px;
  min-width: 0;
}
.ui .ctl-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.ui .ctl-list li {
  border-top: 1px dashed var(--border);
  padding: 8px 0;
}

/* Templates list (Milestone 11): name with its kind under it, wrapping row actions, inline rename */
.ui .admin .templates-list .cell-sub,
.ui .admin .logins-list .cell-sub,
.ui .admin .feedback-table .cell-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
/* A table's actions cell sizes to its fixed slots (components Actions). */
.ui .admin td.row-actions {
  width: 1%;
  white-space: nowrap;
}
.ui .admin .row-rename > summary {
  list-style: none;
  cursor: pointer;
}
.ui .admin .row-rename > summary::-webkit-details-marker {
  display: none;
}
.ui .admin .row-rename[open] > summary {
  border-color: var(--primary);
}
.ui .admin .rename-form {
  display: grid;
  gap: 6px;
  margin-top: 6px;
  padding: 10px;
  min-width: 240px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
}
.ui .admin .rename-form label {
  font-size: 12px;
  color: var(--muted);
}
/* On a phone each template is a card: name, then labelled status, use, and date, then actions. */
@media (max-width: 700px) {
  .ui .admin .templates-list,
  .ui .admin .templates-list tbody,
  .ui .admin .templates-list tr,
  .ui .admin .templates-list td,
  .ui .admin .logins-list,
  .ui .admin .logins-list tbody,
  .ui .admin .logins-list tr,
  .ui .admin .logins-list td,
  .ui .admin .feedback-table,
  .ui .admin .feedback-table tbody,
  .ui .admin .feedback-table tr,
  .ui .admin .feedback-table td,
  .ui .admin .document-review,
  .ui .admin .document-review tbody,
  .ui .admin .document-review tr,
  .ui .admin .document-review td {
    display: block;
    width: 100%;
  }
  .ui .admin .templates-list thead,
  .ui .admin .logins-list thead,
  .ui .admin .feedback-table thead,
  .ui .admin .document-review thead {
    display: none;
  }
  .ui .admin .templates-list tr,
  .ui .admin .logins-list tr,
  .ui .admin .feedback-table tr,
  .ui .admin .document-review tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }
  .ui .admin .templates-list td,
  .ui .admin .logins-list td,
  .ui .admin .feedback-table td,
  .ui .admin .document-review td {
    padding: 2px 0;
    border: 0;
  }
  .ui .admin .templates-list td[data-label]::before,
  .ui .admin .logins-list td[data-label]::before,
  .ui .admin .feedback-table td[data-label]::before,
  .ui .admin .document-review td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-size: 12px;
  }
  .ui .admin .templates-list .row-actions,
  .ui .admin .logins-list .row-actions,
  .ui .admin .document-review .row-actions {
    width: 100%;
    padding-top: 8px;
    white-space: normal;
  }
}
.ui .admin .table-foot {
  margin: 0;
  padding: 12px 16px;
  font-size: 13px;
  border-top: 1px solid var(--line);
}

/* New template's "Start from" (Milestone 11 phase 4): three choices as cards. */
.ui .start-from {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.ui .start-from legend {
  padding: 0;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--ink);
}
.ui .start-choices {
  display: grid;
  gap: 0.5rem;
}
@media (min-width: 720px) {
  .ui .start-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.ui .start-choice {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  cursor: pointer;
}
.ui .start-choice:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
  background: var(--primary-soft);
}
.ui .start-choice:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}
.ui .start-choice input {
  margin-top: 0.2rem;
  accent-color: var(--primary);
}
.ui .start-choice > span {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.ui .start-choice strong {
  color: var(--ink);
}
.ui .start-choice .muted {
  font-size: 0.85rem;
}

/* Proposal versions (Milestone 11b): one row per version, stacked, so phones never scroll sideways. */
.ui .version-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ui .version-list li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.ui .version-list li:first-child {
  border-top: 0;
}
.ui .version-list .version-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ui .version-list p {
  margin: 4px 0 0;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
/* A checkbox row inside a stacked form keeps its box beside its words (Withdraw, 11b). */
.ui .stack label.check-row {
  flex-direction: row;
  align-items: flex-start;
}
.ui .stack .form-check > label {
  flex-direction: row;
  align-items: center;
  font-weight: 400;
}
/* Copy link's fallback when the clipboard isn't allowed (Milestone 12). */
.ui .copy-link-box {
  width: 100%;
  margin-top: 4px;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}
.ui .link-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.ui .link-copy .link-box {
  flex: 1 1 20rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Proposal page actions: labeled groups of same-size buttons (links and form buttons alike). */
.ui .admin .pa-groups {
  margin: 8px 0 20px;
}
.ui .admin .pa-group + .pa-group {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.ui .admin .pa-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ui .admin .pa-group .form-help {
  margin: 8px 0 0;
}
.ui .admin .pa-group .form-help:empty {
  display: none;
}

/* Ops people list (9c): the Resend button keeps its words on one line when the table scrolls. */
.ui .admin .people-table .btn {
  white-space: nowrap;
  overflow-wrap: normal;
}

.ui .admin .users-list td[data-label="Role"] {
  white-space: nowrap;
}
.ui .admin .users-list td[data-label="State"] .pill {
  white-space: normal;
  line-height: 1.35;
}

/* ------------------------------------------------------------------ action buttons
   One look for every set of actions (components.tsx Actions, Action, ReasonAction): every
   button in a group the same width and height, links and form buttons alike. */
.ui .btn-danger,
.ui .admin .btn-danger {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
}
.ui .btn-danger:hover {
  filter: brightness(0.92);
}
.ui .actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(9.5rem, 1fr);
  width: max-content;
  max-width: 100%;
  gap: 8px;
  align-items: stretch;
  margin: 0;
}
.ui .admin .actions {
  margin: 12px 0;
}
.ui .admin td .actions,
.ui .admin .action-row .actions {
  margin: 0;
}
/* Fixed slots: one row of same-width slots, each action in the same place on every row. */
.ui .actions[class*="actions-cols-"] {
  grid-auto-flow: column;
  grid-template-columns: none;
  grid-auto-columns: 7.5rem;
}
.ui .actions > *,
.ui .actions > form {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-width: 0;
}
.ui .actions > form > .btn,
.ui .actions > details > summary.btn {
  flex: 1 1 auto;
}
.ui .actions .btn,
.ui .actions > details > summary.btn,
.ui .reason-action .btn {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
  line-height: 1.2;
  border-radius: 8px;
  white-space: nowrap;
  text-align: center;
}
.ui .actions[class*="actions-cols-"] .btn {
  white-space: normal;
}
/* A disclosure in a group (Edit name) opens over the page rather than stretching its slot. */
.ui .actions > details {
  position: relative;
}
.ui .actions > details > summary {
  list-style: none;
  cursor: pointer;
}
.ui .actions > details > summary::-webkit-details-marker {
  display: none;
}
.ui .actions > details > .rename-form,
.ui .actions > details > .action-pop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  width: 16rem;
  white-space: normal;
  box-shadow: var(--shadow);
}
td .actions {
  width: max-content;
}
.ui .reason-action {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 0;
}
.ui .reason-action input[type="text"],
.ui .reason-action input[type="search"] {
  box-sizing: border-box;
  height: 40px;
  min-height: 40px;
  min-width: 0;
  width: 100%;
  margin: 0;
}
.ui .reason-action .btn {
  height: 40px;
  min-height: 40px;
}
.ui .reason-buttons {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 12rem;
  gap: 8px;
}
@media (max-width: 700px) {
  .ui .actions {
    grid-auto-flow: row;
    /* Two to a row, and a lone button takes the whole row. */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
    width: 100%;
  }
  .ui .actions[class*="actions-cols-"] {
    grid-auto-flow: column;
    grid-template-columns: none;
    width: max-content;
  }
  .ui .actions .btn {
    white-space: normal;
  }
  td .actions {
    width: 100%;
  }
  .ui .reason-action {
    grid-template-columns: minmax(0, 1fr);
  }
  .ui .reason-buttons {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* A list item with its words on the left and its actions at the right edge, the same on every
   row (components Actions). */
.ui .action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
@media (max-width: 700px) {
  .ui .action-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* What a disclosure in an action group opens (a confirmation, a small form). */
.ui .actions .action-pop {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
}
.ui .actions .action-pop p {
  margin: 0;
  font-size: 13px;
}

/* Choices in a form (resume email's send or discard): a framed group with room below it. */
.ui .admin fieldset {
  margin: 0 0 14px;
  padding: 10px 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.ui .admin legend {
  padding: 0 6px;
  font-weight: 600;
  color: var(--ink);
}
/* Cards straight inside one form (Settings > Notices) keep the usual gap. */
.ui .admin form > .card + .card {
  margin-top: 16px;
}
.ui .form-save-bar .btn {
  white-space: nowrap;
}
@media (max-width: 700px) {
  .settings-search {
    width: 100%;
  }
}

/* ------------------------------------------------------------------ icons for actions
   An action with an icon (components.tsx Action icon) shows its words while there's room. When
   a table is short of room, its fixed-slot actions show only their icons, in 40px slots; the
   words stay for screen readers and as the tooltip. */
.ui .actions .btn > .icon {
  display: none;
}
.ui .table-scroll,
.ui .table-card {
  container-type: inline-size;
}
@container (max-width: 1400px) {
  .ui .actions[class*="actions-cols-"] .btn > .icon {
    display: block;
    width: 18px;
    height: 18px;
    flex: none;
  }
  .ui .actions[class*="actions-cols-"] .btn > .action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
  .ui .actions[class*="actions-cols-"] .btn {
    padding: 0;
  }
  .ui .actions[class*="actions-cols-"] {
    grid-auto-columns: 40px;
    gap: 6px;
  }
  .ui td .actions {
    width: max-content;
  }
}

/* ------------------------------------------------------------------ credits (Milestone 13) */
.ui .credit-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.ui .credit-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ui .credit-stats b {
  font: 600 24px/1.1 var(--font-display);
  color: var(--ink);
}
.ui .credit-stats span {
  font-size: 13px;
  color: var(--muted);
}
.ui .tone-bad-text {
  color: var(--bad) !important;
}
.ui .credit-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--sunken);
  overflow: hidden;
  min-width: 80px;
}
td .credit-bar {
  display: inline-block;
  width: 80px;
  vertical-align: middle;
}
.ui .credit-bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
}
.ui .credit-bar.warn > i {
  background: var(--amber);
}
.ui .credit-bar.bad > i {
  background: var(--bad);
}
.credit-bar-w0 {
  width: 0%;
}
.credit-bar-w5 {
  width: 5%;
}
.credit-bar-w10 {
  width: 10%;
}
.credit-bar-w15 {
  width: 15%;
}
.credit-bar-w20 {
  width: 20%;
}
.credit-bar-w25 {
  width: 25%;
}
.credit-bar-w30 {
  width: 30%;
}
.credit-bar-w35 {
  width: 35%;
}
.credit-bar-w40 {
  width: 40%;
}
.credit-bar-w45 {
  width: 45%;
}
.credit-bar-w50 {
  width: 50%;
}
.credit-bar-w55 {
  width: 55%;
}
.credit-bar-w60 {
  width: 60%;
}
.credit-bar-w65 {
  width: 65%;
}
.credit-bar-w70 {
  width: 70%;
}
.credit-bar-w75 {
  width: 75%;
}
.credit-bar-w80 {
  width: 80%;
}
.credit-bar-w85 {
  width: 85%;
}
.credit-bar-w90 {
  width: 90%;
}
.credit-bar-w95 {
  width: 95%;
}
.credit-bar-w100 {
  width: 100%;
}
.ui .credit-kvs {
  display: grid;
  gap: 6px;
  margin: 12px 0 4px;
}
.ui .credit-kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.ui .credit-kv span {
  color: var(--muted);
}
.ui .credit-plus {
  color: var(--good);
}
.ui .credit-minus {
  color: var(--ink);
}
.ui .actions .action-pop.action-pop-wide {
  width: min(30rem, 90vw);
}
.ui .stack {
  display: grid;
  gap: 12px;
}
.ui th .sort-link {
  color: inherit;
  text-decoration: none;
}
.ui th .sort-link.is-active,
.ui th .sort-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* The credits chip, its panel, and the confirmation (Milestone 13, design: credits.html). */
.ui .alert-warn {
  background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
  color: var(--ink);
}
.credit-menu {
  position: relative;
}
.ui .credit-chip {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 600 13px/1 var(--font-display);
  white-space: nowrap;
}
.ui .credit-chip::-webkit-details-marker {
  display: none;
}
.ui .credit-chip.tone-warn {
  border-color: color-mix(in srgb, var(--amber) 55%, transparent);
  background: var(--amber-soft);
}
.ui .credit-chip.tone-bad {
  border-color: color-mix(in srgb, var(--bad) 45%, transparent);
  color: var(--bad);
}
.credit-ring {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--muted);
}
.credit-ring .credit-ring-fill {
  stroke: var(--primary);
}
.credit-ring.tone-warn .credit-ring-fill {
  stroke: var(--amber);
}
.credit-ring.tone-bad .credit-ring-fill {
  stroke: var(--bad);
}
.ui .credit-panel {
  width: min(22rem, calc(100vw - 32px));
  padding: 16px;
  gap: 12px;
}
.ui .credit-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ui .credit-panel h3 {
  margin: 0;
  font-size: 16px;
}
.ui .credit-panel .credit-stats b {
  font-size: 20px;
}
.ui .credit-panel .btn {
  width: 100%;
}
.ui .credit-dialog {
  width: min(30rem, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  color: var(--body);
  padding: 22px;
  box-shadow: var(--shadow);
}
.ui .credit-dialog::backdrop {
  background: rgb(0 0 0 / 0.45);
}
.ui .credit-dialog h3 {
  margin: 0 0 8px;
  color: var(--ink);
}
.ui .credit-cost {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sunken);
}
.ui .credit-cost b {
  color: var(--ink);
}
.ui .credit-cost-n {
  font: 600 28px/1 var(--font-display);
  color: var(--ink);
  min-width: 2.5ch;
  text-align: center;
}
.ui .credit-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.ui .credit-confirm-page {
  max-width: 34rem;
}
@media (max-width: 700px) {
  .ui .credit-chip .credit-chip-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .ui .credit-chip {
    padding: 0 8px;
  }
  /* The chip sits mid-bar on a phone, so the panel spans the screen instead of hanging off it. */
  .ui .credit-panel {
    position: fixed;
    top: 68px;
    left: 16px;
    right: 16px;
    width: auto;
  }
}

/* ------------------------------------------------------------------ campaign builder
   Milestone 14 (ARCHITECTURE 18), docs/design/campaign-builder.html: numbered sections down one
   column with a sticky summary rail; rules use a blue "If" and a green "Then". */
.ui .cb-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 16px;
}
.ui .cb-crumb {
  font-size: 13px;
  color: var(--muted);
}
.ui .cb-crumb b {
  display: block;
  color: var(--ink);
  font: 600 19px var(--font-display);
}
.ui .cb-status {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}
/* "Learn more": the page's help center article, in a new tab (Milestone 22). */
.ui .learn-more {
  font-size: 13px;
  white-space: nowrap;
}
.ui .cb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}
.ui .cb-wide {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 18px;
  min-width: 0;
}
.ui .cb-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.ui .cb-card {
  padding: 0;
  min-width: 0;
}
.ui .cb-card-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.ui .cb-card-head h2 {
  font-size: 17px;
  margin: 0;
}
.ui .cb-card-head p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.ui .cb-right {
  margin-left: auto;
}
.ui .cb-n {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font: 600 13px var(--font-display);
  flex: none;
}
.ui .cb-card-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ui .cb-hint,
.ui .cb-card-body .hint {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.ui .cb-sm {
  display: block;
  font-size: 12px;
  color: var(--muted);
}
.ui .cb-sub {
  color: var(--ink);
  font-size: 14px;
}
.ui .cb-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
/* A note under a row's fields, on its own line. */
.ui .cb-row-note {
  flex-basis: 100%;
  margin: -4px 0 0;
}
.ui .cb-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font: 600 13px var(--font-display);
  color: var(--ink);
}
.ui .cb-field input,
.ui .cb-field select {
  font: 400 14px var(--font-body);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sunken);
  color: var(--ink);
  max-width: 100%;
}
.ui .cb-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ui .cb-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--sunken);
  color: var(--body);
  border-radius: 999px;
  padding: 6px 12px;
  font: 500 13.5px var(--font-body);
  cursor: pointer;
}
.ui span.cb-chip {
  cursor: default;
}
.ui .cb-chip.is-on {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.ui .cb-x {
  border: 0;
  background: none;
  color: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
}
.ui .cb-count {
  font: 600 15px var(--font-display);
  color: var(--ink);
}
.ui .cb-pkgs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ui .cb-pkg {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--paper);
}
.ui .cb-pkg h3 {
  font-size: 15px;
  margin: 0;
  display: flex;
  gap: 8px;
  align-items: center;
}
.ui .cb-badge {
  font: 600 11px var(--font-body);
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 2px 8px;
}
.ui .cb-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}
.ui .cb-q {
  color: var(--muted);
}
.ui .cb-tot {
  border-top: 1px solid var(--line);
  padding-top: 6px;
  font-weight: 700;
  color: var(--ink);
}
.ui .cb-radio {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui .cb-radio label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  cursor: pointer;
  background: var(--paper);
}
.ui .cb-radio label.is-on {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.ui .cb-radio label b {
  color: var(--ink);
  display: block;
}
.ui .cb-radio label span {
  font-size: 13px;
  color: var(--muted);
}
.ui .cb-plain {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ui .cb-rule {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  overflow: hidden;
}
.ui .cb-rule-top {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  flex-wrap: wrap;
}
.ui .cb-rule-top b {
  color: var(--ink);
  font-family: var(--font-display);
}
.ui .cb-matches {
  margin-left: auto;
  font-weight: 600;
  color: var(--primary);
}
.ui .cb-rule-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui .cb-rule-body fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui .cb-cond,
.ui .cb-act {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ui .cb-tag {
  font: 600 11px/1 var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 6px;
  min-width: 44px;
  text-align: center;
}
.ui .cb-tag.is-if {
  background: var(--primary-soft);
  color: var(--primary);
}
.ui .cb-tag.is-and {
  background: var(--sunken);
  color: var(--muted);
  border: 1px solid var(--line);
}
.ui .cb-tag.is-then {
  background: var(--good-soft);
  color: var(--good);
}
.ui .cb-f {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--sunken);
  color: var(--ink);
  font: 400 13.5px var(--font-body);
  max-width: 100%;
}
.ui .cb-num {
  width: 80px;
}
.ui .cb-draft {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 8px;
}
.ui .cb-conflict {
  font-size: 12.5px;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 8px;
  padding: 6px 10px;
}
.ui .cb-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ui .cb-looks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ui .cb-look {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px;
  background: var(--sunken);
  text-align: left;
  color: var(--body);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  font: inherit;
}
.ui .cb-look.is-on {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.ui .cb-look b {
  color: var(--ink);
  font-size: 14px;
}
.ui .cb-thumb {
  aspect-ratio: 4 / 3;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ui .cb-thumb i {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.ui .cb-thumb i.h {
  height: 7px;
  width: 55%;
  background: var(--ink);
}
.ui .cb-thumb i.a {
  background: var(--primary);
  width: 35%;
}
.ui .cb-review {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ui .cb-review-tools,
.ui .cb-review-foot,
.ui .cb-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.ui .cb-review-foot {
  justify-content: space-between;
}
.ui .cb-bulk {
  background: var(--primary-soft);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-size: 13.5px;
}
.ui .cb-bulk[hidden] {
  display: none;
}
.ui .cb-bulk-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.ui .cb-search {
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sunken);
  color: var(--ink);
  font: 400 13.5px var(--font-body);
  min-width: 0;
}
.ui .cb-table td {
  vertical-align: top;
}
.ui .cb-table td:nth-child(2) {
  min-width: 150px;
}
.ui .cb-table .cb-rchip {
  max-width: 170px;
  white-space: normal;
}
.ui .cb-table th,
.ui .cb-table td {
  padding-left: 8px;
  padding-right: 8px;
}
.ui .cb-table tr.is-left-out td {
  opacity: 0.6;
}
.ui .cb-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ui .cb-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.ui .cb-actions form {
  margin: 0;
}
.ui .cb-up {
  color: var(--warn);
  font-weight: 600;
}
.ui .cb-flat {
  color: var(--muted);
}
.ui .cb-rchip {
  display: inline-block;
  font-size: 11.5px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  margin: 2px 4px 0 0;
  color: var(--body);
}
.ui .cb-rchip.is-quiet {
  color: var(--muted);
  border-style: dashed;
}
.ui .cb-flag {
  display: inline-block;
  font: 600 11px var(--font-display);
  padding: 2px 7px;
  border-radius: 999px;
  margin: 2px 4px 0 0;
}
.ui .cb-flag.is-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.ui .cb-flag.is-bad {
  background: var(--bad-soft);
  color: var(--bad);
}
/* A note, not a warning: a renewal carried last year's discount (ARCHITECTURE 44.9). */
.ui .cb-flag.is-info {
  background: var(--sunken);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.ui .cb-problems {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--warn);
}
.ui .cb-problems:empty {
  display: none;
}
.ui .cb-rail {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ui .cb-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.ui .cb-stat:last-child {
  border-bottom: 0;
}
.ui .cb-stat b {
  color: var(--ink);
}
.ui .cb-stat b.tone-warn-text {
  color: var(--warn);
}
.ui .cb-big {
  font: 600 30px/1 var(--font-display);
  color: var(--ink);
}
.ui .cb-pv-scrim {
  position: fixed;
  inset: 0;
  background: rgba(12, 17, 29, 0.5);
  z-index: 60;
  display: flex;
  justify-content: flex-end;
}
.ui .cb-pv {
  width: min(760px, 100%);
  height: 100%;
  background: var(--canvas);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.ui .cb-pv-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.ui .cb-pv-bar b {
  color: var(--ink);
  font-family: var(--font-display);
}
.ui .cb-pv-sp {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.ui .cb-pv-sp form {
  margin: 0;
}
.ui .cb-pv-why {
  padding: 8px 16px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
}
.ui .cb-pv-scroll {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  justify-content: center;
}
.ui .cb-pv-frame {
  width: 100%;
  height: 100%;
  min-height: 600px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
}
.ui .cb-pv-frame.is-phone {
  width: 390px;
  max-width: 100%;
}
@media (max-width: 1000px) {
  .ui .cb-layout {
    grid-template-columns: 1fr;
  }
  .ui .cb-rail {
    position: static;
    order: -1;
  }
}
@media (max-width: 640px) {
  .ui .cb-pkgs,
  .ui .cb-looks {
    grid-template-columns: 1fr;
  }
  .ui .cb-search {
    margin-left: 0;
    width: 100%;
  }
  .ui .cb-pv-scroll {
    padding: 8px;
  }
}

/* The campaign builder's guide (Milestone 14, ARCHITECTURE 18.14): one question per screen over
   the same sections, as in the mockup's Guide mode. */
.ui .cb-guide-head,
.ui .cb-guide-nav {
  width: 100%;
  max-width: 760px;
  margin: 0 auto 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ui .cb-guide-head[hidden],
.ui .cb-guide-nav[hidden] {
  display: none;
}
.ui .cb-guide-head h1 {
  font-size: 26px;
  margin: 0;
}
.ui .cb-progress {
  display: flex;
  gap: 6px;
}
.ui .cb-progress i {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
}
.ui .cb-progress i.is-on {
  background: var(--primary);
}
.ui .cb-guide-nav {
  flex-direction: row;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 18px;
}
.ui .cb-guide-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ui .cb-guide-mode .cb-col > .cb-card:not(.is-current),
.ui .cb-guide-mode .cb-wide > .cb-card:not(.is-current),
.ui .cb-guide-mode .cb-rail:not(.is-current) {
  display: none;
}
.ui .cb-guide-mode .cb-layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: 760px;
  margin: 0 auto;
}
.ui .cb-guide-mode .cb-rail {
  position: static;
}
.ui .cb-guide-mode .cb-col .cb-card-head {
  display: none;
}
.ui .cb-guide-mode .cb-table tbody tr:nth-child(n + 7),
.ui .cb-guide-mode .cb-review-tools,
.ui .cb-guide-mode .cb-bulk,
.ui .cb-guide-mode .cb-pager,
.ui .cb-guide-mode [data-reviewed] {
  display: none;
}

/* The offer builder (Milestone 15, ARCHITECTURE 19.5), as in docs/design/offer-builder.html:
   numbered sections on the left (the campaign builder's cards and rule cards) and a sticky
   "Preview as a prospect" on the right that runs the real offer page in a frame. */
.ui .ob-top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ui .ob-top-right .cb-status {
  margin-left: 0;
}
.ui .ob-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 24px;
  align-items: start;
}
.ui .ob-q {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  overflow: hidden;
}
.ui .ob-q-top {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  flex-wrap: wrap;
}
.ui .ob-q-top b {
  color: var(--ink);
  font-family: var(--font-display);
}
.ui .ob-used {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.ui .ob-q-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui .ob-wide {
  width: 100%;
}
.ui .ob-choice {
  padding: 2px 4px 2px 10px;
}
.ui .ob-choice input {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  width: auto;
  max-width: 100%;
  min-width: 0;
}
.ui .ob-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.ui .ob-more-q summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}
.ui .ob-more-q[open] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui .ob-now {
  margin-left: auto;
  font-weight: 600;
}
.ui .ob-now.is-yes {
  color: var(--good);
}
.ui .ob-now.is-no {
  color: var(--muted);
}
.ui .ob-status {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sunken);
}
.ui .ob-grow {
  flex: 1 1 200px;
}
.ui .ob-remove {
  margin-top: 14px;
}
.ui .ob-archived {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.ui .ob-status-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ui .ob-recent {
  margin: 0;
}
.ui .ob-share {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 14px;
  align-items: start;
}
.ui .ob-share-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.ui .ob-share .embed-snippet {
  max-width: 100%;
  overflow-x: auto;
}
.ui .ob-qr {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.ui .ob-qr .actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.ui .ob-qr .actions .btn {
  width: 100%;
  justify-content: center;
}
.ui .ob-qr .qr-box svg {
  width: 120px;
  height: 120px;
}
.ui .ob-pv {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.ui .ob-pv-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ui .ob-pv-bar b {
  font: 600 15px var(--font-display);
  color: var(--ink);
}
.ui .ob-device {
  margin: 0 auto;
  width: 100%;
}
.ui .ob-device.is-phone {
  max-width: 390px;
}
.ui .ob-device iframe {
  width: 100%;
  height: calc(100vh - 300px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.ui .ob-why {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ui .ob-why b {
  color: var(--ink);
}
.ui .ob-why .hint {
  margin: 0;
}
.ui .ob-rchip {
  display: inline-block;
  font-size: 12px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  margin: 3px 4px 0 0;
}
@media (max-width: 1100px) {
  .ui .ob-layout {
    grid-template-columns: 1fr;
  }
  .ui .ob-pv {
    position: static;
  }
}
@media (max-width: 640px) {
  .ui .ob-share {
    grid-template-columns: 1fr;
  }
  .ui .ob-top-right {
    margin-left: 0;
    width: 100%;
  }
  .ui .ob-device iframe {
    min-height: 600px;
  }
}

/* Support sessions (ARCHITECTURE 21): the banner on every admin page, and the session tables. */
.ui .support-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.ui .support-banner form {
  margin: 0;
}
.ui .admin .support-table,
.ui .admin .support-sessions {
  min-width: 640px;
}
.ui .admin .support-table .btn,
.ui .admin .support-sessions .btn {
  white-space: nowrap;
}
.ui .admin .support-open fieldset {
  margin-bottom: 16px;
}

/* Ops > Settings, Demo follow-up: the rendered versions (ARCHITECTURE 23.7). */
.ui .followup-previews {
  margin-top: 1rem;
}
.ui .followup-preview-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 960px) {
  .ui .followup-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.ui .followup-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: var(--paper);
  min-width: 0;
}
.ui .followup-preview-label {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.ui .followup-preview-subject {
  margin: 0 0 0.5rem;
}
.ui .followup-preview-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
}

/* Copied people (ARCHITECTURE 27): the client's People section, the builder's card, and the
   proposal page's list. */
.ui .people-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}
.ui .people-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
}
.ui .people-row:first-child {
  border-top: 0;
}
.ui .people-who {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.ui .people-asked {
  font-size: 0.85rem;
}
.ui .people-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}
.ui .people-actions form {
  margin: 0;
}
.ui .people-edit,
.ui .people-add {
  width: 100%;
}
.ui .people-edit > summary,
.ui .people-add > summary {
  display: inline-flex;
  list-style: none;
  cursor: pointer;
}
.ui .people-edit > summary::-webkit-details-marker,
.ui .people-add > summary::-webkit-details-marker {
  display: none;
}
.ui .people-form {
  margin-top: 0.75rem;
}
.ui .people-signed-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin: 0 0 0.75rem;
}
.ui .people-signed-copy .form-field {
  margin: 0;
}
.ui .bd-side .people-card,
.ui .bd-side .signers-card {
  margin-top: 1rem;
}
/* Signers (ARCHITECTURE 35.6): the builder's card and the client page's default. */
.ui .signers-list {
  margin: 0.75rem 0 0;
  padding-left: 1.5rem;
}
.ui .signers-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}
.ui .signers-row:first-child {
  border-top: 0;
}
.ui .signers-who {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  overflow-wrap: anywhere;
}
.ui .signers-move {
  display: flex;
  gap: 0.25rem;
}
.ui .signers-move form,
.ui .signers-settings {
  margin: 0;
}
.ui .people-signing {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-end;
}
.ui .people-signing .form-field {
  margin: 0;
}
.ui .bd-copied-check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0.25rem 0 0.5rem;
  font-size: 0.9rem;
}

/* ------------------------------------------------------------------ Integrations, Billing, Plans (Milestone 16) */
.ui .not-on-plan {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--sunken);
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}
.ui .not-on-plan p {
  margin: 0.25rem 0;
}
.ui .not-on-plan-title {
  font-weight: 600;
  color: var(--ink);
}
.ui .endpoint-card {
  padding: 1rem 1.25rem;
  margin: 0 0 1rem;
}
.ui .endpoint-card h3 {
  margin: 0 0 0.25rem;
}
.ui .endpoint-card p {
  margin: 0.25rem 0;
}
.ui .endpoint-url code {
  overflow-wrap: anywhere;
}
.ui .endpoint-edit {
  min-width: min(36rem, 80vw);
}
/* "Every event" hides the list of event types; ticking "Only these" shows it. */
.ui .event-choice:has(input[name="which"][value="all"]:checked) .event-list {
  display: none;
}
.ui .event-choice .event-list {
  margin-top: 0.5rem;
}
.ui .feature-desc {
  display: block;
  margin-top: 0.15rem;
}
.ui .billing-grid {
  display: grid;
  gap: 1rem;
}
.ui .plans-table .plan-key {
  display: block;
  white-space: nowrap;
  margin: 0.15rem 0;
  width: fit-content;
}
.ui .plan-feature-list li {
  white-space: nowrap;
}
.ui .plan-feature-grid {
  display: grid;
  gap: 0.5rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}
.ui .plan-feature-row {
  display: grid;
  gap: 0.25rem;
}
.ui .endpoint-paused {
  color: var(--bad);
  font-weight: 600;
}
.ui .plan-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  margin-top: 0.75rem;
}
.ui .plan-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ui .plan-card.is-current {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.ui .plan-card h3,
.ui .plan-card p {
  margin: 0;
}
.ui .plan-card ul {
  flex: 1;
}
.ui .plan-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}
/* A downgrade's offer picks on Billing (Milestone 16 phase 4). */
.ui .keep-offers {
  display: grid;
  gap: 0.75rem;
}
.ui .keep-offers-list {
  border: 0;
  padding: 0;
  margin: 0;
}
.ui .keep-offers-list legend {
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.ui .keep-offers button {
  justify-self: start;
}

/* Dialogs (components Modal, ARCHITECTURE 28.8): centered, at most 640px wide (860px for the
   wide ones), a fixed head and foot with the fields scrolling between, full screen on a phone.
   Without scripts the same panel opens under its button, like the other action popovers. */
.ui .modal-only {
  display: none;
}
.ui .modal-host > .modal-panel .modal-head {
  margin: 0;
}
.ui .modal-host > .modal-panel .modal-title {
  margin: 0;
  font-size: 15px;
}
.ui .modal-host > .modal-panel .modal-form {
  display: grid;
  gap: 12px;
}
.ui .modal-host > .modal-panel .modal-foot {
  display: flex;
  gap: 8px;
}
.ui dialog.modal {
  box-sizing: border-box;
  /* Centered in the viewport (an action group's children otherwise get margin 0). */
  margin: auto;
  width: min(92vw, 640px);
  max-width: min(92vw, 640px);
  max-height: 85vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ui dialog.modal.modal-wide {
  width: min(92vw, 860px);
  max-width: min(92vw, 860px);
}
/* Closed, it takes no room, even in an action group (whose children are flex). */
.ui dialog.modal:not([open]) {
  display: none;
}
.ui dialog.modal[open] {
  display: flex;
  flex-direction: column;
}
.ui dialog.modal::backdrop {
  background: rgba(10, 14, 24, 0.55);
}
.ui dialog.modal .modal-only {
  display: inline-flex;
}
.ui dialog.modal .modal-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.ui dialog.modal .modal-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.ui dialog.modal .modal-title {
  margin: 0;
  font-size: 17px;
}
.ui dialog.modal .modal-x {
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.ui dialog.modal .modal-x:hover,
.ui dialog.modal .modal-x:focus-visible {
  border-color: var(--line);
  color: var(--ink);
}
.ui dialog.modal .modal-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
}
.ui dialog.modal .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 20px 20px;
}
.ui dialog.modal .modal-foot {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.ui dialog.modal .modal-errors {
  margin: 0;
}
.ui dialog.modal .modal-errors ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
/* The page behind doesn't scroll while a dialog is open. */
.ui.modal-open,
.ui.modal-open body {
  overflow: hidden;
}
@media (max-width: 600px) {
  .ui dialog.modal,
  .ui dialog.modal.modal-wide {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .ui dialog.modal .modal-head,
  .ui dialog.modal .modal-body,
  .ui dialog.modal .modal-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .ui dialog.modal .modal-foot .btn {
    flex: 1 1 0;
  }
}

/* A business's License card with its Controls beside it (ARCHITECTURE 28.6). */
.ui .is-ops .license-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (min-width: 1200px) {
  .ui .is-ops .license-row {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}
.ui .is-ops .license-row > .form-section {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.ui .license-lines {
  width: 100%;
  border-collapse: collapse;
}
.ui .license-lines th,
.ui .license-lines td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.ui .license-lines th[scope="row"] {
  font-size: inherit;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}
.ui .license-lines thead th {
  font-size: 12px;
  color: var(--muted);
}
.ui .license-lines .license-group th {
  padding-top: 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The License card's actions wrap inside the card instead of running past it. */
.ui .license-actions > .actions {
  grid-auto-flow: row;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
  width: 100%;
}
/* On a phone each line stacks: its name, what it is now, and where that came from. */
@media (max-width: 600px) {
  .ui .license-lines thead {
    display: none;
  }
  .ui .license-lines tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
  }
  .ui .license-lines th,
  .ui .license-lines td {
    padding: 1px 8px;
    border-bottom: 0;
  }
  .ui .license-lines td.muted {
    font-size: 13px;
  }
}

/* ------------------------------------------------------------------ feedback (ARCHITECTURE 30) */
.app-help {
  list-style: none;
}
.app-help::-webkit-details-marker {
  display: none;
}
.ui .feedback-context {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--sunken);
  padding: 12px 14px;
}
.ui .feedback-context-head {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.ui .feedback-context .facts {
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 10px 16px;
}
.ui .feedback-context .facts dd {
  font: 400 14px/1.35 var(--font-body);
}
.ui .feedback-page-form {
  max-width: 44rem;
}
.ui .feedback-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.ui .feedback-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.ui .feedback-item-head .muted {
  font-size: 13px;
}
.ui .feedback-body {
  margin: 10px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ui .feedback-image {
  display: inline-block;
  margin-top: 12px;
}
.ui .feedback-image img {
  display: block;
  max-width: min(100%, 28rem);
  max-height: 20rem;
  width: auto;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.ui .feedback-reply {
  margin-top: 12px;
  padding: 10px 14px;
  border-left: 3px solid var(--primary);
  background: var(--sunken);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.ui .feedback-reply-head {
  margin: 0;
  font-size: 13px;
}
.ui .feedback-reply .feedback-body {
  margin-top: 6px;
}
.ui .pill-feedback-new,
.ui .admin .pill-feedback-new {
  background: var(--primary-soft);
  color: var(--primary);
}
.ui .pill-feedback-looking,
.ui .pill-feedback-planned,
.ui .admin .pill-feedback-looking,
.ui .admin .pill-feedback-planned {
  background: var(--warn-soft);
  color: var(--warn);
}
.ui .pill-feedback-done,
.ui .admin .pill-feedback-done {
  background: var(--good-soft);
  color: var(--good);
}
/*
 * Long addresses break at their wbr points (after the @, before dots) and hyphens, not mid-name;
 * only a piece too long for the line on its own is broken inside.
 */
.ui .email-text {
  overflow-wrap: break-word;
  word-break: normal;
}
.ui .feedback-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.ui .feedback-log li {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.ui .feedback-log .is-note {
  background: var(--warn-soft);
  border-color: transparent;
}
@media (max-width: 560px) {
  .ui .feedback-context .facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------------------------ Terms (rich text, ARCHITECTURE 31) */
/* The template editor's rich text over the Terms textarea (/static/terms-field.js); the toolbar's
   buttons are the editor's own markup (toolbarHtml in src/web/rich-text/editor.ts). */
.ui .rt-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--sunken);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.ui .rt-tools[hidden] {
  display: none;
}
.ui .rt-tools button,
.ui .rt-tools select {
  min-height: 34px;
  padding: 4px 10px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: 600 13px/1.2 var(--font-body);
}
.ui .rt-tools select {
  flex: 0 0 auto;
  width: auto;
  background: var(--paper);
  border-color: var(--line-strong);
}
.ui .rt-tools button:hover {
  background: var(--paper);
  border-color: var(--line);
}
.ui .rt-tools button.is-on {
  color: var(--primary-ink);
  background: var(--primary-soft);
  border-color: var(--primary);
}
.ui .rt-tools .cv-rt-link {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding-top: 4px;
}
.ui .rt-tools .cv-rt-link[hidden],
.ui .rt-tools .cv-rt-link-problem[hidden],
.ui .rt-tools [data-rt-link-remove][hidden] {
  display: none;
}
.ui .rt-tools .cv-rt-link input {
  flex: 1 1 14rem;
  min-width: 0;
  min-height: 34px;
}
.ui .rt-tools .cv-rt-link button {
  border-color: var(--line-strong);
  background: var(--paper);
}
.ui .rt-tools .cv-rt-link-problem {
  flex-basis: 100%;
  color: var(--bad);
  font: 600 13px/1.3 var(--font-body);
}
.ui .rt-box {
  min-height: 12rem;

  padding: 0.6rem 0.85rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 0 0 var(--r-md) var(--r-md);
  font: 15px/1.5 var(--font-body);
}
.ui .rt-box.is-readonly {
  background: var(--sunken);
  border-radius: var(--r-md);
}
.ui .rt-box:focus-within {
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  border-color: var(--primary);
}
.ui .rt-box h2 {
  margin: 0.9rem 0 0.35rem;
  font: 700 1.15rem/1.3 var(--font-display);
}
.ui .rt-box h3 {
  margin: 0.8rem 0 0.3rem;
  font: 700 1rem/1.3 var(--font-display);
}
.ui .rt-box p {
  margin: 0 0 0.6rem;
}
.ui .rt-box ul,
.ui .rt-box ol {
  margin: 0 0 0.6rem;
  padding-left: 1.4rem;
}
.ui .rt-box a {
  color: var(--primary);
  text-decoration: underline;
}
/* What ProseMirror needs to edit correctly (the same rules as editor.css; Tiptap's own <style>
   is off because the CSP doesn't allow it). */
.ui .rt-box .ProseMirror {
  position: relative;
  min-height: 10rem;
  word-wrap: break-word;
  white-space: pre-wrap;
  white-space: break-spaces;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0;
  outline: none;
}
.ui .rt-box .ProseMirror > :first-child {
  margin-top: 0;
}
.ui .rt-box .ProseMirror li {
  position: relative;
}
.ui .rt-box .ProseMirror-hideselection *::selection {
  background: transparent;
}
.ui .rt-box .ProseMirror-hideselection {
  caret-color: transparent;
}
.ui .rt-box img.ProseMirror-separator {
  display: inline !important;
  border: none !important;
  margin: 0 !important;
}

/* Staff activity: the terms before and after a save. */
.ui .terms-change {
  margin-top: 0.35rem;
}
.ui .terms-change h3 {
  margin: 0.5rem 0 0.2rem;
  font-size: 0.85rem;
}
.ui .terms-change-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--body);
}

.sso-tag {
  margin-left: 6px;
  vertical-align: middle;
}

/* Offer review (ARCHITECTURE 37): the dashboard card, the lead page's panel, the list's links. */
.waiting-review {
  margin-bottom: 16px;
  border-left: 4px solid var(--warn);
}
.waiting-review-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.waiting-review-head h2 {
  margin: 0;
}
.waiting-review-count {
  font: 600 28px/1 var(--font-display);
  color: var(--warn);
}
.review-panel {
  margin-bottom: 16px;
  border-left: 4px solid var(--warn);
}
.review-panel h2 {
  margin-top: 0;
}
.review-decline {
  margin-top: 12px;
}
.review-decline[open] > summary {
  margin-bottom: 12px;
}
.review-decline textarea,
.review-decline input:not([type="checkbox"]) {
  width: 100%;
}
.lead-review-actions {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}
.lead-review-form {
  display: inline;
  margin: 0;
}
.lead-review-form .btn-link {
  padding: 0;
  font-size: inherit;
}
/* On a phone a long label (a lead's question) left no room for its value: label over value. */
@media (max-width: 480px) {
  .ui .detail-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem;
  }
  .ui .detail-list dd {
    margin-bottom: 0.5rem;
  }
}
/* A one-off document's "Good for (days)" beside its Preview button (ARCHITECTURE 12.22). */
.ui .doc-expiry-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.ui .doc-expiry-form input {
  width: 6rem;
}
.ui .doc-expiry-form .form-help {
  flex-basis: 100%;
}

/* Packets (ARCHITECTURE 40.17): the builder, after docs/design/walkthrough-builder.html. The
   palette on the left, the packet as a vertical list in the middle, the selected step and what
   the client sees on the right. */
.ui .packet-explain {
  margin: 0.75rem 0 1rem;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
}
.ui .packet-new {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ui .packet-new input {
  min-width: 14rem;
}
.ui .pk-top {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.ui .pk-top .crumbs {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.ui .pk-summary {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}
.ui .pk-chip {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--body);
  border: 1px solid var(--line);
}
.ui .pk-chip.is-credit {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}
.ui .pk-status {
  align-self: center;
}
.ui .pk-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 340px;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 1180px) {
  .ui .pk-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .ui .pk-side {
    grid-column: 1 / -1;
  }
}
@media (max-width: 760px) {
  .ui .pk-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}
.ui .pk-palette,
.ui .pk-flow-card,
.ui .pk-inspector,
.ui .pk-preview,
.ui .pk-more {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}
.ui .pk-side {
  display: grid;
  gap: 1rem;
  min-width: 0;
}
.ui .pk-palette h2,
.ui .pk-flow-card h2,
.ui .pk-inspector h2,
.ui .pk-preview h2 {
  margin: 0;
  font-size: 1rem;
}
.ui .pk-group {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.ui .pk-group .eyebrow {
  margin: 0.4rem 0 0;
}
.ui .pk-none {
  margin: 0;
  font-size: 0.82rem;
}
.ui .pk-tile-form {
  margin: 0;
}
.ui .pk-tile {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.5rem 0.65rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  cursor: grab;
}
.ui .pk-tile:hover {
  border-color: var(--primary);
}
.ui .pk-tile.k-screen {
  border-style: dashed;
}
.ui .pk-tile-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.ui .pk-plus {
  color: var(--primary);
  font-weight: 700;
}
.ui .pk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--muted);
}
.ui .k-proposal .pk-dot {
  background: var(--primary);
}
.ui .k-agreement .pk-dot {
  background: var(--good);
}
.ui .k-consent .pk-dot {
  background: var(--warn);
}
.ui .pk-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}
.ui .pk-flow {
  display: grid;
  gap: 0;
  border-radius: var(--r-md);
}
.ui .pk-flow.is-over {
  outline: 2px dashed var(--primary);
  outline-offset: 4px;
}
.ui .pk-start,
.ui .pk-finish {
  justify-self: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--sunken);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
}
.ui .pk-drop-hint {
  margin: 0.75rem 0;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 1.1rem;
  text-align: center;
  color: var(--muted);
}
.ui .pk-steps {
  list-style: none;
  margin: 0;
  padding: 0.75rem 0;
  display: grid;
  gap: 0.6rem;
}
.ui .pk-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 0.65rem 0.75rem;
}
.ui .pk-step.has-handle {
  grid-template-columns: auto auto minmax(0, 1fr) auto;
}
.ui .pk-step.is-screen {
  border-style: dashed;
  background: var(--sunken);
}
.ui .pk-step.is-sel {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.ui .pk-step:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}
.ui .pk-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}
.ui .pk-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--primary);
  color: var(--primary-ink);
}
.ui .pk-num.is-screen {
  background: var(--line);
  color: var(--body);
}
.ui .pk-step-main {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.ui .pk-step-title {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}
.ui .pk-step-title b {
  color: var(--ink);
  overflow-wrap: anywhere;
}
.ui .pk-step-desc {
  font-size: 0.82rem;
  color: var(--muted);
}
.ui .pk-kind {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--sunken);
  color: var(--body);
}
.ui .pk-kind.k-proposal {
  background: var(--primary-soft);
  color: var(--primary);
}
.ui .pk-kind.k-agreement {
  background: var(--good-soft);
  color: var(--good);
}
.ui .pk-kind.k-consent {
  background: var(--warn-soft);
  color: var(--warn);
}
.ui .pk-step-actions,
.ui .pk-moves {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.ui .pk-moves form {
  margin: 0;
}
.ui .pk-seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
  margin: 0;
}
.ui .pk-seg button {
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--paper);
  color: var(--body);
  border: 0;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}
.ui .pk-seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
@media (max-width: 560px) {
  .ui .pk-step,
  .ui .pk-step.has-handle {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .ui .pk-step .pk-handle {
    display: none;
  }
  .ui .pk-step-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}
.ui .pk-rule,
.ui .pk-note {
  margin: 0;
  background: var(--sunken);
  border-radius: var(--r-md);
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
}
.ui .pk-rule b,
.ui .pk-note b {
  color: var(--ink);
}
.ui .pk-rich .rt-box {
  min-height: 8rem;
}
.ui .pk-field {
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 4px;
  padding: 0 0.25rem;
  font-weight: 700;
  font-size: 0.9em;
}
.ui .pk-phone {
  border: 10px solid var(--ink);
  border-radius: 30px;
  background: var(--paper);
  max-width: 320px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
}
.ui .pk-phone-top {
  padding: 0.75rem 0.9rem 0.5rem;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.45rem;
}
.ui .pk-phone-top b {
  color: var(--ink);
  font-size: 0.85rem;
}
.ui .pk-rail {
  display: flex;
  gap: 0.35rem;
}
.ui .pk-bar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
}
.ui .pk-bar.is-done {
  background: var(--good);
}
.ui .pk-bar.is-now {
  background: var(--primary);
}
.ui .pk-phone-label {
  font-size: 0.72rem;
  color: var(--muted);
}
.ui .pk-phone-body {
  padding: 1rem;
  min-height: 260px;
  display: grid;
  gap: 0.6rem;
  align-content: start;
  font-size: 0.9rem;
}
.ui .pk-phone-body h2,
.ui .pk-phone-body h3 {
  margin: 0;
  font-size: 1rem;
}
.ui .pk-phone-body p {
  margin: 0 0 0.5rem;
}
.ui .pk-phone-intro {
  background: var(--sunken);
  border-radius: var(--r-md);
  padding: 0.6rem 0.7rem;
}
.ui .pk-phone-doc {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.75rem;
  display: grid;
  gap: 0.4rem;
  background: var(--sunken);
}
.ui .pk-phone-doc span {
  height: 7px;
  border-radius: 4px;
  background: var(--line-strong);
}
.ui .pk-phone-doc span:nth-child(2n) {
  width: 75%;
}
.ui .pk-phone-foot {
  padding: 0.75rem 1rem 1rem;
  display: grid;
  gap: 0.4rem;
  border-top: 1px solid var(--line);
}
.ui .pk-phone-btn {
  display: block;
  text-align: center;
  border-radius: 999px;
  padding: 0.5rem;
  font-weight: 700;
  background: var(--primary);
  color: var(--primary-ink);
}
.ui .pk-phone-skip {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}
.ui .pk-phone-skip.is-muted {
  color: var(--muted);
}
.ui .pill-packet-completed {
  background: var(--good-soft);
  color: var(--good);
}
.ui .pill-packet-open {
  background: var(--primary-soft);
  color: var(--primary);
}
.ui .pill-packet-stopped,
.ui .pill-packet-expired,
.ui .pill-packet-withdrawn {
  background: var(--sunken);
  color: var(--muted);
}
/* A sent packet's Links: each signer, then their buttons, wrapping on a phone. */
.ui .packet-signer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}
.ui .packet-signer-row > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.ui .packet-signer-row .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ui .packet-signer-row .row-actions form.inline + form.inline {
  margin-left: 0;
}

/* ------------------------------------------------------------------ the Save bar
 * ARCHITECTURE 42, save-bar.tsx: one Save for the page, stuck to the bottom of the window and
 * clear of a phone's home indicator. In the page's flow, so at the bottom of the page it sits
 * under the last field instead of over it. With scripts it waits for a change. Here, not in
 * styles.css, which is copied into every PDF.
 */
.ui .save-bar {
  justify-content: space-between;
  flex-wrap: wrap;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}
.ui.js .save-bar:not(.is-shown) {
  display: none;
}
/* While it waits, a toast sits where it always does (styles.css lifts it over a save bar). */
.ui.js body:has(.save-bar:not(.is-shown)) .toast-region {
  bottom: 1.25rem;
}
.ui .save-bar-status {
  margin: 0;
}
.ui .save-bar-count {
  color: var(--muted);
  font-size: 0.9rem;
}
.ui .save-bar-buttons {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
}
@media (max-width: 600px) {
  .ui .save-bar {
    margin-inline: calc(-1 * var(--gutter, 1rem));
    padding-inline: var(--gutter, 1rem);
  }
  .ui .save-bar-buttons {
    width: 100%;
  }
  .ui .save-bar-buttons .btn {
    flex: 1;
    justify-content: center;
  }
}
/* A field a failed save came back about. */
.ui .form-error {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--danger);
  line-height: 1.4;
}
.ui .form-field.has-error input:not([type="checkbox"]):not([type="radio"]),
.ui .form-field.has-error select,
.ui .form-field.has-error textarea,
.ui .form-field.has-error .rt-box {
  border-color: var(--danger);
}
.ui .save-problems p {
  margin: 0;
}
.ui .save-problems ul {
  margin: 0.35rem 0 0;
}

/* The development inbox keeps a long signing link on one line: let it wrap on a phone. */
.dev-mail {
  overflow-wrap: anywhere;
}

/* Discount lines in the builder (ARCHITECTURE 44.3): the amount reads as taken off. */
.ui .bd-discount-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 13rem) 9rem 1.9rem;
  gap: 8px;
  align-items: center;
}
.ui .bd-discount-row input,
.ui .bd-discount-row select {
  min-width: 0;
  width: 100%;
}
@media (max-width: 700px) {
  .ui .bd-discount-row {
    grid-template-columns: minmax(0, 1fr) 1.9rem;
  }
  .ui .bd-discount-row .bd-addon-terms,
  .ui .bd-discount-row .bd-discount-amount {
    grid-column: 1 / -1;
  }
  .ui .bd-discount-row .bd-x {
    grid-column: 2;
    grid-row: 1;
  }
}
.ui .bd-discount-amount {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--good);
  font-weight: 700;
}
.ui .bd-discount-amount .bd-price {
  color: var(--good);
}
.ui .bd-carried {
  margin-left: 6px;
}
.ui .bd-sum-net .num {
  color: var(--good);
}
.ui .discount-amount {
  color: var(--good);
  font-weight: 600;
}

/* Extend deadline (ARCHITECTURE 46.14): the current deadline, then the quick picks under the
   date field, which shell.js shows (hidden without scripts). Packed at the top, so a full-screen
   dialog on a phone doesn't spread its fields down the screen. */
.ui .extend-form {
  display: grid;
  gap: 12px;
  align-content: start;
}
.ui .extend-current {
  margin: 0;
  font-weight: 600;
}
.ui .extend-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ui .extend-picks[hidden] {
  display: none;
}
.ui .extend-form .extend-email-help {
  margin-top: -6px;
}
/* Four or more actions in a group (The client's link with Extend deadline): they wrap, three
   to a row, instead of running past the column. Phones already stack them. */
@media (min-width: 701px) {
  .ui .admin .pa-group .actions:has(> :nth-child(4)) {
    grid-auto-flow: row;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    width: 100%;
  }
}
