/* ============================================================
   docs-creator UI — operator workspace
   Design tokens
   ============================================================ */
:root {
  /* Surfaces */
  --bg:           #eef1f6;
  --surface:      #ffffff;
  --surface-alt:  #f7f9fc;
  --surface-soft: #f1f4f9;

  /* Borders */
  --border:        #dde3ec;
  --border-strong: #c6cfdc;
  --border-soft:   #e8ecf3;

  /* Text */
  --text:         #0f1a2b;
  --text-muted:   #4f5b72;
  --text-faint:   #8390a3;
  --text-on-dark: #ffffff;

  /* Brand */
  --brand:        #2563eb;
  --brand-strong: #1d4ed8;
  --brand-tint:   #eff4ff;
  --brand-ink:    #1e3a8a;

  /* States */
  --ok:        #15803d;
  --ok-tint:   #ecfdf5;
  --ok-border: #bbf7d0;

  --warn:        #b45309;
  --warn-tint:   #fff7ed;
  --warn-border: #fed7aa;
  --warn-strong: #9a3412;

  --danger:        #b91c1c;
  --danger-tint:   #fef2f2;
  --danger-border: #fecaca;
  --danger-strong: #991b1b;

  --info:        #0e7490;
  --info-tint:   #ecfeff;
  --info-border: #a5f3fc;

  /* Radii / shadows */
  --r-sm: 4px;
  --r:    6px;
  --r-lg: 10px;
  --r-xl: 14px;
  --shadow-1: 0 1px 0 rgba(15, 26, 43, 0.04), 0 1px 2px rgba(15, 26, 43, 0.04);
  --shadow-2: 0 1px 2px rgba(15, 26, 43, 0.06), 0 4px 12px rgba(15, 26, 43, 0.06);
  --shadow-pop: 0 8px 24px rgba(15, 26, 43, 0.10);
  --ring: 0 0 0 3px rgba(37, 99, 235, 0.18);

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --fs-xs: 11px;
  --fs-s:  12px;
  --fs:    13px;
  --fs-m:  14px;
  --fs-l:  16px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
}

/* ============================================================
   Reset & base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button { font: inherit; }

input, select, textarea {
  font: inherit;
  color: inherit;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

.muted { color: var(--text-muted); }
.num   { font-variant-numeric: tabular-nums; }

[hidden] { display: none !important; }

/* ============================================================
   Preview bar (демо переключатель — не часть продукта)
   ============================================================ */
.preview-bar {
  background: #0f1a2b;
  color: #c5cee0;
  border-bottom: 1px solid #1f2b41;
  font-size: var(--fs-s);
}
.preview-bar__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.preview-bar__label { color: #94a2bd; }
.preview-bar__buttons { display: flex; gap: 4px; }
.preview-bar__buttons button {
  background: transparent;
  border: 1px solid transparent;
  color: #c5cee0;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  letter-spacing: 0.01em;
}
.preview-bar__buttons button:hover { background: #1a2640; color: #fff; }
.preview-bar__buttons button.is-active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}
.preview-bar__hint { margin-left: auto; color: #6b7896; font-size: var(--fs-xs); }

/* ============================================================
   Brand
   ============================================================ */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text);
}
.brand__mark {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, #2563eb 0%, #1e3a8a 100%);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  letter-spacing: -0.02em;
}
.brand__name { font-size: var(--fs-m); letter-spacing: -0.01em; }
.brand--sm .brand__mark { width: 24px; height: 24px; font-size: 11px; }
.brand--sm .brand__name { font-size: var(--fs); }

