:root {
    color-scheme: light;
    --ink: #17202a;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --canvas: #f8fafc;
    --accent: #1d4ed8;
    --accent-dark: #1e3a8a;
    --green-bg: #dcfce7;
    --green-ink: #166534;
    --blue-bg: #dbeafe;
    --blue-ink: #1e40af;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.5; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f4f7fb; }
.auth-card { width: min(100%, 420px); padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 40px rgba(23, 32, 42, .08); }
.stack-form { display: grid; gap: 16px; margin-top: 24px; }
.stack-form label { display: grid; gap: 6px; font-weight: 600; }
.stack-form input { padding: 10px 12px; border: 1px solid #b8c6d6; border-radius: 8px; font: inherit; }
a { color: inherit; }
.container { width: min(1200px, calc(100% - 40px)); margin: 0 auto; }
.item-link:hover { color: var(--accent); }

/* Шапка: основные разделы, «Справочники» и меню пользователя */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 64px; display: flex; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--accent-dark); font-weight: 800; letter-spacing: -0.02em; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); font-size: 12px; letter-spacing: .02em; }
.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.nav-link { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 8px; color: #475569; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.nav-link:hover { color: var(--accent-dark); background: #f1f5f9; }
.nav-link[aria-current="page"] { color: var(--accent-dark); background: #eff6ff; }
.nav-menu { position: relative; }
.nav-menu > summary { list-style: none; }
.nav-menu > summary::-webkit-details-marker { display: none; }
.main-nav .nav-menu > summary::after { content: ""; width: 6px; height: 6px; margin: -3px 2px 0 2px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.main-nav .nav-menu[open] > summary::after { margin-top: 3px; transform: rotate(-135deg); }
.nav-dropdown { position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; display: grid; min-width: 300px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 18px 40px rgba(15, 23, 42, .14); }
.nav-dropdown-right { left: auto; right: 0; }
.nav-dropdown a { display: grid; gap: 1px; padding: 9px 12px; border-radius: 8px; text-decoration: none; }
.nav-dropdown a strong { font-size: 14px; }
.nav-dropdown a span { color: var(--muted); font-size: 12px; }
.nav-dropdown a:hover { background: #f1f5f9; }
.nav-dropdown a:hover strong { color: var(--accent-dark); }
.nav-dropdown-head { margin: 0 0 4px; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.nav-dropdown form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.nav-dropdown-button { width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; color: #b91c1c; background: none; font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.nav-dropdown-button:hover { background: #fef2f2; }
.user-menu { margin-left: auto; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; border: 1px solid transparent; border-radius: 999px; cursor: pointer; }
.user-chip:hover, .user-menu[open] .user-chip, .user-chip[aria-current="page"] { border-color: var(--line); background: #f8fafc; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--accent-dark); background: #dbeafe; font-size: 13px; font-weight: 800; }
.user-chip-text { display: grid; line-height: 1.2; }
.user-chip-text strong { max-width: 220px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-text span { color: var(--muted); font-size: 12px; }
@media (max-width: 760px) {
    .header-inner { flex-wrap: wrap; gap: 0 12px; padding-top: 10px; }
    .brand-name, .user-chip-text { display: none; }
    .main-nav { order: 3; flex-basis: 100%; margin: 6px -4px 0; padding-bottom: 8px; overflow-x: auto; }
    .nav-dropdown { position: fixed; top: auto; left: 12px; right: 12px; min-width: 0; }
}
.page-content { padding: 48px 0 72px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: -0.03em; }
h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.1; }
h2 { font-size: 20px; }
.muted { color: var(--muted); }
.summary-card { min-width: 160px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.summary-label { display: block; color: var(--muted); font-size: 12px; }
.summary-card strong { display: block; margin-top: 3px; font-size: 28px; }
.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 4px 18px rgba(15, 23, 42, .04); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table-total td { font-weight: 700; background: #f8fafc; border-top: 2px solid var(--line); border-bottom: 0; }
th { color: var(--muted); background: #f8fafc; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbff; }
.item-link { color: var(--accent-dark); font-weight: 700; text-decoration: none; }
.table-action { text-align: right; }
.button { display: inline-block; padding: 9px 14px; border-radius: 8px; color: #fff; background: var(--accent); font-size: 13px; font-weight: 700; text-decoration: none; }
.button:hover { background: var(--accent-dark); }
.button-small { padding: 7px 10px; }
.empty-state { padding: 48px 24px; border: 1px dashed #cbd5e1; border-radius: 14px; background: var(--surface); text-align: center; }
.empty-state h2 { margin-bottom: 8px; }
.breadcrumbs { display: flex; gap: 10px; margin-bottom: 24px; color: var(--muted); font-size: 14px; }
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 40px; }
.compact-card { padding: 20px; }
.card-heading { margin-bottom: 12px; }
.details-list { margin: 0; }
.details-list div { display: flex; justify-content: space-between; gap: 20px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.details-list div:last-child { border-bottom: 0; }
dt { color: var(--muted); font-size: 14px; }
dd { margin: 0; font-weight: 600; text-align: right; }
.section-heading { margin-bottom: 16px; }
.badge { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-print { color: var(--green-ink); background: var(--green-bg); }
.badge-web { color: var(--blue-ink); background: var(--blue-bg); }
.status-text { font-weight: 600; }
.alert { margin-bottom: 20px; padding: 13px 16px; border-radius: 10px; font-size: 14px; }
.alert-error { color: #991b1b; border: 1px solid #fecaca; background: #fef2f2; }
.deadline-alert { margin-top: -8px; }
.status-overdue { color: #991b1b; background: #fee2e2; }
.deadline-summary-overdue { border-color: #fecaca !important; background: #fff7f7 !important; }
.deadline-section { margin-top: 38px; }
.deadline-table-card { overflow-x: auto; }
.deadline-table-card table { min-width: 900px; }
.deadline-row-overdue { background: #fffafa; }
.deadline-row-overdue:hover { background: #fff1f2; }
.overdue-label { color: #b91c1c; font-weight: 800; }
.entity-label { display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.audit-table-card { overflow-x: auto; }
.audit-table-card table { min-width: 900px; }
.audit-action { display: inline-block; padding: 4px 7px; border-radius: 6px; color: var(--blue-ink); background: #eff6ff; font-size: 11px; font-weight: 800; }
.audit-status_change, .audit-deadline_change { color: #7c2d12; background: #fff7ed; }
.audit-assign, .audit-create { color: var(--green-ink); background: #f0fdf4; }
.deadline-empty { padding: 30px 24px; }
.workflow-summary { display: flex; gap: 12px; }
.workflow-summary div { min-width: 112px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.workflow-summary span { display: block; color: var(--muted); font-size: 12px; }
.workflow-summary strong { display: block; margin-top: 3px; font-size: 24px; }
.workflow-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 4px 0 18px; }
.button-secondary { color: var(--accent-dark); border: 1px solid #bfdbfe; background: #eff6ff; }
.button-secondary:hover { color: #fff; background: var(--accent); }
.workflow-list { position: relative; display: grid; gap: 14px; }
.workflow-list::before { content: ""; position: absolute; top: 26px; bottom: 26px; left: 25px; width: 2px; background: #dbeafe; }
.workflow-stage { position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 4px 18px rgba(15, 23, 42, .04); }
.stage-marker { z-index: 1; display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border: 4px solid var(--canvas); border-radius: 50%; color: var(--accent-dark); background: #dbeafe; font-size: 12px; font-weight: 800; }
.stage-completed .stage-marker { color: var(--green-ink); background: var(--green-bg); }
.stage-in_progress .stage-marker { color: #92400e; background: #fef3c7; }
.stage-skipped .stage-marker { color: var(--muted); background: #e2e8f0; }
.stage-main { min-width: 0; }
.stage-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.stage-heading h3 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }
.stage-code { margin: 0 0 3px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.status-pill { display: inline-flex; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-pending { color: #475569; background: #f1f5f9; }
.status-progress { color: #92400e; background: #fef3c7; }
.status-completed { color: var(--green-ink); background: var(--green-bg); }
.status-skipped { color: #475569; background: #e2e8f0; }
.button-complete { background: #15803d; }
.button-complete:hover { background: #166534; }
.workflow-empty form { margin-top: 18px; }
@media (max-width: 900px) {
    .table-card { overflow-x: auto; }
    table { min-width: 820px; }
}
@media (max-width: 640px) {
    .container { width: min(100% - 24px, 1200px); }
    .page-content { padding-top: 28px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .summary-card { width: 100%; }
    .details-grid { grid-template-columns: 1fr; }
    .workflow-summary { width: 100%; }
    .workflow-summary div { flex: 1; }
    .workflow-toolbar { align-items: flex-start; flex-direction: column; }
    .workflow-stage { grid-template-columns: 40px minmax(0, 1fr); gap: 10px; padding: 14px; }
    .stage-marker { width: 40px; height: 40px; }
    .stage-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
}

/* Редакторы */
.alert-success { color: #166534; border: 1px solid #bbf7d0; background: #f0fdf4; }
.table-scroll { overflow-x: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.section-block { margin-top: 40px; }
.form-card { margin-top: 20px; padding: 20px; }
.form-card h2 { margin-bottom: 14px; font-size: 17px; }
.form-hint { margin: 12px 0 0; font-size: 13px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; }
.inline-form label, .stacked-mini-form label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }
.inline-form input[type="text"], .inline-form input[type="email"], .inline-form select,
.row-form select, .stacked-mini-form select { min-width: 220px; max-width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; font: inherit; }
.inline-form .checkbox-label, .stacked-mini-form .checkbox-label { flex-direction: row; align-items: center; gap: 8px; padding-bottom: 8px; color: var(--ink); font-size: 14px; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stacked-mini-form { display: grid; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.stacked-mini-form .button { justify-self: start; }
.check-cell { width: 44px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) {
  .inline-form select, .inline-form input[type="text"], .inline-form input[type="email"] { min-width: 0; width: 100%; }
  .inline-form label { width: 100%; }
}

/* Таймлайн этапов выпуска */
.summary-overdue { border-color: #fecaca !important; background: #fef2f2 !important; }
.summary-overdue strong { color: #991b1b; }
.workflow-toolbar .muted { margin: 0; max-width: 720px; font-size: 14px; }
.timeline { position: relative; display: grid; gap: 6px; margin-bottom: 8px; padding-left: 40px; }
.timeline-heading { margin: 8px 0 6px; color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.timeline-history { position: relative; display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.timeline-history::before { content: ""; position: absolute; left: -27px; top: 14px; bottom: -40px; width: 4px; border-radius: 4px; background: linear-gradient(180deg, #dcfce7 0%, #86efac 45%, #f59e0b 100%); }
.timeline-pass { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); opacity: var(--age, 1); }
.timeline-pass-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 14px; }
.timeline-pass-main strong { font-size: 15px; }
.timeline-pass-return { border-color: #fcd34d; background: #fffbeb; }
.timeline-tag { padding: 2px 8px; border-radius: 999px; color: #9a3412; background: #ffedd5; font-size: 12px; font-weight: 800; }
.timeline-dot { position: absolute; left: -33px; top: 14px; width: 14px; height: 14px; border: 3px solid #16a34a; border-radius: 50%; background: #16a34a; }
.timeline-pass-inferred .timeline-dot { background: #fff; }
.timeline-note { margin: 2px 0 4px; font-size: 13px; }
.timeline-current { position: relative; display: grid; gap: 16px; margin-top: 6px; padding: 22px; border: 2px solid #fcd34d; border-radius: 14px; background: var(--surface); box-shadow: 0 8px 24px rgba(15, 23, 42, .07); }
.timeline-current-overdue { border-color: #fca5a5; }
.timeline-current-done { border-color: #86efac; }
.timeline-current h2 { font-size: 28px; }
.timeline-current-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.timeline-current-head .muted { margin: 4px 0 0; font-size: 14px; }
.timeline-now { margin: 0 0 2px; color: #92400e; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.timeline-dot-current { left: -40px; top: 26px; width: 24px; height: 24px; border: 4px solid var(--canvas); background: #f59e0b; box-shadow: 0 0 0 3px #fde68a; }
.timeline-current-overdue .timeline-dot-current { background: #dc2626; box-shadow: 0 0 0 3px #fecaca; }
.timeline-current-done .timeline-dot-current { background: #16a34a; box-shadow: 0 0 0 3px #bbf7d0; }
.timeline-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.timeline-facts > div, .timeline-due-form { padding: 12px 14px; border-radius: 10px; background: var(--canvas); }
.timeline-facts span { display: block; color: var(--muted); font-size: 12px; }
.timeline-due-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.timeline-due-form label, .timeline-move label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.timeline input, .timeline select { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 7px; color: var(--ink); background: #fff; font: inherit; font-size: 14px; }
.timeline-move { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.timeline-move-next { flex: 1 1 240px; }
.timeline-move .button { min-height: 40px; border: 0; cursor: pointer; font-family: inherit; }
.timeline-upcoming { display: grid; gap: 10px; margin: 10px 0 0 -27px; padding: 4px 0 4px 23px; border-left: 4px dashed #cbd5e1; }
.timeline-upcoming .muted { margin: 0; font-size: 13px; }
.timeline-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.timeline-chip { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border: 1px solid #cbd5e1; border-radius: 999px; color: #334155; background: #fff; font-size: 13px; font-weight: 600; text-decoration: none; }
.timeline-chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.timeline-chip-selected { border-color: var(--accent); color: #fff; background: var(--accent); }
.timeline-chip-selected:hover { color: #fff; }

/* Типы журналов */
.type-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -8px 0 20px; }
.type-tabs a, .type-tabs button { display: inline-flex; cursor: pointer; font-family: inherit; align-items: center; min-height: 36px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; color: #334155; background: var(--surface); font-size: 14px; font-weight: 600; text-decoration: none; }
.type-tabs a:hover, .type-tabs button:hover { border-color: var(--accent); color: var(--accent-dark); }
.type-tabs a[aria-current="page"], .type-tabs button[aria-current="page"] { border-color: var(--accent); color: #fff; background: var(--accent); }
.type-tabs .type-tabs-aside { margin-left: auto; border-color: transparent; background: none; color: var(--accent); }
.type-card { padding: 22px; margin-bottom: 24px; scroll-margin-top: 16px; }
.type-card-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; }
.type-card-head h2 { font-size: 22px; }
.cycle-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; counter-reset: stage; }
.cycle-list li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 9px 0; border-bottom: 1px solid var(--line); counter-increment: stage; }
.cycle-list li:last-child { border-bottom: 0; }
.cycle-list li::before { content: counter(stage, decimal-leading-zero); min-width: 28px; color: var(--muted); font-size: 12px; font-weight: 800; }
.cycle-stage { flex: 1 1 260px; }
.cycle-group { color: var(--muted); font-size: 13px; }

/* CRUD: опасные действия и формы правки */
.button-danger { color: #991b1b; border: 1px solid #fecaca; background: #fef2f2; cursor: pointer; font-family: inherit; }
.button-danger:hover { color: #fff; background: #b91c1c; }
.danger-zone { border-color: #fecaca; }
.archived-banner { margin-bottom: 20px; padding: 13px 16px; border: 1px dashed #94a3b8; border-radius: 10px; color: #334155; background: #f8fafc; font-size: 14px; }
.edit-details { margin-top: 18px; }
.edit-details > summary { cursor: pointer; color: var(--accent-dark); font-weight: 700; font-size: 14px; }
.edit-details[open] > summary { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--muted, #64748b); }
.form-grid .form-wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.form-grid input, .form-grid select, .form-grid textarea { min-width: 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; font: inherit; }
.form-grid textarea { min-height: 64px; resize: vertical; }
.inline-form input[type="password"] { min-width: 180px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; font: inherit; }

/* Исполнители этапов выпуска */
.stage-row-current { background: #eff6ff; }
.assignee { display: inline-flex; align-items: center; gap: 4px; margin: 2px 8px 2px 0; padding: 2px 4px 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; }
.assignee-remove { display: inline; margin: 0; }
.assignee-remove button { border: 0; background: none; color: #b91c1c; font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; }

/* Панель создания: свёрнутая кнопка, разделы формы, поля с подписями и подсказками */
.button { border: 0; cursor: pointer; font-family: inherit; }
.button-ghost { color: #334155; border: 1px solid var(--line); background: #fff; }
.button-ghost:hover { color: var(--ink); background: #f1f5f9; }
.table-card + .form-panel, .form-panel + .form-panel { margin-top: 14px; }
.form-panel { margin-bottom: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 4px 18px rgba(15, 23, 42, .04); }
.form-panel[open] { border-color: #bfdbfe; box-shadow: 0 10px 30px rgba(29, 78, 216, .08); }
.form-panel-toggle { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 14px; cursor: pointer; list-style: none; }
.form-panel-toggle::-webkit-details-marker { display: none; }
.form-panel-toggle:hover { background: #f8fbff; }
.form-panel-toggle > span:last-child { display: grid; line-height: 1.3; }
.form-panel-toggle strong { color: var(--accent-dark); font-size: 15px; }
.form-panel-toggle .muted { font-size: 13px; }
.form-panel-icon { position: relative; flex: none; width: 32px; height: 32px; border-radius: 9px; background: #eff6ff; }
.form-panel-form .form-panel-icon::before, .form-panel-form .form-panel-icon::after { content: ""; position: absolute; top: 50%; left: 50%; width: 14px; height: 2px; border-radius: 2px; background: var(--accent); transform: translate(-50%, -50%); transition: transform .15s; }
.form-panel-form .form-panel-icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.form-panel[open] .form-panel-form .form-panel-icon::after { transform: translate(-50%, -50%); }
.form-panel[open] .form-panel-toggle { border-bottom: 1px solid var(--line); border-radius: 14px 14px 0 0; }
.form-panel-body { padding: 4px 22px 0; }
.form-section { margin: 0; padding: 18px 0 20px; border: 0; border-bottom: 1px solid var(--line); }
.form-section legend { float: left; width: 100%; margin-bottom: 14px; padding: 0; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.field-grid { clear: both; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 16px 18px; align-items: start; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-span-2 { grid-column: span 2; }
.field-span-4 { grid-column: span 4; }
.field-span-8 { grid-column: 1 / -1; }
.field-label { color: #334155; font-size: 13px; font-weight: 700; }
.field-required { color: #dc2626; font-weight: 800; }
.field-hint { color: var(--muted); font-size: 12px; }
.field input:not([type="radio"]):not([type="checkbox"]), .field select, .field textarea { width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px; color: var(--ink); background: #fff; font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.field textarea { min-height: 64px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #94a3b8; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(29, 78, 216, .15); }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.choice-card { display: flex; align-items: flex-start; gap: 10px; min-height: 40px; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; cursor: pointer; }
.choice-card:hover { border-color: #93c5fd; }
.choice-card:has(input:checked) { border-color: var(--accent); background: #eff6ff; box-shadow: 0 0 0 1px var(--accent); }
.choice-card input { margin: 3px 0 0; accent-color: var(--accent); }
.choice-card > span { display: grid; line-height: 1.3; }
.choice-card strong { font-size: 13px; }
.choice-card .muted { font-size: 12px; }
.form-panel-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 0 20px; }
.form-panel-actions > .muted { margin-right: auto; font-size: 12px; }
.form-panel-list .form-panel-icon { background: #f1f5f9; }
.form-panel-edit .form-panel-icon::before { content: ""; position: absolute; top: 11px; left: 12px; width: 7px; height: 7px; border-right: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(45deg); transition: transform .15s; }
.form-panel-edit[open] .form-panel-icon::before { top: 14px; transform: rotate(-135deg); }
.form-panel-list .form-panel-icon::before { content: ""; position: absolute; top: 11px; left: 12px; width: 7px; height: 7px; border-right: 2px solid #475569; border-bottom: 2px solid #475569; transform: rotate(45deg); transition: transform .15s; }
.form-panel-list[open] .form-panel-icon::before { top: 14px; transform: rotate(-135deg); }
.form-panel-list .form-panel-toggle strong { color: var(--ink); }
.form-panel > table, .form-panel > .table-scroll { border-radius: 0 0 14px 14px; }
.form-panel > p { margin: 0; padding: 16px 22px; }
.form-panel-body > .muted:first-child { margin: 16px 0 0; font-size: 13px; }
/* Отдельное действие внутри панели: «Создать выпуски года», «Взять исполнителей журнала». */
.form-panel-extra { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; margin: 0 22px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.form-panel-extra .field { width: 140px; }
.form-panel-extra > legend, .form-panel-extra-title { flex-basis: 100%; margin: 0 0 -4px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.form-panel-extra .muted { flex: 1 1 260px; font-size: 13px; }
/* Опасное действие в конце панели: удаление, архив. */
.form-panel-danger { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 0 22px; padding: 16px 0 20px; border-top: 1px dashed #fecaca; }
.form-panel-danger .muted { flex: 1 1 260px; font-size: 13px; }
.form-panel .form-panel-actions:last-child { padding-bottom: 20px; }
/* Короткие формы внутри карточек и строк таблиц — те же поля, что в панелях. */
.inline-form input:not([type="radio"]):not([type="checkbox"]), .inline-form select,
.stacked-mini-form select, .stacked-mini-form input:not([type="radio"]):not([type="checkbox"]),
.row-form select, .row-form input:not([type="radio"]):not([type="checkbox"]) { min-height: 36px; padding: 7px 10px; border: 1px solid #cbd5e1; border-radius: 8px; color: var(--ink); background: #fff; font: inherit; font-size: 14px; }
.inline-form :is(input, select):focus, .stacked-mini-form :is(input, select):focus, .row-form :is(input, select):focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(29, 78, 216, .15); }
.inline-form label, .stacked-mini-form label { color: #334155; font-size: 13px; font-weight: 700; }
.inline-form .checkbox-label, .stacked-mini-form .checkbox-label { font-weight: 500; }
@media (max-width: 760px) {
    .form-panel-extra, .form-panel-danger { margin: 0 16px; }
    .field-grid { grid-template-columns: 1fr; }
    .field-span-2, .field-span-4, .field-span-8 { grid-column: 1 / -1; }
    .form-panel-body { padding: 0 16px; }
}
.form-section-note { margin: 12px 0 0; }
.form-section-title { margin: 18px 0 -6px; }
.report-filter { padding: 20px 22px; }
.report-filter-actions { display: flex; gap: 10px; align-self: start; margin-top: 25px; }
.report-filter > p.form-section-note { padding: 0; }
.table-card + .table-card { margin-top: 14px; }
.inline-form :is(input, select), .stacked-mini-form :is(input, select), .row-form :is(input, select) { font-weight: 400; }
.assignee-inherited { padding-right: 10px; border-style: dashed; color: #475569; background: #f8fafc; }
.inherited-from { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Окна поверх страницы (макрос modal) */
.modal { width: min(880px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 16px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 80px rgba(15, 23, 42, .3); }
.modal-wide { width: min(1080px, calc(100% - 32px)); }
.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.modal-head h2 { font-size: 20px; }
.modal-head p { margin: 4px 0 0; font-size: 13px; }
.modal-close { flex: none; width: 34px; height: 34px; border: 0; border-radius: 8px; color: var(--muted); background: #f1f5f9; font-size: 22px; line-height: 1; cursor: pointer; }
.modal-close:hover { color: var(--ink); background: #e2e8f0; }
.modal-body > .form-panel-body, .modal-body > .form-panel-extra, .modal-body > .form-panel-danger { margin-left: 0; margin-right: 0; padding-left: 22px; padding-right: 22px; }
.modal-body > .form-panel-extra, .modal-body > .form-panel-danger { margin: 0 22px; padding-left: 0; padding-right: 0; }
.modal-body > .table-scroll, .modal-body > table { border-bottom: 1px solid var(--line); }
.modal-section { padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-section:last-child { border-bottom: 0; }
.modal-section h3 { margin: 0 0 10px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.modal-body > p.muted { margin: 0; padding: 16px 22px; }

/* Панель инструментов над таблицей: поиск, счётчик, действия */
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; }
.search-field { position: relative; flex: 1 1 320px; max-width: 520px; }
.search-field input { width: 100%; min-height: 40px; padding: 9px 36px 9px 38px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; font: inherit; font-size: 14px; }
.search-field input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(29, 78, 216, .15); }
.search-field::before { content: ""; position: absolute; top: 12px; left: 14px; width: 11px; height: 11px; border: 2px solid #94a3b8; border-radius: 50%; }
.search-field::after { content: ""; position: absolute; top: 25px; left: 26px; width: 6px; height: 2px; border-radius: 2px; background: #94a3b8; transform: rotate(45deg); }
.search-field kbd { position: absolute; top: 10px; right: 10px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #f8fafc; font: inherit; font-size: 12px; }
.list-count { color: var(--muted); font-size: 13px; }
.list-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.button-plus::before { content: "+"; margin-right: 6px; font-size: 16px; line-height: 0; }
.page-heading-compact { align-items: center; margin-bottom: 18px; }
.page-heading-compact h1 { font-size: clamp(26px, 3vw, 34px); }
.page-heading-compact .muted { margin: 4px 0 0; }
.no-results td { padding: 28px 18px; color: var(--muted); text-align: center; }
mark { padding: 0 1px; border-radius: 3px; color: inherit; background: #fef08a; }
.page-heading-compact + .type-tabs { margin-top: 0; }

/* Карточка журнала: справка строкой, действия кнопками, выпуски сразу */
.meta-chips { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.meta-chips li { display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px; }
.meta-chips li span { color: var(--muted); font-size: 12px; }
.meta-chips li em { color: var(--muted); font-style: normal; }
.meta-chips a { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.section-toolbar h2 { margin-right: 4px; }
.modal-section .stacked-mini-form { margin-top: 0; padding-top: 0; border-top: 0; }
.modal-section .details-list { font-size: 14px; }
.action-bar-note { align-self: center; color: var(--muted); font-size: 13px; }
.modal-body > p.modal-note { padding: 14px 22px; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline-hint { margin: 18px 0 0; font-size: 13px; }
.action-bar .button { display: inline-flex; align-items: center; min-height: 38px; }
.modal .row-form { flex-wrap: nowrap; }
.modal .row-form select { min-width: 170px; }
.nowrap { white-space: nowrap; }

/* Сводка: плитки, «требует внимания», полосы групп, давность просрочек, прогресс по циклу, загрузка */
.dash-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.dash-tile { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.dash-tile:hover { border-color: #93c5fd; box-shadow: 0 6px 18px rgba(29, 78, 216, .08); }
.dash-tile span { display: block; color: var(--muted); font-size: 12px; }
.dash-tile strong { display: block; margin-top: 2px; font-size: 30px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dash-tile small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.dash-tile-bad { border-color: #fecaca; background: #fef2f2; }
.dash-tile-bad strong { color: #b91c1c; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dash-side { display: grid; gap: 18px; min-width: 0; }
.dash-card { min-width: 0; }
.dash-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.dash-card-head h2 { margin: 0; font-size: 17px; }
.dash-card-head > span { color: var(--muted); font-size: 12px; }
.dash-card-head .eyebrow { margin-bottom: 2px; font-size: 11px; }
.dash-empty { margin: 0; padding: 16px 18px; color: var(--muted); font-size: 13px; }
.attention-row { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 18px 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.attention-row:last-child { border-bottom: 0; }
.attention-row:hover { background: #f8fbff; }
.attention-stripe { align-self: stretch; border-radius: 0 3px 3px 0; background: #d97706; }
.attention-stripe-hot { background: #b91c1c; }
.attention-main { min-width: 0; }
.attention-title { display: block; font-weight: 700; font-size: 14px; }
.attention-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; color: var(--muted); font-size: 12px; }
.attention-stage { color: var(--ink); font-weight: 600; }
.attention-nobody { color: #b91c1c; font-weight: 700; }
.attention-late { padding: 4px 10px; border-radius: 999px; color: #b91c1c; background: #fef2f2; font-size: 12px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.funnel { padding: 12px 18px 16px; }
.funnel + .funnel { border-top: 1px solid var(--line); }
.funnel h3 { margin: 4px 0 8px; color: var(--muted); font-size: 13px; }
.funnel-row { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) 24px; gap: 10px; align-items: center; padding: 3px 0; font-size: 13px; }
.funnel-row b { text-align: right; font-variant-numeric: tabular-nums; }
.funnel-zero { color: var(--muted); }
.funnel-track { position: relative; height: 10px; border-radius: 5px; background: #eef2f7; overflow: hidden; }
.funnel-fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--accent); }
.aging { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: end; padding: 14px 18px 16px; }
.aging-col { display: grid; justify-items: center; gap: 6px; font-size: 12px; }
.aging-col b { font-size: 15px; font-variant-numeric: tabular-nums; }
.aging-track { position: relative; width: 100%; max-width: 54px; height: 84px; border-radius: 6px; background: #f1f5f9; }
.aging-fill { position: absolute; inset: auto 0 0 0; border-radius: 6px 6px 4px 4px; }
.aging-1 { background: #fcd34d; } .aging-2 { background: #f59e0b; } .aging-3 { background: #dc2626; } .aging-4 { background: #991b1b; }
.aging-label { color: var(--muted); white-space: nowrap; }
.dash-progress { margin-top: 18px; }
.progress-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 12px; }
.progress-list { margin: 0; padding: 6px 18px 12px; list-style: none; }
.progress-list li { display: grid; grid-template-columns: minmax(0, 300px) auto minmax(0, 1fr); gap: 16px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.progress-list li:last-child { border-bottom: 0; }
.progress-name { overflow: hidden; color: var(--accent-dark); font-weight: 700; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.progress-dots { display: inline-flex; gap: 3px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e2e8f0; }
.dot-done { background: #93c5fd; }
.dot-now { background: var(--accent); box-shadow: 0 0 0 3px #dbeafe; }
.dot-late { background: #b91c1c; box-shadow: 0 0 0 3px #fecaca; }
.progress-legend .dot { margin-right: 2px; }
.progress-stage { min-width: 0; color: #334155; }
.progress-stage b { color: #b91c1c; }
.dash-load-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin: 24px 0 10px; }
.dash-load-head h2 { margin: 0; font-size: 20px; }
.dash-load { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.load-list { margin: 0; padding: 8px 16px 12px; list-style: none; }
.load-list li { display: grid; grid-template-columns: minmax(0, 1fr) 70px auto; gap: 8px; align-items: center; padding: 5px 0; font-size: 13px; }
.load-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-bar { display: flex; gap: 2px; height: 10px; }
.load-ok, .load-late { display: inline-block; height: 10px; border-radius: 3px; }
.load-ok { background: var(--accent); }
.load-late { background: #b91c1c; }
.legend-bar { display: inline-block; width: 14px; height: 8px; margin-right: 2px; }
.load-num { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.load-num b { color: #b91c1c; }
@media (max-width: 1000px) {
    .dash-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dash-grid { grid-template-columns: 1fr; }
    .dash-load { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .progress-list li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
@media (max-width: 560px) {
    .dash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-load { grid-template-columns: 1fr; }
    .progress-dots { flex-wrap: wrap; }
}
.dash-load .table-card, .dash-side .table-card, .dash-grid .table-card { margin-top: 0; }
.level-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.access-matrix th.access-col, .access-matrix td.access-col { text-align: center; white-space: nowrap; }
.access-mark { display: inline-flex; justify-content: center; min-width: 30px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.access-yes { color: #166534; background: #dcfce7; }
.access-own { color: #92400e; background: #fef3c7; }
.access-no { color: #94a3b8; }
@media (max-width: 760px) { .level-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
