
:root {
  font-family: Manrope, "Segoe UI", sans-serif;
  color: hsl(calc(var(--accent-h) + 6) calc(40.7% * var(--accent-s)) 17.8%);
  background: hsl(calc(var(--accent-h) + 5) calc(37.5% * var(--accent-s)) 96.9%);
  font-synthesis: none;
  --bg: hsl(calc(var(--accent-h) + 5) calc(37.5% * var(--accent-s)) 96.9%);
  --surface: #fff;
  --surface-alt: hsl(calc(var(--accent-h) + 5) calc(40.0% * var(--accent-s)) 98.0%);
  --text: hsl(calc(var(--accent-h) + 6) calc(40.7% * var(--accent-s)) 17.8%);
  --muted: #758396;
  --line: hsl(calc(var(--accent-h) + 5) calc(33.3% * var(--accent-s)) 92.9%);
  --brand: hsl(var(--accent-h) calc(91.2% * var(--accent-s)) 31.4%);
  --brand-hover: hsl(calc(var(--accent-h) + 1) calc(91.2% * var(--accent-s)) 26.7%);
  --blue-soft: hsl(calc(var(--accent-h) + 3) calc(68.0% * var(--accent-s)) 95.1%);
  --success: #24866a;
  --success-bg: #eaf6ef;
  --danger: #c04e53;
  --danger-bg: #fdf0f0;
  --warning: #a87525;
  --warning-bg: #fcf5e7;
  --shadow: 0 3px 12px hsl(calc(var(--accent-h) + 4) calc(51.0% * var(--accent-s)) 20.0% / 0.016);
  --rail: hsl(calc(var(--accent-h) + 4) calc(59.5% * var(--accent-s)) 15.5%);
  --focus: hsl(calc(var(--accent-h) + 1) calc(73.3% * var(--accent-s)) 55.9%);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: hsl(calc(var(--accent-h) + 8) calc(42.9% * var(--accent-s)) 11.0%);
  --surface: hsl(calc(var(--accent-h) + 6) calc(38.7% * var(--accent-s)) 14.7%);
  --surface-alt: hsl(calc(var(--accent-h) + 7) calc(35.6% * var(--accent-s)) 17.6%);
  --text: hsl(calc(var(--accent-h) + 5) calc(50.0% * var(--accent-s)) 92.9%);
  --muted: hsl(calc(var(--accent-h) + 3) calc(23.5% * var(--accent-s)) 68.2%);
  --line: hsl(calc(var(--accent-h) + 7) calc(28.8% * var(--accent-s)) 23.1%);
  --brand: hsl(calc(var(--accent-h) + 1) calc(75.1% * var(--accent-s)) 62.2%);
  --brand-hover: hsl(var(--accent-h) calc(72.7% * var(--accent-s)) 69.8%);
  --blue-soft: hsl(calc(var(--accent-h) + 2) calc(42.9% * var(--accent-s)) 22.0%);
  --success: #70c5a4;
  --success-bg: #1c3b34;
  --danger: #f18e93;
  --danger-bg: #412b35;
  --warning: #e0b96f;
  --warning-bg: #3b3529;
  --shadow: 0 3px 16px #00000010;
  --rail: hsl(calc(var(--accent-h) + 6) calc(51.0% * var(--accent-s)) 9.6%);
  color-scheme: dark;
  background: var(--bg);
  color: var(--text);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button {
  border: 0;
  background: none;
  color: inherit;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
a {
  color: inherit;
  text-decoration: none;
}
p {
  line-height: 1.65;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  letter-spacing: -0.035em;
}
h1 {
  font-size: calc(31px + var(--font-plus));
  font-weight: 750;
  margin-bottom: 8px;
  line-height: 1.25;
}
h2 {
  font-size: calc(18px + var(--font-plus));
  margin-bottom: 0;
  font-weight: 750;
}
h3 {
  font-size: calc(16px + var(--font-plus));
  margin-bottom: 8px;
}
small,
.small {
  font-size: calc(12px + var(--font-plus));
}
strong {
  font-weight: 700;
}
svg {
  flex-shrink: 0;
}
button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
}
button,
.button,
a,
input,
select,
textarea {
  transition:
    background 0.16s,
    color 0.16s,
    border-color 0.16s,
    box-shadow 0.16s,
    transform 0.16s;
}
button:active:not(:disabled),
.button:active {
  transform: translateY(1px);
}
::selection {
  background: hsl(calc(var(--accent-h) + -1) calc(73.1% * var(--accent-s)) 79.6%);
  color: hsl(calc(var(--accent-h) + 4) calc(59.5% * var(--accent-s)) 15.5%);
}
.muted {
  color: var(--muted);
}
.success-text {
  color: var(--success) !important;
}
.danger-text {
  color: var(--danger) !important;
}
.blue-dot {
  color: var(--brand);
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 15px;
  font-size: calc(12px + var(--font-plus));
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--surface);
  color: var(--text);
}
.button:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: hsl(calc(var(--accent-h) + 3) calc(31.5% * var(--accent-s)) 78.8%);
}
.button.primary {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: #fff;
  box-shadow: 0 3px 8px hsl(var(--accent-h) calc(91.2% * var(--accent-s)) 31.4% / 0.071);
}
.button.primary:hover:not(:disabled) {
  background: hsl(var(--accent-h) calc(90.9% * var(--accent-s)) 25.9%);
  border-color: hsl(var(--accent-h) calc(90.9% * var(--accent-s)) 25.9%);
}
.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
}
.button.danger {
  color: #fff;
  background: #b8434a;
  border-color: #b8434a;
}
.button.danger-ghost {
  color: var(--danger);
  border-color: transparent;
  background: var(--danger-bg);
}
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.icon-button,
.notification-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--muted);
  flex-shrink: 0;
}
.icon-button:hover,
.notification-button:hover {
  background: var(--surface-alt);
  color: var(--text);
}
.icon-button[disabled] {
  opacity: 0.4;
}
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--brand);
  font-size: calc(12px + var(--font-plus));
  font-weight: 700;
  padding: 5px 0;
  min-height: 32px;
}
.text-link:hover {
  text-decoration: underline;
}
.avatar {
  display: inline-flex;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  font-size: calc(17px + var(--font-plus));
  font-weight: 750;
  color: hsl(var(--accent-h) calc(46.5% * var(--accent-s)) 41.8%);
  background: hsl(calc(var(--accent-h) + 2) calc(64.3% * var(--accent-s)) 94.5%);
}
.avatar.small {
  height: 32px;
  width: 32px;
  font-size: calc(11px + var(--font-plus));
  border-radius: 50%;
}
.avatar.purple {
  background: #f0edfa;
  color: #8272a8;
}
.avatar.orange {
  background: #fcf0e5;
  color: #bd8757;
}
.avatar.green {
  background: #e9f4ef;
  color: #568b74;
}
.avatar.pink {
  background: #f9edf2;
  color: #b17b93;
}
.avatar.slate {
  background: hsl(calc(var(--accent-h) + 3) calc(35.1% * var(--accent-s)) 92.7%);
  color: hsl(calc(var(--accent-h) + 4) calc(18.5% * var(--accent-s)) 47.6%);
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.6;
}
.badge i,
.status-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge.success {
  background: var(--success-bg);
  color: var(--success);
}
.badge.blue {
  background: var(--blue-soft);
  color: var(--brand);
}
.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge.warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge.on-blue {
  background: #ffffff16;
  color: hsl(calc(var(--accent-h) + -1) calc(100.0% * var(--accent-s)) 91.2%);
  font-size: calc(10px + var(--font-plus));
  padding: 5px 9px;
  border: 1px solid #ffffff16;
}
.status-dot {
  color: var(--success);
}
.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  font-size: calc(11px + var(--font-plus));
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  white-space: nowrap;
}
.source-badge b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff4cf;
  color: #c04c26;
  border-radius: 4px;
  font-size: calc(10px + var(--font-plus));
  font-weight: 800;
  width: 20px;
  height: 18px;
}
.source-badge.onec > span {
  display: none;
}
.source-badge.bitrix svg {
  color: hsl(calc(var(--accent-h) + -10) calc(53.7% * var(--accent-s)) 51.8%);
}
.source-badge.small {
  padding: 3px 5px;
  font-size: calc(9px + var(--font-plus));
}
.source-badge.small b {
  width: 18px;
  height: 16px;
  font-size: calc(10px + var(--font-plus));
}
.surface {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.eyebrow {
  font-size: calc(9px + var(--font-plus));
  font-weight: 750;
  letter-spacing: 0.17em;
  color: var(--muted);
  margin-bottom: 10px;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}
.brand strong {
  font-size: calc(28px + var(--font-plus));
  letter-spacing: -0.055em;
  font-weight: 750;
  line-height: 1;
}
.brand-period {
  color: hsl(calc(var(--accent-h) + 1) calc(60.4% * var(--accent-s)) 63.3%);
}
.brand small {
  display: block;
  font-size: calc(7px + var(--font-plus));
  letter-spacing: 0.19em;
  margin-top: 6px;
  opacity: 0.6;
  font-weight: 600;
}
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 37px;
  height: 43px;
  background: white;
  border-radius: 10px;
  flex-shrink: 0;
  overflow: hidden;
}
.mascot {
  width: 100%;
  height: 100%;
  display: block;
}
.brand-mark .mascot {
  width: 31px;
  height: 36px;
}
.brand-link {
  display: block;
}
.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.profile > div {
  flex: 1;
  min-width: 0;
}
.profile strong {
  font-size: calc(11px + var(--font-plus));
  display: block;
}
.profile small {
  display: block;
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
  margin-top: 4px;
}
.mobile-only {
  display: none;
}
.flex-wrap {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
/* Administration shell */
.admin-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 228px;
  background: var(--rail);
  color: hsl(calc(var(--accent-h) + 5) calc(44.4% * var(--accent-s)) 92.9%);
  padding: 28px 17px 20px;
  display: flex;
  flex-direction: column;
  z-index: 25;
}
.admin-sidebar .brand-link {
  padding: 0 13px;
}
.workspace-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #ffffff12;
  padding: 12px 9px;
  margin: 30px 0 28px;
  border-radius: 10px;
  color: hsl(calc(var(--accent-h) + 5) calc(44.4% * var(--accent-s)) 89.4%);
}
.workspace-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 27px;
  height: 29px;
  border-radius: 7px;
  background: hsl(calc(var(--accent-h) + 2) calc(40.7% * var(--accent-s)) 26.5%);
  font-size: calc(15px + var(--font-plus));
  font-weight: 750;
}
.workspace-switch > div {
  flex: 1;
  min-width: 0;
}
.workspace-switch strong {
  display: block;
  font-size: calc(10px + var(--font-plus));
  font-weight: 600;
}
.workspace-switch small {
  display: block;
  color: hsl(calc(var(--accent-h) + 4) calc(21.8% * var(--accent-s)) 56.9%);
  font-size: calc(8px + var(--font-plus));
  margin-top: 4px;
}
.nav-caption {
  display: block;
  font-size: calc(8px + var(--font-plus));
  letter-spacing: 0.16em;
  font-weight: 700;
  color: hsl(calc(var(--accent-h) + 3) calc(18.9% * var(--accent-s)) 57.5%);
  margin: 0 12px 12px;
}
.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 43px;
  border-radius: 9px;
  padding: 10px 12px;
  gap: 11px;
  color: hsl(calc(var(--accent-h) + 3) calc(27.3% * var(--accent-s)) 65.5%);
  font-size: calc(11px + var(--font-plus));
  text-align: left;
  line-height: 1.4;
  margin: 4px 0;
}
.nav-item span {
  flex: 1;
}
.nav-item b {
  font-size: calc(9px + var(--font-plus));
  background: #ffffff15;
  color: hsl(calc(var(--accent-h) + 2) calc(48.9% * var(--accent-s)) 81.6%);
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 500;
}
.nav-item:hover {
  background: #ffffff05;
  color: hsl(calc(var(--accent-h) + 2) calc(66.0% * var(--accent-s)) 90.8%);
}
.nav-item.active {
  background: hsl(calc(var(--accent-h) + 2) calc(51.1% * var(--accent-s)) 25.7%);
  color: #fff;
  box-shadow: inset 2px 0 hsl(calc(var(--accent-h) + -2) calc(72.5% * var(--accent-s)) 67.3%);
}
.nav-item.active svg {
  color: hsl(calc(var(--accent-h) + -2) calc(83.5% * var(--accent-s)) 76.3%);
}
.nav-alert {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #e3b16e;
}
.sidebar-bottom {
  margin-top: auto;
}
.sidebar-tip {
  padding: 18px 12px;
  margin: 24px 4px 15px;
  border-top: 1px solid #ffffff0d;
  color: hsl(var(--accent-h) calc(52.2% * var(--accent-s)) 68.8%);
}
.sidebar-tip strong {
  display: block;
  font-size: calc(10px + var(--font-plus));
  color: hsl(var(--accent-h) calc(46.3% * var(--accent-s)) 83.9%);
  margin: 9px 0 7px;
}
.sidebar-tip p {
  font-size: calc(9px + var(--font-plus));
  line-height: 1.8;
  color: hsl(calc(var(--accent-h) + 3) calc(23.4% * var(--accent-s)) 59.0%);
  margin: 0;
  max-width: 150px;
}
.admin-sidebar .profile {
  border-color: #ffffff10;
  margin: 20px 5px 0;
}
.admin-sidebar .profile small {
  color: hsl(calc(var(--accent-h) + 3) calc(19.6% * var(--accent-s)) 62.0%);
}
.admin-sidebar .profile .icon-button {
  color: hsl(calc(var(--accent-h) + 3) calc(19.6% * var(--accent-s)) 62.0%);
  width: 25px;
}
.admin-workspace {
  margin-left: 228px;
  min-height: 100vh;
}
.topbar {
  height: 72px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: calc(11px + var(--font-plus));
  color: var(--muted);
}
.breadcrumb strong {
  color: var(--text);
  font-weight: 600;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.notification-button {
  position: relative;
}
.journal-button.active, .journal-button[aria-current="page"] { color: var(--brand, var(--blue)); background: var(--blue-soft); }
.notification-button i {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 5px;
  height: 5px;
  background: #d9914d;
  border: 1px solid var(--surface);
  border-radius: 50%;
}
.prototype-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
  font-weight: 600;
  border: 1px solid var(--line);
  padding: 6px 9px;
  border-radius: 6px;
  white-space: nowrap;
  min-height: 29px;
}
.prototype-badge i {
  height: 5px;
  width: 5px;
  background: hsl(calc(var(--accent-h) + 4) calc(25.0% * var(--accent-s)) 65.5%);
  border-radius: 50%;
}
.prototype-badge:hover {
  background: var(--blue-soft);
}
.admin-main {
  max-width: 1600px;
  margin: auto;
  padding: 30px 32px 16px;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 27px;
}
.page-heading p {
  font-size: calc(11px + var(--font-plus));
  color: var(--muted);
  margin: 0;
}
.overview-hero {
  height: 172px;
  background: var(--brand-strong);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}