/* ============================================================
   Topbar
   ============================================================ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.topbar__nav { display: flex; gap: 4px; margin-left: 16px; }
.topbar__link {
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs);
  text-decoration: none;
}
.topbar__link:hover { background: var(--surface-soft); color: var(--text); text-decoration: none; }
.topbar__link.is-active { color: var(--text); background: var(--surface-soft); font-weight: 500; }
.topbar__user {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
  font-size: var(--fs-s);
  color: var(--text-muted);
}
.topbar__service { color: var(--text-muted); }
.topbar__name { color: var(--text); font-weight: 500; }
.topbar__role { color: var(--text-faint); font-size: var(--fs-xs); }
.divider { width: 1px; height: 16px; background: var(--border); display: inline-block; }

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-soft);
  color: var(--text-muted);
}
.badge--env { background: var(--ok-tint); color: var(--ok); border: 1px solid var(--ok-border); }
.badge--danger {
  background: var(--danger-tint); color: var(--danger); border: 1px solid var(--danger-border);
  text-transform: none; letter-spacing: 0;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  background: var(--text-faint);
  flex-shrink: 0;
}
.status-dot--ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12); }
.status-dot--warn { background: var(--warn); }
.status-dot--err { background: var(--danger); }

/* ============================================================
   Layout / container
   ============================================================ */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--s-6) var(--s-6) 96px;
}

.page-head { margin-bottom: var(--s-5); }
.page-head__title { font-size: var(--fs-xl); }
.page-head__sub { color: var(--text-muted); margin: 4px 0 0; }

.actions-row {
  display: flex; gap: 8px; margin-top: var(--s-5);
}

/* ============================================================
   Cards & sections
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: var(--s-5) var(--s-6);
  margin-bottom: var(--s-4);
}

.section__head {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--border-soft);
}
.section__head--row {
  flex-direction: row; align-items: flex-start; justify-content: space-between; gap: var(--s-4);
}
.section__head--danger { border-bottom-color: var(--warn-border); }

.section__title {
  font-size: var(--fs-m);
  font-weight: 600;
  color: var(--text);
  display: inline-flex; align-items: center; gap: 8px;
}
.section__title--danger { color: var(--warn-strong); }
.section__hint { color: var(--text-muted); font-size: var(--fs-s); }
.section__actions { display: flex; gap: var(--s-2); margin-top: var(--s-3); }

.counter {
  display: inline-block;
  background: var(--surface-soft);
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: 2px;
}

/* ============================================================
   Search panel
   ============================================================ */
.card--search { padding: var(--s-3) var(--s-4); }
.search {
  display: flex;
  align-items: flex-end;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.search__hint {
  color: var(--text-muted);
  font-size: var(--fs-s);
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: var(--s-3);
}
.search__spacer { flex: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-s);
}
.chip--ok { background: var(--ok-tint); border-color: var(--ok-border); color: var(--ok); }

/* ============================================================
   Deal head
   ============================================================ */
