/* EXPERT PLATFORM — оформление в духе iOS: светлый фон, белые карточки, системный шрифт. */

:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #8a8a8e;
  --line: #e5e5ea;
  --fill: #f2f2f7;          /* фон полей ввода */
  --fill-strong: #e9e9ef;
  --accent: #0a6cff;
  --accent-soft: #e8f1ff;
  --ok: #24a148;
  --ok-soft: #e7f6ec;
  --warn: #b26a00;
  --warn-soft: #fff4e0;
  --err: #e5383b;
  --err-soft: #fdecec;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); letter-spacing: -0.01em; }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px 48px; }
h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.025em; margin: 6px 0; }
h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 10px; }
h3 { font-size: 0.95rem; font-weight: 600; margin: 16px 0 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 6px 0; }
[hidden] { display: none !important; }

/* --- Верхняя панель --- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.brand { font-weight: 800; letter-spacing: 0.06em; color: var(--text); font-size: 0.95rem; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 0.875rem; }
.who { color: var(--muted); }
.dev-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 0.8rem; align-items: center; }
.dev-switch a { padding: 3px 10px; border-radius: 999px; color: var(--warn); }
.dev-switch a.active { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); font-weight: 600; text-decoration: none; }

/* --- Карточки --- */
.card { position: relative; display: block; background: var(--card); border-radius: var(--radius); padding: 18px; margin: 14px 0; box-shadow: var(--shadow); }
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.module::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: transparent; }
.module.has-errors::before { background: var(--err); }
.module.is-complete::before { background: var(--ok); }

.back { display: inline-block; margin: 4px 0 2px; font-size: 0.95rem; }
.order-head { margin-bottom: 4px; }
.order-head form { margin-top: 12px; }
.badge { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--fill); color: var(--muted); font-size: 0.72rem; font-weight: 500; letter-spacing: 0; }
.notice { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: #134a9e; }
.empty { color: var(--muted); padding: 6px 0; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline { display: inline; }
.line { padding: 10px 0; border-bottom: 1px solid var(--line); }

/* --- Поля ввода --- */
label { display: block; margin: 10px 0; font-size: 0.82rem; color: var(--muted); }
.label-text { display: block; margin-bottom: 4px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 12px 14px;
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--fill); border: 1px solid transparent; border-radius: var(--radius-sm);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  appearance: none; -webkit-appearance: none;
}
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238a8a8e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
input:focus, select:focus, textarea:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(10, 108, 255, 0.15); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.7; }
input[type="checkbox"], input[type="radio"] {
  display: inline-block; width: 22px; height: 22px; margin: 0 10px 0 0; padding: 0; flex: none; vertical-align: middle;
  appearance: auto; -webkit-appearance: auto; accent-color: var(--accent); background: none;
}
textarea { min-height: 88px; resize: vertical; }
.row input, .row select { width: auto; flex: 1 1 180px; margin-top: 0; }
label.check { display: flex; align-items: center; color: var(--text); font-size: 0.95rem; margin: 8px 0; }
/* Подпись группы — внутри серого блока, а не на его кромке (как рисует браузер по умолчанию). */
fieldset { position: relative; border: none; background: var(--fill); border-radius: var(--radius-sm); margin: 12px 0; padding: 36px 14px 8px; min-width: 0; }
legend { position: absolute; top: 12px; left: 14px; padding: 0; color: var(--muted); font-size: 0.82rem; }

.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 14px; }
.grid-form .full { grid-column: 1 / -1; }
.grid-form > label { min-width: 0; }
.grid-form input, .grid-form select { min-width: 0; max-width: 100%; }

.checkbox-grid > div, .radio-list > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 10px; }
.checkbox-grid label, .radio-list label { display: flex; align-items: center; color: var(--text); font-size: 0.95rem; margin: 7px 0; }
.radio-list > div { grid-template-columns: 1fr; }
.radio-list label { padding: 14px; margin: 6px 0; background: var(--fill); border-radius: var(--radius-sm); }