.hero-copy {
  z-index: 2;
}
.hero-copy h2 {
  font-size: calc(25px + var(--font-plus));
  letter-spacing: -0.025em;
  line-height: 1.27;
  margin-top: 12px;
}
.hero-copy p {
  font-size: calc(10px + var(--font-plus));
  color: hsl(calc(var(--accent-h) + -1) calc(58.3% * var(--accent-s)) 81.2%);
  margin: 9px 0 0;
}
.hero-orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 300px;
  height: 300px;
  transform: translate(-33%, -50%);
}
.orbit-circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid hsl(var(--accent-h) calc(67.2% * var(--accent-s)) 76.1% / 0.208);
  inset: 40px;
}
.orbit-circle.two {
  inset: 0;
  border-color: hsl(var(--accent-h) calc(67.2% * var(--accent-s)) 76.1% / 0.11);
}
.hero-mascot {
  position: absolute;
  left: 111px;
  top: 95px;
  width: 78px;
  height: 105px;
  background: #fff;
  border-radius: 30px;
  transform: rotate(-7deg);
  box-shadow: 0 8px 30px hsl(calc(var(--accent-h) + 3) calc(100.0% * var(--accent-s)) 15.9% / 0.188);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-mascot .mascot {
  width: 67px;
  height: 81px;
}
.orbit-tag {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: calc(12px + var(--font-plus));
  font-weight: 700;
  background: #ffffffec;
  border-radius: 9px;
  padding: 9px 12px;
  color: var(--brand);
  box-shadow: 0 5px 18px hsl(calc(var(--accent-h) + 4) calc(100.0% * var(--accent-s)) 14.1% / 0.141);
  animation: float 5s ease-in-out infinite;
}
.onec-tag {
  top: 60px;
  left: 32px;
  font-size: calc(20px + var(--font-plus));
  color: #d18c3b;
  font-weight: 800;
  transform: rotate(-10deg);
}
.crm-tag {
  top: 192px;
  left: 182px;
  font-size: calc(11px + var(--font-plus));
  animation-delay: -1s;
  transform: rotate(7deg);
}
.ai-tag {
  top: 56px;
  left: 223px;
  animation-delay: -2s;
}
.orbit-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(calc(var(--accent-h) + -1) calc(67.2% * var(--accent-s)) 73.7%);
}
.orbit-dot.d1 {
  top: 220px;
  left: 69px;
}
.orbit-dot.d2 {
  top: 140px;
  left: 293px;
  width: 4px;
  height: 4px;
}
.hero-right {
  text-align: right;
  position: relative;
  z-index: 1;
  color: hsl(var(--accent-h) calc(50.9% * var(--accent-s)) 77.6%);
  font-size: calc(9px + var(--font-plus));
}
.hero-overline {
  font-size: calc(7px + var(--font-plus));
  letter-spacing: 0.18em;
  color: hsl(var(--accent-h) calc(47.1% * var(--accent-s)) 76.3%);
}
.hero-number {
  font-size: calc(70px + var(--font-plus));
  line-height: 1.1;
  color: hsl(calc(var(--accent-h) + -1) calc(63.6% * var(--accent-s)) 89.2%);
  font-family: Manrope, sans-serif;
  font-weight: 400;
  letter-spacing: -0.08em;
  padding-right: 4px;
}
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 23px;
}
.metric {
  padding: 17px 18px;
  min-width: 0;
}
.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
}
.metric-top svg {
  color: hsl(calc(var(--accent-h) + 4) calc(20.2% * var(--accent-s)) 64.1%);
}
.metric-number {
  font-size: calc(29px + var(--font-plus));
  line-height: 1.4;
  font-weight: 750;
  letter-spacing: -0.04em;
  margin: 7px 0 2px;
  font-variant-numeric: tabular-nums;
}
.metric-number > span {
  font-size: calc(20px + var(--font-plus));
  color: hsl(calc(var(--accent-h) + 5) calc(17.6% * var(--accent-s)) 66.7%);
  font-weight: 500;
  margin-left: 4px;
}
.metric > small {
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
}
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 282px;
  gap: 20px;
  align-items: start;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 21px 21px 17px;
}
.section-heading h2 {
  font-size: calc(15px + var(--font-plus));
  letter-spacing: -0.025em;
}
.section-heading p {
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
  margin: 6px 0 0;
}
.count {
  font-size: calc(10px + var(--font-plus));
  font-weight: 600;
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 5px;
  margin-left: 5px;
  color: var(--muted);
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 20px 16px;
  flex-wrap: wrap;
}
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 7px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  gap: 2px;
}
.segmented button {
  padding: 6px 8px;
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.segmented button.selected {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px hsl(calc(var(--accent-h) + 2) calc(53.5% * var(--accent-s)) 19.4% / 0.071);
}
.segmented button span {
  font-size: calc(8px + var(--font-plus));
  border-radius: 3px;
  padding: 0 3px;
  background: var(--warning-bg);
  color: var(--warning);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  color: hsl(calc(var(--accent-h) + 4) calc(17.1% * var(--accent-s)) 62.2%);
  width: 158px;
  background: var(--surface);
}
.search-box input {
  border: 0;
  min-width: 0;
  width: 100%;
  font-size: calc(9px + var(--font-plus));
  outline: none;
  color: var(--text);
  background: transparent;
}
.search-box:focus-within {
  box-shadow: 0 0 0 2px hsl(calc(var(--accent-h) + 3) calc(75.6% * var(--accent-s)) 66.3% / 0.333);
}
.search-box button {
  display: flex;
  padding: 0;
}
.table-head,
.client-row {
  display: grid;
  grid-template-columns:
    minmax(138px, 1.4fr) minmax(102px, 1fr) minmax(114px, 1fr)
    48px 12px;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
}
.table-head {
  background: var(--surface-alt);
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  height: 34px;
  border-block: 1px solid var(--line);
}
.client-row {
  width: 100%;
  text-align: left;
  min-height: 74px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.client-row:last-child {
  border-bottom: 0;
}
.client-row:hover {
  background: var(--surface-alt);
}
.company-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.company-cell > span:last-child {
  min-width: 0;
}
.company-cell strong {
  display: block;
  font-size: calc(11px + var(--font-plus));
}
.company-cell small {
  display: block;
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sources-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.subscription-cell > small {
  display: block;
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  margin-top: 6px;
}
.users-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
}
.client-row > svg {
  color: hsl(calc(var(--accent-h) + 6) calc(19.5% * var(--accent-s)) 66.9%);
}
.table-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
}
.table-footer > span:last-child {
  display: flex;
  align-items: center;
  gap: 6px;
}
.overview-aside {
  display: flex;
  flex-direction: column;
  gap: 17px;
}
.activity-chart .section-heading {
  padding: 21px 20px 12px;
}
.activity-chart .section-heading > svg {
  color: hsl(calc(var(--accent-h) + 1) calc(21.8% * var(--accent-s)) 64.9%);
}
.chart-value {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 0 20px;
  font-size: calc(25px + var(--font-plus));
  font-weight: 750;
  letter-spacing: -0.04em;
}
.chart-value > span {
  font-size: calc(9px + var(--font-plus));
  font-weight: 400;
  color: var(--muted);
  letter-spacing: normal;
}
.chart-value .badge {
  margin-left: auto;
  font-size: calc(8px + var(--font-plus));
  padding: 2px 5px;
  letter-spacing: normal;
}
.bar-chart {
  height: 137px;
  padding: 8px 21px 17px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: end;
  position: relative;
}
.chart-guide {
  position: absolute;
  top: 35px;
  border-top: 1px dashed var(--line);
  left: 21px;
  right: 21px;
}
.chart-guide.second {
  top: 77px;
}
.bar-column {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: flex-end;
  flex: 1;
  z-index: 1;
}
.bar-column i {
  display: block;
  width: 100%;
  max-width: 20px;
  border-radius: 4px 4px 0 0;
  background: hsl(calc(var(--accent-h) + 1) calc(62.5% * var(--accent-s)) 90.6%);
  transition: height 0.4s;
}
.bar-column.current i {
  background: var(--brand-strong);
}
.bar-column small {
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  margin-top: 9px;
}
.bar-value {
  font-size: calc(8px + var(--font-plus));
  color: var(--brand);
  margin-bottom: 4px;
  visibility: hidden;
}
.bar-column:hover .bar-value,
.bar-column.current .bar-value {
  visibility: visible;
}
.bar-column:hover i {
  background: hsl(var(--accent-h) calc(51.1% * var(--accent-s)) 65.5%);
}
.attention-card .section-heading {
  padding: 18px 18px 7px;
}
.attention-card h2 {
  font-size: calc(12px + var(--font-plus));
}
.attention-row {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  width: 100%;
  padding: 14px 18px;
}
.attention-row + .attention-row {
  border-top: 1px solid var(--line);
}
.attention-row:hover {
  background: var(--surface-alt);
}
.attention-row > span:nth-child(2) {
  flex: 1;
}
.attention-row strong {
  display: block;
  font-size: calc(10px + var(--font-plus));
}
.attention-row small {
  display: block;
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  margin-top: 4px;
}
.attention-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex-shrink: 0;
}
.attention-icon.amber {
  background: var(--warning-bg);
  color: var(--warning);
}
.attention-icon.red {
  background: var(--danger-bg);
  color: var(--danger);
}
.attention-row > svg {
  color: hsl(calc(var(--accent-h) + 2) calc(19.3% * var(--accent-s)) 64.5%);
}
.quiet-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.7;
  padding: 0 10px;
}
.quiet-note svg {
  color: hsl(calc(var(--accent-h) + 1) calc(22.0% * var(--accent-s)) 65.3%);
}
.page-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 26px;
  padding-bottom: 6px;
  color: hsl(calc(var(--accent-h) + 5) calc(18.4% * var(--accent-s)) 65.9%);
  font-size: calc(8px + var(--font-plus));
}
.mobile-bottom-nav {
  display: none;
}
/* Common dialogs, states, forms */
.agent-console textarea { width: 100%; font-family: Consolas, monospace; resize: vertical; min-height: 7rem; }
.agent-console-output { min-height: 9rem; max-height: 24rem; overflow: auto; padding: 1rem; background: #111827; color: #e5e7eb; white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-console-command { white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-console-confirm { display: flex; align-items: center; gap: .35rem; }
.agent-console-confirm input { width: auto; }
.agent-console-history { display: grid; gap: .5rem; max-height: 18rem; overflow: auto; }
.agent-console-entry { text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; padding: .6rem; border: 1px solid var(--border); border-radius: .4rem; background: transparent; color: inherit; cursor: pointer; }
.dialog {
  padding: 0;
  max-height: 90dvh;
  width: min(480px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 100px hsl(calc(var(--accent-h) + 2) calc(72.1% * var(--accent-s)) 8.4% / 0.208);
  overflow: hidden;
  animation: dialog-in 0.2s ease-out;
}
.dialog.wide {
  width: 640px;
}
.dialog::backdrop {
  background: hsl(calc(var(--accent-h) + 6) calc(71.4% * var(--accent-s)) 11.0% / 0.369);
  backdrop-filter: blur(5px);
}
.dialog-shell {
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.dialog-heading h2 {
  font-size: calc(16px + var(--font-plus));
}
.dialog-body {
  padding: 25px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.dialog-body > p {
  font-size: calc(13px + var(--font-plus));
  line-height: 1.8;
}
/* One-time confirmation before a dangerous action (static/js/step-up.js). */
.step-up-dialog {
  width: min(430px, calc(100% - 32px));
}
.step-up-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.step-up-form .dialog-body {
  flex: 1;
}
.step-up-lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: calc(12px + var(--font-plus));
  line-height: 1.7;
}
.step-up-action {
  display: grid;
  gap: 3px;
  margin: 0 0 18px;
  padding: 11px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}
.step-up-action span {
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.step-up-action strong {
  font-size: calc(12px + var(--font-plus));
  line-height: 1.5;
}
.step-up-action small {
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.45;
}
.step-up-form .web-alert {
  margin: 0 0 14px;
}
.step-up-dialog [hidden] {
  display: none;
}
.step-up-form .field {
  margin-bottom: 16px;
}
.step-up-form [name="code"] {
  letter-spacing: 0.32em;
  font-variant-numeric: tabular-nums;
  font-size: calc(17px + var(--font-plus));
  font-weight: 650;
}
.step-up-note,
.step-up-session {
  margin: 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.65;
}
.step-up-session {
  margin-top: 10px;
  color: var(--danger);
}
.step-up-session a {
  color: var(--danger);
  font-weight: 650;
}
.step-up-dialog .dialog-footer {
  margin-top: auto;
  justify-content: flex-end;
}
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
  gap: 12px;
  flex-shrink: 0;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  font-size: calc(12px + var(--font-plus));
  font-weight: 650;
}
.field input,
.field select,
select {
  width: 100%;
  height: 44px;
  border-radius: 9px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font-size: calc(12px + var(--font-plus));
}
.field input[readonly] {
  background: var(--surface-alt);
  color: var(--muted);
}
.field small {
  font-weight: 400;
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
  line-height: 1.6;
}
.field.invalid input {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.field.invalid small {
  color: var(--danger);
}
.field:focus-within > span {
  color: var(--brand);
}
.note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 11px;
  padding: 15px;
  margin: 18px 0;
  line-height: 1.65;
}
.note > svg {
  margin-top: 2px;
  width: 18px;
  flex-shrink: 0;
}
.note p {
  font-size: calc(11px + var(--font-plus));
  margin: 0;
  flex: 1;
}
.note.blue {
  background: var(--blue-soft);
  color: var(--brand);
}
.note.danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.note.success {
  background: var(--success-bg);
  color: var(--success);
}
.note .text-link {
  align-self: center;
}
.empty-state {
  text-align: center;
  padding: 42px 18px;
  display: flex;
  align-items: center;
  flex-direction: column;
}
.empty-icon {
  background: var(--blue-soft);
  color: var(--brand);
  border-radius: 18px;
  width: 60px;
  height: 60px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 17px;
  flex-shrink: 0;
}
.empty-state h3 {
  font-size: calc(17px + var(--font-plus));
  margin-bottom: 10px;
}
.empty-state p {
  max-width: 330px;
  color: var(--muted);
  font-size: calc(12px + var(--font-plus));
  margin-bottom: 20px;
}
.empty-state.large {
  min-height: 480px;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}
.skeleton-screen {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  min-height: 470px;
}
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-alt);
  border-radius: 8px;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent, var(--line), transparent);
  animation: shimmer 1.8s infinite;
}
.skeleton.heading {
  height: 22px;
  width: 40%;
  margin-bottom: 24px;
}
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.skeleton.block {
  height: 85px;
}
.skeleton.long {
  height: 20px;
  margin: 30px 0 20px;
  width: 60%;
}
.skeleton.row {
  height: 45px;
  margin-bottom: 12px;
}
.skeleton-screen > p {
  font-size: calc(12px + var(--font-plus));
  text-align: center;
}
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 15px);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 17px;
  border-radius: 12px;
  background: hsl(calc(var(--accent-h) + 1) calc(55.3% * var(--accent-s)) 20.2%);
  color: #fff;
  box-shadow: 0 8px 35px hsl(calc(var(--accent-h) + 4) calc(100.0% * var(--accent-s)) 11.2% / 0.149);
  font-size: calc(12px + var(--font-plus));
  max-width: calc(100% - 36px);
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: none;
}
.toast > svg {
  color: #9cddc3;
}
/* The global update bar must not cover the primary action bar or swallow its clicks. */
body:has(.primary-page) .update-bar {
  bottom: 148px;
  max-width: min(640px, calc(100% - 32px));
}
body:has(.primary-page) .toast {
  bottom: 96px;
}
.toast button {
  display: flex;
  color: hsl(calc(var(--accent-h) + 1) calc(26.2% * var(--accent-s)) 76.1%);
  padding: 3px;
}
.demo-controls {
  position: fixed;
  right: 22px;
  bottom: 18px;
  z-index: 30;
  font-size: calc(10px + var(--font-plus));
}
.demo-controls > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 3px 16px hsl(calc(var(--accent-h) + 4) calc(56.9% * var(--accent-s)) 20.0% / 0.035);
  min-height: 38px;
}
.demo-controls > summary::-webkit-details-marker {
  display: none;
}
.demo-controls > summary:hover {
  color: var(--brand);
  border-color: hsl(calc(var(--accent-h) + 2) calc(42.1% * var(--accent-s)) 70.2%);
}
.demo-version {
  font-size: calc(7px + var(--font-plus));
  background: var(--blue-soft);
  padding: 3px 4px;
  border-radius: 4px;
  color: var(--brand);
}
.demo-panel {
  position: absolute;
  bottom: 48px;
  right: 0;
  width: 216px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 8px 40px hsl(calc(var(--accent-h) + 4) calc(53.3% * var(--accent-s)) 17.6% / 0.125);
  animation: dialog-in 0.15s;
}
.demo-panel small {
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  letter-spacing: 0.09em;
  display: block;
  padding: 6px 7px 9px;
}
.demo-panel button,
.demo-panel a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  font-size: calc(11px + var(--font-plus));
  padding: 9px;
  border-radius: 6px;
}
.demo-panel button:hover,
.demo-panel a:hover {
  background: var(--surface-alt);
}
.demo-panel .selected {
  background: var(--blue-soft);
  color: var(--brand);
}
.demo-panel hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 8px 0;
}
.nav-scrim {
  position: fixed;
  inset: 0;
  background: hsl(calc(var(--accent-h) + 7) calc(74.5% * var(--accent-s)) 10.8% / 0.349);
  backdrop-filter: blur(3px);
  z-index: 39;
}
.about-mascot {
  width: 70px;
  height: 90px;
  background: #fff;
  margin-bottom: 15px;
  border-radius: 16px;
}
.notification-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 15px 5px;
  border-bottom: 1px solid var(--line);
}
.notification-row > span:nth-child(2) {
  flex: 1;
}
.notification-row strong {
  font-size: calc(13px + var(--font-plus));
  display: block;
}
.notification-row small {
  font-size: calc(11px + var(--font-plus));
  display: block;
  color: var(--muted);
  margin-top: 5px;
}
/* Administration detail pages */
.section-intro {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
  font-size: calc(11px + var(--font-plus));
}
.connection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.connection-card {
  padding-bottom: 20px;
}
.connection-card > .button {
  margin-left: 20px;
}
.inline-company {
  display: flex;
  align-items: center;
  gap: 11px;
}
.inline-company h3 {
  font-size: calc(14px + var(--font-plus));
  margin-bottom: 3px;
}
.inline-company small {
  font-size: calc(9px + var(--font-plus));
}
.connected-modules {
  padding: 0 20px 14px;
}
.connected-modules > div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.connected-modules > div > span:nth-child(2) {
  flex: 1;
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
}
.connected-modules > div > svg {
  color: var(--success);
}
.ai-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.ai-card {
  padding: 24px;
  position: relative;
}
.ai-card > .badge {
  position: absolute;
  right: 18px;
  top: 26px;
}
.app-icon {
  height: 52px;
  width: 52px;
  border-radius: 14px;
  background: var(--blue-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}
.app-icon.pale {
  background: var(--surface-alt);
  color: var(--muted);
}
.ai-card h2 {
  font-size: calc(20px + var(--font-plus));
}
.ai-card > p {
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
  margin: 8px 0 20px;
}
.ai-card > small {
  font-size: calc(9px + var(--font-plus));
  display: block;
  margin: 12px 0 20px;
}
.ai-card > .button {
  width: 100%;
}
.ai-card .empty-state {
  padding: 10px 0;
}
.ai-card .empty-state h3 {
  font-size: calc(12px + var(--font-plus));
}
.ai-card .empty-state p {
  font-size: calc(10px + var(--font-plus));
}
.ai-card .empty-icon {
  height: 42px;
  width: 42px;
  border-radius: 12px;
}
.detail-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  font-size: calc(12px + var(--font-plus));
}
.detail-stat > span:first-child {
  color: var(--muted);
}
.detail-stat strong {
  font-size: calc(12px + var(--font-plus));
  text-align: right;
  overflow-wrap: anywhere;
}
.detail-stat:last-child {
  border-bottom: 0;
}
.ai-card .detail-stat {
  font-size: calc(10px + var(--font-plus));
  padding: 14px 0;
}
.ai-card .detail-stat strong {
  font-size: calc(10px + var(--font-plus));
}
.event-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px;
  border-top: 1px solid var(--line);
}
.event-row time {
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
  width: 35px;
}
.event-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 33px;
  width: 33px;
  border-radius: 10px;
  flex-shrink: 0;
  background: var(--surface-alt);
  color: var(--muted);
}
.event-symbol.ok {
  color: var(--success);
  background: var(--success-bg);
}
.event-symbol.error {
  color: var(--danger);
  background: var(--danger-bg);
}
.event-symbol.warning {
  color: var(--warning);
  background: var(--warning-bg);
}
.event-row > div {
  flex: 1;
}
.event-row strong {
  font-size: calc(12px + var(--font-plus));
}
.event-row p {
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
  margin: 5px 0 0;
}
.event-row p span {
  margin: 0 5px;
}
.section-heading > select {
  width: auto;
  max-width: 180px;
  font-size: calc(11px + var(--font-plus));
  height: 38px;
}
.client-detail-top {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 24px;
}
.client-detail-top > .avatar {
  width: 50px;
  height: 50px;
  font-size: calc(22px + var(--font-plus));
  border-radius: 14px;
}
.client-detail-top > div {
  flex: 1;
}
.client-detail-top h2 {
  font-size: calc(22px + var(--font-plus));
}
.client-detail-top p {
  font-size: calc(11px + var(--font-plus));
  color: var(--muted);
  margin: 5px 0 0;
}
.detail-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  overflow: auto;
  scrollbar-width: none;
}
.detail-tabs button {
  font-size: calc(11px + var(--font-plus));
  white-space: nowrap;
  padding: 12px 2px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.detail-tabs button.selected {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 700;
}
.detail-content {
  padding-top: 22px;
  animation: fade-in 0.2s ease-out;
}
.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 15px;
}
.detail-stats > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px;
}
.detail-stats svg {
  color: var(--muted);
  width: 18px;
}
.detail-stats strong {
  font-size: calc(23px + var(--font-plus));
}
.detail-stats span {
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
  width: 100%;
}
.source-setting {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 15px;
}
.source-setting > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.source-setting p {
  font-size: calc(12px + var(--font-plus));
  font-weight: 600;
  margin: 15px 0 9px;
}
.endpoint {
  background: var(--surface-alt);
  border-radius: 6px;
  color: var(--muted);
  padding: 10px;
  font-size: calc(11px + var(--font-plus));
  overflow-wrap: anywhere;
}
.source-setting small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  margin-top: 10px;
  font-size: calc(9px + var(--font-plus));
}
.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.member-row > div {
  flex: 1;
}
.member-row strong {
  font-size: calc(11px + var(--font-plus));
  display: block;
}
.member-row small {
  display: block;
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
  margin-top: 3px;
}
.add-member {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 10px;
  align-items: start;
  padding-top: 25px;
}
.add-member .field {
  font-size: calc(10px + var(--font-plus));
}
.add-member > .button {
  margin-top: 23px;
}
.add-member input,
.add-member select {
  font-size: calc(10px + var(--font-plus));
}
.subscription-banner {
  background: var(--blue-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  gap: 17px;
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 24px;
}
.subscription-banner.expired {
  background: var(--warning-bg);
  color: var(--warning);
}
.subscription-banner strong {
  font-size: calc(19px + var(--font-plus));
}
.subscription-banner p {
  font-size: calc(10px + var(--font-plus));
  margin: 5px 0 0;
}
.confirm-inline {
  flex-direction: column;
}
.wizard-steps {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 30px;
}
.wizard-steps > div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  position: relative;
}
.wizard-steps span {
  height: 26px;
  width: 26px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: calc(10px + var(--font-plus));
  display: flex;
  justify-content: center;
  align-items: center;
}
.wizard-steps small {
  font-size: calc(10px + var(--font-plus));
}
.wizard-steps .passed {
  color: var(--brand);
  font-weight: 700;
}
.wizard-steps .passed span {
  color: white;
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}
.wizard-body {
  animation: fade-in 0.2s;
  min-height: 300px;
}
.wizard-body h3 {
  font-size: calc(23px + var(--font-plus));
}
.wizard-body > p {
  font-size: calc(12px + var(--font-plus));
  margin-bottom: 24px;
}
.step-indicator {
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
}
.module-choice {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 100%;
  margin-bottom: 12px;
  text-align: left;
  background: var(--surface);
}
.module-choice:hover {
  background: var(--surface-alt);
}
.module-choice.selected {
  border-color: hsl(calc(var(--accent-h) + -1) calc(45.2% * var(--accent-s)) 69.2%);
  background: var(--blue-soft);
}
.module-choice > span:nth-child(2) {
  flex: 1;
}
.module-choice strong {
  display: block;
  font-size: calc(12px + var(--font-plus));
}
.module-choice small {
  display: block;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  margin-top: 4px;
}
.checkbox-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  border: 1px solid hsl(calc(var(--accent-h) + 2) calc(24.8% * var(--accent-s)) 75.5%);
  border-radius: 5px;
}
.module-choice.selected .checkbox-mark {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
  color: white;
}
.review-check {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  background: var(--success-bg);
  height: 54px;
  width: 54px;
  border-radius: 15px;
  margin-bottom: 18px;
}
.brand-stage {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 40px;
  gap: 35px;
  margin-bottom: 20px;
}
.brand-stage h2 {
  font-size: calc(37px + var(--font-plus));
  line-height: 1.3;
  letter-spacing: -0.035em;
}
.brand-stage p {
  font-size: calc(12px + var(--font-plus));
  color: var(--muted);
  margin: 17px 0 25px;
}
.brand-stage-image {
  width: 180px;
  height: 205px;
  border-radius: 30px;
  background: #fff;
  padding: 16px;
  margin-right: 55px;
  transform: rotate(-5deg);
  box-shadow: 0 12px 40px hsl(calc(var(--accent-h) + 4) calc(50.0% * var(--accent-s)) 26.7% / 0.039);
}
.brand-variants {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.brand-variants > section {
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand-variants h3 {
  font-size: calc(12px + var(--font-plus));
}
.wordmark-holder {
  padding: 15px 10px;
  background: white;
  border-radius: 12px;
  margin: 15px 0;
}
.wordmark-holder img {
  width: 100%;
  display: block;
}
.brand-variants small {
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
}
.brand-variants .inverse-brand {
  background: hsl(calc(var(--accent-h) + 2) calc(89.2% * var(--accent-s)) 32.7%);
  color: #fff;
  border-color: hsl(calc(var(--accent-h) + 2) calc(89.2% * var(--accent-s)) 32.7%);
}
.inverse-brand > svg {
  width: 100%;
  height: 150px;
}
.inverse-brand small {
  color: hsl(calc(var(--accent-h) + -4) calc(51.2% * var(--accent-s)) 83.9%);
}
.brand-tokens {
  padding: 24px;
}
.brand-tokens > .section-heading {
  padding: 0 0 24px;
}
.swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.swatches i {
  display: block;
  height: 60px;
  border-radius: 9px;
  border: 1px solid hsl(calc(var(--accent-h) + 4) calc(59.5% * var(--accent-s)) 15.5% / 0.043);
  margin-bottom: 12px;
}
.swatches strong {
  display: block;
  font-size: calc(10px + var(--font-plus));
}
.swatches small {
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
}
.type-sample {
  display: flex;
  align-items: center;
  gap: 25px;
  border-block: 1px solid var(--line);
  margin: 26px 0;
  padding: 23px 0;
}
.type-sample > span {
  font-size: calc(70px + var(--font-plus));
  font-weight: 600;
  color: var(--brand);
  line-height: 1.2;
}
.type-sample h3 {
  font-size: calc(23px + var(--font-plus));
  margin: 0;
}
.type-sample p {
  font-size: calc(11px + var(--font-plus));
  color: var(--muted);
  margin: 7px 0;
}
.type-sample small {
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
}
.brand-tokens > .small {
  margin: 25px 0 0;
}
/* Client Mini App */
.client-app {
  height: 100dvh;
  display: flex;
  background: var(--surface);
}
.chat-sidebar {
  width: 258px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 20px;
  background: var(--surface-alt);
  border-right: 1px solid var(--line);
}
.chat-sidebar .brand {
  padding: 0 13px;
}
.chat-sidebar .brand strong {
  font-size: calc(30px + var(--font-plus));
  color: var(--text);
}
.chat-sidebar .brand small {
  font-size: calc(6px + var(--font-plus));
  color: var(--muted);
  opacity: 1;
}
.client-workspace {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  margin: 30px 0 21px;
  padding: 12px 8px;
  border-block: 1px solid var(--line);
  width: 100%;
}
.client-workspace > span:nth-child(2) {
  flex: 1;
}
.client-workspace strong {
  display: block;
  font-size: calc(11px + var(--font-plus));
}
.client-workspace small {
  display: block;
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  margin-top: 4px;
}
.client-workspace > svg {
  color: var(--muted);
}
.new-chat {
  width: 100%;
  justify-content: flex-start;
  padding-left: 17px;
  min-height: 43px;
  font-size: calc(11px + var(--font-plus));
}
.chat-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 17px 9px 22px;
  color: var(--muted);
}
.chat-search input {
  background: none;
  border: 0;
  outline: none;
  font-size: calc(10px + var(--font-plus));
  color: var(--text);
  min-width: 0;
  width: 100%;
}
.chat-search kbd {
  font-family: inherit;
  font-size: calc(12px + var(--font-plus));
  border: 1px solid var(--line);
  width: 20px;
  height: 20px;
  text-align: center;
  border-radius: 4px;
  color: hsl(var(--accent-h) calc(18.6% * var(--accent-s)) 67.3%);
}
.chat-list {
  overflow: auto;
  flex: 1;
  scrollbar-width: thin;
  padding-top: 10px;
  min-height: 80px;
}
.chat-list .nav-caption {
  font-size: calc(7px + var(--font-plus));
  margin-bottom: 19px;
}
.chat-group {
  font-size: calc(8px + var(--font-plus));
  color: hsl(calc(var(--accent-h) + 6) calc(16.8% * var(--accent-s)) 63.7%);
  display: block;
  margin: 20px 10px 8px;
}
.chat-nav-row {
  display: flex;
  align-items: center;
  border-radius: 8px;
  margin: 4px 0;
  min-width: 0;
}
.chat-nav-row > button:first-child {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 10px;
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
  text-align: left;
  min-width: 0;
  flex: 1;
  min-height: 42px;
}
.chat-nav-row > button:first-child span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
.chat-nav-row.active {
  background: var(--blue-soft);
}
.chat-nav-row.active > button {
  color: var(--brand) !important;
}
.chat-nav-row.active > button:first-child {
  font-weight: 700;
}
.chat-nav-row:hover {
  background: var(--blue-soft);
}
.chat-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 30px;
  opacity: 0;
  color: var(--muted);
  margin-right: 3px;
  flex-shrink: 0;
}
.chat-nav-row:hover .chat-remove,
.chat-remove:focus-visible {
  opacity: 1;
}
.chat-sidebar-bottom {
  padding-top: 18px;
}
.client-help-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px 10px;
  margin-bottom: 20px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}