.deal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-6);
  margin: var(--s-3) 0 var(--s-4);
  padding: var(--s-4) 4px;
}
.deal-head__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.deal-head__id {
  font-family: var(--font-mono);
  color: var(--text-faint);
  font-size: var(--fs-s);
  letter-spacing: 0.02em;
}
.deal-head__title {
  font-size: var(--fs-2xl);
  letter-spacing: -0.01em;
}
.deal-head__meta {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, max-content));
  gap: 4px var(--s-6);
}
.deal-head__meta div { display: flex; flex-direction: column; }
.deal-head__meta dt {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.deal-head__meta dd { margin: 2px 0 0; font-weight: 500; color: var(--text); font-size: var(--fs-m); }

/* ============================================================
   Form fields
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--inline { gap: 6px; flex: 0 0 auto; min-width: 200px; }
.field--readout { gap: 6px; }
.field__label {
  font-size: var(--fs-s);
  color: var(--text-muted);
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
}
.field__error {
  color: var(--danger);
  font-size: var(--fs-s);
  margin-top: 2px;
}
.field.has-error .input,
.field.has-error .input input { border-color: var(--danger); background: var(--danger-tint); }
.field.has-error .input:focus-within { box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.18); }

.input {
  display: inline-flex; align-items: center;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--brand);
  border-radius: var(--r);
  height: 34px;
  padding: 0 10px;
  font-size: var(--fs);
  color: var(--text);
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.input:hover { border-color: #aab6c8; }
.input:focus,
.input:focus-within {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.input::placeholder { color: var(--text-faint); }
.input[disabled] { background: var(--surface-soft); color: var(--text-muted); cursor: not-allowed; }

input.input,
select.input,
.input input { /* nested input inside .input wrapper */
  border: 0; outline: 0; background: transparent;
  width: 100%; height: 100%;
  padding: 0;
  font: inherit; color: inherit;
}
select.input { padding-right: 26px; 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' fill='none' stroke='%234f5b72' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }

.input--mono input,
.input.input--mono { font-family: var(--font-mono); letter-spacing: 0.01em; }
.input--num,
.input--num input { text-align: right; font-variant-numeric: tabular-nums; }

.input--with-icon { padding-right: 8px; gap: 6px; }
.input__icon { width: 14px; height: 14px; color: var(--text-faint); flex-shrink: 0; }

.readout {
  height: 34px;
  display: inline-flex; align-items: center;
  padding: 0 10px;
  border: 1px dashed var(--border);
  border-radius: var(--r);
  background: var(--surface-soft);
  color: var(--text-muted);
}

/* Source tag — показывает, откуда пришло поле */
.src-tag {
  display: inline-flex; align-items: center;
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.01em;
  text-transform: lowercase;
}
.src-tag[data-src="amo"] {
  color: var(--info);
  background: var(--info-tint);
  border: 1px solid var(--info-border);
}
.src-tag[data-src="manual"] {
  color: var(--warn);
  background: var(--warn-tint);
  border: 1px solid var(--warn-border);
}

.form-grid {
  display: grid;
  gap: var(--s-3) var(--s-4);
}
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .form-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .form-grid--3 { grid-template-columns: 1fr; }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: transparent;
  font-size: var(--fs);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
  white-space: nowrap;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn--sm { height: 28px; padding: 0 10px; font-size: var(--fs-s); }
.btn--block { width: 100%; }

.btn--primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.btn--primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }

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

.btn--ghost { color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-soft); color: var(--text); }

.btn--danger {
  background: var(--danger); border-color: var(--danger); color: #fff;
}
.btn--danger:hover { background: var(--danger-strong); border-color: var(--danger-strong); }
.btn--danger[disabled],
.btn[disabled] {
  background: #cdd5e1; border-color: #cdd5e1; color: #fff;
  cursor: not-allowed; opacity: .9;
  box-shadow: none;
}
.btn--danger[disabled] { background: #e6c8c8; border-color: #e6c8c8; color: #fff; }

.icon { width: 14px; height: 14px; flex-shrink: 0; }

.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: transparent;
  border-radius: var(--r-sm);
  color: var(--text-faint);
  cursor: pointer;
}
.icon-btn:hover { background: var(--danger-tint); color: var(--danger); }

/* ============================================================
   Login screen
   ============================================================ */
