/* без границ — warm artisanal, high-density */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600&family=Inter+Tight:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* warm neutrals — paper, ink, smoke */
  --page-bg: #f6efdf;        /* страница — чуть теплее/светлее, чтобы карточки выделялись */
  --paper: #fbf8f1;
  --paper-2: #f4efe4;
  --paper-3: #ebe4d3;
  --line: #d8cfb9;
  --line-soft: #e8e0cc;
  --ink: #1f1a14;
  --ink-2: #4a4239;
  --ink-3: #7a6f5f;
  --ink-4: #a89c87;

  /* singular accent — aubergine plum, not the predictable purple */
  --accent: #5b2a86;
  --accent-2: #7c3aed;
  --accent-soft: #ede4f5;

  /* status — muted, not loud */
  --good: #3f6b3a;
  --good-soft: #e3ecd8;
  --warn: #a55a1a;
  --warn-soft: #f4e6d0;
  --bad: #92352b;
  --bad-soft: #f1dad4;

  /* type */
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter Tight', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* radii — subtle */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--page-bg);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* ── PAGE LAYOUTS ─────────────────────────────── */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.shell {
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 0 32px;
}

.shell-narrow {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 0 32px;
}

/* ── TOP BAR ──────────────────────────────────── */

.topbar {
  border-bottom: 1px solid var(--line-soft);
  background: var(--page-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  height: 52px;
  gap: 16px;
}

.brand {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-mark {
  display: inline-block;
  width: 9px;
  height: 9px;
  background: var(--accent);
  border-radius: 50%;
  transform: translateY(-2px);
}

.brand-sep {
  color: var(--ink-4);
  font-size: 12px;
  font-family: var(--sans);
  font-weight: 400;
}

.brand-role {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.topbar-spacer { flex: 1; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-2);
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--paper);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
}

/* ── HEADINGS ─────────────────────────────────── */

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}

h1 { font-size: 32px; line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.2; }
h3 { font-size: 16px; line-height: 1.3; font-weight: 600; }

.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

.muted { color: var(--ink-3); }
.muted-2 { color: var(--ink-4); }

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: -0.01em;
}

/* ── BUTTONS ──────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--paper-2);
  border-color: var(--ink-4);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.btn-primary:hover {
  background: #2c241a;
  border-color: #2c241a;
}

.btn-accent {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}

.btn-accent:hover {
  background: #491f6c;
  border-color: #491f6c;
}

.btn-sm {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
}

.btn-ghost:hover {
  background: var(--paper-2);
  border-color: var(--line-soft);
}

/* ── INPUTS ───────────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}

.field-hint {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: -2px;
}

.input, .select {
  height: 36px;
  padding: 0 12px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  width: 100%;
}

.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input.readonly, .input:read-only {
  background: var(--paper-2);
  color: var(--ink-2);
  cursor: default;
}

.input-row {
  display: flex;
  gap: 8px;
}

select.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%237a6f5f' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 28px;
}

/* ── CARDS ────────────────────────────────────── */

.card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.card-body {
  padding: 16px 18px;
}

.card-body-tight {
  padding: 8px 0;
}

/* ── BADGES ───────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--line-soft);
  white-space: nowrap;
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-4);
  flex-shrink: 0;
}

.badge.success { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.success .dot { background: var(--good); }

.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.warn .dot { background: var(--warn); }

.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.bad .dot { background: var(--bad); }

.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.accent .dot { background: var(--accent); }

.badge.live .dot {
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ── TABLE ────────────────────────────────────── */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper-2);
}

.table tbody tr {
  border-bottom: 1px solid var(--line-soft);
  transition: background 100ms ease;
  cursor: pointer;
}

.table tbody tr:hover {
  background: var(--paper-2);
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table tbody td {
  padding: 12px 14px;
  vertical-align: middle;
}

.table .col-name {
  font-weight: 500;
  color: var(--ink);
}

.table .col-name .sub {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
}

.table .col-time {
  color: var(--ink-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ── DEFINITION LIST ──────────────────────────── */

.dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 18px;
  margin: 0;
  font-size: 13px;
}

.dl dt {
  color: var(--ink-3);
  font-weight: 400;
}

.dl dd {
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}

/* ── FILE LIST ────────────────────────────────── */

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line-soft);
  cursor: pointer;
  transition: padding 150ms ease;
}

.file-item:last-child { border-bottom: none; }

.file-item:hover {
  padding-left: 6px;
}