.client-help-card > span {
  display: flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  background: var(--blue-soft);
  color: var(--brand);
  border-radius: 8px;
}
.client-help-card > div {
  flex: 1;
}
.client-help-card strong {
  font-size: calc(10px + var(--font-plus));
  display: block;
}
.client-help-card small {
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  display: block;
  margin-top: 5px;
}
.client-help-card > svg {
  color: var(--muted);
}
.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.chat-header {
  height: 78px;
  border-bottom: 1px solid var(--line);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.chat-header-title > div {
  min-width: 0;
}
.chat-header-title strong {
  display: block;
  font-size: calc(13px + var(--font-plus));
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-title span:not(.mobile-only) {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
  margin-top: 6px;
}
.context-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 8px;
}
.context-trigger:hover {
  background: var(--surface-alt);
}
/* Quiet sections of the cabinet next to the chat: dashboards, primary, templates.
   The links are server-rendered for this tenant; the labels yield to icons on narrow screens
   so the header keeps its height and never overflows. */
.chat-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  min-width: 0;
}
.chat-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  color: color-mix(in srgb, var(--text) 78%, var(--surface));
  font-size: calc(10px + var(--font-plus));
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.chat-nav-item:hover {
  background: var(--surface-alt);
  color: var(--text);
}
.chat-nav-item:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
@media (max-width: 1024px) {
  .chat-nav-item {
    width: 36px;
    padding: 0;
  }
  .chat-nav-item > span {
    display: none;
  }
}
@media (max-width: 800px) {
  .chat-nav {
    gap: 0;
  }
  .chat-nav-item {
    width: 40px;
    height: 40px;
  }
}
.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  overflow-anchor: none;
}
.chat-loading {
  width: 100%;
  max-width: 920px;
  min-height: 100%;
  margin: auto;
  padding: 28px 50px 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
}
.chat-loading[hidden] {
  display: none;
}
.chat-loading .loading-rows {
  width: min(720px, 100%);
}
@media (max-width: 800px) {
  .chat-loading {
    padding: 20px 17px;
    justify-content: flex-start;
  }
}
.chat-welcome {
  width: 100%;
  max-width: 920px;
  min-height: 100%;
  margin: auto;
  padding: 28px 50px 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}
.welcome-visual {
  width: 160px;
  height: 158px;
  position: relative;
  margin: 0 0 15px;
}
.welcome-visual > .mascot {
  position: absolute;
  left: 44px;
  top: 19px;
  width: 73px;
  height: 97px;
  transform: rotate(-5deg);
  background: #fff;
  border-radius: 24px;
  padding: 5px;
  z-index: 2;
}
.welcome-ring {
  position: absolute;
  left: 21px;
  top: 9px;
  width: 118px;
  height: 118px;
  border: 1px solid hsl(var(--accent-h) calc(56.5% * var(--accent-s)) 91.0%);
  border-radius: 50%;
  background: hsl(calc(var(--accent-h) + -1) calc(62.5% * var(--accent-s)) 96.9%);
}
.welcome-ring.two {
  left: 4px;
  top: -8px;
  width: 152px;
  height: 152px;
  background: transparent;
  border-style: dashed;
  border-color: hsl(var(--accent-h) calc(52.7% * var(--accent-s)) 89.2% / 0.329);
}
.welcome-spark {
  position: absolute;
  color: hsl(calc(var(--accent-h) + 1) calc(50.0% * var(--accent-s)) 67.8%);
  font-size: calc(19px + var(--font-plus));
  z-index: 3;
  animation: float 5s ease-in-out infinite;
}
.welcome-spark.s1 {
  top: 14px;
  right: 12px;
}
.welcome-spark.s2 {
  font-size: calc(11px + var(--font-plus));
  top: 99px;
  left: 13px;
  animation-delay: -2s;
}
.welcome-eyebrow {
  font-size: calc(8px + var(--font-plus));
  letter-spacing: 0.2em;
  color: hsl(calc(var(--accent-h) + 1) calc(22.4% * var(--accent-s)) 64.1%);
  font-weight: 650;
  margin-bottom: 15px;
}
.chat-welcome h1 {
  font-size: calc(40px + var(--font-plus));
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.045em;
  margin-bottom: 17px;
}
.chat-welcome h1 > span {
  color: var(--brand);
}
.chat-welcome > p {
  font-size: calc(12px + var(--font-plus));
  line-height: 1.9;
  color: var(--muted);
  margin-bottom: 32px;
}
.starter-prompts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 704px;
  text-align: left;
}
.starter-prompts > button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 18px 16px;
  text-align: left;
  position: relative;
  box-shadow: 0 3px 7px hsl(calc(var(--accent-h) + 1) calc(59.6% * var(--accent-s)) 22.4% / 0.008);
  transition:
    transform 0.18s,
    border-color 0.18s,
    box-shadow 0.18s;
}
.starter-prompts > button:hover {
  transform: translateY(-3px);
  border-color: hsl(calc(var(--accent-h) + 1) calc(56.2% * var(--accent-s)) 74.9%);
  box-shadow: 0 8px 24px hsl(calc(var(--accent-h) + 1) calc(59.6% * var(--accent-s)) 22.4% / 0.035);
}
.starter-prompts strong {
  display: block;
  font-size: calc(10px + var(--font-plus));
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.starter-prompts small {
  display: block;
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  white-space: nowrap;
}
.starter-prompts > button > svg {
  position: absolute;
  right: 15px;
  top: 20px;
  color: hsl(calc(var(--accent-h) + 1) calc(22.4% * var(--accent-s)) 67.6%);
}
.prompt-icon {
  height: 30px;
  width: 30px;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}
.prompt-icon svg {
  width: 17px;
}
.prompt-icon.green {
  background: var(--success-bg);
  color: var(--success);
}
.prompt-icon.violet {
  background: #f1edf7;
  color: #9581b4;
}
.welcome-assurance {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: calc(9px + var(--font-plus));
  color: hsl(calc(var(--accent-h) + 2) calc(21.7% * var(--accent-s)) 67.5%);
  margin-top: 28px;
}
.composer-area {
  padding: 18px 44px 25px;
  width: 100%;
  max-width: 980px;
  align-self: center;
  flex-shrink: 0;
  background: var(--surface);
}
.composer {
  border: 1px solid hsl(calc(var(--accent-h) + 1) calc(36.5% * var(--accent-s)) 87.6%);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 6px 26px hsl(calc(var(--accent-h) + 4) calc(59.5% * var(--accent-s)) 15.5% / 0.024);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.composer:focus-within {
  border-color: hsl(calc(var(--accent-h) + 1) calc(59.0% * var(--accent-s)) 69.4%);
  box-shadow:
    0 0 0 3px hsl(calc(var(--accent-h) + 5) calc(75.6% * var(--accent-s)) 61.4% / 0.039),
    0 6px 26px hsl(calc(var(--accent-h) + 4) calc(59.5% * var(--accent-s)) 15.5% / 0.024);
}
.composer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px 4px;
}
.composer-sources {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  padding: 5px 7px;
  border-radius: 6px;
  font-size: calc(12px + var(--font-plus));
  font-weight: 600;
  color: var(--text);
  min-height: 32px;
  max-width: 52%;
}
.composer-sources [data-source-name] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-question-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0;
}
.composer-top > span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: hsl(calc(var(--accent-h) + 3) calc(18.8% * var(--accent-s)) 66.7%);
  font-size: calc(8px + var(--font-plus));
}
.composer textarea {
  display: block;
  resize: none;
  width: 100%;
  border: 0;
  outline: 0;
  min-height: 58px;
  font-size: calc(12px + var(--font-plus));
  line-height: 1.8;
  padding: 13px 18px 5px;
  background: transparent;
  color: var(--text);
}
.composer textarea:focus-visible {
  outline: none;
}
.composer textarea::placeholder {
  color: hsl(calc(var(--accent-h) + 4) calc(16.8% * var(--accent-s)) 66.1%);
}
.composer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 13px 12px;
}
.composer-bottom > div {
  display: flex;
  align-items: center;
  gap: 2px;
}
.composer-bottom .icon-button {
  height: 32px;
  width: 32px;
}
.composer-hint {
  font-size: calc(8px + var(--font-plus));
  color: hsl(calc(var(--accent-h) + 3) calc(17.3% * var(--accent-s)) 68.2%);
}
.send-button {
  height: 34px;
  width: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-strong);
  color: white;
  box-shadow: 0 3px 10px hsl(var(--accent-h) calc(91.2% * var(--accent-s)) 31.4% / 0.071);
  flex-shrink: 0;
}
.send-button:hover {
  background: hsl(calc(var(--accent-h) + -1) calc(88.5% * var(--accent-s)) 23.9%);
}
.send-button:disabled {
  background: hsl(calc(var(--accent-h) + 2) calc(33.3% * var(--accent-s)) 93.5%);
  color: hsl(calc(var(--accent-h) + 1) calc(20.9% * var(--accent-s)) 73.7%);
  opacity: 1;
  box-shadow: none;
}
.send-button.stop {
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--text);
}
.composer-disclaimer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: calc(8px + var(--font-plus));
  color: hsl(calc(var(--accent-h) + 3) calc(16.5% * var(--accent-s)) 66.7%);
  margin-top: 11px;
  padding: 0 2px;
}
.client-app .demo-controls {
  bottom: 9px;
  right: 12px;
}
.client-app .demo-controls > summary {
  font-size: calc(8px + var(--font-plus));
  padding: 6px 9px;
  min-height: 30px;
  opacity: 0.85;
}
.client-app .demo-controls .demo-version {
  display: none;
}
.client-app .demo-panel {
  bottom: 40px;
}
.chat-action-menu {
  position: absolute;
  right: 24px;
  top: 65px;
  min-width: 200px;
  border: 1px solid var(--line);
  padding: 8px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 32px hsl(calc(var(--accent-h) + 4) calc(59.5% * var(--accent-s)) 15.5% / 0.125);
}
.chat-action-menu > button,
.chat-action-menu > a {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  font-size: calc(11px + var(--font-plus));
  padding: 12px;
  border-radius: 6px;
}
.chat-action-menu > button:hover,
.chat-action-menu > a:hover {
  background: var(--surface-alt);
}
.messages {
  width: 100%;
  max-width: 800px;
  margin: auto;
  padding: 28px 32px 24px;
}
.conversation-date {
  text-align: center;
  font-size: calc(8px + var(--font-plus));
  color: hsl(var(--accent-h) calc(18.6% * var(--accent-s)) 67.3%);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}