.screen--login { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: var(--s-6); }
.login { width: 100%; max-width: 380px; }
.login__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
  padding: var(--s-8);
}
.login__brand { text-align: center; margin-bottom: var(--s-5); }
.login__brand .brand { justify-content: center; margin-bottom: 8px; }
.login__subtitle { color: var(--text-muted); margin: 0; font-size: var(--fs-s); }
.login__form { display: flex; flex-direction: column; gap: var(--s-3); }
.login__form .btn { margin-top: 4px; }
.login__footer {
  margin-top: var(--s-5);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: var(--fs-s);
  justify-content: center;
}
.login__legal { color: var(--text-faint); font-size: var(--fs-xs); text-align: center; margin: var(--s-4) 0 0; }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding: var(--s-10) var(--s-6);
}
.empty-state__icon { width: 56px; height: 56px; color: var(--text-faint); margin-bottom: var(--s-3); }
.empty-state h2 { font-size: var(--fs-l); font-weight: 600; margin-bottom: 4px; }
.empty-state p { color: var(--text-muted); max-width: 520px; margin: 0 0 var(--s-5); }
.empty-state__steps {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: var(--s-3);
  margin: 0; padding: 0; list-style: none;
}
.empty-state__steps li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: var(--fs-s);
  color: var(--text);
}
.step-num {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
@media (max-width: 800px) {
  .empty-state__steps { grid-template-columns: 1fr; }
}

/* ============================================================
   Students table
   ============================================================ */
.section--students .section__head { padding-bottom: var(--s-3); }
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.table-wrap--wide .students { min-width: 1480px; }
.students {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs);
}
.students th,
.students td {
  border-bottom: 1px solid var(--border-soft);
  padding: 0;
  text-align: left;
  vertical-align: middle;
}
.students thead th {
  background: var(--surface-soft);
  color: var(--text-muted);
  font-weight: 500;
  font-size: var(--fs-s);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.students tbody td { padding: 4px 6px; }
.students tbody tr:hover { background: #fafbfd; }
.students tbody tr.is-excluded { background: var(--surface-soft); color: var(--text-faint); }
.students tbody tr.is-excluded .cell { color: var(--text-faint); }
.students tbody tr:last-child td { border-bottom: 0; }

.col-check { width: 36px; text-align: center; padding-left: 12px !important; }
.col-num   { text-align: right; }
.col-act   { width: 36px; text-align: center; }
.cell {
  width: 100%;
  height: 32px;
  border: 1px solid var(--brand);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 0 8px;
  color: inherit;
  font: inherit;
}
.cell:hover { border-color: var(--brand); background: #fff; }
.cell:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: var(--ring); }
.cell--num { text-align: right; font-variant-numeric: tabular-nums; }
.cell--narrow { max-width: 140px; }
select.cell { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%234f5b72' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 22px; }

.students tfoot td {
  background: var(--surface-soft);
  padding: 10px 10px;
  font-weight: 600;
  border-top: 1px solid var(--border);
  border-bottom: 0;
}
.tfoot-label { text-align: right; color: var(--text-muted); font-weight: 500; }

/* ============================================================
   Checkbox
   ============================================================ */
.checkbox { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox__box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  display: inline-block;
  position: relative;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.checkbox input:checked + .checkbox__box {
  background: var(--brand);
  border-color: var(--brand);
}
.checkbox input:checked + .checkbox__box::after {
  content: "";
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(40deg);
}
.checkbox input:focus-visible + .checkbox__box { box-shadow: var(--ring); }
.checkbox--header .checkbox__box { width: 14px; height: 14px; }
.checkbox--header input:checked + .checkbox__box::after { left: 3px; top: 0; width: 4px; height: 8px; }

/* ============================================================
   Radio cards
   ============================================================ */
.radio-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}
@media (max-width: 720px) { .radio-list { grid-template-columns: 1fr; } }

.radio-card {
  position: relative;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  background: var(--surface);
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.radio-card:hover { border-color: var(--border-strong); }
.radio-card input { margin-top: 3px; accent-color: var(--brand); flex-shrink: 0; }
.radio-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-tint);
  box-shadow: 0 0 0 1px var(--brand) inset;
}
.radio-card__body { display: flex; flex-direction: column; gap: 2px; }
.radio-card__title { font-weight: 600; color: var(--text); }
.radio-card__desc { color: var(--text-muted); font-size: var(--fs-s); }

/* ============================================================
   Confirm controls (опасные действия)
   ============================================================ */
.danger {
  background: var(--warn-tint);
  border: 1px solid var(--warn-border);
  border-left: 4px solid var(--warn);
  box-shadow: var(--shadow-1);
}
.danger .section__title { color: var(--warn-strong); }

.confirm-list { display: flex; flex-direction: column; gap: 10px; }

.confirm {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--warn-border);
  border-radius: var(--r);
  cursor: pointer;
  align-items: start;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.confirm:hover { background: #fffbf3; }
.confirm input { position: absolute; opacity: 0; pointer-events: none; }
.confirm__box {
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--warn);
  background: #fff;
  display: inline-block;
  position: relative;
  margin-top: 2px;
  transition: background .12s, border-color .12s;
}
.confirm:has(input:checked) {
  background: #fff4e0;
  border-color: var(--warn);
  box-shadow: 0 0 0 1px var(--warn) inset;
}
.confirm:has(input:checked) .confirm__box {
  background: var(--warn);
  border-color: var(--warn);
}
.confirm:has(input:checked) .confirm__box::after {
  content: "";
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(40deg);
}
.confirm__body { display: flex; flex-direction: column; gap: 2px; }
.confirm__title { font-weight: 600; color: var(--text); }
.confirm__desc { color: var(--text-muted); font-size: var(--fs-s); }

/* ============================================================
   Action bar (sticky bottom)
   ============================================================ */
.actionbar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15, 26, 43, 0.04);
  z-index: 20;
}
.actionbar__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: var(--s-4);
}
.actionbar__summary {
  display: flex; align-items: center; gap: var(--s-2);
  color: var(--text-muted); font-size: var(--fs);
  flex-wrap: wrap;
}
.actionbar__doc { color: var(--text); font-weight: 500; }
.actionbar__sep { color: var(--text-faint); }
.actionbar__sum { color: var(--text); font-weight: 600; }
.actionbar__buttons { margin-left: auto; display: flex; gap: var(--s-2); }
.actionbar__hint {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px 10px;
  color: var(--text-muted);
  font-size: var(--fs-s);
}
.actionbar__hint--armed { color: var(--warn-strong); }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  display: flex; align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: var(--s-3);
  font-size: var(--fs);
}
.alert .icon { margin-top: 2px; flex-shrink: 0; }
.alert--lg { padding: 14px 16px; gap: 12px; }
.alert--lg .icon { width: 18px; height: 18px; }
.alert > div { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.alert > div > strong { color: var(--text); font-weight: 600; }
.alert > div > span { color: var(--text-muted); font-size: var(--fs-s); }

.alert--success { background: var(--ok-tint); border-color: var(--ok-border); color: var(--ok); }
.alert--warning { background: var(--warn-tint); border-color: var(--warn-border); color: var(--warn); }
.alert--error   { background: var(--danger-tint); border-color: var(--danger-border); color: var(--danger); }

/* ============================================================
   Result card (success state)
   ============================================================ */
.result__file {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  margin-bottom: var(--s-4);
}
.result__icon { width: 32px; height: 32px; color: var(--brand); flex-shrink: 0; }
.result__meta { flex: 1; min-width: 0; }
.result__name { font-family: var(--font-mono); font-size: var(--fs-m); font-weight: 500; color: var(--text); word-break: break-all; }
.result__sub { color: var(--text-muted); font-size: var(--fs-s); margin-top: 2px; }
.result__actions { display: flex; gap: 8px; }

.result__log {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: var(--s-3);
}
.result__log li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
}
.result__log li > div { display: flex; flex-direction: column; }
.result__log li strong { color: var(--text); font-weight: 600; }
.result__log .muted { color: var(--text-muted); font-size: var(--fs-s); }

