/* Notion-style minimalist design */
:root {
  --bg: #ffffff;
  --surface: #f7f6f3;
  --surface-hover: #efeeea;
  --text: #37352f;
  --muted: #787774;
  --border: #e9e9e7;
  --accent: #2eaadc;
  --accent-hover: #1e98c7;
  --danger: #e03e3e;
  --success: #0f7b0f;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1 { font-size: 28px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 20px; font-weight: 600; margin: 24px 0 8px; }

.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.mt-24 { margin-top: 24px; }

/* ---- Auth pages ---- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--surface);
}

.auth-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.auth-card h1 { margin-bottom: 4px; font-size: 24px; }
.auth-card > .muted { margin-top: 0; margin-bottom: 24px; }

/* ---- Forms ---- */
form label {
  display: block;
  margin-bottom: 16px;
}

form label > span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

form .hint {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

form label.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
}

form label.checkbox-row > input[type="checkbox"] {
  margin-top: 3px;
  flex: 0 0 auto;
}

form label.checkbox-row > span {
  display: inline;
  font-size: 13px;
  font-weight: 400;
  margin-bottom: 0;
  color: var(--muted);
}

input[type="email"],
input[type="password"],
input[type="url"],
input[type="text"],
input[type="date"],
input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

/* Custom select chevron — the browser default arrow is busy and clashes
   with the rest of the Notion-style form chrome. SVG is inline so there's
   no extra request; currentColor would pull the active text shade if the
   site went dark-mode, but for now --muted is a fine fixed gray. */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%23787774' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 170, 220, 0.15);
}

/* Labels inside cards (not just <form>) get the same block layout the
   AI-korrektor form uses, so the producer-helper controls — which live
   outside a <form> for the AJAX flow — pick up the same look. */