.user-message {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 11px;
  margin: 24px 0 30px;
  animation: message-in 0.2s;
}
.user-message > div {
  background: var(--blue-soft);
  padding: 14px 18px;
  border-radius: 15px 15px 3px 15px;
  max-width: 83%;
}
.user-message p {
  margin: 0;
  font-size: calc(12px + var(--font-plus));
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.assistant-message {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin: 20px 0 35px;
  animation: message-in 0.25s;
}
.messages .no-entrance {
  animation: none;
}
.assistant-avatar {
  flex-shrink: 0;
  width: 29px;
  height: 34px;
  background: white;
  border-radius: 8px;
  padding: 2px;
}
.assistant-content {
  min-width: 0;
  flex: 1;
}
.assistant-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-weight: 750;
  font-size: calc(12px + var(--font-plus));
  margin: 6px 0 12px;
}
.assistant-name small {
  font-size: calc(8px + var(--font-plus));
  font-weight: 400;
  color: var(--muted);
}
/* P2a: a quiet per-message route note. It reports the server's route, never a local guess. */
.assistant-name .route-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-left: auto;
  padding: 3px 9px 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .01em;
}
.route-badge::before {
  content: "";
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
}
.route-badge .route-badge-label { white-space: nowrap; }
.route-badge .route-badge-detail {
  min-width: 0;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  opacity: .78;
}
.route-badge .route-badge-detail::before {
  content: "·";
  margin-right: 6px;
  opacity: .7;
}
.route-badge.command { color: var(--brand); background: var(--blue-soft); border-color: transparent; }
.route-badge.freeform { color: var(--text); background: var(--surface-alt); }
.route-badge.clarify { color: var(--warning); background: var(--warning-bg); border-color: transparent; }
.route-badge.unavailable { color: var(--warning); background: var(--warning-bg); border-color: transparent; }
.route-badge.conversation { background: transparent; }
.route-badge.refusal { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.route-badge[data-route-reason="ai_complete"] { border-style: dashed; border-color: currentColor; }
.assistant-content .assistant-meta {
  display: block;
  margin-top: 10px;
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.assistant-content > p {
  font-size: calc(12px + var(--font-plus));
  line-height: 1.9;
  white-space: pre-wrap;
  margin: 0 0 16px;
  overflow-wrap: anywhere;
}
.question-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
}
.question-options .button {
  font-size: calc(10px + var(--font-plus));
  min-height: 37px;
}
.report-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  margin: 20px 0 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.report-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}
.report-symbol {
  height: 34px;
  width: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 9px;
}
.report-heading > div {
  flex: 1;
}
.report-heading strong {
  font-size: calc(12px + var(--font-plus));
  display: block;
}
.report-heading small {
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
  display: block;
  margin-top: 5px;
}
.report-heading .badge {
  font-size: calc(8px + var(--font-plus));
}
.report-card .report-heading .badge.v2-write-status {
  display: inline-flex;
  flex: 0 1 auto;
  white-space: normal;
}
.report-symbol[data-v2-tone="warning"] { background: var(--warning-bg); color: var(--warning); }
.report-symbol[data-v2-tone="danger"] { background: var(--danger-bg); color: var(--danger); }
.report-symbol[data-v2-tone="blue"] { background: var(--blue-soft); color: var(--brand); }
.report-symbol[data-v2-tone="muted"] { background: var(--surface); color: var(--muted); }
.report-stats {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  padding: 24px 18px;
  gap: 15px;
}
.report-stats span {
  font-size: calc(9px + var(--font-plus));
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}
.report-stats strong {
  font-size: calc(23px + var(--font-plus));
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.report-stats strong small {
  font-size: calc(17px + var(--font-plus));
  color: var(--muted);
}
.report-table > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  gap: 14px;
  border-top: 1px solid var(--line);
  font-size: calc(10px + var(--font-plus));
}
.report-table .report-table-head {
  background: var(--surface-alt);
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  padding-block: 9px;
}
.report-table > div > span strong {
  display: block;
  font-size: calc(10px + var(--font-plus));
}
.report-table > div > span small {
  display: block;
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  margin-top: 5px;
}
.report-table > div > strong {
  white-space: nowrap;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.report-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
}
.report-footer .button {
  font-size: calc(10px + var(--font-plus));
  min-height: 34px;
  padding: 7px 10px;
}
.report-footer .text-link {
  font-size: calc(10px + var(--font-plus));
}
.answer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: hsl(calc(var(--accent-h) + 3) calc(20.7% * var(--accent-s)) 63.9%);
  margin-top: 16px;
  font-size: calc(9px + var(--font-plus));
}
.answer-actions > span {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-right: auto;
}
.answer-actions button {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: calc(9px + var(--font-plus));
  min-height: 28px;
}
.answer-actions button:hover {
  color: var(--brand);
}
.quality-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 20px 0;
}
.inline-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: calc(13px + var(--font-plus));
  color: var(--text);
  margin-bottom: 13px;
}
.quality-card .inline-heading > svg {
  color: var(--warning);
}
.quality-row {
  padding: 13px 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.quality-row strong {
  font-size: calc(10px + var(--font-plus));
  display: block;
}
.quality-row small {
  display: block;
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
  margin-top: 4px;
}
.quality-card > p {
  font-size: calc(9px + var(--font-plus));
  margin: 10px 0 0;
}
.approval-card {
  padding: 22px;
  border: 1px solid hsl(calc(var(--accent-h) + 6) calc(36.5% * var(--accent-s)) 87.6%);
  border-radius: 14px;
  background: var(--surface-alt);
  margin: 20px 0;
}
.approval-shield {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 37px;
  height: 37px;
  background: var(--blue-soft);
  border-radius: 10px;
  color: var(--brand);
}
.approval-card .inline-heading strong {
  display: block;
  font-size: calc(12px + var(--font-plus));
}
.approval-card .inline-heading small {
  display: block;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  margin-top: 5px;
}
.transfer-route {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 21px 0;
  flex-wrap: wrap;
}
.transfer-route > svg {
  color: var(--muted);
}
.approval-card > p {
  font-size: calc(11px + var(--font-plus));
  color: var(--muted);
  margin-bottom: 19px;
}
.approval-card > .button {
  font-size: calc(11px + var(--font-plus));
}
.diff-table {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.diff-table > div {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 15px;
  border-top: 1px solid var(--line);
  padding: 15px;
  font-size: calc(11px + var(--font-plus));
}
.diff-table > div:first-child {
  background: var(--surface-alt);
  border-top: 0;
}
.diff-added {
  color: var(--success);
}
.processing p {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: calc(11px + var(--font-plus));
  margin: 0 0 8px;
  color: var(--muted);
}
.processing > div > small {
  font-size: calc(9px + var(--font-plus));
}
.typing-dots {
  display: inline-flex;
  gap: 3px;
}
.typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brand-strong);
  animation: pulse 1s infinite;
}
.typing-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
.composer-gate {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-alt);
}
.composer-gate .empty-icon {
  height: 43px;
  width: 43px;
  margin: 0;
  border-radius: 12px;
}
.composer-gate > div {
  flex: 1;
}
.composer-gate strong {
  font-size: calc(13px + var(--font-plus));
}
.composer-gate p {
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
  margin: 6px 0 0;
}
.composer-gate > .button {
  font-size: calc(10px + var(--font-plus));
}
.connection-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--warning);
  background: var(--warning-bg);
  padding: 14px 24px;
  font-size: calc(11px + var(--font-plus));
}
.connection-banner > button {
  margin-left: auto;
  font-size: calc(11px + var(--font-plus));
  font-weight: 700;
  white-space: nowrap;
}
.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 8px;
  width: fit-content;
  font-size: calc(10px + var(--font-plus));
}
.attachment-chip svg {
  color: var(--brand);
}
.attachment-chip > button {
  display: flex;
  align-items: center;
  margin-left: 8px;
}
.user-file {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: calc(9px + var(--font-plus));
  color: var(--brand);
  margin-bottom: 10px;
}
.attachment-option {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 12px;
  width: 100%;
  text-align: left;
  margin: 15px 0;
}
.attachment-option > svg {
  color: var(--brand);
}
.attachment-option > span {
  flex: 1;
}
.attachment-option strong {
  display: block;
  font-size: calc(12px + var(--font-plus));
}
.attachment-option small {
  display: block;
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
  margin-top: 5px;
}
.capabilities-list > button {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  text-align: left;
  width: 100%;
}
.capabilities-list > button > svg {
  color: var(--brand);
}
.capabilities-list > button > span {
  flex: 1;
}
.capabilities-list strong {
  display: block;
  font-size: calc(12px + var(--font-plus));
}
.capabilities-list small {
  display: block;
  font-size: calc(10px + var(--font-plus));
  color: var(--muted);
  margin-top: 6px;
}
/* Dark surfaces retain the original supplied mascot on a deliberate white tile. */
[data-theme="dark"] .welcome-ring {
  background: hsl(calc(var(--accent-h) + 4) calc(45.1% * var(--accent-s)) 20.0%);
  border-color: hsl(calc(var(--accent-h) + 3) calc(40.1% * var(--accent-s)) 26.9%);
}
[data-theme="dark"] .welcome-ring.two {
  background: none;
  border-color: hsl(calc(var(--accent-h) + 6) calc(35.6% * var(--accent-s)) 28.6% / 0.4);
}
[data-theme="dark"] .composer {
  border-color: hsl(calc(var(--accent-h) + 3) calc(31.1% * var(--accent-s)) 29.6%);
}
[data-theme="dark"] .prompt-icon.violet {
  background: #312c43;
  color: #b0a1d1;
}
[data-theme="dark"] .bar-column i {
  background: hsl(calc(var(--accent-h) + 3) calc(45.1% * var(--accent-s)) 27.8%);
}
[data-theme="dark"] .bar-column.current i {
  background: hsl(calc(var(--accent-h) + 1) calc(75.1% * var(--accent-s)) 62.2%);
}
[data-theme="dark"] .source-badge b {
  background: #51422a;
  color: #ffdc91;
}
[data-theme="dark"] .avatar {
  filter: saturate(0.65);
  background: hsl(calc(var(--accent-h) + 1) calc(39.5% * var(--accent-s)) 25.3%);
  color: hsl(calc(var(--accent-h) + -1) calc(72.9% * var(--accent-s)) 81.2%);
}
[data-theme="dark"] .avatar.purple {
  background: #39334d;
  color: #cec0ec;
}
[data-theme="dark"] .avatar.orange {
  background: #473c2f;
  color: #e5c09b;
}
[data-theme="dark"] .avatar.green {
  background: #2b4039;
  color: #b1d5c4;
}
[data-theme="dark"] .avatar.pink {
  background: #46333e;
  color: #dbb7cb;
}
[data-theme="dark"] .avatar.slate {
  background: hsl(calc(var(--accent-h) + 5) calc(25.0% * var(--accent-s)) 25.1%);
  color: hsl(var(--accent-h) calc(29.5% * var(--accent-s)) 79.4%);
}
[data-theme="dark"] .hero-mascot,
[data-theme="dark"] .brand-stage-image {
  box-shadow: 0 7px 35px #00000030;
}
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}
@keyframes pulse {
  0%,
  70%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
@keyframes float {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -5px;
  }
}
/* Tablet and narrow desktop */
@media (min-width: 1650px) {
  .admin-main {
    padding: 37px 40px;
  }
  .overview-grid {
    grid-template-columns: minmax(0, 1fr) 330px;
  }
  .overview-hero {
    height: 190px;
  }
  .client-row {
    min-height: 80px;
  }
  .chat-welcome h1 {
    font-size: calc(46px + var(--font-plus));
  }
  .chat-welcome > p {
    font-size: calc(13px + var(--font-plus));
  }
  .starter-prompts strong {
    font-size: calc(12px + var(--font-plus));
  }
  .starter-prompts small {
    font-size: calc(10px + var(--font-plus));
  }
}
@media (max-width: 1220px) {
  .admin-sidebar {
    width: 204px;
    padding-inline: 12px;
  }
  .admin-workspace {
    margin-left: 204px;
  }
  .admin-main {
    padding: 26px 24px;
  }
  .topbar {
    padding-inline: 24px;
  }
  .overview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .overview-aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .quiet-note {
    display: none;
  }
  .table-toolbar {
    flex-wrap: nowrap;
  }
  .table-head,
  .client-row {
    grid-template-columns:
      minmax(190px, 1.6fr) minmax(140px, 1fr)
      140px 70px 14px;
  }
  .company-cell strong {
    font-size: calc(12px + var(--font-plus));
  }
  .company-cell small {
    font-size: calc(9px + var(--font-plus));
  }
  .hero-orbit {
    left: 49%;
  }
  .hero-right {
    max-width: 130px;
  }
  .metric {
    padding: 16px 13px;
  }
  .metric-top {
    font-size: calc(9px + var(--font-plus));
  }
  .metric > small {
    font-size: calc(8px + var(--font-plus));
  }
  .chat-sidebar {
    width: 235px;
    padding-inline: 14px;
  }
  .chat-header {
    padding-inline: 25px;
  }
  .chat-header .header-actions {
    gap: 10px;
  }
  .chat-header .prototype-badge span {
    display: none;
  }
  .chat-welcome {
    padding-inline: 35px;
  }
  .chat-welcome h1 {
    font-size: calc(37px + var(--font-plus));
  }
  .starter-prompts {
    gap: 9px;
  }
  .starter-prompts > button {
    padding: 15px 12px;
  }
  .starter-prompts strong {
    font-size: calc(9px + var(--font-plus));
  }
  .starter-prompts small {
    font-size: calc(8px + var(--font-plus));
  }
  .composer-area {
    padding-inline: 28px;
  }
  .ai-grid {
    gap: 15px;
  }
  .ai-card {
    padding: 20px 16px;
  }
  .ai-card > .badge {
    position: static;
    margin-bottom: 14px;
  }
  .ai-card .app-icon {
    margin-bottom: 13px;
  }
  .brand-stage-image {
    margin-right: 0;
  }
}
/* Mini App / phone */
@media (max-width: 800px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: inline-flex;
  }
  .admin-sidebar,
  .chat-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.23s ease;
    z-index: 40;
    padding: 28px 18px max(20px, env(safe-area-inset-bottom));
    box-shadow: 15px 0 50px hsl(calc(var(--accent-h) + 5) calc(100.0% * var(--accent-s)) 7.8% / 0.125);
  }
  .admin-sidebar.mobile-open,
  .chat-sidebar.mobile-open {
    transform: translateX(0);
  }
  .admin-sidebar .brand strong {
    font-size: calc(29px + var(--font-plus));
  }
  .admin-sidebar .brand small {
    font-size: calc(8px + var(--font-plus));
  }
  .admin-sidebar .nav-item {
    font-size: calc(13px + var(--font-plus));
    min-height: 48px;
  }
  .admin-sidebar .nav-caption {
    font-size: calc(9px + var(--font-plus));
  }
  .workspace-switch strong {
    font-size: calc(12px + var(--font-plus));
  }
  .workspace-switch small {
    font-size: calc(10px + var(--font-plus));
  }
  .workspace-switch {
    padding: 14px 10px;
  }
  .sidebar-tip strong {
    font-size: calc(12px + var(--font-plus));
  }
  .sidebar-tip p {
    font-size: calc(11px + var(--font-plus));
    max-width: 190px;
  }
  .profile strong {
    font-size: calc(12px + var(--font-plus));
  }
  .profile small {
    font-size: calc(10px + var(--font-plus));
  }
  .admin-workspace {
    margin-left: 0;
  }
  .topbar {
    height: 64px;
    padding: 0 16px;
    gap: 8px;
  }
  .breadcrumb {
    gap: 6px;
    font-size: calc(12px + var(--font-plus));
  }
  .breadcrumb > svg {
    display: none;
  }
  .topbar .header-actions {
    gap: 6px;
  }
  .topbar .header-actions > .avatar {
    display: none;
  }
  .prototype-badge {
    font-size: calc(9px + var(--font-plus));
    border: 0;
    padding: 6px;
  }
  .prototype-badge span {
    display: none;
  }
  .notification-button {
    width: 32px;
  }
  .admin-main {
    padding: 25px 18px 98px;
  }
  .page-heading {
    align-items: flex-start;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 21px;
  }
  .eyebrow {
    font-size: calc(8px + var(--font-plus));
    margin-bottom: 9px;
  }
  h1 {
    font-size: calc(30px + var(--font-plus));
  }
  .page-heading p {
    font-size: calc(12px + var(--font-plus));
    line-height: 1.75;
    max-width: 340px;
  }
  .page-heading > .button {
    min-height: 44px;
    font-size: calc(12px + var(--font-plus));
  }
  .overview-hero {
    height: 181px;
    margin-bottom: 16px;
    padding: 23px 22px;
  }
  .hero-copy h2 {
    font-size: calc(23px + var(--font-plus));
    margin-top: 14px;
  }
  .hero-copy p {
    font-size: calc(10px + var(--font-plus));
    max-width: 180px;
  }
  .hero-orbit {
    left: auto;
    right: -45px;
    transform: translateY(-50%) scale(0.73);
    transform-origin: right center;
  }
  .hero-right {
    display: none;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
  }
  .metric {
    padding: 17px 15px;
    min-height: 112px;
  }
  .metric-top {
    font-size: calc(10px + var(--font-plus));
  }
  .metric-top svg {
    width: 17px;
  }
  .metric-number {
    font-size: calc(28px + var(--font-plus));
    margin-top: 9px;
  }
  .metric > small {
    font-size: calc(9px + var(--font-plus));
    line-height: 1.6;
    display: block;
  }
  .overview-grid {
    gap: 17px;
  }
  .section-heading {
    padding: 20px 17px 17px;
  }
  .section-heading h2 {
    font-size: calc(16px + var(--font-plus));
  }
  .section-heading p {
    font-size: calc(10px + var(--font-plus));
  }
  .table-toolbar {
    padding: 0 14px 15px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .segmented {
    width: 100%;
    justify-content: space-between;
    padding: 4px;
  }
  .segmented button {
    font-size: calc(10px + var(--font-plus));
    min-height: 35px;
    padding: 7px 8px;
  }
  .search-box {
    width: 100%;
    height: 40px;
    padding-inline: 11px;
  }
  .search-box input {
    font-size: calc(11px + var(--font-plus));
  }
  .table-head {
    display: none;
  }
  .client-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 13px;
    gap: 10px;
    min-height: 92px;
    padding: 15px;
  }
  .company-cell {
    gap: 10px;
  }
  .company-cell .avatar {
    width: 36px;
    height: 39px;
    font-size: calc(17px + var(--font-plus));
  }
  .company-cell strong {
    font-size: calc(13px + var(--font-plus));
  }
  .company-cell small {
    font-size: calc(9px + var(--font-plus));
    margin-top: 6px;
  }
  .sources-cell,
  .users-cell {
    display: none;
  }
  .subscription-cell .badge {
    font-size: calc(9px + var(--font-plus));
    padding: 4px 6px;
  }
  .subscription-cell > small {
    font-size: calc(8px + var(--font-plus));
    text-align: right;
  }
  .table-footer {
    font-size: calc(9px + var(--font-plus));
    padding: 14px;
  }
  .table-footer > span:last-child {
    font-size: calc(8px + var(--font-plus));
  }
  .overview-aside {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .overview-aside > .surface {
    width: 100%;
  }
  .activity-chart .section-heading h2 {
    font-size: calc(16px + var(--font-plus));
  }
  .chart-value {
    font-size: calc(29px + var(--font-plus));
  }
  .chart-value > span {
    font-size: calc(11px + var(--font-plus));
  }
  .bar-chart {
    height: 155px;
    padding-inline: 26px;
    gap: 20px;
  }
  .bar-column i {
    max-width: 28px;
  }
  .bar-column small,
  .bar-value {
    font-size: calc(10px + var(--font-plus));
  }
  .attention-card h2 {
    font-size: calc(15px + var(--font-plus));
  }
  .attention-row {
    padding: 17px;
  }
  .attention-row strong {
    font-size: calc(12px + var(--font-plus));
  }
  .attention-row small {
    font-size: calc(10px + var(--font-plus));
  }
  .attention-icon {
    width: 38px;
    height: 38px;
  }
  .quiet-note {
    display: flex;
    font-size: calc(10px + var(--font-plus));
    padding: 9px;
  }
  .page-footer {
    margin-top: 26px;
    display: block;
    line-height: 2;
    font-size: calc(9px + var(--font-plus));
  }
  .page-footer span {
    display: block;
  }
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 7px 13px max(8px, env(safe-area-inset-bottom));
    height: calc(66px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--line);
    z-index: 28;
  }
  .mobile-bottom-nav > button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px;
    min-width: 60px;
    color: var(--muted);
    font-size: calc(9px + var(--font-plus));
    border-radius: 9px;
    min-height: 44px;
  }
  .mobile-bottom-nav > button.active {
    color: var(--brand);
    background: var(--blue-soft);
  }
  .demo-controls {
    bottom: calc(77px + env(safe-area-inset-bottom));
    right: 13px;
  }
  .demo-controls > summary {
    padding: 8px 11px;
    font-size: calc(10px + var(--font-plus));
  }
  .toast {
    bottom: calc(85px + env(safe-area-inset-bottom));
    width: max-content;
    max-width: calc(100% - 28px);
    font-size: calc(11px + var(--font-plus));
  }
  .dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    margin: auto 0 0;
    position: fixed;
    inset: auto 0 0;
    border-bottom: 0;
  }
  .dialog.wide {
    width: 100%;
  }
  .dialog-shell {
    max-height: 91dvh;
  }
  .dialog-heading {
    padding: 17px 20px;
  }
  .dialog-heading h2 {
    font-size: calc(16px + var(--font-plus));
  }
  .dialog-body {
    padding: 22px 20px;
  }
  .dialog-footer {
    padding: 16px 20px max(18px, env(safe-area-inset-bottom));
    flex-wrap: wrap;
  }
  .dialog-footer > .button-row {
    margin-left: auto;
  }
  .dialog-footer .button {
    font-size: calc(11px + var(--font-plus));
  }
  .dialog-body .button {
    min-height: 44px;
  }
  .field input,
  .field select {
    font-size: calc(16px + var(--font-plus));
    height: 46px;
  }
  .field > span {
    font-size: calc(12px + var(--font-plus));
  }
  .field small {
    font-size: calc(10px + var(--font-plus));
  }
  .wizard-steps {
    gap: 7px;
    margin-bottom: 27px;
  }
  .wizard-steps > div {
    flex-direction: column;
    gap: 7px;
    flex: 1;
  }
  .wizard-steps small {
    font-size: calc(10px + var(--font-plus));
  }
  .wizard-body {
    min-height: 285px;
  }
  .wizard-body h3 {
    font-size: calc(23px + var(--font-plus));
  }
  .module-choice {
    padding: 17px 13px;
    gap: 10px;
  }
  .module-choice strong {
    font-size: calc(12px + var(--font-plus));
  }
  .module-choice small {
    font-size: calc(10px + var(--font-plus));
    line-height: 1.7;
  }
  .note {
    padding: 15px;
    gap: 9px;
    flex-wrap: wrap;
  }
  .note p {
    font-size: calc(11px + var(--font-plus));
  }
  .note .text-link {
    margin-left: 25px;
  }
  .connection-grid,
  .ai-grid,
  .brand-variants {
    grid-template-columns: 1fr;
  }
  .section-intro {
    flex-wrap: wrap;
    gap: 10px;
    font-size: calc(11px + var(--font-plus));
  }
  .connection-card > .button {
    margin-inline: 20px;
    width: calc(100% - 40px);
  }
  .connected-modules > div {
    min-height: 51px;
  }
  .connected-modules > div > span:nth-child(2) {
    font-size: calc(10px + var(--font-plus));
  }
  .source-badge.small {
    font-size: calc(9px + var(--font-plus));
  }
  .ai-card {
    padding: 23px;
  }
  .ai-card .app-icon {
    margin-bottom: 20px;
  }
  .ai-card > .badge {
    position: absolute;
    top: 27px;
    right: 22px;
  }
  .ai-card .detail-stat,
  .ai-card .detail-stat strong {
    font-size: calc(12px + var(--font-plus));
  }
  .ai-card > p,
  .ai-card > small {
    font-size: calc(11px + var(--font-plus));
  }
  .ai-card > .button {
    min-height: 44px;
  }
  .client-detail-top {
    gap: 11px;
    flex-wrap: wrap;
  }
  .client-detail-top > .avatar {
    width: 44px;
    height: 46px;
  }
  .client-detail-top h2 {
    font-size: calc(23px + var(--font-plus));
  }
  .client-detail-top .badge {
    font-size: calc(9px + var(--font-plus));
  }
  .detail-tabs {
    gap: 15px;
    justify-content: space-between;
  }
  .detail-tabs button {
    font-size: calc(11px + var(--font-plus));
    padding-block: 14px;
  }
  .detail-stats {
    gap: 8px;
  }
  .detail-stats > div {
    padding: 13px 11px;
    gap: 8px;
  }
  .detail-stats strong {
    font-size: calc(21px + var(--font-plus));
  }
  .detail-stats span {
    font-size: calc(8px + var(--font-plus));
  }
  .detail-stat {
    font-size: calc(11px + var(--font-plus));
  }
  .detail-stat strong {
    font-size: calc(11px + var(--font-plus));
  }
  .add-member {
    grid-template-columns: 1fr 1fr;
  }
  .add-member > .button {
    grid-column: span 2;
    margin-top: 0;
  }
  .add-member input,
  .add-member select {
    font-size: calc(13px + var(--font-plus));
  }
  .member-row .badge {
    font-size: calc(8px + var(--font-plus));
  }
  .subscription-banner strong {
    font-size: calc(19px + var(--font-plus));
  }
  .subscription-banner p {
    font-size: calc(10px + var(--font-plus));
  }
  .event-row {
    padding: 18px 14px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .event-row time {
    font-size: calc(9px + var(--font-plus));
    width: 30px;
  }
  .event-row strong {
    font-size: calc(11px + var(--font-plus));
  }
  .event-row p {
    font-size: calc(9px + var(--font-plus));
  }
  .event-row > .badge {
    margin-left: 81px;
    font-size: calc(9px + var(--font-plus));
  }
  .section-heading > select {
    font-size: calc(10px + var(--font-plus));
    max-width: 130px;
    height: 42px;
    padding-inline: 8px;
  }
  .event-row > div {
    min-width: 180px;
  }
  .brand-stage {
    padding: 25px;
    gap: 22px;
    flex-direction: column;
    align-items: flex-start;
  }
  .brand-stage h2 {
    font-size: calc(35px + var(--font-plus));
  }
  .brand-stage p {
    font-size: calc(12px + var(--font-plus));
  }
  .brand-stage-image {
    width: 115px;
    height: 130px;
    align-self: flex-end;
    margin-top: -25px;
  }
  .brand-variants {
    gap: 15px;
  }
  .brand-variants h3 {
    font-size: calc(13px + var(--font-plus));
  }
  .brand-variants small {
    font-size: calc(11px + var(--font-plus));
  }
  .brand-tokens {
    padding: 20px;
  }
  .swatches {
    gap: 12px;
    grid-template-columns: repeat(3, 1fr);
  }
  .swatches strong {
    font-size: calc(10px + var(--font-plus));
  }
  .swatches i {
    height: 58px;
  }
  .type-sample {
    gap: 16px;
    align-items: flex-start;
  }
  .type-sample > span {
    font-size: calc(53px + var(--font-plus));
  }
  .type-sample p {
    font-size: calc(11px + var(--font-plus));
  }
  .type-sample small {
    font-size: calc(9px + var(--font-plus));
    line-height: 1.8;
    display: block;
  }
  .brand-tokens > .section-heading {
    flex-wrap: wrap;
  }
  .empty-state.large {
    min-height: 430px;
  }
  .skeleton-screen {
    padding: 18px;
  }
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Client phone */
  .chat-sidebar {
    background: var(--surface-alt);
    border-right: 1px solid var(--line);
  }
  .chat-sidebar .brand {
    padding-left: 12px;
  }
  .chat-sidebar .brand small {
    font-size: calc(7px + var(--font-plus));
  }
  .client-workspace strong {
    font-size: calc(13px + var(--font-plus));
  }
  .client-workspace small {
    font-size: calc(9px + var(--font-plus));
  }
  .chat-sidebar .new-chat {
    font-size: calc(13px + var(--font-plus));
    min-height: 46px;
  }
  .chat-search {
    padding: 20px 10px;
  }
  .chat-search input {
    font-size: calc(12px + var(--font-plus));
  }
  .chat-group {
    font-size: calc(10px + var(--font-plus));
  }
  .chat-nav-row > button:first-child {
    font-size: calc(12px + var(--font-plus));
    min-height: 46px;
  }
  .chat-nav-row > button:first-child span {
    max-width: 190px;
  }
  .chat-remove {
    opacity: 0.6;
    width: 30px;
    height: 38px;
  }
  .chat-list .nav-caption {
    font-size: calc(8px + var(--font-plus));
  }
  .client-help-card {
    padding: 17px 12px;
  }
  .client-help-card strong {
    font-size: calc(11px + var(--font-plus));
  }
  .client-help-card small {
    font-size: calc(9px + var(--font-plus));
  }
  .chat-header {
    height: 67px;
    padding: 0 13px 0 7px;
    gap: 7px;
  }
  .chat-header-title {
    gap: 2px;
  }
  .chat-header-title strong {
    font-size: calc(12px + var(--font-plus));
    max-width: 190px;
  }
  .chat-header-title span:not(.mobile-only) {
    font-size: calc(8px + var(--font-plus));
    margin-top: 5px;
  }
  .chat-header .header-actions {
    gap: 0;
  }
  .chat-header .header-actions > .prototype-badge {
    font-size: calc(8px + var(--font-plus));
    padding: 8px 6px;
  }
  .chat-header .context-trigger {
    display: none;
  }
  .chat-header .icon-button {
    width: 33px;
  }
  .chat-welcome {
    padding: 26px 22px 24px;
    justify-content: flex-start;
    max-width: 480px;
    min-height: 0;
  }
  .welcome-visual {
    width: 130px;
    height: 112px;
    margin: 8px 0 18px;
  }
  .welcome-visual > .mascot {
    left: 35px;
    top: 4px;
    width: 61px;
    height: 80px;
    padding: 3px;
    border-radius: 18px;
  }
  .welcome-ring {
    width: 99px;
    height: 99px;
    left: 16px;
    top: -5px;
  }
  .welcome-ring.two {
    width: 125px;
    height: 125px;
    left: 3px;
    top: -18px;
  }
  .welcome-spark.s1 {
    font-size: calc(16px + var(--font-plus));
    right: 9px;
    top: 5px;
  }
  .welcome-spark.s2 {
    font-size: calc(9px + var(--font-plus));
    left: 10px;
    top: 82px;
  }
  .welcome-eyebrow {
    font-size: calc(7px + var(--font-plus));
    margin-bottom: 12px;
    letter-spacing: 0.17em;
  }
  .chat-welcome h1 {
    font-size: calc(31px + var(--font-plus));
    line-height: 1.22;
    margin-bottom: 14px;
  }
  .chat-welcome > p {
    font-size: calc(11px + var(--font-plus));
    line-height: 1.85;
    margin-bottom: 24px;
    max-width: 325px;
  }
  .starter-prompts {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .starter-prompts > button {
    display: grid;
    grid-template-columns: 33px 1fr 16px;
    gap: 4px 12px;
    padding: 14px;
    align-items: center;
    min-height: 69px;
    border-radius: 11px;
  }
  .starter-prompts .prompt-icon {
    grid-row: span 2;
    margin: 0;
    width: 33px;
    height: 34px;
    border-radius: 10px;
  }
  .starter-prompts strong {
    font-size: calc(11px + var(--font-plus));
    margin: 0;
  }
  .starter-prompts small {
    font-size: calc(9px + var(--font-plus));
    grid-column: 2;
    white-space: normal;
  }
  .starter-prompts > button > svg {
    position: static;
    grid-column: 3;
    grid-row: 1 / span 2;
  }
  .welcome-assurance {
    font-size: calc(8px + var(--font-plus));
    margin-top: 19px;
    gap: 6px;
  }
  .composer-area {
    padding: 12px 14px max(29px, env(safe-area-inset-bottom));
    flex-shrink: 0;
  }
  .composer {
    border-radius: 13px;
  }
  .composer-top {
    padding: 10px 12px 3px;
  }
  .composer-sources {
    font-size: calc(11px + var(--font-plus));
    padding: 5px 6px;
  }
  .composer-top > span {
    font-size: 0;
    gap: 0;
  }
  .composer-top > span > svg {
    width: 13px;
  }
  .composer textarea {
    font-size: calc(16px + var(--font-plus));
    line-height: 1.5;
    padding: 11px 13px 4px;
    min-height: 54px;
    height: 58px;
  }
  .composer-bottom {
    padding: 1px 10px 9px;
  }
  .composer-hint {
    font-size: calc(8px + var(--font-plus));
  }
  .composer-bottom .icon-button {
    width: 35px;
    height: 35px;
  }
  .send-button {
    height: 37px;
    width: 37px;
  }
  .composer-disclaimer {
    font-size: calc(7px + var(--font-plus));
    justify-content: center;
    margin-top: 9px;
  }
  .client-app .demo-controls {
    right: 11px;
    bottom: 3px;
  }
  .client-app .demo-controls > summary {
    padding: 3px 8px;
    min-height: 24px;
    font-size: calc(8px + var(--font-plus));
    gap: 5px;
  }
  .client-app .demo-controls > summary > svg {
    width: 12px;
  }
  .client-app .toast {
    bottom: 200px;
  }
  .messages {
    padding: 20px 17px 15px;
    max-width: 650px;
  }
  .conversation-date {
    font-size: calc(8px + var(--font-plus));
    margin-bottom: 20px;
  }
  .user-message {
    gap: 8px;
    margin: 19px 0 27px;
  }
  .user-message > .avatar {
    height: 26px;
    width: 26px;
    font-size: calc(9px + var(--font-plus));
  }
  .user-message > div {
    padding: 11px 14px;
    max-width: 86%;
  }
  .user-message p {
    font-size: calc(12px + var(--font-plus));
  }
  .assistant-message {
    gap: 9px;
    margin-bottom: 26px;
  }
  .assistant-avatar {
    width: 24px;
    height: 29px;
  }
  .assistant-name {
    font-size: calc(12px + var(--font-plus));
    margin-top: 5px;
    gap: 8px;
  }
  .assistant-name small {
    font-size: calc(7px + var(--font-plus));
  }
  .assistant-content > p {
    font-size: calc(12px + var(--font-plus));
    line-height: 1.85;
  }
  .report-heading {
    padding: 13px 12px;
    gap: 8px;
  }
  .report-heading strong {
    font-size: calc(10px + var(--font-plus));
  }
  .report-heading small {
    font-size: calc(8px + var(--font-plus));
  }
  .report-heading .badge {
    font-size: calc(7px + var(--font-plus));
    padding: 3px 5px;
    gap: 4px;
  }
  .report-symbol {
    width: 28px;
    height: 29px;
    border-radius: 8px;
  }
  .report-symbol > svg {
    width: 17px;
  }
  .report-stats {
    padding: 18px 12px;
    gap: 10px;
    grid-template-columns: 1.65fr 1fr 1fr;
  }
  .report-stats span {
    font-size: calc(7px + var(--font-plus));
    margin-bottom: 6px;
  }
  .report-stats strong {
    font-size: calc(18px + var(--font-plus));
  }
  .report-stats strong small {
    font-size: calc(12px + var(--font-plus));
  }
  .report-table > div {
    padding: 12px;
    font-size: calc(9px + var(--font-plus));
  }
  .report-table > div > span strong {
    font-size: calc(9px + var(--font-plus));
  }
  .report-table > div > span small {
    font-size: calc(7px + var(--font-plus));
    line-height: 1.5;
  }
  .report-table .report-table-head {
    font-size: calc(7px + var(--font-plus));
  }
  .report-footer {
    padding: 11px;
    gap: 4px;
    flex-wrap: wrap;
  }
  .report-footer .text-link {
    font-size: calc(9px + var(--font-plus));
    min-height: 38px;
  }
  .report-footer .button {
    font-size: calc(9px + var(--font-plus));
    padding: 8px;
    min-height: 38px;
    gap: 5px;
  }
  .report-footer .button svg {
    width: 15px;
  }
  .answer-actions {
    gap: 9px;
    font-size: calc(8px + var(--font-plus));
    flex-wrap: wrap;
  }
  .answer-actions button {
    font-size: calc(8px + var(--font-plus));
    min-height: 33px;
  }
  .answer-actions > span {
    font-size: calc(8px + var(--font-plus));
  }
  .question-options .button {
    font-size: calc(10px + var(--font-plus));
    min-height: 43px;
  }
  .quality-card,
  .approval-card {
    padding: 15px;
    margin-top: 17px;
  }
  .quality-row strong {
    font-size: calc(10px + var(--font-plus));
  }
  .quality-row small {
    font-size: calc(8px + var(--font-plus));
    line-height: 1.7;
    max-width: 155px;
  }
  .quality-row .badge {
    font-size: calc(8px + var(--font-plus));
  }
  .inline-heading {
    font-size: calc(11px + var(--font-plus));
    gap: 8px;
  }
  .approval-card .inline-heading strong {
    font-size: calc(11px + var(--font-plus));
  }
  .approval-card .inline-heading small {
    font-size: calc(8px + var(--font-plus));
  }
  .approval-card > p {
    font-size: calc(10px + var(--font-plus));
  }
  .approval-card > .button {
    min-height: 44px;
    font-size: calc(11px + var(--font-plus));
    width: 100%;
  }
  .composer-gate {
    padding: 17px;
    gap: 11px;
    flex-wrap: wrap;
  }
  .composer-gate .empty-icon {
    width: 37px;
    height: 37px;
  }
  .composer-gate strong {
    font-size: calc(12px + var(--font-plus));
  }
  .composer-gate p {
    font-size: calc(10px + var(--font-plus));
  }
  .composer-gate > .button {
    margin-left: 48px;
    font-size: calc(11px + var(--font-plus));
    min-height: 44px;
  }
  .composer-gate > div {
    min-width: 210px;
  }
  .connection-banner {
    font-size: calc(10px + var(--font-plus));
    padding: 12px;
    gap: 8px;
    line-height: 1.7;
  }
  .connection-banner > button {
    font-size: calc(10px + var(--font-plus));
  }
  .chat-scroll > .skeleton-screen,
  .chat-scroll > .empty-state {
    margin: 20px 17px;
  }
  .attachment-option {
    padding: 16px 12px;
    gap: 10px;
  }
  .attachment-option strong {
    font-size: calc(11px + var(--font-plus));
  }
  .attachment-option small {
    font-size: calc(8px + var(--font-plus));
  }
  .diff-table > div {
    font-size: calc(10px + var(--font-plus));
    padding: 13px;
  }
  .dialog-footer > .small {
    font-size: calc(9px + var(--font-plus));
  }
  .dialog-body .transfer-route {
    gap: 9px;
  }
  .dialog-body .transfer-route .badge {
    font-size: calc(9px + var(--font-plus));
  }
  .chat-action-menu {
    right: 12px;
    top: 58px;
  }
  .chat-action-menu > button,
  .chat-action-menu > a {
    min-height: 44px;
  }
}
@media (max-width: 370px) {
  .topbar {
    padding-inline: 10px;
  }
  .topbar .header-actions {
    gap: 2px;
  }
  .topbar .prototype-badge {
    font-size: calc(8px + var(--font-plus));
    padding: 4px;
  }
  .admin-main {
    padding-inline: 13px;
  }
  .hero-orbit {
    right: -80px;
    transform: translateY(-50%) scale(0.66);
  }
  .hero-copy h2 {
    font-size: calc(21px + var(--font-plus));
  }
  .hero-copy p {
    font-size: calc(9px + var(--font-plus));
  }
  .client-row {
    padding-inline: 12px;
    gap: 7px;
  }
  .company-cell .avatar {
    height: 34px;
    width: 31px;
  }
  .company-cell {
    gap: 8px;
  }
  .company-cell strong {
    font-size: calc(12px + var(--font-plus));
  }
  .subscription-cell .badge {
    font-size: calc(8px + var(--font-plus));
  }
  .segmented button {
    font-size: calc(9px + var(--font-plus));
    padding-inline: 6px;
  }
  .chat-header-title strong {
    max-width: 135px;
  }
  .chat-welcome h1 {
    font-size: calc(28px + var(--font-plus));
  }
  .chat-welcome {
    padding-inline: 18px;
  }
  .chat-header .prototype-badge {
    font-size: calc(7px + var(--font-plus));
    padding-inline: 4px;
  }
  .composer-hint {
    font-size: calc(7px + var(--font-plus));
  }
  .report-stats {
    gap: 6px;
    grid-template-columns: 1.8fr 1fr 1fr;
  }
  .report-stats strong {
    font-size: calc(16px + var(--font-plus));
  }
  .report-heading .badge {
    display: none;
  }
  .report-footer .text-link {
    font-size: calc(8px + var(--font-plus));
  }
  .report-footer .button {
    font-size: calc(8px + var(--font-plus));
  }
  .answer-actions > span {
    font-size: calc(7px + var(--font-plus));
  }
  .hero-copy .badge {
    font-size: calc(8px + var(--font-plus));
  }
}
.onec-tag {
  top: 84px;
}
.ai-tag {
  top: 78px;
}
@media (min-width: 801px) and (max-height: 850px) {
  .chat-welcome {
    padding: 15px 35px;
    justify-content: center;
  }
  .welcome-visual {
    height: 66px;
    width: 100px;
    margin: 0 0 14px;
  }
  .welcome-visual > .mascot {
    left: 26px;
    top: -6px;
    width: 49px;
    height: 66px;
    padding: 2px;
    border-radius: 16px;
  }
  .welcome-ring {
    height: 80px;
    width: 80px;
    left: 10px;
    top: -14px;
  }
  .welcome-ring.two {
    height: 103px;
    width: 103px;
    left: -2px;
    top: -26px;
  }
  .welcome-spark.s1 {
    font-size: calc(13px + var(--font-plus));
    right: 0;
    top: -4px;
  }
  .welcome-spark.s2 {
    font-size: calc(9px + var(--font-plus));
    left: 0;
    top: 49px;
  }
  .welcome-eyebrow {
    display: none;
  }
  .chat-welcome h1 {
    font-size: calc(33px + var(--font-plus));
    margin-bottom: 10px;
  }
  .chat-welcome > p {
    font-size: calc(11px + var(--font-plus));
    line-height: 1.65;
    margin-bottom: 20px;
  }
  .starter-prompts > button {
    padding: 12px 15px;
  }
  .starter-prompts .prompt-icon {
    margin-bottom: 12px;
    height: 27px;
    width: 27px;
  }
  .starter-prompts strong {
    font-size: calc(10px + var(--font-plus));
    margin-bottom: 6px;
  }
  .starter-prompts small {
    font-size: calc(9px + var(--font-plus));
  }
  .welcome-assurance {
    margin-top: 16px;
    font-size: calc(8px + var(--font-plus));
  }
  .composer-area {
    padding-top: 10px;
    padding-bottom: 22px;
  }
  .composer textarea {
    min-height: 48px;
    height: 48px;
  }
}
@media (max-width: 800px) {
  .admin-sidebar:not(.mobile-open),
  .chat-sidebar:not(.mobile-open) {
    visibility: hidden;
  }
  .admin-sidebar.mobile-open,
  .chat-sidebar.mobile-open {
    visibility: visible;
  }
  .chat-header .icon-button,
  .topbar .icon-button,
  .notification-button {
    min-height: 44px;
    min-width: 40px;
  }
  .chat-header-title strong {
    max-width: 175px;
  }
  .new-chat {
    min-height: 44px;
  }
  .mobile-open .chat-remove {
    width: 30px;
  }
  .source-badge {
    font-size: calc(11px + var(--font-plus));
  }
}
@media (max-width: 800px) {
  .starter-prompts strong {
    font-size: calc(12px + var(--font-plus));
  }
  .starter-prompts small {
    font-size: calc(10px + var(--font-plus));
  }
  .chat-welcome > p {
    font-size: calc(12px + var(--font-plus));
  }
  .assistant-content > p,
  .user-message p {
    font-size: calc(13px + var(--font-plus));
  }
  .report-heading strong {
    font-size: calc(12px + var(--font-plus));
  }
  .report-heading small {
    font-size: calc(9px + var(--font-plus));
  }
  .report-heading .badge {
    font-size: calc(8px + var(--font-plus));
  }
  .report-table > div {
    font-size: calc(11px + var(--font-plus));
  }
  .report-table > div > span strong {
    font-size: calc(11px + var(--font-plus));
  }
  .report-table > div > span small {
    font-size: calc(9px + var(--font-plus));
  }
  .report-table .report-table-head {
    font-size: calc(9px + var(--font-plus));
  }
  .report-stats span {
    font-size: calc(9px + var(--font-plus));
  }
  .report-stats strong {
    font-size: calc(21px + var(--font-plus));
  }
  .report-stats strong small {
    font-size: calc(13px + var(--font-plus));
  }
  .report-footer .button,
  .report-footer .text-link {
    font-size: calc(10px + var(--font-plus));
  }
  .quality-row strong {
    font-size: calc(12px + var(--font-plus));
  }
  .quality-row small {
    font-size: calc(10px + var(--font-plus));
  }
  .approval-card > p {
    font-size: calc(12px + var(--font-plus));
  }
  .approval-card .inline-heading strong {
    font-size: calc(12px + var(--font-plus));
  }
  .answer-actions > span,
  .answer-actions button {
    font-size: calc(9px + var(--font-plus));
  }
  .report-heading {
    flex-wrap: wrap;
  }
  .report-heading > div {
    min-width: 140px;
  }
}
@media (max-width: 370px) {
  .report-stats strong {
    font-size: calc(18px + var(--font-plus));
  }
  .report-stats span {
    font-size: calc(8px + var(--font-plus));
  }
  .report-table > div > span strong {
    font-size: calc(10px + var(--font-plus));
  }
  .report-table > div > span small {
    font-size: calc(8px + var(--font-plus));
  }
  .report-table > div {
    font-size: calc(10px + var(--font-plus));
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .starter-prompts > button:hover {
    transform: none;
  }
}

@media (max-width: 370px) {
  .overview-hero .hero-orbit {
    display: none;
  }
}

/* ===== «Проведение»: the guided primary write panel (11.11.2026) =====
   The chat keeps the conversation; the panel holds the decisions about one primary document.
   It is a neighbouring grid column (not a dialog): the composer and the scroll never block. */
.chat-main {
  --primary-w: 0px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--primary-w);
  grid-template-rows: auto minmax(0, 1fr) auto;
  transition: grid-template-columns 0.16s ease;
}
.chat-header {
  grid-column: 1;
  grid-row: 1;
}
.chat-scroll {
  grid-column: 1;
  grid-row: 2;
}
.chat-main > .composer-area {
  grid-column: 1;
  grid-row: 3;
  align-self: end;
  justify-self: center;
}
.chat-main[data-primary="closed"] {
  --primary-w: 48px;
}
.chat-main[data-primary="open"] {
  --primary-w: 384px;
}
@media (min-width: 1200px) and (max-width: 1439px) {
  .chat-main[data-primary="open"] {
    --primary-w: 340px;
  }
}
@media (min-width: 801px) and (max-width: 1199px) {
  .chat-main[data-primary="open"],
  .chat-main[data-primary="closed"] {
    --primary-w: 48px;
  }
}

.primary-panel {
  grid-column: 2;
  grid-row: 1 / span 3;
  position: relative;
  z-index: 6;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  font-size: calc(11px + var(--font-plus));
  color: var(--text);
}
.primary-panel[hidden],
.chat-main[data-primary="hidden"] .primary-panel {
  display: none;
}
.pp-sheet {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: var(--surface);
}
.primary-panel[data-open="true"] .pp-sheet {
  display: flex;
}
.pp-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* -- header ------------------------------------------------------------- */
.pp-head {
  flex-shrink: 0;
  display: grid;
  gap: 3px;
  padding: 15px 15px 11px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-alt), var(--surface));
}
.pp-head-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}
.pp-eyebrow {
  font-size: calc(8px + var(--font-plus));
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--muted);
}
.pp-title {
  margin: 0;
  font-size: calc(13px + var(--font-plus));
  line-height: 1.35;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.pp-title:focus-visible,
.pp-screen-title:focus-visible {
  outline: none;
  box-shadow: inset 3px 0 0 var(--brand);
  padding-left: 7px;
  margin-left: -7px;
  border-radius: 4px;
}
.pp-meta {
  margin: 0;
  font-size: calc(9px + var(--font-plus));
  line-height: 1.5;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.pp-collapse,
.pp-close {
  flex: none;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.pp-collapse {
  margin-left: auto;
}
.pp-collapse:hover,
.pp-close:hover {
  color: var(--text);
  border-color: var(--brand);
}
.primary-panel[data-collapsed="true"] .pp-collapse {
  transform: none;
}
.pp-close {
  display: none;
}

/* -- transport ---------------------------------------------------------- */
.pp-transport {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 7px 15px;
  border-bottom: 1px solid var(--line);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.45;
  color: var(--muted);
}
.pp-transport-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.pp-transport-dot[data-tone="success"] {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-bg);
}
.pp-transport-dot[data-tone="warning"] {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-bg);
}
.pp-transport-dot[data-tone="danger"] {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-bg);
}
.pp-transport-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.pp-link {
  margin-left: auto;
  color: var(--brand);
  font-size: calc(9px + var(--font-plus));
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pp-link[hidden] {
  display: none;
}

/* -- stepper ------------------------------------------------------------ */
.pp-steps {
  flex-shrink: 0;
  display: grid;
  gap: 3px;
  padding: 9px 14px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.pp-track {
  display: flex;
  align-items: center;
  min-height: 26px;
  margin: 0;
  padding: 4px 12px;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 20px, #000 calc(100% - 20px), transparent 100%);
  scroll-padding-inline: 22px;
}
.pp-track::-webkit-scrollbar {
  display: none;
}
.pp-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  scroll-snap-align: center;
}
.pp-step-line {
  width: 9px;
  height: 1px;
  background: var(--line);
  margin-right: 1px;
}
.pp-step-node {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: calc(7px + var(--font-plus));
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.pp-step-label {
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
  white-space: nowrap;
}
.pp-step[data-state="done"] .pp-step-node {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}
.pp-step[data-state="done"] .pp-step-label {
  color: var(--text);
}
.pp-step[data-state="current"] .pp-step-node {
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.pp-step[data-state="current"] .pp-step-label {
  color: var(--brand);
  font-weight: 700;
}
.pp-step[data-state="error"] .pp-step-node {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}
.pp-step[data-state="error"] .pp-step-label {
  color: var(--danger);
}
.pp-step[data-state="unknown"] .pp-step-node {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
}
.pp-step[aria-current="step"] .pp-step-node {
  box-shadow: 0 0 0 3px var(--blue-soft);
  border-color: var(--brand);
}
.pp-step-caption {
  margin: 0;
  font-size: calc(10px + var(--font-plus));
  font-weight: 700;
  line-height: 1.4;
}
/* The SF note of an UPD receipt: what this pass does not do, in one sentence on the surface.
   It is a note, not an action: no button, no checkbox, no hidden switch. */
.pp-sf-note {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  padding: 1px 12px 2px;
  color: var(--text);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.pp-sf-mark {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}
.pp-sf-note[data-tone="warning"] .pp-sf-mark {
  color: var(--warning);
}
.pp-sf-note[data-tone="danger"] .pp-sf-mark {
  color: var(--danger);
}
.pp-sf-note[data-tone="success"] .pp-sf-mark {
  color: var(--success);
}
.pp-sf-text {
  min-width: 0;
}
.pp-step[data-state="not_required"] .pp-step-node {
  border-style: dashed;
  color: var(--muted);
  background: var(--surface);
}
.pp-step[data-state="not_required"] .pp-step-label {
  color: var(--muted);
}
.pp-all-steps {
  margin-top: 1px;
}
.pp-all-steps > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
  list-style: none;
  cursor: pointer;
  color: var(--brand);
  font-size: calc(9px + var(--font-plus));
  font-weight: 700;
}
.pp-all-steps > summary::-webkit-details-marker,
.pp-lines > summary::-webkit-details-marker,
.pp-lookup > summary::-webkit-details-marker,
.pcard-timeline > summary::-webkit-details-marker {
  display: none;
}
.pp-all-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.pp-all-list li {
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
}
.pp-all-list li.on strong {
  color: var(--brand);
}
.pp-all-list strong {
  display: block;
  font-weight: 700;
  color: var(--text);
}
.pp-all-list small {
  display: block;
  margin-top: 1px;
  font-size: calc(8px + var(--font-plus));
  line-height: 1.45;
}
.pp-all-node {
  text-align: center;
  font-weight: 800;
  line-height: 1.4;
}
.pp-all-list li[data-state="done"] .pp-all-node {
  color: var(--success);
}
.pp-all-list li[data-state="error"] .pp-all-node {
  color: var(--danger);
}
.pp-all-list li[data-state="unknown"] .pp-all-node {
  color: var(--warning);
}
.pp-all-list li[data-state="not_required"] .pp-all-node {
  color: var(--muted);
}

/* -- body and cards ----------------------------------------------------- */
.pp-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 11px 13px 14px;
}
.pp-body[aria-busy="true"] {
  cursor: progress;
}
.pp-overview {
  display: block;
}
.pp-overview[hidden],
.pp-editor[hidden] {
  display: none;
}
.pp-cards {
  display: grid;
  gap: 9px;
}
.pcard {
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.pcard-attention {
  border-left: 3px solid var(--brand);
  background: linear-gradient(180deg, var(--surface-alt), var(--surface) 65%);
}
.pcard-attention[data-tone="warning"] {
  border-left-color: var(--warning);
  background: linear-gradient(180deg, var(--warning-bg), var(--surface) 75%);
}
.pcard-attention[data-tone="danger"] {
  border-left-color: var(--danger);
  background: linear-gradient(180deg, var(--danger-bg), var(--surface) 75%);
}
.pcard-attention[data-tone="success"] {
  border-left-color: var(--success);
  background: linear-gradient(180deg, var(--success-bg), var(--surface) 75%);
}
.pcard-attention[data-tone="progress"] {
  border-left-color: var(--brand);
  background: linear-gradient(180deg, var(--blue-soft), var(--surface) 80%);
}
.pp-card-kind {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: calc(11px + var(--font-plus));
  font-weight: 750;
  line-height: 1.4;
}
.pp-card-mark {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--brand);
  font-size: calc(9px + var(--font-plus));
  font-weight: 800;
  line-height: 1;
}
[data-tone="warning"] .pp-card-mark {
  background: var(--warning-bg);
  color: var(--warning);
}
[data-tone="danger"] .pp-card-mark {
  background: var(--danger-bg);
  color: var(--danger);
}
[data-tone="success"] .pp-card-mark {
  background: var(--success-bg);
  color: var(--success);
}
.pp-card-text {
  margin: 0;
  font-size: calc(10px + var(--font-plus));
  line-height: 1.6;
  color: var(--muted);
}
.pp-card-hint {
  margin: 0;
  font-size: calc(9px + var(--font-plus));
  line-height: 1.5;
  color: var(--warning);
}
.pp-card-note {
  margin: 0;
  font-size: calc(9px + var(--font-plus));
  line-height: 1.5;
  color: var(--muted);
}
.pp-foot-note {
  margin: 1px 0 0;
  font-size: calc(8px + var(--font-plus));
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}
.pp-mini-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 10px;
  margin: 1px 0 0;
  font-size: calc(9px + var(--font-plus));
}
.pp-mini-facts dt {
  color: var(--muted);
}
.pp-mini-facts dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* -- actions ------------------------------------------------------------ */
.pcard-actions {
  display: grid;
  gap: 6px;
  margin-top: 1px;
}
.pp-action-wrap {
  display: grid;
  gap: 3px;
}
.pp-action-hint {
  padding-left: 2px;
  font-size: calc(8px + var(--font-plus));
  line-height: 1.45;
  color: var(--muted);
}
.pp-action {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  font-size: calc(10px + var(--font-plus));
  white-space: normal;
  text-align: center;
  line-height: 1.4;
}
.pp-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.pp-stat {
  padding: 6px 7px;
  border-radius: 8px;
  background: var(--surface-alt);
  min-width: 0;
}
.pp-stat span {
  display: block;
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
}
.pp-stat strong {
  display: block;
  margin-top: 2px;
  font-size: calc(10px + var(--font-plus));
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.pp-lines > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  list-style: none;
  cursor: pointer;
  color: var(--brand);
  font-size: calc(9px + var(--font-plus));
  font-weight: 700;
}
.pp-lines-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.pp-lines-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: calc(9px + var(--font-plus));
  color: var(--muted);
}
.pp-lines-sum {
  flex: none;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pp-lines-more {
  justify-content: flex-start !important;
  font-style: italic;
}
.pp-facts {
  display: grid;
  gap: 2px;
}
.pp-fact {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr) 13px;
  gap: 6px;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px dashed var(--line);
  font-size: calc(9px + var(--font-plus));
}
.pp-fact:last-child {
  border-bottom: 0;
}
.pp-fact-what {
  color: var(--muted);
}
.pp-fact-result {
  color: var(--text);
  overflow-wrap: anywhere;
}
.pp-fact-mark {
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}
.pp-fact[data-tone="success"] .pp-fact-mark {
  color: var(--success);
}
.pp-fact[data-tone="warning"] .pp-fact-mark {
  color: var(--warning);
}
.pp-fact[data-tone="danger"] .pp-fact-mark {
  color: var(--danger);
}
.pp-results {
  display: grid;
  gap: 5px;
}
.pp-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font-size: calc(9px + var(--font-plus));
  text-align: left;
}
.pp-result strong {
  display: block;
  font-size: calc(10px + var(--font-plus));
  overflow-wrap: anywhere;
}
.pp-result small {
  display: block;
  margin-top: 2px;
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
}
button.pp-result:hover {
  background: var(--blue-soft);
  border-color: var(--brand);
}
.pcard-timeline {
  padding: 9px 11px;
}
.pcard-timeline > summary {
  display: flex;
  align-items: center;
  gap: 7px;
  list-style: none;
  cursor: pointer;
  font-size: calc(10px + var(--font-plus));
  font-weight: 750;
}
.pcard-timeline > summary small {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
}
.pp-timeline {
  list-style: none;
  margin: 7px 0 0;
  padding: 0;
  display: grid;
  gap: 5px;
}
.pp-timeline li {
  display: grid;
  grid-template-columns: 34px 52px minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  font-size: calc(9px + var(--font-plus));
  line-height: 1.45;
}
.pp-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pp-who {
  color: var(--muted);
}
.pp-what {
  color: var(--text);
}

