:root {
  --ink: #0E1A2B;
  --ink-2: #33415C;
  --muted: #5A6578;
  --line: #E3E7EE;
  --ground: #F5F6F8;
  --white: #FFFFFF;
  --red: #C62F25;
  --red-dark: #A1241B;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; min-height: 100vh; }
a { color: var(--ink); }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; line-height: 1.15; }
h1 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; }
h2 { font-size: 20px; font-weight: 800; }
p { margin: 0; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.main { flex: 1 0 auto; padding-top: 32px; padding-bottom: 64px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.mono { font-family: var(--mono); letter-spacing: 0.04em; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 24px; }

/* Шапка и подвал */
.topbar { background: var(--ink); color: var(--white); }
.topbar-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; min-height: 68px; padding-top: 10px; padding-bottom: 10px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; font-weight: 800; font-size: 19px; }
.logo:hover { color: var(--white); }
.logo small { font-size: 13px; font-weight: 600; color: #B4C0D3; margin-left: 4px; }
.logo-mark { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; background: var(--red); }
.topnav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; font-size: 15px; font-weight: 600; }
.topnav a { color: #DCE3EE; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.topnav a:hover { color: var(--white); text-decoration: underline; }
.topnav-email { color: #8A99B2; font-weight: 500; }
.foot { background: #0A1422; color: #B4C0D3; font-size: 14px; padding: 24px 0; }
.foot a { color: #DCE3EE; }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }

/* Карточки и сетки */
.card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.card-tight { padding: 16px 20px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.narrow { max-width: 480px; margin: 0 auto; }
.mid { max-width: 760px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* Кнопки и формы */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 10px; border: 1px solid transparent; font-family: inherit; font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); color: var(--white); }
.btn-ghost { background: var(--white); color: var(--ink); border-color: #C9D1DD; }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-dark { background: var(--ink); color: var(--white); }
.btn-dark:hover { background: #1B2A42; color: var(--white); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: default; }
.field { display: block; }
.field + .field { margin-top: 16px; }
.field > span { display: block; margin-bottom: 6px; font-weight: 600; font-size: 15px; }
.field small { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid #C9D1DD; border-radius: 10px; background: var(--white); font-family: inherit; font-size: 16px; color: var(--ink); }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.45; }
.input-mono { font-family: var(--mono); letter-spacing: 0.06em; font-weight: 600; text-transform: uppercase; }
.input-code { font-family: var(--mono); font-size: 28px; letter-spacing: 0.3em; text-align: center; }
.input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(198, 47, 37, 0.18); }
.err { color: var(--red-dark); font-size: 14px; margin-top: 6px; font-weight: 600; }
.input.has-err { border-color: var(--red); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); }
.check input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--red); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form .input { flex: 1 1 240px; width: auto; }

/* Метки статусов */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.badge-bad { background: #FDE8E6; color: var(--red-dark); }
.badge-warn { background: #FFF1D6; color: #7A4F00; }
.badge-ok { background: #E3F4EA; color: #17603C; }
.badge-info { background: #EEF1F6; color: var(--ink-2); }

/* Уведомления */
.flash { margin-bottom: 20px; padding: 14px 18px; border-radius: 12px; font-weight: 600; }
.flash-ok { background: #E3F4EA; color: #0F3F27; }
.flash-err { background: #FDE8E6; color: #7E1B14; }
.flash-info { background: #EEF1F6; color: var(--ink-2); }
.note { padding: 14px 18px; border-radius: 12px; background: #EEF1F6; color: var(--ink-2); font-size: 15px; }
.note-green { background: #E3F4EA; color: #0F3F27; }
.note-amber { background: #FFF1D6; color: #5C3B00; }

/* Список заказов клиента */
.orders { display: flex; flex-direction: column; gap: 12px; }
.order-card { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 20px; padding: 18px 20px; background: var(--white); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); }
.order-card:hover { border-color: var(--ink); color: var(--ink); }
.order-card .t { font-weight: 800; font-size: 17px; }
.empty { text-align: center; padding: 48px 24px; }

/* История статусов */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--white); border: 2px solid var(--ink); }
.timeline li:first-child::before { background: var(--red); border-color: var(--red); }
.timeline .when { font-size: 13px; color: var(--muted); }

/* Отчёт */
.report > * + * { margin-top: 16px; }
.report-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 16px; }
.report-head > div > * + * { margin-top: 6px; }
.report-title { font-size: clamp(24px, 3vw, 32px); }
.verdict { background: var(--ink); color: var(--white); border-radius: 16px; padding: 20px 24px; }
.verdict-label { font-size: 13px; font-weight: 700; color: #B4C0D3; margin-bottom: 4px; }
.report-sec h2 { margin-bottom: 14px; }
.rows { display: flex; flex-direction: column; gap: 2px; background: #E6EAF0; border-radius: 12px; overflow: hidden; }
.row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 14px 16px; background: var(--white); }
.row-main { flex: 1 1 260px; min-width: 0; }
.row-date { font-size: 13px; color: var(--muted); }
.row-text { font-weight: 600; }

/* Таблицы админки */
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 700; background: #FAFBFC; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FAFBFC; }
td a { font-weight: 700; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid #C9D1DD; background: var(--white); color: var(--ink-2); text-decoration: none; font-weight: 700; font-size: 14px; }
.tab.on { background: var(--ink); border-color: var(--ink); color: var(--white); }
.tab .cnt { font-family: var(--mono); font-size: 12px; opacity: 0.8; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
details summary { cursor: pointer; font-weight: 700; }
pre { white-space: pre-wrap; word-break: break-word; font-size: 13px; background: var(--ground); padding: 12px; border-radius: 10px; max-height: 320px; overflow: auto; }
.help { font-size: 13px; color: var(--muted); line-height: 1.5; }
.help code { font-family: var(--mono); background: var(--ground); padding: 1px 6px; border-radius: 6px; }
.doc h2 { margin: 28px 0 10px; }
.doc p + p { margin-top: 10px; }