/* --- Кнопки --- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px;
  font: inherit; font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em;
  color: var(--accent); background: var(--accent-soft);
  border: none; border-radius: 999px; cursor: pointer; text-decoration: none;
  transition: transform 0.08s, background 0.15s, opacity 0.15s;
}
button:hover, .button:hover { text-decoration: none; filter: brightness(0.97); }
button:active, .button:active { transform: scale(0.97); }
button.primary, .button.primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px rgba(10, 108, 255, 0.28); }
button:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; transform: none; }
button.wide { width: 100%; margin-top: 12px; }
button.full { margin-top: 6px; }
button.small, .button.small { min-height: 36px; padding: 6px 14px; font-size: 0.875rem; }
button.danger, .button.danger { color: var(--err); background: var(--err-soft); }
.button.ghost { background: var(--fill); color: var(--text); font-weight: 500; }
button.icon { min-height: 28px; width: 28px; padding: 0; border-radius: 50%; background: var(--fill); color: var(--muted); font-size: 0.95rem; box-shadow: none; }
button.icon.danger { background: var(--err-soft); color: var(--err); }
button.link { min-height: 0; padding: 0; background: none; color: var(--accent); font-weight: 500; box-shadow: none; }

/* --- Тексты и сообщения --- */
.muted { color: var(--muted); }
.small { font-size: 0.8rem; font-weight: normal; }
.error { color: var(--err); }
.warning { color: var(--warn); }
.ok { color: var(--ok); }
.checks { margin: 8px 0 12px; padding-left: 18px; font-size: 0.9rem; }
.messages { list-style: none; padding: 0; margin: 0 0 10px; }
.messages li { padding: 12px 16px; border-radius: var(--radius-sm); margin: 8px 0; background: var(--accent-soft); color: #134a9e; font-size: 0.95rem; animation: pop 0.25s ease-out; }
.messages .msg-success { background: var(--ok-soft); color: #17652f; }
.messages .msg-warning { background: var(--warn-soft); color: var(--warn); }
.messages .msg-error { background: var(--err-soft); color: #a3191c; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* --- Список заказов --- */
.chips { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; margin: 12px 0; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips a { flex: none; padding: 7px 14px; border-radius: 999px; background: var(--card); color: var(--text); font-size: 0.875rem; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.chips a:hover { text-decoration: none; }
.chips a.active { background: var(--text); color: #fff; }
.order-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--text); transition: transform 0.1s; }
.order-row:hover { text-decoration: none; transform: translateY(-1px); }
.status { padding: 4px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--fill); color: var(--muted); white-space: nowrap; }
.status-submitted, .status-in_work { background: var(--accent-soft); color: var(--accent); }
.status-review { background: var(--warn-soft); color: var(--warn); }
.status-remarks { background: var(--err-soft); color: var(--err); }
.status-done { background: var(--ok-soft); color: var(--ok); }
.tag { font-size: 0.78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #fff; }
.chip { display: inline-block; margin: 2px 4px 2px 0; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 0.82rem; font-weight: 500; }

/* --- Шапка заказа: модули --- */
.modules-toggle { margin-top: 12px; background: var(--card); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.modules-toggle summary, details.notes summary { cursor: pointer; font-weight: 600; list-style: none; }
.modules-toggle summary::-webkit-details-marker, details.notes summary::-webkit-details-marker { display: none; }
.modules-toggle summary::after, details.notes summary::after { content: "›"; display: inline-block; margin-left: 8px; color: var(--muted); transition: transform 0.2s; }
.modules-toggle[open] summary::after, details.notes[open] summary::after { transform: rotate(90deg); }
details.notes { margin: 12px 0 4px; font-size: 0.875rem; }
details.notes summary { font-weight: 500; color: var(--muted); }
details.notes ul { padding-left: 18px; color: var(--muted); }

/* --- Вкладки (как сегменты iOS) --- */
.tabs {
  position: sticky; top: 52px; z-index: 10;
  display: flex; gap: 2px; padding: 3px; margin: 16px 0 4px;
  background: rgba(228, 228, 234, 0.85); border-radius: 12px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.tab {
  flex: 1; min-height: 38px; padding: 6px 8px; border-radius: 9px;
  background: transparent; color: var(--text); font-weight: 500; font-size: 0.9rem; box-shadow: none;
}
.tab.active { background: #fff; font-weight: 650; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 1px 1px rgba(0, 0, 0, 0.04); }
.tab:active { transform: none; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: transparent; margin-right: 2px; }
.dot.red { background: var(--err); }
.dot.green { background: var(--ok); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade 0.22s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }

/* --- Повреждения, фото --- */
.damage { border-radius: var(--radius-sm); background: var(--fill); padding: 14px; margin: 10px 0; }
.damage .ops { margin: 6px 0; }
.photo-group { margin-top: 12px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.thumbs figure { margin: 0; width: 96px; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; display: block; background: var(--fill); }
.thumbs figcaption { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 0.72rem; color: var(--muted); }
.pdf-tile { width: 96px; height: 96px; border-radius: 12px; background: var(--err-soft); color: var(--err); font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.pdf-tile small { font-weight: 500; font-size: 0.65rem; color: var(--muted); max-width: 86px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-pick { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-pick .pick { position: relative; margin: 0; }
.photo-pick .pick input { position: absolute; top: 6px; left: 6px; margin: 0; }
.photo-pick img { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; display: block; }

.checklist { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.checklist span { padding: 4px 12px; border-radius: 999px; background: var(--fill); font-size: 0.85rem; font-weight: 500; }

/* Загрузка файлов: своя кнопка вместо системной */
.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.upload select { width: auto; flex: 1 1 200px; margin: 0; }
.file-pick { position: relative; margin: 0; flex: 1 1 200px; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; margin: 0; padding: 0; }
.file-pick-text {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px;
  border: 1.5px dashed #c7c7cc; border-radius: 999px; color: var(--text); font-size: 0.95rem; font-weight: 500;
}
.file-pick-text::before { content: "＋"; color: var(--accent); font-weight: 700; }
.file-pick:hover .file-pick-text { border-color: var(--accent); background: var(--accent-soft); }
.file-pick.chosen .file-pick-text { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.file-pick.chosen .file-pick-text::before { content: "✓"; }

/* --- Каталог --- */
.catalog-box { background: var(--fill); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; }
.catalog-box .row { margin-top: 8px; }
.catalog-box .button { background: #fff; }
.variant { border-radius: var(--radius-sm); background: var(--fill); padding: 14px; margin: 10px 0; }
.ops-list { display: grid; grid-template-columns: 1fr; }
.ops-list label { margin: 7px 0; }

/* --- Рынок --- */
.group-title { margin-top: 20px; padding-top: 4px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.group-title.up { color: var(--ok); }
.group-title.down { color: var(--err); }
.factor { padding: 12px 0; border-bottom: 1px solid var(--line); }
.factor-text { font-size: 0.92rem; }
.factor-text .small { display: block; margin-top: 4px; }
.factor-no { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 50%; background: var(--fill); font-size: 0.75rem; font-weight: 700; }
.factor-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.factor-controls select { width: auto; flex: 1 1 200px; margin: 0; }
.factor-value { display: inline-flex; align-items: center; gap: 6px; }
.factor-value input, .factor-value select { width: 110px; margin: 0; }
.defect-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.defect-row.on .defect-name span { font-weight: 600; }
.defect-row:not(.on) .defect-values { display: none; }
.defect-name { margin: 0; align-items: flex-start; }
.defect-name input { margin-top: 1px; }
.defect-values { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 6px 0 0 32px; }
label.mini { margin: 0; font-size: 0.75rem; }
label.mini input { width: 110px; padding: 8px 12px; }
.accepted { padding: 4px 10px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 0.8rem; font-weight: 600; }
.totals { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--fill); }
.totals strong { font-size: 1.1rem; }

/* --- Переписка --- */
.remark { padding: 10px 14px; border-radius: 16px 16px 16px 4px; background: var(--fill); margin: 8px 0; max-width: 90%; }
.remark.from-staff { background: var(--accent-soft); margin-left: auto; border-radius: 16px 16px 4px 16px; }

/* --- Памятка --- */
.instruction-dialog { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow-y: auto; border: none; border-radius: 22px; padding: 18px 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.instruction-dialog[open] { animation: pop 0.2s ease-out; }
.instruction-dialog::backdrop { background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(4px); }
.instruction h1 { font-size: 1.35rem; }
.instruction h2 { font-size: 1.05rem; margin-top: 20px; }
.instruction blockquote { margin: 10px 0; padding: 10px 14px; background: var(--warn-soft); border-radius: var(--radius-sm); color: var(--warn); }
.instruction blockquote p { margin: 0; }
.instruction table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.instruction th, .instruction td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.instruction li { margin: 4px 0; }
.instruction code { background: var(--fill); padding: 1px 6px; border-radius: 6px; font-size: 0.85em; }

@media (max-width: 520px) {
  .topbar { flex-wrap: nowrap; padding: 8px 12px; }
  .topbar .who { display: none; }
  .topbar nav { flex-wrap: nowrap; gap: 8px; }
  .dev-switch { font-size: 0.75rem; }
  .dev-switch .dev-label { display: none; }
  main { padding: 10px 12px 40px; }
  h1 { font-size: 1.35rem; }
  .card { padding: 16px; border-radius: 16px; }
  .tabs { top: 48px; }
}

/* --- Автосохранение и VIN --- */
.field-state { margin-left: 6px; font-weight: 600; }
.field-state.ok { color: var(--ok); }
.field-state.saving { color: var(--muted); }
.field-state.bad { color: var(--err); }
.field-error { display: block; color: var(--err); font-size: 0.78rem; min-height: 0; }
.field-error:empty { display: none; }
.inspection-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inspection-grid .full { grid-column: 1 / -1; }
.vin-box { margin-top: 2px; }
.vin-input { position: relative; display: block; }
.vin-input input { padding-right: 46px; text-transform: uppercase; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.vin-input .spinner, .vin-input .vin-mark { position: absolute; right: 14px; top: 50%; margin-top: -10px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.vin-mark { width: 20px; height: 20px; line-height: 20px; text-align: center; color: var(--ok); font-weight: 700; }
@keyframes spin { to { transform: rotate(360deg); } }
.vin-model { margin: 4px 0 6px; }
.vin-variants { display: grid; gap: 8px; margin: 8px 0; }
.variant-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--fill); color: var(--text); text-align: left; font-weight: 500; box-shadow: none; }
.variant-btn:hover { background: var(--accent-soft); }
input.vin { text-transform: uppercase; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .inspection-grid { grid-template-columns: 1fr 1fr; }
  .inspection-grid [data-field="claim_number"], .inspection-grid [data-field="vin_body"] { grid-column: 1 / -1; }
}

/* --- Сторона детали: переключатель-сегмент, как в iOS --- */
.side-pick { margin: 10px 0; }
.side-pick .label-text { color: var(--muted); font-size: 0.82rem; }
.segmented { display: flex; gap: 2px; padding: 3px; margin-top: 4px; background: rgba(228, 228, 234, 0.85); border-radius: 12px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.segmented label { flex: 1; margin: 0; padding: 9px 8px; border-radius: 9px; text-align: center; color: var(--text); font-size: 0.92rem; font-weight: 500; cursor: pointer; }
.segmented input:checked + label { background: #fff; font-weight: 650; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); }

/* --- Характер повреждения: две вкладки, выбранное строкой сверху --- */
.damage-kind { margin: 12px 0; padding: 12px 14px; background: var(--fill); border-radius: var(--radius-sm); }
.damage-kind > .label-text { color: var(--muted); font-size: 0.82rem; }
.kind-summary { min-height: 48px; margin: 6px 0 10px; padding: 12px 14px; background: #fff; border-radius: 10px; font-size: 0.98rem; line-height: 1.4; }
.kind-summary.empty::before { content: attr(data-empty); color: var(--muted); font-size: 0.88rem; }
.kind-tabs { margin: 0 0 6px; background: rgba(210, 210, 218, 0.7); }
.kind-tab { flex: 1; min-height: 36px; padding: 6px 8px; border-radius: 9px; background: transparent; color: var(--text); font-weight: 500; box-shadow: none; }
.kind-tab.active { background: #fff; font-weight: 650; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); }
.kind-tab:active { transform: none; }
/* Теги «кирпичной кладкой»: идут один за другим в строку и переносятся */
.kind-list { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.tag-pick { position: relative; margin: 0; cursor: pointer; }
.tag-pick input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; pointer-events: none; }
.tag-pick span { display: inline-block; padding: 8px 14px; border-radius: 999px; background: #fff; color: var(--text);
  font-size: 0.92rem; line-height: 1.25; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); transition: background 0.15s, color 0.15s; }
.tag-pick.on span, .tag-pick input:checked + span { background: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(10, 108, 255, 0.25); }
.tag-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid-2 > label { min-width: 0; }

/* Кнопка удаления в режиме «нажмите ещё раз» */
button.armed { width: auto !important; min-width: 0; padding: 4px 12px !important; border-radius: 999px !important;
  background: var(--err) !important; color: #fff !important; font-size: 0.8rem !important; font-weight: 600; }

/* --- Дашборд --- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.kpi { display: flex; flex-direction: column; gap: 2px; background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi-label { color: var(--muted); font-size: 0.82rem; }
.kpi-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: 0.75rem; }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.section-title { margin: 22px 0 0; }
.resources { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 14px; }
.resource h3 { margin: 0; font-size: 1.05rem; }
.resource.planned { opacity: 0.8; }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 12px 0 8px; font-size: 0.88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.pill { padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: var(--fill); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--err-soft); color: var(--err); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.status-line { display: grid; grid-template-columns: 170px 1fr 32px; align-items: center; gap: 10px; padding: 6px 0; color: var(--text); }
.status-line:hover { text-decoration: none; }
.status-line .status { justify-self: start; }
.status-line strong { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; padding: 0; min-width: 0; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.dash-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.78rem; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.dash-table td { padding: 8px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.dash-table td:not(:first-child), .dash-table th:not(:first-child) { text-align: right; }
.module-line { display: grid; grid-template-columns: 82px 1fr; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mstate { padding: 3px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; text-align: center; }
.mstate.ready { background: var(--ok-soft); color: var(--ok); }
.mstate.work { background: var(--accent-soft); color: var(--accent); }
.mstate.plan { background: var(--fill); color: var(--muted); }
.order-row.compact { padding: 10px 0; border-bottom: 1px solid var(--line); }
.map-wrap { overflow-x: auto; }
.sysmap { width: 100%; min-width: 620px; height: auto; font-family: var(--font); }
.sysmap .links line { stroke: #8a8a8e; stroke-width: 1.6; }
.sysmap .links line.plan { stroke-dasharray: 5 5; stroke: #b8b8bd; }
.sysmap .link-label { font-size: 11px; fill: var(--muted); text-anchor: middle; }
.sysmap .node rect { stroke-width: 1.5; }
.sysmap .node text { font-size: 14px; font-weight: 650; text-anchor: middle; fill: var(--text); }
.sysmap .node text.sub { font-size: 11px; font-weight: 400; fill: var(--muted); }
.sysmap .node.ready rect { fill: #e7f6ec; stroke: #24a148; }
.sysmap .node.work rect { fill: #e8f1ff; stroke: #0a6cff; }
.sysmap .node.plan rect { fill: #f2f2f7; stroke: #c7c7cc; stroke-dasharray: 5 4; }
.legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 0.82rem; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: middle; margin-right: -8px; }
.lg.ready { background: #e7f6ec; border: 1.5px solid #24a148; }
.lg.work { background: #e8f1ff; border: 1.5px solid #0a6cff; }
.lg.plan { background: #f2f2f7; border: 1.5px dashed #c7c7cc; }
@media (max-width: 720px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid { grid-template-columns: 1fr; }
  .status-line { grid-template-columns: 140px 1fr 28px; }
}
.bar-fill { background: #8a8a8e; }
.bar-fill.status-submitted, .bar-fill.status-in_work { background: var(--accent); }
.bar-fill.status-review { background: #e0a100; }
.bar-fill.status-remarks { background: var(--err); }
.bar-fill.status-done { background: var(--ok); }