.file-icon {
  width: 28px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-2);
  position: relative;
  font-size: 8px;
  font-family: var(--mono);
  color: var(--ink-3);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 3px;
}

.file-icon::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background: var(--paper);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.file-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}

.file-meta {
  font-size: 11px;
  color: var(--ink-3);
  display: block;
  font-weight: 400;
  margin-top: 1px;
  font-variant-numeric: tabular-nums;
}

.file-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 240ms ease;
}

.file-item.open + .file-detail {
  max-height: 200px;
}

.file-detail-inner {
  padding: 10px 14px 14px 40px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.6;
  background: var(--paper-2);
  border-radius: var(--r-md);
  margin: 4px 0 8px;
}

/* ── PIPELINE (the showpiece) ─────────────────── */

.pipeline {
  position: relative;
  padding: 24px 8px 12px;
}

.pipeline-track {
  position: relative;
  height: 2px;
  background: var(--line);
  margin: 0 14px 24px;
}

.pipeline-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--ink);
  transition: width 600ms cubic-bezier(0.65, 0, 0.35, 1);
}

.pipeline-steps {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-top: -36px;
}

.pipeline-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  gap: 10px;
}

.pipeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--line);
  position: relative;
  z-index: 2;
  transition: all 200ms ease;
}

.pipeline-step.done .pipeline-dot {
  background: var(--ink);
  border-color: var(--ink);
}

.pipeline-step.active .pipeline-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.pipeline-step.active .pipeline-dot::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: ripple 1.8s ease-out infinite;
}

@keyframes ripple {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}

.pipeline-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
}

.pipeline-step.done .pipeline-num,
.pipeline-step.active .pipeline-num {
  color: var(--ink-2);
}

.pipeline-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  max-width: 110px;
  line-height: 1.3;
}

.pipeline-step.done .pipeline-label,
.pipeline-step.active .pipeline-label {
  color: var(--ink);
}

.pipeline-step.active .pipeline-label {
  color: var(--accent);
}

.pipeline-step.skipped {
  opacity: 0.4;
}

.pipeline-step.skipped .pipeline-label::after {
  content: ' · пропущено';
  font-style: italic;
  color: var(--ink-4);
  font-weight: 400;
}

/* ── COUNTERS ─────────────────────────────────── */

.counters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  background: var(--paper);
  overflow: hidden;
}