/* -- sub-screens -------------------------------------------------------- */
.pp-screen-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pp-back {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 4px 4px 0;
  color: var(--brand);
  font-size: calc(9px + var(--font-plus));
  font-weight: 700;
}
.pp-screen-title {
  margin: 0;
  font-size: calc(12px + var(--font-plus));
  line-height: 1.35;
}
.pp-form {
  display: grid;
  gap: 8px;
}
.pp-form[hidden] {
  display: none;
}
.pp-lookup {
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.pp-lookup > summary {
  list-style: none;
  cursor: pointer;
  color: var(--brand);
  font-size: calc(10px + var(--font-plus));
  font-weight: 700;
}
.pp-lookup .field {
  margin-top: 7px;
}
.pp-screen-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pp-screen-foot .button {
  min-height: 36px;
  padding: 6px 8px;
  font-size: calc(9px + var(--font-plus));
  white-space: normal;
}

/* -- footer ------------------------------------------------------------- */
.pp-actions {
  flex-shrink: 0;
  display: grid;
  gap: 5px;
  padding: 9px 13px max(11px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.pp-continue {
  width: 100%;
  min-height: 40px;
  font-size: calc(11px + var(--font-plus));
}
.pp-continue-hint {
  display: block;
  text-align: center;
  font-size: calc(8px + var(--font-plus));
  line-height: 1.4;
  color: var(--muted);
}
.pp-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
/* With no «Открыть в 1С» the save button takes the full width (no dead placeholder). */
.pp-action-row.single {
  grid-template-columns: minmax(0, 1fr);
}
.pp-action-row .button {
  min-height: 33px;
  padding: 6px 7px;
  font-size: calc(9px + var(--font-plus));
  white-space: normal;
  line-height: 1.35;
}

/* -- spine (collapsed) and mobile sheet --------------------------------- */
.pp-spine {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 14px 0;
  background: var(--surface-alt);
  color: var(--muted);
}
.primary-panel[data-collapsed="true"] .pp-spine {
  display: flex;
}
.pp-spine-step {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: calc(9px + var(--font-plus));
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.pp-spine-label {
  writing-mode: vertical-rl;
  font-size: calc(9px + var(--font-plus));
  font-weight: 700;
  letter-spacing: 0.05em;
}
.pp-spine-flag {
  color: var(--warning);
  font-weight: 800;
}
.pp-spine:hover .pp-spine-step,
.pp-spine:focus-visible .pp-spine-step {
  border-color: var(--brand);
  color: var(--brand);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.pp-grabber {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 17px;
  flex: none;
  cursor: grab;
  touch-action: none;
}
.pp-grabber > span {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}

/* The editor lives inside the panel: same fields, one column, no window. */
.pp-body .pp-editor {
  display: block;
}
.pp-body .invoice-review-form {
  padding: 0;
}
.pp-body .invoice-review-heading h2 {
  font-size: calc(12px + var(--font-plus));
  line-height: 1.35;
}
.pp-body .invoice-review-grid {
  grid-template-columns: minmax(0, 1fr);
}
.pp-body .invoice-review-line {
  grid-template-columns: 1fr 1fr;
  padding: 9px;
  margin: 9px 0;
  gap: 8px;
}
.pp-body .invoice-review-line > :first-child {
  grid-column: 1 / -1;
}
.pp-body .invoice-review-form .web-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.pp-body .invoice-review-form .web-actions .button {
  width: 100%;
  white-space: normal;
}
.pp-body .invoice-ocr-text {
  max-height: 180px;
}

/* 801–1199: the panel is a spine; opened it floats over the chat, without dimming. */
@media (min-width: 801px) and (max-width: 1199px) {
  .primary-panel[data-open="true"] .pp-sheet {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: min(360px, 92vw);
    height: 100dvh;
    z-index: 28;
    border-left: 1px solid var(--line);
    box-shadow: -14px 0 40px hsl(calc(var(--accent-h) + 5) calc(100% * var(--accent-s)) 7.8% / 0.14);
  }
  :root[data-theme="dark"] .primary-panel[data-open="true"] .pp-sheet {
    box-shadow: -14px 0 40px #0008;
  }
}

/* ≤ 800: the same DOM as a bottom sheet above the composer, never a modal. */
@media (max-width: 800px) {
  .chat-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }
  .chat-header {
    grid-column: 1;
    grid-row: 1;
  }
  .chat-scroll {
    grid-column: 1;
    grid-row: 2;
  }
  .primary-panel {
    grid-column: 1;
    grid-row: 3;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .chat-main > .composer-area {
    grid-column: 1;
    grid-row: 4;
  }
  .primary-panel[data-collapsed="true"] .pp-spine {
    flex-direction: row;
    height: 50px;
    padding: 0 14px;
    gap: 8px;
    color: var(--text);
  }
  .primary-panel[data-collapsed="true"] .pp-spine::after {
    content: "⌃";
    margin-left: auto;
    color: var(--muted);
    font-weight: 800;
    font-size: calc(11px + var(--font-plus));
  }
  .primary-panel[data-collapsed="true"][data-tone="warning"] .pp-spine {
    background: var(--warning-bg);
  }
  .primary-panel[data-collapsed="true"][data-tone="danger"] .pp-spine {
    background: var(--danger-bg);
  }
  .primary-panel[data-collapsed="true"][data-tone="brand"] .pp-spine {
    background: var(--blue-soft);
  }
  .primary-panel[data-collapsed="true"] .pp-spine-step {
    border-color: var(--brand);
    color: var(--brand);
  }
  .primary-panel[data-collapsed="true"] .pp-spine-label {
    writing-mode: horizontal-tb;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .primary-panel[data-open="true"] .pp-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: 76dvh;
    z-index: 30;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -14px 40px hsl(calc(var(--accent-h) + 5) calc(100% * var(--accent-s)) 7.8% / 0.2);
    overflow: hidden;
  }
  :root[data-theme="dark"] .primary-panel[data-open="true"] .pp-sheet {
    box-shadow: 0 -14px 40px #0009;
  }
  .pp-grabber {
    display: flex;
  }
  .pp-close {
    display: inline-flex;
  }
  .pp-collapse {
    display: none;
  }
  .pp-head {
    padding: 4px 16px 10px;
  }
  .pp-body {
    padding: 10px 14px 12px;
  }
  .pp-actions {
    position: sticky;
    bottom: 0;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .pp-action,
  .pp-continue {
    min-height: 44px;
  }
  .pp-track {
    padding-bottom: 6px;
  }
  .pp-step-label {
    font-size: calc(9px + var(--font-plus));
  }
}

/* Large text: the ribbon becomes a readable vertical list. */
:root[data-font="6"] .pp-track {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  overflow: visible;
}
:root[data-font="6"] .pp-step {
  width: 100%;
}
:root[data-font="6"] .pp-step-line {
  display: none;
}

/* Receipt inside the chat card: the same draft is decided in the panel only. */
.primary-receipt {
  display: grid;
  gap: 6px;
  margin: 13px 18px 4px;
  padding: 11px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}
.primary-receipt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.primary-receipt-title {
  font-size: calc(11px + var(--font-plus));
  font-weight: 750;
}
.primary-receipt-meta,
.primary-receipt-note {
  margin: 0;
  font-size: calc(9px + var(--font-plus));
  line-height: 1.5;
  color: var(--muted);
}
.primary-receipt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.primary-receipt-row .button {
  min-height: 36px;
  font-size: calc(10px + var(--font-plus));
}
.primary-receipt-row .button.primary {
  flex: 1 1 auto;
}
@media (max-width: 800px) {
  .primary-receipt {
    margin-inline: 12px;
  }
  .primary-receipt-row .button {
    min-height: 44px;
  }
}

/* -- saved form, manual guidance and the read-only contract list --------- */
/* A saved form is a local draft payload: the label is the only claim it makes. */
.pp-saved {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 0;
  font-size: calc(8px + var(--font-plus));
  line-height: 1.4;
  font-weight: 650;
  color: var(--success);
  text-align: center;
}
.pp-saved-mark {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  font-size: calc(7px + var(--font-plus));
  font-weight: 800;
}
/* 409 of `draft/save`: calm, never a warning siren, always two explicit ways out. */
.pp-conflict {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: 10px;
  background: var(--warning-bg);
}
.pp-conflict-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 5px;
}
.pp-conflict-actions .button {
  min-height: 32px;
  padding: 6px 8px;
  white-space: normal;
  line-height: 1.35;
}
/* Manual steps: a quiet row, no colour that reads as an alarm, no button that posts. */
.pcard-guidance {
  border-left: 3px solid var(--line);
  background: var(--surface-alt);
}
.pp-guide {
  display: grid;
  gap: 4px;
  padding: 7px 0 1px;
  border-top: 1px dashed var(--line);
}
.pp-guide:first-of-type {
  border-top: 0;
  padding-top: 1px;
}
.pp-guide strong {
  font-size: calc(10px + var(--font-plus));
}
.pp-guide .button {
  justify-self: start;
  min-height: 30px;
}
/* The contract list is read-only: the state of each card is a word, not only a colour. */
.pcard-contract-picker {
  border-left: 3px solid var(--brand);
}
.pp-contract-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: end;
}
.pp-contract-search .field {
  margin: 0;
}
.pp-contract-search .button {
  min-height: 34px;
}
.pp-contract {
  align-items: flex-start;
}
.pp-contract > span:first-child {
  min-width: 0;
}
.pp-contract-state {
  flex: none;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  font-size: calc(8px + var(--font-plus));
  font-weight: 650;
  white-space: nowrap;
}
.pp-contract-state[data-active="false"] {
  background: var(--warning-bg);
  color: var(--warning);
}
.pp-contract[data-warn] {
  border-color: var(--warning);
}
.pp-chosen {
  display: grid;
  gap: 3px;
  padding: 7px 9px;
  border-radius: 9px;
  background: var(--blue-soft);
}
.pp-chosen strong {
  font-size: calc(9px + var(--font-plus));
  overflow-wrap: anywhere;
}
.pp-chosen small {
  font-size: calc(8px + var(--font-plus));
  color: var(--muted);
}
@media (max-width: 800px) {
  .pp-contract-search {
    grid-template-columns: minmax(0, 1fr);
  }
  .pp-contract-search .button,
  .pp-guide .button {
    min-height: 40px;
  }
}

/* -- the missing-item picker: exact cards, no auto-selection -------------- */
.pp-item {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.pp-item-hints {
  display: grid;
  gap: 3px;
  padding: 7px 9px;
  border-radius: 9px;
  background: var(--surface-alt);
}
.pp-item-suggestions {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: calc(9px + var(--font-plus));
  color: var(--text);
}
.pp-item-suggestions li {
  overflow-wrap: anywhere;
}
.pp-item-search {
  margin: 0;
  gap: 5px;
  font-size: calc(9px + var(--font-plus));
}
.pp-item-search input {
  height: 36px;
  padding: 7px 10px;
  font-size: calc(10px + var(--font-plus));
}
.pp-item-count {
  margin: 0;
  font-size: calc(8px + var(--font-plus));
  line-height: 1.45;
  color: var(--muted);
}
.pp-item-list {
  display: grid;
  gap: 6px;
  max-height: 238px;
  margin: 0;
  padding: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.pp-item-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.pp-item-row[hidden] {
  display: none;
}
.pp-item-row:hover {
  border-color: var(--brand);
}
.pp-item-row:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.pp-item-row:has(input:checked) {
  border-color: var(--brand);
  background: var(--blue-soft);
}
.pp-item-row input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--brand-strong);
}
.pp-item-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.pp-item-name {
  font-size: calc(10px + var(--font-plus));
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.pp-item-meta {
  font-size: calc(8px + var(--font-plus));
  line-height: 1.4;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.pp-item-submit {
  width: 100%;
  min-height: 38px;
  white-space: normal;
  line-height: 1.4;
}
.pp-item-note {
  margin: 0;
  font-size: calc(8px + var(--font-plus));
  line-height: 1.5;
  color: var(--muted);
}
.pp-item .web-alert.error {
  margin: 0;
}
@media (max-width: 800px) {
  .pp-item-search input,
  .pp-item-submit {
    min-height: 44px;
  }
  .pp-item-list {
    max-height: 210px;
  }
}

/* -- the received SF: one exact basis and its own child card ----------------- */
.pp-basis {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.pp-basis .pp-item-search {
  margin: 0;
}
.pp-basis .pp-item-list {
  max-height: 188px;
}
.pp-basis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pp-basis-head .pp-item-count {
  min-width: 0;
}
.pp-basis-head .pp-basis-refresh {
  flex: none;
  min-height: 28px;
  padding: 4px 9px;
  font-size: calc(9px + var(--font-plus));
}
.pp-basis-row .pp-item-name {
  font-variant-numeric: tabular-nums;
}
.pp-basis-vat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 5px 10px;
  margin: 0;
  padding: 6px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
}
.pp-basis-vat legend {
  grid-column: 1 / -1;
  padding: 0 4px;
  font-size: calc(8px + var(--font-plus));
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.pp-basis-vat label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: calc(9px + var(--font-plus));
  line-height: 1.45;
  color: var(--text);
  cursor: pointer;
}
.pp-basis-vat input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand-strong);
}
.pp-basis-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}
.pp-basis-refresh {
  justify-self: start;
  min-height: 30px;
}
.pcard-child {
  border-left: 3px solid var(--brand);
  background: linear-gradient(180deg, var(--surface-alt), var(--surface) 72%);
}
.pp-child-line {
  margin: 0;
  font-size: calc(10px + var(--font-plus));
  font-weight: 650;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.pcard-ledger[data-pp-ledger-state="ok"] {
  border-left: 3px solid var(--success);
  background: linear-gradient(180deg, var(--success-bg), var(--surface) 78%);
}
.pcard-ledger[data-pp-ledger-state="missing"],
.pcard-ledger[data-pp-ledger-state="mismatch"],
.pcard-ledger[data-pp-ledger-state="unverified"] {
  border-left: 3px solid var(--warning);
  background: linear-gradient(180deg, var(--warning-bg), var(--surface) 78%);
}
.pcard-ledger[data-pp-ledger-state="none"] {
  border-left: 3px solid var(--line);
  background: var(--surface-alt);
}
.pcard-ledger .pp-mini-facts dd {
  font-variant-numeric: tabular-nums;
}
@media (max-width: 800px) {
  .pp-basis .pp-item-list {
    max-height: 190px;
  }
  .pp-basis-vat input {
    width: 18px;
    height: 18px;
  }
  .pp-basis-vat label {
    min-height: 32px;
    align-items: center;
  }
  .pp-basis-refresh {
    min-height: 40px;
  }
}

/* -- the chosen contract: a suggestion inside the form ------------------- */
.pcard-chosen {
  border-left: 3px solid var(--brand);
  background: linear-gradient(180deg, var(--blue-soft), var(--surface) 70%);
}
.pp-chosen-line {
  margin: 0;
  font-size: calc(10px + var(--font-plus));
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.pp-chosen .button {
  justify-self: start;
  min-height: 30px;
}
/* The same line inside the editor, under the confirmation checkbox. */
.invoice-contract-note {
  margin: 0;
  padding: 7px 9px;
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  background: var(--blue-soft);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.5;
  color: var(--text);
}
.invoice-contract-note[hidden] {
  display: none;
}
/* ---- Первичка: рабочий стол и очередь (15.11.2026) ----------------------- */
.primary-page {
  --primary-rail: 366px;
  position: relative;
  min-width: 0;
}
.primary-page [hidden] {
  display: none !important;
}
.primary-page .eyebrow {
  color: var(--brand);
}
.primary-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.primary-heading {
  align-items: flex-end;
  margin-bottom: 18px;
}
.primary-heading h1 {
  margin-bottom: 4px;
}
.primary-heading p {
  max-width: 700px;
  font-size: calc(12px + var(--font-plus));
  line-height: 1.65;
}
.primary-head-side {
  padding-bottom: 4px;
}
.primary-flow-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  font-weight: 650;
  white-space: nowrap;
}
.primary-flow-pill svg {
  color: var(--success);
}
.primary-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(90deg, var(--surface), var(--surface-alt));
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.primary-context-source {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.primary-context-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-soft);
  color: var(--brand);
  flex-shrink: 0;
}
.primary-context-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.primary-context-label {
  font-size: calc(8px + var(--font-plus));
  letter-spacing: 0.14em;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
}
.primary-context-copy strong {
  font-size: calc(13px + var(--font-plus));
  overflow-wrap: anywhere;
}
.primary-context-copy small {
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  overflow-wrap: anywhere;
}
.primary-context-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  min-width: 0;
}
.primary-sync {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  white-space: nowrap;
}
.primary-sync svg {
  opacity: 0.7;
}
.primary-sync time {
  color: var(--text);
  font-weight: 650;
}
.primary-desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--primary-rail);
  gap: 18px;
  align-items: start;
  min-width: 0;
}
.primary-workspace {
  position: relative;
  min-width: 0;
}
.primary-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: clamp(420px, calc(100dvh - 330px), 620px);
  padding: 44px 26px;
  border: 1.5px dashed hsl(calc(var(--accent-h) + 4) calc(40% * var(--accent-s)) 78%);
  border-radius: 20px;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--blue-soft), transparent 62%),
    var(--surface);
  overflow: hidden;
  isolation: isolate;
}
.primary-dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 72%);
}
.primary-page.is-dragover .primary-dropzone {
  border-color: var(--brand);
  background: var(--blue-soft);
}
.primary-drop-art {
  position: relative;
  width: 108px;
  height: 126px;
  margin-bottom: 22px;
}
.primary-drop-sheet {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 14px 34px hsl(calc(var(--accent-h) + 4) calc(60% * var(--accent-s)) 20% / 0.1);
}
.primary-drop-sheet.one {
  transform: rotate(-9deg) translate(-7px, 4px);
  opacity: 0.55;
}
.primary-drop-sheet.two {
  transform: rotate(5deg) translate(6px, 2px);
  opacity: 0.8;
}
.primary-drop-sheet.top {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  background: linear-gradient(160deg, var(--surface), var(--blue-soft));
  transform: rotate(-2deg);
}
.primary-dropzone h2 {
  font-size: calc(23px + var(--font-plus));
  margin-bottom: 8px;
  letter-spacing: -0.035em;
}
.primary-drop-hint {
  max-width: 460px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: calc(12px + var(--font-plus));
  line-height: 1.65;
}
.primary-drop-actions {
  justify-content: center;
  margin-bottom: 16px;
}
.primary-drop-note {
  max-width: 480px;
  margin: 0;
  color: var(--muted);
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.6;
}
.primary-drop-status {
  min-height: 18px;
  max-width: 520px;
  margin: 10px 0 0;
  color: var(--warning);
  font-size: calc(10px + var(--font-plus));
  font-weight: 650;
  line-height: 1.55;
}
.primary-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 26px;
  text-align: center;
  border-radius: 20px;
  background: var(--surface);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.primary-drop-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.primary-drop-overlay-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin-bottom: 6px;
  border-radius: 18px;
  background: var(--success-bg);
  color: var(--success);
}
.primary-drop-overlay strong {
  font-size: calc(16px + var(--font-plus));
}
.primary-drop-overlay p {
  max-width: 380px;
  margin: 0;
  color: var(--muted);
  font-size: calc(11px + var(--font-plus));
  line-height: 1.6;
}
.primary-rail {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
  max-height: calc(100dvh - 46px);
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.primary-rail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.primary-rail-title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.primary-rail-title h2 {
  font-size: calc(18px + var(--font-plus));
  letter-spacing: -0.03em;
}
.primary-rail-head > p {
  flex-basis: 100%;
  margin: 1px 0 0;
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.5;
}
.primary-sheet-close {
  display: none;
}
.primary-views {
  width: 100%;
}
.primary-views button {
  flex: 1;
  justify-content: center;
  min-height: 34px;
  padding: 7px 4px;
  font-size: calc(10px + var(--font-plus));
}
.primary-search {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-alt);
  color: var(--muted);
}
.primary-search input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: calc(11px + var(--font-plus));
}
.primary-search:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px hsl(calc(var(--accent-h) + 3) calc(75.6% * var(--accent-s)) 66.3% / 0.18);
}
.primary-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.primary-chips button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  white-space: nowrap;
}
.primary-chips button[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
  font-weight: 700;
}
.primary-chips button span {
  display: inline-flex;
  min-width: 16px;
  justify-content: center;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
}
.primary-chips button[aria-pressed="true"] span {
  background: hsl(calc(var(--accent-h) + 4) calc(20% * var(--accent-s)) 100% / 0.18);
  color: var(--surface);
}
.primary-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  max-height: calc(100dvh - 470px);
  margin: 0 -2px;
  padding: 1px 2px 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.primary-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
}
.primary-card:hover {
  border-color: hsl(calc(var(--accent-h) + 3) calc(31.5% * var(--accent-s)) 78.8%);
  box-shadow: 0 6px 18px hsl(calc(var(--accent-h) + 4) calc(50% * var(--accent-s)) 20% / 0.07);
  transform: translateY(-1px);
}
.primary-card[data-current="1"] {
  border-color: var(--brand);
  background: linear-gradient(180deg, var(--blue-soft), var(--surface));
  box-shadow: inset 3px 0 0 var(--brand);
}
.primary-card[data-selected="1"] {
  border-color: var(--focus);
}
.primary-card-open {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  min-height: 104px;
  padding: 11px 40px 11px 12px;
  border-radius: 11px;
  text-align: left;
}
.primary-card-open:focus-visible {
  outline-offset: -2px;
}
.primary-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.primary-card-date {
  color: var(--muted);
  font-size: calc(8.5px + var(--font-plus));
  white-space: nowrap;
}
.primary-card-title {
  display: block;
  font-size: calc(12px + var(--font-plus));
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.primary-card-file {
  display: block;
  margin-top: -1px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.primary-card-party {
  display: block;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.primary-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}
.primary-card-amount {
  font-size: calc(11px + var(--font-plus));
  letter-spacing: -0.01em;
}
.primary-card-type {
  color: var(--muted);
  font-size: calc(8.5px + var(--font-plus));
  white-space: nowrap;
}
.primary-card-flag,
.primary-card-archived {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  color: var(--warning);
  font-size: calc(8.5px + var(--font-plus));
  font-weight: 650;
}
.primary-card-archived {
  color: var(--muted);
}
.primary-card-select {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: 0 11px 0 9px;
}
.primary-card-select:hover {
  background: var(--surface-alt);
}
.primary-card-select input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}
.primary-card-skeleton {
  display: flex;
  flex-direction: column;
  gap: 9px;
  height: 102px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.primary-card-skeleton span {
  display: block;
  height: 9px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-alt), var(--line), var(--surface-alt));
  background-size: 200% 100%;
  animation: primary-shimmer 1.6s linear infinite;
}
.primary-card-skeleton span:nth-child(2) {
  width: 72%;
}
.primary-card-skeleton span:nth-child(3) {
  width: 44%;
}
.primary-rail-loading {
  margin: 2px 0;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  text-align: center;
}
.primary-rail-state {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 140px;
}
.primary-rail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  text-align: center;
  color: var(--muted);
}
.primary-rail-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--surface-alt);
  color: var(--muted);
}
.primary-rail-empty strong {
  color: var(--text);
  font-size: calc(11px + var(--font-plus));
}
.primary-rail-empty p {
  max-width: 250px;
  margin: 0;
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.55;
}
.primary-bulk {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  animation: fade-in 0.16s ease;
}
.primary-bulk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: calc(10px + var(--font-plus));
}
.primary-bulk-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.primary-bulk-actions .button {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  font-size: calc(9px + var(--font-plus));
}
.primary-bulk-note {
  margin: 0;
  color: var(--muted);
  font-size: calc(8.5px + var(--font-plus));
  line-height: 1.5;
}
.primary-rail-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: calc(8.5px + var(--font-plus));
  line-height: 1.5;
}
.primary-rail-note svg {
  flex-shrink: 0;
  margin-top: 1px;
}
.primary-detail {
  display: flex;
  flex-direction: column;
  min-height: clamp(480px, calc(100dvh - 330px), 720px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: clip;
  animation: fade-in 0.18s ease;
}
.primary-detail-scroll {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.primary-detail-head {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-alt), var(--surface));
  min-width: 0;
}
.primary-detail-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.primary-back {
  transform: rotate(180deg);
  border: 1px solid var(--line);
  background: var(--surface);
}
.primary-detail-eyebrow {
  min-width: 0;
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.primary-detail-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.primary-mobile-list {
  display: none;
}
.primary-detail-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.primary-detail-title-row h2 {
  margin: 0;
  font-size: calc(22px + var(--font-plus));
  line-height: 1.25;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}
.primary-detail-file {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.primary-detail-kind-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  padding: 4px 9px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 550;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.primary-detail-chosen-kind {
  letter-spacing: 0;
}
.primary-detail-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.primary-detail-meta-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.primary-detail-meta-cell span {
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.primary-detail-meta-cell strong {
  font-size: calc(11px + var(--font-plus));
  overflow-wrap: anywhere;
}
.primary-stages-block,
.primary-history {
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.primary-block-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.primary-block-title h3 {
  margin: 0;
  font-size: calc(14px + var(--font-plus));
}
.primary-stages {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0 0 4px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
}
.primary-stage {
  position: relative;
  display: flex;
  flex: 1;
  align-items: flex-start;
  gap: 8px;
  min-width: 118px;
  padding-right: 14px;
}
.primary-stage:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 22px;
  right: 0;
  height: 1px;
  background: var(--line);
}
.primary-stage-dot {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  flex-shrink: 0;
}
.primary-stage-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding-top: 1px;
}
.primary-stage-copy strong {
  font-size: calc(10px + var(--font-plus));
  line-height: 1.3;
}
.primary-stage-copy small {
  max-width: 96px;
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.primary-stage[data-stage="posted"] .primary-stage-copy small {
  /* «Ожидает документ» is the honest receipt state: wrap it instead of clipping it. */
  max-width: none;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.primary-stage.is-done .primary-stage-dot {
  background: var(--success-bg);
  color: var(--success);
}
.primary-stage.is-current .primary-stage-dot {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.primary-stage.is-error .primary-stage-dot {
  background: var(--danger-bg);
  color: var(--danger);
}
.primary-stage.is-unknown .primary-stage-dot {
  background: var(--warning-bg);
  color: var(--warning);
}
.primary-stage.is-skip .primary-stage-dot {
  opacity: 0.55;
}
.primary-warnings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 22px 0;
}
.primary-warnings .note {
  margin: 0;
}
.primary-warnings .note.warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.primary-tabs {
  display: flex;
  gap: 2px;
  margin-top: 14px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}
.primary-tabs button {
  min-height: 44px;
  padding: 10px 12px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: calc(11px + var(--font-plus));
  font-weight: 650;
}
.primary-tabs button[aria-selected="true"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 750;
}
.primary-tabpanel {
  padding: 18px 22px;
}
.primary-document-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 18px;
  align-items: start;
}
.primary-fields-main {
  min-width: 0;
}
.primary-fields-group {
  min-width: 0;
  margin-bottom: 18px;
}
.primary-fields-group h3 {
  margin-bottom: 8px;
  font-size: calc(12px + var(--font-plus));
}
.primary-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.primary-field {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-alt);
}
.primary-field.wide {
  grid-column: 1 / -1;
}
.primary-field dt {
  color: var(--muted);
  font-size: calc(7.5px + var(--font-plus));
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.primary-field dd {
  margin: 3px 0 0;
  font-size: calc(10.5px + var(--font-plus));
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.primary-fields-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 0;
  padding: 10px;
  border-radius: 9px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.55;
}
.primary-fields-note svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--success);
}
.primary-party-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-alt);
}
.primary-party-copy {
  min-width: 0;
}
.primary-party-copy strong {
  display: block;
  font-size: calc(11px + var(--font-plus));
}
.primary-party-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.6;
}
.primary-party-action .button {
  flex-shrink: 0;
  min-height: 40px;
}
@media (max-width: 800px) {
  .primary-party-action {
    align-items: stretch;
    flex-direction: column;
  }
  .primary-party-action .button {
    min-height: 44px;
  }
}
.primary-original-aside {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-alt);
}
.primary-aside-label {
  color: var(--muted);
  font-size: calc(7.5px + var(--font-plus));
  font-weight: 750;
  letter-spacing: 0.12em;
}
.primary-original-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 0.72;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.primary-original-thumb.is-paper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  color: var(--muted);
  text-align: center;
}
.primary-original-thumb.is-paper span {
  max-height: 3.2em;
  overflow: hidden;
  font-size: calc(8px + var(--font-plus));
  overflow-wrap: anywhere;
}
.primary-lines-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.primary-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(9.5px + var(--font-plus));
}
.primary-lines th,
.primary-lines td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.primary-lines th {
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.primary-lines td:nth-child(2),
.primary-lines td:nth-child(3) {
  white-space: nowrap;
}
.primary-original-figure {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}
.primary-original-image {
  align-self: center;
  max-width: 100%;
  max-height: 62dvh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
}
.primary-original-file {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}
.primary-original-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: var(--surface);
  color: var(--brand);
  flex-shrink: 0;
}
.primary-original-file > div {
  flex: 1;
  min-width: 140px;
}
.primary-original-file strong {
  display: block;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}