.card label {
  display: block;
  margin-bottom: 16px;
}
.card label > span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.btn-primary {
  display: inline-block;
  width: 100%;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 120ms ease;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.oauth-form {
  margin: 0;
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  padding-bottom: 15px;
  color: var(--muted);
  font-size: 13px;
}
.oauth-divider span { flex-shrink: 0; }
.oauth-divider::before,
.oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-secondary {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.btn-secondary:hover { background: var(--surface-hover); }

.btn-copied {
  background: #e6f7ed !important;
  border-color: #a8d9b9 !important;
  color: var(--success) !important;
}

.btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto !important;
  padding: 9px 16px !important;
  margin-top: 0 !important;
  text-decoration: none;
}
.btn-inline:hover { text-decoration: none; }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.result-actions .btn-secondary {
  padding: 9px 16px;
  font-size: 14px;
}

/* ---- Users table (admin) ---- */
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 16px;
}
.users-table th,
.users-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.users-table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.users-table tbody tr:hover { background: var(--surface); }
.users-table .col-actions { text-align: right; white-space: nowrap; }
.users-table .col-actions form { margin-left: 6px; }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  margin-left: 6px;
  vertical-align: middle;
}
.tag-ok { background: #e6f7ed; color: var(--success); }
.tag-warn { background: #fff4e0; color: #a96a00; }
.tag-admin { background: #eef2ff; color: #3949ab; }
.tag-active { background: #eef2ff; color: #3949ab; }
.tag-error { background: #fde7e7; color: #b00020; }

.btn-danger {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
  background: #fff0f0;
  border: 1px solid #f5caca;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease;
}
.btn-danger:hover { background: #ffe4e4; }

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
}
.btn-link:hover { color: var(--text); }

.inline-form { display: inline; }

/* ---- Flash messages ---- */
.flash {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 16px;
}
.flash-error {
  background: #fff0f0;
  color: var(--danger);
  border: 1px solid #f5caca;
}
.flash-info {
  background: #eef7ff;
  color: #1867a0;
  border: 1px solid #cce3f5;
}

/* ---- Top bar ----
   The nav lives behind a hamburger toggle. With seven+ links (Корректор,
   Валидатор, две истории, и три админских) inline takes up half the
   viewport on narrow screens and wraps awkwardly on every page. Folding
   them into a dropdown keeps the topbar stable as more sections land.
*/
.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: relative; /* dropdown anchors to the topbar, not the page */
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-brand { font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* Hamburger button: three stacked lines drawn with currentColor so the
   button picks up theme colours. Sits at the very left of the topbar. */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}
.nav-toggle:hover { background: var(--surface); }
.nav-toggle .hamburger {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  position: relative;
}
.nav-toggle .hamburger::before,
.nav-toggle .hamburger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
}
.nav-toggle .hamburger::before { top: -6px; }
.nav-toggle .hamburger::after { top: 6px; }

/* The nav panel itself. Hidden by default via the `hidden` attribute;
   when shown it floats below the topbar's left edge so the active link
   stays close to the hamburger that opened it. */
.topbar-nav {
  position: absolute;
  top: 100%;
  left: 24px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  z-index: 20;
  min-width: 220px;
}
.topbar-nav[hidden] { display: none; }
.topbar-nav a {
  padding: 8px 12px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.topbar-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.topbar-nav a.active { color: var(--text); background: var(--surface); font-weight: 500; }

/* ---- Main page ---- */
.page {
  max-width: 720px;
  margin: 40px auto;
  padding: 0 24px;
}
.page-wide { max-width: 1200px; }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
}

.code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
}
.code-row code { flex: 1; color: var(--text); word-break: break-all; }

/* ---- Status / result panels ---- */
.status {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status .progress-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.status .progress-sub {
  font-size: 13px;
  padding-left: 26px; /* align under spinner */
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress-bar {
  margin-left: 26px; /* align under the spinner column */
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar[hidden] { display: none; }
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 300ms ease;
}
.progress-eta {
  font-size: 13px;
  padding-left: 26px;
}
.progress-eta[hidden] { display: none; }

.result {
  margin-top: 24px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.result h2 { margin-top: 0; }
.result .kv { display: grid; grid-template-columns: 200px 1fr; row-gap: 8px; font-size: 14px; }
.result .kv dt { color: var(--muted); }
.result .kv dd { margin: 0; color: var(--text); }
.result-success { border-left: 3px solid var(--success); }
.result-error   { border-left: 3px solid var(--danger); background: #fff7f7; }

.changes-details {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.changes-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}
.changes-details > summary::-webkit-details-marker { display: none; }
.changes-details > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  transition: transform 120ms ease;
  color: var(--muted);
}
.changes-details[open] > summary::before { transform: rotate(90deg); }

.changes-list {
  margin: 0;
  padding: 4px 14px 14px 32px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.changes-list li {
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.changes-list li:first-child { border-top: none; }
.changes-list .diff-old {
  background: #fff0f0;
  color: #8a1a1a;
  padding: 1px 4px;
  border-radius: 3px;
  text-decoration: line-through;
  text-decoration-color: rgba(138, 26, 26, 0.4);
}
.changes-list .diff-new {
  background: #e6f7ed;
  color: #0f5c1a;
  padding: 1px 4px;
  border-radius: 3px;
}
.changes-list .diff-arrow {
  color: var(--muted);
  margin: 0 8px;
}

/* ---- Corrections history (admin) ----
   The list page is dense: ~7 columns of mostly-numeric data plus user emails
   and document titles. Force numeric/date cells to stay on one line so the
   columns don't ratchet wider than the content needs, and leave the doc-title
   column free to wrap when titles are long.
*/
.corrections-table th,
.corrections-table td { vertical-align: top; }
.corrections-table .col-num,
.corrections-table .col-date,
.corrections-table .col-user { white-space: nowrap; }
.corrections-table .col-num { text-align: right; }
.corrections-table .col-doc { min-width: 220px; }
/* Reserve enough room for "2026-04-25 05:39" so the auto-layout table
   can't squeeze the column down to a single character per line. The
   date cell is rendered inside a <span> with its own nowrap so even a
   narrower viewport keeps the date on one line and overflows the cell
   instead of breaking on every hyphen. */
.corrections-table .col-date { min-width: 150px; }
.corrections-table .col-date span { white-space: nowrap; }
.corrections-table .col-actions a { white-space: nowrap; text-decoration: none; }

/* Bold the words that actually changed inside the red/green pills.
   Server-side (admin detail) and client-side (dashboard summary) both wrap
   changed words in <strong>; this rule just makes sure the weight is
   distinct enough from the regular pill text. */
.changes-list .diff-old strong,
.changes-list .diff-new strong { font-weight: 700; }

/* Detail-page toolbar above the title: «← К списку» on the left,
   «Скопировать ссылку» on the right. Always one line. */
.detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.detail-toolbar a { font-size: 14px; }
.detail-toolbar > :only-child { margin-left: auto; }

/* ---- Review page (two-phase AI-korrektor flow) ----------------------- */

.review-group { margin-top: 24px; }
.review-group h2 { margin: 0; }
.review-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}
.review-toggle-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.review-toggle-all input { accent-color: var(--accent); }

.review-list { padding-inline-start: 0; list-style: none; }
.review-list li { padding: 0; }
.review-row {
  display: grid;
  grid-template-columns: 24px 1fr auto 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 10px 8px;
  cursor: pointer;
  border-radius: 4px;
}
.review-row:hover { background: var(--surface); }
.review-row input[type="checkbox"] {
  margin: 0;
  align-self: start;
  margin-top: 4px;
  accent-color: var(--accent);
}
.review-row:has(input:not(:checked)) {
  opacity: 0.45;
}

/* ---- Stress conflict resolution ----------------------------------------
   The korrektor proposed two different stress positions for the same word.
   Rendered as an amber callout (something needs the editor's decision)
   with one row per word and tappable card-chips per variant. The stressed
   syllable is colorized by review.js so the difference between variants
   is visible at a glance. */
.stress-conflicts {
  margin: 20px 0 28px;
  padding: 16px 18px 12px;
  background: #fdf8ee;
  border: 1px solid #f0e3c5;
  border-radius: var(--radius);
}
.stress-conflicts-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stress-conflicts-head h2 {
  margin: 0;
  font-size: 17px;
}
.stress-conflicts > p {
  margin: 6px 0 14px;
  font-size: 14px;
}
.stress-conflict {
  display: flex;
  align-items: center;
  gap: 8px 20px;
  flex-wrap: wrap;
  padding: 10px 0;
}
.stress-conflict + .stress-conflict {
  border-top: 1px dashed #ecdfc0;
}
.stress-conflict-word {
  font-weight: 600;
  min-width: 110px;
}
.stress-variants {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.stress-variant {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 9px 18px 7px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.stress-variant:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.stress-variant input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.stress-variant-form {
  font-size: 19px;
  line-height: 1.35;
}
.stress-variant-form .stress-hit {
  color: var(--accent-hover);
  font-weight: 700;
  font-style: normal;
}
.stress-variant-count {
  font-size: 12px;
  color: var(--muted);
}
.stress-variant:has(input:checked) {
  border-color: var(--accent);
  background: #eef7fb;
  box-shadow: inset 0 0 0 1px var(--accent);
}
.stress-variant:has(input:checked)::after {
  content: "✓";
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.stress-variant:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.stress-conflict-hint {
  display: none;
  flex-basis: 100%;
  color: var(--danger);
  font-size: 13px;
}
.stress-conflict.needs-choice .stress-variant {
  border-color: #f5caca;
}
.stress-conflict.needs-choice .stress-conflict-hint {
  display: block;
}

.review-actions {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 16px 0 8px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
}

/* ---- Validator detail (Валидатор) -----------------------------------
   Findings are shown as quoted fragments + an explanatory comment beneath.
   Visually distinct from the Korrektor's red/green diff pills because
   there's no "before/after" — just "this passage broke this rule."
*/
.findings-list {
  margin: 0;
  padding: 4px 14px 14px 32px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}
.finding-item {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.findings-list li:first-child { border-top: none; }
.finding-fragment {
  margin: 0 0 8px;
  padding: 8px 12px;
  border-left: 3px solid #058add;
  background: #eaf6fd;
  color: #0a3a52;
  border-radius: 0 6px 6px 0;
  font-style: italic;
  white-space: pre-wrap;
}
.finding-comment {
  margin: 0;
  color: var(--text);
}

/* ---- Шеф-редактор checklist ---------------------------------------- */
.detail-meta {
  margin: 12px 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}
.detail-meta > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--muted, #666);
  user-select: none;
}
.detail-meta[open] > summary {
  border-bottom: 1px solid var(--border);
}
.detail-meta > table,
.detail-meta > h3,
.detail-meta > p {
  margin: 12px 14px;
}

.checklist-item {
  padding: 14px 16px;
  margin: 12px 0;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.checklist-ok { border-left-color: var(--success); }
.checklist-warn { border-left-color: #d98a00; }
.checklist-error { border-left-color: #b00020; }
.checklist-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.checklist-head h3 {
  margin: 0;
  font-size: 16px;
}
.checklist-summary {
  margin: 0 0 8px;
  color: var(--text);
  line-height: 1.55;
}
.checklist-sub {
  margin: 8px 0 0;
  padding: 0 0 0 2px;
  list-style: none;
}
.checklist-sub > li {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.checklist-sub > li:first-child { border-top: none; }
/* Fragment-anchored sub-findings are the ones highlighted yellow in the doc. */
.checklist-sub .finding-fragment {
  border-left-color: #d98a00;
  background: #fff8e6;
  color: #6b4a00;
}

/* ---- Unified history (Корректор + Валидатор) ----------------------- */
.history-tabs {
  display: flex;
  gap: 6px;
  margin: 16px 0 18px;
  flex-wrap: wrap;
}
.history-tab {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  background: var(--bg);
}
.history-tab:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.history-tab-active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.history-tab-active:hover { background: var(--text); color: var(--bg); }

.cancel-pending {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0 18px;
  background: var(--surface);
}
.cancel-pending-counts {
  margin: 8px 0 0;
  padding-left: 18px;
}
.cancel-pending-form { margin-top: 12px; }

/* Per-row "Тип" badge: distinguish Корректор / Валидатор at a glance.
   Different hue from the status badge so the eye doesn't have to read
   both to tell them apart. */
.tag-kind-korrektor {
  background: #f3eaff;
  color: #4a2a86;
  border: 1px solid #d8c5f3;
}
.tag-kind-validator {
  background: #e6f7fb;
  color: #074d63;
  border: 1px solid #b9e2ee;
}
.tag-kind-chiefeditor {
  background: #fff4e0;
  color: #7a4d00;
  border: 1px solid #f0d5a0;
}

/* Inline mini-options (TTS, подсветка) shown under the result count. */
.row-options { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.row-options .tag { font-size: 11px; padding: 1px 6px; }



/* Продюсер-помощник. Diff-table layout with subtle visual cue on rows whose
   proposed due date differs from the current one. The card wraps the table
   in a horizontal-scroll container so narrow viewports keep working without
   us having to redesign the columns for mobile — the producer flow is a
   desktop workflow first. */
#plan-card { overflow-x: auto; }
.producer-stages-text {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  resize: vertical;
}

/* Advanced operations spoiler — collapsed by default; the AI text analyzer is
   the primary control above it. */
details#ops-card > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  list-style: revert;
}
details#ops-card[open] > summary {
  margin-bottom: 8px;
}

/* Higher specificity than `.card label { display: block }` so the checkbox
   and its label sit on one line. */
label.producer-start-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.producer-start-toggle > input {
  width: auto;
  margin: 0;
  flex: none;
}
.producer-start-toggle > span {
  display: inline;
  margin-bottom: 0;
}

.producer-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  margin-top: 12px;
  table-layout: fixed;
}
.producer-table.with-start-dates {
  min-width: 1100px;
}
.producer-table th,
.producer-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  word-break: break-word;
}
.producer-table thead th {
  font-size: 11px;
  text-transform: none;
  color: var(--muted);
  letter-spacing: 0;
  line-height: 1.3;
}
.producer-table thead th.col-start,
.producer-table thead th.col-due {
  min-width: 118px;
}
.producer-table tfoot th,
.producer-table tfoot td {
  border-top: 2px solid var(--border);
  font-weight: 600;
}
/* Column order: key | task | cur-start | cur-due | new-start | new-due | apply
   (the two start cols may be hidden). Current pair sits before the new pair
   so each срок reads next to its «текущее»→«новое» counterpart. */
.producer-table th:nth-child(1),
.producer-table td:nth-child(1) { width: 100px; }
.producer-table th:nth-child(2),
.producer-table td:nth-child(2) { width: auto; }
/* Without start dates only the two due cols show: cur-due (4), new-due (6). */
.producer-table:not(.with-start-dates) th:nth-child(4),
.producer-table:not(.with-start-dates) td:nth-child(4) { width: 120px; }
.producer-table:not(.with-start-dates) th:nth-child(6),
.producer-table:not(.with-start-dates) td:nth-child(6) { width: 140px; }
.producer-table th:nth-child(7),
.producer-table td:nth-child(7) {
  width: 100px;
  text-align: center;
  padding-left: 5px;
  padding-right: 5px;
}

/* Seven-column layout: key | task | cur-start | cur-due | new-start | new-due | apply */
.producer-table.with-start-dates th:nth-child(3),
.producer-table.with-start-dates td:nth-child(3),
.producer-table.with-start-dates th:nth-child(4),
.producer-table.with-start-dates td:nth-child(4),
.producer-table.with-start-dates th:nth-child(5),
.producer-table.with-start-dates td:nth-child(5),
.producer-table.with-start-dates th:nth-child(6),
.producer-table.with-start-dates td:nth-child(6) {
  width: 130px;
}
.producer-table.with-start-dates th:nth-child(7),
.producer-table.with-start-dates td:nth-child(7) {
  width: 100px;
  text-align: center;
  padding-left: 5px;
  padding-right: 5px;
}

.producer-row.changed td {
  background: #fff4e0;
}

/* Resolved-in-Jira rows are inert: muted, never highlighted, never written.
   The .done.changed reset keeps the change-highlight from ever showing on a
   frozen row (rowChanged already returns false, this is belt-and-braces). */
.producer-row.done td {
  opacity: 0.5;
  background: #f8f9fa;
}
.producer-row.done.changed td {
  background: #f8f9fa;
}

/* Small muted chip next to a resolved subtask's title. */
.producer-done-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  background: #e5e7eb;
  color: #4b5563;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

.producer-skip-cell {
  text-align: center;
}

/* Loading state for the epic-meta paragraph: spinner + text aligned in a
   row, same visual idiom as the AI-korrektor progress headline. The class
   is dropped once the data has loaded (see producer.js renderHeader). */
.producer-meta-loading {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Bullet list inside the warning card (e.g. "не удалось сопоставить" list
   of subtask titles). Keeps the long Russian titles readable instead of
   running them together with commas. */
#epic-warning ul {
  margin: 4px 0 0 18px;
  padding: 0;
}
#epic-warning ul li {
  margin: 2px 0;
}
#epic-warning p {
  margin: 0 0 4px 0;
}

/* Stage divider row inserted between Пре-продакшн and Пост-продакшн in
   two-stage TR templates. Visually breaks the table into the two
   production phases without changing the surrounding row structure. */
.producer-row.stage-divider td {
  background: #f3f4f6;
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  padding-top: 12px;
  padding-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Transient highlight on cells whose proposed date changed during the
   most recent runOp(). Drives the eye to the rows the producer's input
   just affected; the animation runs once and fades back to whatever
   background the cell would have anyway (transparent, or the .changed
   row's #fff4e0). */
@keyframes producer-flash-fade {
  0%   { background-color: #ffd66b; }
  60%  { background-color: #ffe6a4; }
  100% { background-color: transparent; }
}
.producer-table td.flash {
  animation: producer-flash-fade 1.2s ease-out;
}
.producer-table select,
.producer-table input[type="date"] {
  font-size: 13px;
  padding: 2px 4px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* «Текущие» date cells (current start / current due) are read-only plain
   text. Match the new-date inputs' 13px so the columns line up, and dim them
   one tone so the editable «новые» values read as the primary number. */
.producer-table td.is-current {
  font-size: 13px;
  color: #54534e;
}
.op-control { margin-top: 8px; }
/* ===== AI-Продюсер ===== */
.aip-modes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.aip-mode {
  position: relative;
  padding: 8px 16px;
  font-size: 14px;
  border: 1.5px solid var(--border); border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.aip-mode:hover { border-color: var(--accent); }
.aip-mode input[type="radio"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.aip-mode:has(input:checked) {
  color: var(--bg); background: var(--accent); border-color: var(--accent);
}
form label.aip-mode { display: inline-block; margin-bottom: 0; }
form label.aip-mode > span { display: inline; font-size: inherit; font-weight: 500; margin-bottom: 0; color: inherit; }
.aip-pitch summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.aip-pitch-text { white-space: pre-wrap; }
textarea.aip-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  resize: vertical;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.aip-steps { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.aip-step {
  font-size: 13px; color: var(--muted);
  padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px;
}
.aip-step-active { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.aip-chosen {
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.aip-topics { display: grid; gap: 16px; margin-top: 16px; }
.aip-topic {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; background: var(--bg); box-shadow: var(--shadow);
}
.aip-topic-top3 { border-color: var(--accent); }
.aip-topic-selected { border-color: var(--success); background: var(--surface); }
.aip-topic-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.aip-topic h3 { margin: 0 0 8px; font-size: 17px; }
.aip-topic p { margin: 6px 0; }
.aip-badge {
  display: inline-block; font-size: 11px; font-weight: 600; vertical-align: middle;
  padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--bg);
}
.aip-badge-ok { background: var(--success); }
.aip-ratings { display: flex; gap: 20px; margin: 10px 0; font-size: 13px; color: var(--muted); }
.aip-stars { color: var(--accent); letter-spacing: 1px; }
.aip-topic form { margin-top: 10px; }

/* AI-Продюсер · locations */
.aip-locs { display: grid; gap: 14px; margin-top: 16px; }
.aip-loc {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; background: var(--bg); box-shadow: var(--shadow);
}
.aip-loc-removed { opacity: 0.5; background: var(--surface); }
.aip-loc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.aip-loc-head h3 { margin: 0; font-size: 16px; }
.aip-loc p { margin: 6px 0; }
.aip-tag {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--surface-hover); color: var(--text);
}
.aip-tag-live { background: #ffe3f1; color: #99004d; }
.aip-tag-user { background: var(--surface-hover); color: var(--muted); }
.aip-tag-bingo { background: #fff3cd; color: #7a5b00; }
.aip-loc-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.aip-loc-actions .inline-form { display: inline; }
.aip-add summary { cursor: pointer; color: var(--accent); }
.aip-confirm { border-top: 1px solid var(--border); padding-top: 16px; }

/* AI-Продюсер · route */
.aip-route-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 12px 0; }
.aip-warn { color: var(--danger); background: #fdeaea; border: 1px solid #f5c2c2; padding: 8px 12px; border-radius: var(--radius); }
.aip-warn-inline { color: var(--danger); font-size: 12px; }
.aip-day { margin: 20px 0 8px; font-size: 16px; }
.aip-stops { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.aip-stop { display: flex; gap: 10px; align-items: flex-start; }
.aip-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; }
.aip-stop-body { flex: 1; }
.aip-stop-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aip-maplink { font-size: 12px; }
.aip-travel { font-size: 12px; }
.aip-dropped { margin-top: 20px; padding: 12px 16px; background: var(--surface); border-radius: var(--radius); }
.aip-dropped h3 { margin: 0 0 6px; font-size: 14px; }
.aip-back-row { display: flex; gap: 16px; }

/* AI-Продюсер · plan */
.result-ok { border: 1px solid #bfe3bf; background: #f0f9f0; color: var(--success); padding: 12px 16px; border-radius: var(--radius); }
.result-ok a { color: var(--success); }
.aip-standups { display: grid; gap: 12px; margin-top: 8px; }
.aip-standup { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; background: var(--bg); }
.aip-standup-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.aip-standup-text { white-space: pre-wrap; margin: 0; }
.aip-fill { border-top: 1px solid var(--border); padding-top: 16px; }

/* AI-Продюсер · landing extras */
.aip-resume { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-left: 3px solid var(--accent); }
.aip-recent { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.aip-recent li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.aip-admin-actions { margin-left: auto; display: flex; gap: 10px; }
.aip-admin-actions .aip-delete { color: #b3261e; }
.aip-admin-actions .aip-delete:hover { color: #8c1d16; }
.aip-status { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-hover); }
.aip-status-active { background: #e6f4fb; color: var(--accent-hover); }
.aip-status-ok { background: #f0f9f0; color: var(--success); }
.aip-status-warn { background: #fff4e0; color: #9a6700; }
.aip-status-error { background: #fdeaea; color: var(--danger); }