.result__dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  margin-top: 4px;
  position: relative;
}
.result__dot--ok    { background: var(--ok); }
.result__dot--ok::after {
  content: ""; position: absolute; left: 3px; top: 1px; width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(40deg);
}
.result__dot--skip {
  background: transparent; border: 2px dashed var(--text-faint);
}
.result__dot--err { background: var(--danger); }

/* ============================================================
   Grid (sections layout)
   ============================================================ */
.grid {
  display: grid;
  gap: var(--s-3);
}

/* ============================================================
   Адаптация под ноутбук
   ============================================================ */
@media (max-width: 1280px) {
  .container { padding: var(--s-5) var(--s-5) 96px; }
  .topbar__inner { padding: 0 var(--s-5); }
  .actionbar__inner { padding: 12px var(--s-5); }
}
@media (max-width: 900px) {
  .deal-head { flex-direction: column; gap: var(--s-3); }
  .deal-head__meta { grid-template-columns: repeat(2, max-content); }
  .topbar__nav { display: none; }
  .actionbar__buttons .btn--ghost { display: none; }
}
@media (max-width: 640px) {
  .container { padding: var(--s-4); padding-bottom: 140px; }
  .topbar__user .topbar__service,
  .topbar__user .topbar__role { display: none; }
  .deal-head__meta { grid-template-columns: 1fr 1fr; }
  .actionbar__summary { display: none; }
  .actionbar__buttons { flex: 1; }
  .actionbar__buttons .btn { flex: 1; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0ms !important; }
}