.counter {
  padding: 14px 18px;
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.counter:last-child { border-right: none; }

.counter-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.counter-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.counter-delta {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 400;
}

/* ── ALERT / INFO BLOCK ───────────────────────── */

.note {
  background: var(--paper-2);
  border-left: 2px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}

.note-eyebrow {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 4px;
  display: block;
}

/* ── BREADCRUMB ───────────────────────────────── */

.crumb {
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
}

.crumb a:hover { color: var(--ink); }

/* ── EVENTS LIST (mini) ───────────────────────── */

.events {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.event {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line-soft);
  font-size: 12px;
}

.event:last-child { border-bottom: none; }

.event-time {
  font-family: var(--mono);
  color: var(--ink-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.event-text {
  color: var(--ink-2);
}

.event-text strong {
  color: var(--ink);
  font-weight: 500;
}

/* ── SECTIONS ─────────────────────────────────── */

.section {
  margin-bottom: 28px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 16px;
}

.section-head h2 { font-size: 18px; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── DIVIDER ──────────────────────────────────── */

.rule {
  height: 1px;
  background: var(--line-soft);
  border: none;
  margin: 24px 0;
}

/* ── THEME VARIANTS for operator (Tweaks) ─────── */
/* (дарк/инк убраны — оставлена только warm) */

/* Палитры — отношение «страница vs карточка» */

/* A. warm-deep (default) — страница темнее карточек, тёплая */
/* (значения по умолчанию в :root) */

/* B. page-light — страница СВЕТЛЕЕ карточек, бумага «лежит» на бледном фоне */
body[data-palette="light"] {
  --page-bg: #fdfaf3;        /* почти кремовый */
  --paper:   #f3ecd9;        /* карточка — заметно темнее, как пергамент */
  --paper-2: #e8e0c8;
  --line-soft: #d8cfb9;
  --line:      #c4b89e;
}

/* C. minimal-white — страница белая, карточки тёплые */
body[data-palette="white"] {
  --page-bg: #ffffff;
  --paper:   #faf6ed;        /* тёплая бумага */
  --paper-2: #f1ecdf;
  --line-soft: #ece5d2;
}

/* ── Card colour variants (when palette=white) ─── */
/* меняем только цвет самой бумаги — фон страницы остаётся белым */

body[data-palette="white"][data-card="cream"] {
  /* default — уже определено выше */
}

body[data-palette="white"][data-card="bone"] {
  --paper:   #f6f3ec;
  --paper-2: #ece8de;
  --line-soft: #e3ddcd;
  --line:      #d3ccb9;
}

body[data-palette="white"][data-card="mist"] {
  --paper:   #eff2f5;
  --paper-2: #e3e8ee;
  --line-soft: #d9e0e8;
  --line:      #c3cdd8;
  --ink-3:     #6f7785;
  --ink-4:     #98a0ad;
}

body[data-palette="white"][data-card="sage"] {
  --paper:   #eef2ea;
  --paper-2: #e1e8db;
  --line-soft: #d6dfcd;
  --line:      #bccab0;
  --ink-3:     #6c7563;
  --ink-4:     #97a08e;
}

body[data-palette="white"][data-card="lavender"] {
  --paper:   #f0edf6;
  --paper-2: #e6e1ee;
  --line-soft: #ddd6e7;
  --line:      #c8bcd8;
  --ink-3:     #6c647a;
  --ink-4:     #968ea8;
}

body[data-palette="white"][data-card="pure"] {
  --page-bg: #f3f3f0;        /* лёгкий тёплый серый, чтобы белая карточка читалась */
  --paper:   #ffffff;
  --paper-2: #f7f5ef;
  --line-soft: #eae5d6;
  --line:      #d8d2bf;
}

body[data-palette="white"][data-card="sand"] {
  --paper:   #f5edd8;
  --paper-2: #ebe1c6;
  --line-soft: #e3d8ba;
  --line:      #ccbe93;
}

body[data-palette="white"][data-card="ink-paper"] {
  --page-bg: #ffffff;
  --paper:   #1f1a14;        /* инверсия — карточка тёмная */
  --paper-2: #2a241b;
  --paper-3: #3a3225;
  --line:      #3f372a;
  --line-soft: #2c261c;
  --ink:       #f6efdf;
  --ink-2:     #d4c9b3;
  --ink-3:     #9b9077;
  --ink-4:     #6b6151;
}
body[data-palette="white"][data-card="ink-paper"] .badge.muted-badge {
  background: rgba(255,255,255,0.06);
  color: var(--ink-3);
  border-color: rgba(255,255,255,0.1);
}

/* D. WILD CARD — терракота: кирпичная страница, кремовые карточки */
body[data-palette="wild"] {
  --page-bg: #b85c3c;        /* терракота, насыщенная */
  --paper:   #fbf4e3;        /* очень светлый крем — карточка светится */
  --paper-2: #f0e6cd;
  --paper-3: #e3d5b2;
  --line:      #d4c39e;
  --line-soft: #ebe0c4;
  --ink-3:     #6f6552;
}
body[data-palette="wild"] .topbar {
  background: var(--page-bg);
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
body[data-palette="wild"] .topbar .brand,
body[data-palette="wild"] .topbar-user span:not(.avatar) {
  color: #fbf4e3;
}
body[data-palette="wild"] .topbar .brand-mark {
  background: #fbf4e3 !important;
}
body[data-palette="wild"] .topbar .brand-sep {
  color: rgba(255,255,255,0.4);
}
body[data-palette="wild"] .topbar .brand-role {
  color: rgba(255,255,255,0.7);
}
body[data-palette="wild"] .topbar-user .avatar {
  background: rgba(0,0,0,0.15);
  color: #fbf4e3;
}
body[data-palette="wild"] .op-head h1,
body[data-palette="wild"] .op-head .sub {
  color: #fbf4e3;
}
body[data-palette="wild"] .op-head .sub { color: rgba(251,244,227,0.75); }
body[data-palette="wild"] .counter {
  background: var(--paper);
  border-color: var(--line-soft);
}
body[data-palette="wild"] .pill-group,
body[data-palette="wild"] .country-filter {
  background: rgba(0,0,0,0.18);
  border-color: rgba(255,255,255,0.12);
}
body[data-palette="wild"] .pill {
  color: rgba(251,244,227,0.7);
}
body[data-palette="wild"] .pill:hover { color: #fbf4e3; }
body[data-palette="wild"] .pill.active {
  background: var(--paper);
  color: var(--ink);
}
body[data-palette="wild"] .country-filter button {
  color: rgba(251,244,227,0.7);
}
body[data-palette="wild"] .country-filter button.active {
  background: var(--paper);
  color: var(--ink);
}
body[data-palette="wild"] .search {
  background: rgba(0,0,0,0.15);
  color: #fbf4e3;
}
body[data-palette="wild"] .search input { color: #fbf4e3; }
body[data-palette="wild"] .search input::placeholder { color: rgba(251,244,227,0.5); }
body[data-palette="wild"] .empty-meta { color: rgba(251,244,227,0.55); }

/* ── DENSITY VARIANTS ─────────────────────────── */

body[data-density="cozy"] .table tbody td { padding: 16px 14px; }
body[data-density="cozy"] { font-size: 14px; }

/* ── FORM (anketa) ────────────────────────────── */

.form-progress {
  position: sticky;
  top: 52px;
  z-index: 5;
  background: var(--paper);
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 28px;
}

.form-progress-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.form-progress-count {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.form-progress-count em {
  font-style: normal;
  color: var(--accent);
  font-weight: 600;
}

.form-progress-meta {
  font-size: 12px;
  color: var(--ink-3);
  flex: 1;
}

.form-progress-bar {
  height: 3px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.form-progress-bar-ai {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: var(--accent);
  border-radius: 999px;
}

.form-progress-bar-user {
  position: absolute;
  top: 0; bottom: 0;
  background: var(--ink);
  border-radius: 999px;
}

.form-progress-legend {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-3);
}

.form-progress-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.form-progress-legend i {
  width: 8px; height: 8px; border-radius: 2px;
  display: inline-block;
}

.form-progress-legend i.ai { background: var(--accent); }
.form-progress-legend i.user { background: var(--ink); }
.form-progress-legend i.empty { background: var(--line); }

.form-section {
  margin-bottom: 36px;
}

.form-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 18px;
  gap: 12px;
}

.form-section-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
}

.form-section-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  flex: 1;
}

.form-section-status {
  font-size: 11px;
  color: var(--ink-3);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
}

.form-grid .field-full {
  grid-column: 1 / -1;
}

.field-with-source {
  position: relative;
}

.field-source {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.field-source::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.input.locked {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--ink);
  font-weight: 500;
  cursor: default;
}

.input.empty-required {
  border-style: dashed;
  border-color: var(--line);
  color: var(--ink-3);
}

.input.empty-required::placeholder { color: var(--ink-4); }

.input-typing {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--paper);
}

.field-error {
  font-size: 11px;
  color: var(--bad);
  margin-top: -2px;
}

/* photo upload tile */
.photo-tile {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--paper);
  align-items: center;
}

.photo-thumb {
  width: 100px;
  height: 128px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #d8c8a8 0%, #b8a888 100%);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
}

.photo-thumb.warn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0%, transparent 35%, rgba(0,0,0,0.35) 60%, rgba(0,0,0,0.45) 100%);
}

.photo-thumb-face {
  position: absolute;
  top: 22%;
  left: 50%;
  width: 50px;
  height: 60px;
  background: rgba(60, 40, 20, 0.6);
  border-radius: 50% 50% 45% 45% / 55% 55% 45% 45%;
  transform: translateX(-50%);
}

.photo-thumb-face::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 50%;
  width: 38px;
  height: 22px;
  background: rgba(60, 40, 20, 0.5);
  border-radius: 50% 50% 0 0;
  transform: translateX(-50%);
}

.photo-info-name {
  font-weight: 500;
  font-size: 13px;
  margin-bottom: 4px;
}

.photo-info-meta {
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 10px;
  line-height: 1.5;
}

.photo-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* save bar */
.save-bar {
  position: sticky;
  bottom: 0;
  background: var(--paper);
  border-top: 1px solid var(--line-soft);
  padding: 14px 0;
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-bar-status {
  flex: 1;
  font-size: 12px;
  color: var(--ink-3);
}

.save-bar-status .dot {
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--good);
  margin-right: 6px;
  vertical-align: middle;
}

.passport-tip {
  background: var(--accent-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.passport-tip-icon {
  width: 28px;
  height: 36px;
  background: var(--accent);
  border-radius: 3px;
  flex-shrink: 0;
  position: relative;
  margin-top: 2px;
}

.passport-tip-icon::after {
  content: '';
  position: absolute;
  inset: 8px 6px;
  border-radius: 50%;
  background: var(--accent-soft);
}

.passport-tip strong {
  color: var(--ink);
  font-weight: 600;
}

.passport-tip-action {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

/* ── TWEAKS PANEL OVERRIDES ───────────────────── */

.tweaks-panel-wrapper {
  z-index: 9999;
}