.primary-original-placeholder {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}
.primary-paper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 230px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 40px hsl(calc(var(--accent-h) + 4) calc(50% * var(--accent-s)) 20% / 0.1);
  transform: rotate(-1.5deg);
}
.primary-paper-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--brand);
  font-size: calc(10px + var(--font-plus));
  font-weight: 750;
}
.primary-paper-line {
  height: 7px;
  border-radius: 3px;
  background: var(--line);
}
.primary-paper-line.short {
  width: 62%;
}
.primary-original-copy {
  min-width: 0;
}
.primary-original-copy p {
  margin: 6px 0 0;
  font-size: calc(10px + var(--font-plus));
  line-height: 1.6;
}
.primary-original-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.primary-original-head .primary-original-copy {
  flex: 1;
  min-width: 180px;
}
.primary-original-thumb-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  cursor: pointer;
  text-align: left;
}
.primary-original-thumb-button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.primary-original-pdf {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.primary-original-frame {
  width: 100%;
  height: min(62dvh, 720px);
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
}
.primary-recognized {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.primary-recognized-fields {
  margin-top: 8px;
}
.primary-recognized-lines {
  margin-top: 14px;
}
.primary-recognized-lines h4 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
@media (max-width: 800px) {
  .primary-original-frame {
    height: 52dvh;
    min-height: 240px;
  }
}
.primary-history {
  border-bottom: 0;
}
.primary-history-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.primary-history-list li {
  position: relative;
  display: flex;
  gap: 10px;
  padding-bottom: 12px;
}
.primary-history-list li:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 0;
  left: 4px;
  width: 1px;
  background: var(--line);
}
.primary-history-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--blue-soft);
  flex-shrink: 0;
}
.primary-history-list strong {
  display: block;
  font-size: calc(10px + var(--font-plus));
  line-height: 1.45;
}
.primary-history-list time {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
}
.primary-history-empty {
  margin: 0;
  font-size: calc(10px + var(--font-plus));
}
.primary-detail-loading,
.primary-detail-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 70px 24px;
  text-align: center;
}
.primary-detail-loading-icon,
.primary-detail-error-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: var(--blue-soft);
  color: var(--brand);
}
.primary-detail-error-icon {
  background: var(--danger-bg);
  color: var(--danger);
}
.primary-detail-loading strong,
.primary-detail-error strong {
  font-size: calc(14px + var(--font-plus));
}
.primary-detail-loading p,
.primary-detail-error p {
  max-width: 380px;
  margin: 0 0 6px;
  font-size: calc(11px + var(--font-plus));
}
.primary-processing {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 14px 22px 0;
  padding: 14px 16px;
  overflow: hidden;
  border: 1px solid hsl(calc(var(--accent-h) + 4) calc(55% * var(--accent-s)) 72% / 0.65);
  border-radius: 13px;
  background:
    radial-gradient(120% 160% at 8% 0%, hsl(calc(var(--accent-h) + 8) calc(70% * var(--accent-s)) 92% / 0.9), transparent 58%),
    var(--surface-alt);
}
.primary-processing-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 11px;
  background: var(--blue-soft);
  color: var(--brand);
}
.primary-processing-icon svg {
  animation: spin 1.2s linear infinite;
}
.primary-processing-copy {
  min-width: 0;
  flex: 1;
}
.primary-processing-copy strong {
  display: block;
  font-size: calc(11px + var(--font-plus));
  font-weight: 700;
  line-height: 1.4;
}
.primary-processing-copy p {
  margin: 3px 0 0;
  max-width: 560px;
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.55;
}
.primary-processing-bar {
  display: block;
  max-width: 260px;
  height: 3px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 3px;
  background: hsl(calc(var(--accent-h) + 4) calc(45% * var(--accent-s)) 84% / 0.7);
}
.primary-processing-bar i {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: 3px;
  background: var(--brand);
  animation: primary-processing-run 1.5s ease-in-out infinite;
}
.badge.is-processing i {
  animation: primary-processing-pulse 1.1s ease-in-out infinite;
}
@keyframes primary-processing-run {
  0% { transform: translateX(-105%); }
  65% { transform: translateX(170%); }
  100% { transform: translateX(270%); }
}
@keyframes primary-processing-pulse {
  40% { opacity: .35; transform: scale(.7); }
  100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .primary-processing-icon svg { animation: spin 1.6s linear infinite; }
  .primary-processing-bar i { animation: primary-processing-run 2.2s ease-in-out infinite; }
  .badge.is-processing i { animation: primary-processing-pulse 1.8s ease-in-out infinite; }
}
.primary-card-banner {
  padding: 14px 22px 0;
}
.primary-card-banner .note {
  margin: 0;
}
.primary-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: auto;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 -10px 30px hsl(calc(var(--accent-h) + 4) calc(50% * var(--accent-s)) 20% / 0.05);
}
.primary-actions-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  max-width: 52%;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.5;
  flex-wrap: wrap;
}
.primary-actions-note .button {
  flex-shrink: 0;
}
.primary-write-access-error {
  flex-basis: 100%;
  color: var(--danger);
  font-size: calc(9px + var(--font-plus));
  font-weight: 550;
  line-height: 1.45;
}
.primary-actions-note svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--brand);
}
.primary-actions-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.primary-actions.has-expired {
  flex-wrap: wrap;
}
.primary-actions-expired {
  flex-basis: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--danger);
  border-radius: 11px;
  background: var(--danger-bg);
  color: var(--danger);
}
.primary-actions-expired > svg {
  margin-top: 1px;
  flex-shrink: 0;
}
.primary-actions-expired-copy strong {
  display: block;
  font-size: calc(10px + var(--font-plus));
  font-weight: 650;
  line-height: 1.4;
}
.primary-actions-expired-copy p {
  margin: 2px 0 0;
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 600;
  line-height: 1.5;
}
.primary-actions-expired-copy small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.45;
}
.primary-actions-expired-reject {
  margin-top: 8px;
  border-color: var(--danger);
  background: var(--surface);
  color: var(--danger);
  white-space: normal;
  text-align: left;
}
.primary-actions-expired-reject:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.primary-action-reason {
  max-width: 220px;
  margin: 0;
  color: var(--warning);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.4;
  text-align: right;
}
.primary-actions-buttons {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.primary-action {
  min-height: 44px;
}
.primary-overflow-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.primary-overflow-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 18px 50px hsl(calc(var(--accent-h) + 4) calc(50% * var(--accent-s)) 18% / 0.18);
  animation: fade-in 0.12s ease;
}
.primary-overflow-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: calc(10px + var(--font-plus));
  text-align: left;
}
.primary-overflow-menu button:hover {
  background: var(--surface-alt);
}
.primary-overflow-menu svg {
  color: var(--muted);
}
.primary-overflow-menu button.primary-overflow-danger {
  color: var(--danger);
}
.primary-overflow-menu button.primary-overflow-danger svg {
  color: var(--danger);
}
.primary-overflow-menu button.primary-overflow-danger:hover {
  background: var(--danger-bg);
}
.primary-card-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: -4px;
  padding: 0 10px 9px;
}
.primary-card-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--danger);
  font-size: calc(9px + var(--font-plus));
  font-weight: 700;
}
.primary-card-delete:hover {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.primary-card-delete svg {
  color: var(--danger);
}
.primary-delete [hidden] {
  display: none !important;
}
.primary-delete .dialog-body > p {
  margin-top: 0;
}
.primary-delete-file {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  overflow-wrap: anywhere;
}
.primary-delete .note {
  margin: 16px 0;
}
.primary-delete .note p {
  font-size: calc(11px + var(--font-plus));
}
.primary-delete .primary-check {
  margin-top: 4px;
}
.primary-delete [data-delete-ok]:disabled {
  opacity: 1;
  color: var(--danger);
  border-color: var(--danger-bg);
  background: var(--danger-bg);
  box-shadow: none;
}
.primary-delete-applied {
  margin: 18px 0 10px;
  border-radius: 10px;
  background: var(--warning-bg);
  color: var(--warning);
}
.primary-delete-applied svg {
  flex-shrink: 0;
}
.primary-delete-error {
  margin-top: 14px;
}
.primary-confirm-note {
  margin-bottom: 0;
}
.primary-confirm-cap {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
}
.primary-source-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 14px 0;
}
.primary-source-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
}
.primary-source-option:hover {
  background: var(--surface-alt);
}
.primary-source-option.is-active {
  border-color: var(--brand);
  background: var(--blue-soft);
}
.primary-source-option-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-alt);
  color: var(--brand);
  flex-shrink: 0;
}
.primary-source-option-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.primary-source-option-copy strong {
  font-size: calc(11px + var(--font-plus));
  overflow-wrap: anywhere;
}
.primary-source-option-copy small {
  font-size: calc(9px + var(--font-plus));
}
.primary-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: calc(11px + var(--font-plus));
  line-height: 1.5;
  cursor: pointer;
}
.primary-check input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--brand);
  flex-shrink: 0;
}
.primary-sheet-scrim {
  display: none;
}
body.primary-sheet-lock {
  overflow: hidden;
}
@keyframes primary-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@media (min-width: 1600px) {
  .primary-page { --primary-rail: 392px; }
}
@media (max-width: 1300px) {
  .primary-detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .primary-page { --primary-rail: 300px; }
  .primary-desk { gap: 14px; }
  .primary-detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .primary-detail-meta-cell { padding: 8px; }
  .primary-detail-head { padding: 16px 18px 14px; }
  .primary-stages-block,
  .primary-history { padding: 14px 18px; }
  .primary-tabs { padding: 0 18px; }
  .primary-tabpanel { padding: 16px 18px; }
  .primary-processing { margin: 12px 18px 0; }
  .primary-card-banner { padding: 12px 18px 0; }
  .primary-warnings { padding: 12px 18px 0; }
  .primary-actions { padding: 10px 14px; }
  .primary-actions-note { max-width: 46%; }
}
@media (max-width: 1000px) {
  .primary-detail-meta { grid-template-columns: minmax(0, 1fr); }
  .primary-document-split { grid-template-columns: minmax(0, 1fr); }
  .primary-original-aside { display: none; }
}
@media (max-width: 800px) {
  .primary-heading { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 14px; }
  .primary-heading p { font-size: calc(11px + var(--font-plus)); }
  .primary-flow-pill { white-space: normal; }
  .primary-context { align-items: flex-start; padding: 10px 12px; }
  .primary-context-meta { width: 100%; gap: 7px; }
  .primary-context-meta > .button { margin-left: auto; }
  .primary-desk { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .primary-dropzone { min-height: calc(100dvh - 330px); padding: 34px 18px; border-radius: 16px; }
  .primary-dropzone h2 { font-size: calc(20px + var(--font-plus)); }
  .primary-drop-note { font-size: calc(9px + var(--font-plus)); }
  .primary-drop-actions { width: 100%; }
  .primary-drop-actions .button { flex: 1; min-height: 46px; }
  .primary-rail { display: none; }
  .primary-page.is-detail .primary-workspace {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block;
    padding: 0;
    background: var(--bg);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .primary-page.is-detail .primary-detail {
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
  .primary-page.is-detail .primary-detail-scroll { min-height: calc(100dvh - 70px); }
  .primary-detail-head { padding: 12px 14px; }
  .primary-detail-title-row h2 { font-size: calc(19px + var(--font-plus)); }
  .primary-detail-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
  .primary-mobile-list { display: inline-flex; min-height: 44px; }
  .primary-stages-block,
  .primary-history { padding: 14px; }
  .primary-stages { padding-bottom: 8px; }
  .primary-stage { min-width: 104px; }
  .primary-processing { margin: 12px 14px 0; padding: 12px; gap: 10px; }
  .primary-processing-copy p { font-size: calc(9.5px + var(--font-plus)); }
  .primary-card-banner { padding: 12px 14px 0; }
  .primary-warnings { padding: 12px 14px 0; }
  .primary-tabs { margin-top: 12px; padding: 0 14px; }
  .primary-tabs button { flex: 1; min-height: 46px; justify-content: center; }
  .primary-tabpanel { padding: 14px; }
  .primary-fields { grid-template-columns: minmax(0, 1fr); }
  .primary-original-placeholder { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .primary-paper { max-width: 240px; margin: 0 auto; }
  .primary-actions {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }
  .primary-actions-note { order: 2; width: 100%; max-width: 100%; font-size: calc(9px + var(--font-plus)); }
  .primary-actions-right { width: 100%; margin-left: 0; }
  .primary-actions-buttons { flex: 1; justify-content: flex-end; }
  .primary-actions-expired { order: -1; }
  .primary-actions.has-expired .primary-action { white-space: normal; text-align: center; }
  .primary-actions-expired-reject { width: 100%; justify-content: flex-start; }
  .primary-action { min-height: 46px; }
  .primary-overflow-toggle { width: 46px; height: 46px; }
  .primary-action-reason { display: none; }
  .primary-page.is-detail .primary-rail {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 90;
    display: flex;
    max-height: 82dvh;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -20px 60px hsl(calc(var(--accent-h) + 4) calc(50% * var(--accent-s)) 15% / 0.24);
    transform: translateY(105%);
    transition: transform 0.22s ease;
  }
  .primary-page.sheet-open .primary-rail { transform: translateY(0); }
  .primary-sheet-close { display: inline-flex; width: 40px; height: 40px; }
  .primary-page.sheet-open .primary-sheet-scrim {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: block;
    padding: 0;
    border: 0;
    background: hsl(calc(var(--accent-h) + 6) calc(40% * var(--accent-s)) 12% / 0.36);
    backdrop-filter: blur(3px);
  }
  .primary-cards { max-height: calc(82dvh - 250px); }
  .primary-chips button,
  .primary-views button,
  .primary-search,
  .primary-rail .button { min-height: 44px; }
  .primary-card-open { min-height: 112px; }
  .primary-card-delete { min-height: 44px; }
  .primary-card-select { width: 44px; height: 44px; }
  .primary-bulk-actions .button { min-height: 44px; }
}
@media (max-width: 430px) {
  .primary-context-meta > .button { width: 100%; margin-left: 0; }
  .primary-sync { order: 3; }
  .primary-flow-pill { font-size: calc(9px + var(--font-plus)); }
  .primary-detail-eyebrow { max-width: 46vw; }
  .primary-detail-top-actions .button span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .primary-card,
  .primary-drop-overlay,
  .primary-page.is-detail .primary-rail,
  .primary-detail,
  .primary-bulk,
  .primary-overflow-menu { animation: none; transition: none; }
  .primary-card-skeleton span { animation: none; }
}
@media (min-width: 801px) {
  .primary-mobile-head-queue { display: none; }
}
@media (max-width: 800px) {
  .primary-head-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .primary-mobile-head-queue { display: inline-flex; min-height: 44px; }
  .primary-page.sheet-open .primary-rail {
    display: flex;
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 90;
    max-height: 82dvh;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -20px 60px hsl(calc(var(--accent-h) + 4) calc(50% * var(--accent-s)) 15% / 0.24);
    transform: translateY(0);
  }
}
.primary-views button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 750;
  box-shadow: 0 1px 3px hsl(calc(var(--accent-h) + 2) calc(53.5% * var(--accent-s)) 19.4% / 0.09);
}
@media (max-width: 430px) {
  .primary-detail-eyebrow {
    flex: 1;
    max-width: none;
    white-space: normal;
    line-height: 1.35;
    letter-spacing: 0.1em;
  }
}
@media (max-width: 430px) {
  .primary-detail-kind { display: none; }
}
.primary-source-mismatch {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--blue-soft);
}
.primary-source-mismatch svg {
  flex-shrink: 0;
}
.primary-source-mismatch p {
  flex: 1 1 240px;
  margin: 0;
  font-size: calc(10.5px + var(--font-plus));
  line-height: 1.55;
}
.primary-source-mismatch .button {
  margin-left: auto;
}
@media (max-width: 800px) {
  .primary-source-mismatch .button {
    width: 100%;
    min-height: 44px;
    margin-left: 0;
  }
}
.primary-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.primary-review-cell {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-alt);
}
.primary-review-cell.wide {
  grid-column: 1 / -1;
}
.primary-review-cell span {
  display: block;
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.primary-review-cell strong {
  display: block;
  margin-top: 3px;
  font-size: calc(11px + var(--font-plus));
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.primary-review-basis,
.primary-review-kind {
  margin: 0 0 14px;
}
.primary-review-basis select:invalid,
.primary-review-kind select:invalid {
  color: var(--muted);
}
.primary-review-basis select:disabled,
.primary-review-kind select:disabled {
  background: var(--surface-alt);
  color: var(--muted);
  opacity: 1;
  -webkit-text-fill-color: var(--muted);
}
.primary-review-basis select.is-ambiguous {
  border-color: var(--warning);
  background: var(--warning-bg);
}
.primary-review-basis option.primary-review-basis-recommended {
  font-weight: 700;
  color: var(--brand);
}
.primary-review-basis-ambiguous {
  margin: -6px 0 12px;
}
.primary-review-basis-ambiguous .button {
  white-space: normal;
  text-align: left;
}
@media (max-width: 800px) {
  .primary-review-basis-ambiguous .button {
    width: 100%;
    min-height: 44px;
  }
}
.primary-review-type {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
}
.primary-review-type .field {
  margin: 0;
  gap: 4px;
}
.primary-review-type .field > span {
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.primary-review-type select {
  height: 42px;
}
.primary-review-type select:invalid {
  color: var(--muted);
}
.primary-review-type .field.invalid select {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.primary-review-type small {
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  font-weight: 400;
  line-height: 1.5;
}
.primary-review-type small.primary-review-field-error {
  color: var(--danger);
  font-weight: 500;
}
.primary-review-type-kind-hint {
  margin: 2px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 500;
  line-height: 1.55;
}
.primary-review-own {
  grid-column: 1 / -1;
  margin: 2px 0 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
}
.primary-review-own-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.primary-review-own-head h3 {
  margin: 0;
  font-size: calc(11px + var(--font-plus));
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.primary-review-own-line {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  margin: 8px 0 4px;
  font-size: calc(11px + var(--font-plus));
}
.primary-review-own-line span {
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  font-weight: 650;
}
.primary-review-own-line strong {
  font-size: calc(12px + var(--font-plus));
  letter-spacing: 0.02em;
}
.primary-review-own-intro {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.55;
}
.primary-review-own-case {
  margin: 0 0 10px;
}
.primary-review-own-case-warning {
  padding: 10px 11px;
  border: 1px solid var(--danger);
  border-radius: 9px;
  background: var(--danger-bg);
}
.primary-review-own-case-warning p {
  margin: 0 0 8px;
  color: var(--danger);
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 600;
  line-height: 1.55;
}
.primary-review-own-case-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.5;
}
.primary-review-own-case .web-alert {
  margin: 8px 0 0;
  padding: 10px 11px;
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.55;
}
.primary-review-own-gate {
  margin: 0 0 9px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 550;
  line-height: 1.5;
}
.primary-review-own-sample {
  margin: 0 0 9px;
  padding: 10px 11px;
  border: 1px solid var(--danger);
  border-radius: 9px;
  background: var(--danger-bg);
}
.primary-review-own-sample-text {
  margin: 0 0 8px;
  color: var(--danger);
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 600;
  line-height: 1.55;
}
.primary-review-own-sample-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.primary-review-own-sample .web-alert {
  margin: 9px 0 0;
  padding: 9px 10px;
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.55;
}
.primary-review-own-sample .web-alert p {
  margin: 0;
}
.primary-review-own-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.primary-review-own-picker {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.primary-review-own-search {
  flex: 1 1 200px;
  margin: 0;
  gap: 4px;
}
.primary-review-own-search > span {
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.primary-review-own-search input {
  height: 40px;
}
.primary-review-own-picker .button {
  min-height: 40px;
}
.primary-review-own-status {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.5;
}
.primary-review-own-status.is-error {
  color: var(--danger);
  font-weight: 550;
}
.primary-review-own-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.primary-review-own-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.primary-review-own-result-copy {
  min-width: 0;
}
.primary-review-own-result-copy strong {
  display: block;
  font-size: calc(10.5px + var(--font-plus));
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.primary-review-own-result-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.primary-review-own-result .button {
  flex-shrink: 0;
  min-height: 38px;
}
.primary-review-own-note {
  margin: 9px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 550;
  line-height: 1.55;
}
.primary-review-own-missing {
  margin: 10px 0 0;
  padding: 11px 12px;
}
.primary-review-own-missing-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
}
.primary-review-own-missing-copy p {
  margin: 0;
  font-size: calc(10px + var(--font-plus));
  line-height: 1.55;
}
.primary-review-own-missing-reload {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus)) !important;
}
.primary-review-own-missing-reload svg {
  flex-shrink: 0;
}
.primary-review-own-missing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  width: 100%;
}
.primary-review-own-create {
  margin-top: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.primary-review-own-create h4 {
  margin: 0 0 4px;
  font-size: calc(11px + var(--font-plus));
  letter-spacing: 0.04em;
}
.primary-review-own-create-lead {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.55;
}
.primary-review-own-create .field {
  margin: 0 0 10px;
  gap: 4px;
}
.primary-review-own-create .field > span {
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.primary-review-own-create .field input {
  height: 40px;
}
.primary-review-own-create .web-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0;
  padding: 10px 11px;
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.55;
}
.primary-review-own-create .web-alert svg {
  flex-shrink: 0;
  margin-top: 2px;
}
.primary-review-own-create .web-alert p {
  margin: 0;
}
.primary-review-own-create .primary-check {
  margin: 9px 0;
  font-weight: 650;
}
.primary-review-own-create-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.5;
}
.primary-review-own-create-uncertain {
  margin: 10px 0 0;
  padding: 10px 11px;
  border: 1px solid var(--warning);
  border-radius: 9px;
  background: var(--warning-bg);
}
.primary-review-own-create-uncertain p {
  margin: 0 0 8px;
  color: var(--warning);
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 550;
  line-height: 1.55;
}
.primary-review-own-create-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}
.primary-review-error p {
  margin: 0;
}
.primary-review-error .button {
  margin-top: 8px;
}
.primary-review-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin: 12px 0 16px;
}
.primary-review-input {
  margin: 0;
  gap: 4px;
}
.primary-review-input > span {
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.primary-review-input input {
  height: 44px;
}
.primary-review-input-wide {
  grid-column: 1 / -1;
}
.primary-review-field-error {
  color: var(--danger);
  font-size: calc(9px + var(--font-plus));
  font-weight: 500;
  line-height: 1.45;
}
.primary-review-form .field.is-server-error input,
.primary-review .field.is-server-error select,
.primary-review-line.is-server-error {
  border-color: var(--danger);
  background: var(--danger-bg);
}
.primary-review-vat-row {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-alt);
}
.primary-review-vat-row .primary-check {
  font-weight: 650;
}
.primary-review-vat-row small {
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.5;
}
.primary-review-lines {
  margin: 0 0 16px;
}
.primary-review-lines-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.primary-review-lines-head h3 {
  margin: 0;
  font-size: calc(12px + var(--font-plus));
}
.primary-review-lines-head h3 .muted {
  display: inline-block;
  margin-left: 5px;
  font-size: calc(9px + var(--font-plus));
  font-weight: 500;
  letter-spacing: 0;
}
.primary-review-lines-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.primary-review-rounding-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.5;
}
.primary-review-rounding-uncertain {
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 550;
  line-height: 1.55;
}
.primary-review-rounding-manual {
  margin: 10px 0 0;
}
.primary-review-lines .note {
  margin: 10px 0 0;
}
.primary-review-lines .web-alert {
  margin-top: 10px;
}
.primary-review-line-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.primary-review-line {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.55fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.7fr) 44px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-alt);
  min-width: 0;
}
.primary-review-line .field {
  margin: 0;
  gap: 3px;
  min-width: 0;
}
.primary-review-line .field > span {
  color: var(--muted);
  font-size: calc(7.5px + var(--font-plus));
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.primary-review-line .field input {
  height: 44px;
  padding: 6px 8px;
  font-size: calc(11px + var(--font-plus));
}
.primary-review-line-name {
  grid-column: span 1;
}
.primary-review-line-remove {
  width: 44px;
  height: 44px;
  align-self: end;
  color: var(--muted);
}
.primary-review-line-remove:hover {
  color: var(--danger);
}
.primary-review-line-units {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}
.primary-original-unit {
  display: block;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.primary-review-line-hint {
  grid-column: 1 / -1;
  color: var(--warning);
  font-size: calc(9px + var(--font-plus));
  font-weight: 500;
  line-height: 1.45;
}
.primary-review-line-error {
  grid-column: 1 / -1;
  color: var(--danger);
  font-size: calc(9px + var(--font-plus));
  font-weight: 500;
  line-height: 1.45;
}
.primary-review-total-hint {
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.55;
}
@media (max-width: 800px) {
  .primary-review-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .primary-review-input-wide {
    grid-column: auto;
  }
  .primary-review-input input {
    height: 46px;
  }
  .primary-review-type select {
    height: 46px;
  }
  .primary-review-own {
    padding: 11px;
  }
  .primary-review-own-actions .button,
  .primary-review-own-picker .button,
  .primary-review-own-result .button,
  .primary-review-own-missing .button,
  .primary-review-own-case .button,
  .primary-review-own-sample .button {
    width: 100%;
    min-height: 44px;
  }
  .primary-review-own-picker {
    flex-direction: column;
    align-items: stretch;
  }
  .primary-review-own-search {
    flex-basis: auto;
  }
  .primary-review-own-search input {
    height: 46px;
  }
  .primary-review-own-result {
    flex-direction: column;
    align-items: stretch;
  }
  .primary-review-own-create .field input {
    height: 46px;
  }
  .primary-review-own-create .button {
    width: 100%;
    min-height: 44px;
  }
  .primary-review-own-create-actions {
    flex-direction: column-reverse;
  }
  .primary-review-line {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .primary-review-line-name {
    grid-column: 1 / -1;
  }
  .primary-review-line .field input {
    height: 44px;
  }
  .primary-review-line-remove {
    grid-column: 1 / -1;
    justify-self: end;
    width: 44px;
    height: 44px;
  }
  .primary-review-lines-head .button {
    min-height: 44px;
  }
  .primary-review-lines-actions {
    width: 100%;
  }
  .primary-review-lines-actions .button {
    flex: 1 1 auto;
  }
}
/* The confirmation gate is fixed below the scrollport; keep the last field clear when scrolled to the end. */
.primary-review .dialog-body {
  padding-bottom: 48px;
}
.primary-review-form-state {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
}
.primary-review-dirty,
.primary-review-saved {
  margin: 0;
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 600;
  line-height: 1.45;
}
.primary-review-dirty {
  color: var(--warning);
}
.primary-review-saved {
  color: var(--muted);
}
.primary-review-conflict .button-row,
.primary-review-locked .button-row {
  margin-top: 8px;
  flex-wrap: wrap;
}
.primary-review-conflict,
.primary-review-locked,
.primary-review-issues,
.primary-review-blocked {
  margin: 10px 0;
}
.primary-review-conflict p,
.primary-review-locked p,
.primary-review-issues p,
.primary-review-blocked p {
  margin: 0;
}
.primary-review-issues ul,
.primary-review-blocked ul {
  margin: 6px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.primary-review-issues li,
.primary-review-blocked li {
  line-height: 1.45;
}
.primary-review-blocked li strong {
  margin-right: 6px;
  font-weight: 700;
}
.primary-review-blocked small {
  display: block;
  margin-top: 6px;
  color: var(--text);
  opacity: 0.78;
  line-height: 1.45;
}
.primary-review-blocked-actions {
  margin-top: 8px;
  flex-wrap: wrap;
}
@media (max-width: 800px) {
  .primary-review-conflict .button,
  .primary-review-locked .button {
    width: 100%;
    min-height: 44px;
  }
}
.primary-review .primary-check {
  margin: 12px 0;
  font-weight: 650;
}
.primary-review .primary-check input {
  width: 20px;
  height: 20px;
}
.primary-review .dialog-footer .button {
  min-height: 44px;
}
.primary-review .web-alert {
  margin-top: 10px;
}
.primary-review-gate {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 25px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}
.primary-review-gate .primary-check {
  margin: 0;
  font-weight: 650;
}
.primary-review-gate .primary-check input {
  width: 20px;
  height: 20px;
}
.primary-review-gate .web-alert {
  margin-top: 0;
}
@media (max-width: 800px) {
  .primary-review-gate {
    padding: 12px 20px;
  }
}
@media (max-width: 800px) {
  .primary-review-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .primary-review-cell.wide {
    grid-column: auto;
  }
  .primary-review .primary-check {
    min-height: 44px;
    align-items: center;
  }
}
.primary-review [hidden],
.primary-confirm [hidden] {
  display: none !important;
}
.primary-party .field {
  margin-bottom: 14px;
}
.primary-party-search-only {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
}
.primary-party-search-only p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.55;
}
@media (max-width: 800px) {
  .primary-party-search-only .button {
    width: 100%;
    min-height: 44px;
  }
}
.primary-item-card {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warning);
  border-radius: 12px;
  background: var(--warning-bg);
}
.primary-item-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.primary-item-icon {
  margin-top: 2px;
  color: var(--warning);
}
.primary-item-heading h3 {
  margin: 0 0 4px;
  font-size: calc(13px + var(--font-plus));
}
.primary-item-heading p {
  margin: 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.5;
}
.primary-item-copy {
  margin: 10px 0;
  font-size: calc(10px + var(--font-plus));
  line-height: 1.55;
}
.primary-item-server-text {
  margin: 10px 0;
  padding: 9px 10px;
  border: 1px solid var(--danger);
  border-radius: 9px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 550;
  line-height: 1.55;
}
.primary-item-candidates {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.primary-item-candidate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.primary-item-candidate-copy {
  min-width: 0;
}
.primary-item-candidate-copy strong {
  display: block;
  font-size: calc(11px + var(--font-plus));
  overflow-wrap: anywhere;
}
.primary-item-candidate-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.45;
}
.primary-item-badge {
  margin-top: 6px;
  font-size: calc(8.5px + var(--font-plus));
  text-transform: none;
}
.primary-item-match-hint {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.45;
}
.primary-item-confirm {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  color: var(--text);
  font-size: calc(9.5px + var(--font-plus));
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}
.primary-item-confirm input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand-strong);
  flex-shrink: 0;
}
.primary-item-candidate .button {
  flex-shrink: 0;
  min-height: 38px;
}
.primary-item-empty {
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.55;
}
.primary-item-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.5;
}
.primary-item-card .web-alert {
  margin-top: 10px;
}
@media (max-width: 800px) {
  .primary-item-candidate {
    flex-direction: column;
    align-items: stretch;
  }
  .primary-item-candidate .button {
    min-height: 44px;
  }
}
.primary-sf-card {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  background: var(--surface-alt);
}
.primary-sf-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.primary-sf-card-icon {
  margin-top: 2px;
  color: var(--brand);
}
.primary-sf-card-head h3 {
  margin: 0 0 4px;
  font-size: calc(13px + var(--font-plus));
}
.primary-sf-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.5;
}
.primary-sf-copy,
.primary-sf-muted {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.55;
}
.primary-sf-child {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--surface);
}
.primary-sf-child span {
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.primary-sf-child strong {
  font-size: calc(11px + var(--font-plus));
}
.primary-sf-ledger {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.5;
}
.primary-sf-ledger strong {
  color: var(--text);
}
.primary-sf-actions-note {
  margin: 10px 0 0;
  font-size: calc(10px + var(--font-plus));
  line-height: 1.5;
}
.primary-received-sf .dialog-body {
  padding-bottom: 24px;
}
.primary-sf-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 16px 0 0;
}
.primary-sf-summary-head h3 {
  margin: 0;
  font-size: calc(13px + var(--font-plus));
}
.primary-sf-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 14px;
}
.primary-sf-summary-cell {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-alt);
}
.primary-sf-summary-cell.wide {
  grid-column: 1 / -1;
}
.primary-sf-summary-cell span {
  display: block;
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.primary-sf-summary-cell strong {
  display: block;
  margin-top: 3px;
  font-size: calc(11px + var(--font-plus));
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.primary-sf-lines {
  margin: 10px 0;
  overflow-x: auto;
}
.primary-sf-lines table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(10px + var(--font-plus));
}
.primary-sf-lines th,
.primary-sf-lines td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.primary-sf-lines th {
  color: var(--muted);
  font-size: calc(8px + var(--font-plus));
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.primary-sf-basis {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.primary-sf-basis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.primary-sf-basis-head h3,
.primary-sf-vat h3 {
  margin: 0;
  font-size: calc(13px + var(--font-plus));
}
.primary-sf-basis-status {
  margin: 8px 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.55;
}
.primary-sf-basis-status.is-error {
  color: var(--danger);
}
.primary-sf-candidates {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.primary-sf-candidate {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}
.primary-sf-candidate input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--brand);
}
.primary-sf-candidate:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--blue-soft);
}
.primary-sf-candidate:has(input:checked) {
  border-color: var(--brand);
  background: var(--blue-soft);
}
.primary-sf-candidate-copy {
  min-width: 0;
}
.primary-sf-candidate-copy strong {
  display: block;
  font-size: calc(11px + var(--font-plus));
  overflow-wrap: anywhere;
}
.primary-sf-candidate-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.primary-sf-vat {
  margin: 14px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.primary-sf-vat-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.primary-sf-vat-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: calc(9.5px + var(--font-plus));
  line-height: 1.55;
}
.primary-sf-status {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.5;
}
@media (max-width: 800px) {
  .primary-sf-summary {
    grid-template-columns: minmax(0, 1fr);
  }
  .primary-sf-summary-cell.wide {
    grid-column: auto;
  }
  .primary-sf-basis-head .button {
    min-height: 44px;
  }
  .primary-sf-candidate input {
    width: 20px;
    height: 20px;
  }
}
.primary-party-directory {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}.primary-party-directory-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.primary-party-directory-head h3 {
  margin: 0;
  font-size: calc(13px + var(--font-plus));
}
.primary-party-directory-head .muted {
  font-size: calc(9px + var(--font-plus));
}
.primary-party-directory-status {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.55;
}
.primary-party-directory-status.is-error {
  color: var(--danger);
}
.primary-party-matches {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.primary-party-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-alt);
}
.primary-party-match-copy {
  min-width: 0;
}
.primary-party-match-copy strong {
  display: block;
  font-size: calc(11px + var(--font-plus));
  overflow-wrap: anywhere;
}
.primary-party-match-copy small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  overflow-wrap: anywhere;
}
.primary-party-match .button {
  flex-shrink: 0;
  min-height: 38px;
}
.primary-party-directory-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: calc(9px + var(--font-plus));
  line-height: 1.55;
}
.primary-party-create-head {
  margin-bottom: 12px;
}
.primary-party-create-head h3 {
  margin: 0 0 4px;
  font-size: calc(13px + var(--font-plus));
}
.primary-party-create-head p {
  margin: 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.55;
}
.primary-party .primary-check {
  margin: 12px 0 4px;
  font-weight: 650;
}
.primary-party .primary-check input {
  width: 20px;
  height: 20px;
}
.primary-party .dialog-footer .button {
  min-height: 44px;
}
.primary-party .web-alert {
  margin-top: 10px;
}
.primary-party-status {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: calc(10px + var(--font-plus));
  line-height: 1.55;
}
.primary-party [hidden] {
  display: none !important;
}
@media (max-width: 800px) {
  .primary-party .primary-check {
    min-height: 44px;
    align-items: center;
  }
  .primary-party-match {
    flex-direction: column;
    align-items: stretch;
  }
  .primary-party-match .button {
    min-height: 44px;
  }
}
