/* Экраны ремонта: цвета проверки строк (всегда вместе с подписью словами), карточка ремонта,
   хронология, просмотр оригинала с подсветкой, значок уведомлений. Переменные — из style.css. */

:root {
  --check-green: var(--success);
  --check-yellow: #9a6a00;
  --check-red: var(--danger);
  --check-gray: #6b7686;
  --check-yellow-soft: #fff4d1;
  --check-gray-soft: #eceff3;
  --check-purple: #6f3fb5;
  --check-purple-soft: #efe7fb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --check-yellow: #f2c46b;
    --check-gray: #a7b1bf;
    --check-yellow-soft: #3a2f12;
    --check-gray-soft: #2a313b;
    --check-purple: #c3a4f2;
    --check-purple-soft: #2f2440;
  }
}

.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.strong-link { font-weight: 700; }
.wide { min-width: 220px; }
.empty-note { color: var(--muted); padding: 8px 0; }
.warn-text { color: var(--warning); }
.total-line { font-size: 1.05rem; }
textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 10px; width: 100%; max-width: 100%; resize: vertical; }
input[type="date"], input[type="datetime-local"], input[type="file"] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px; min-height: 38px; max-width: 100%;
}
input[type="file"] { padding: 5px; }

/* --- Цвета проверки -------------------------------------------------- */

.check-label {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .85rem;
  padding: 1px 8px; border-radius: 999px; white-space: nowrap;
}
.check-label::before { content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none; background: currentColor; }
.check-label.green { color: var(--check-green); background: var(--success-soft); }
.check-label.yellow { color: var(--check-yellow); background: var(--check-yellow-soft); }
.check-label.red { color: var(--check-red); background: var(--danger-soft); }
.check-label.gray, .check-label.none { color: var(--check-gray); background: var(--check-gray-soft); }
.check-label.purple { color: var(--check-purple); background: var(--check-purple-soft); }

.check-summary { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 10px; }
.check-summary.legend .check-label { font-weight: 400; background: transparent; padding: 0 6px 0 0; }
.check-summary.legend li.muted { align-self: center; }

tr.check-row td:first-child { border-left: 5px solid transparent; }
tr.check-row.green td:first-child { border-left-color: var(--check-green); }
tr.check-row.yellow td:first-child { border-left-color: var(--check-yellow); }
tr.check-row.red td:first-child { border-left-color: var(--check-red); }
tr.check-row.gray td:first-child { border-left-color: var(--check-gray); }
tr.check-row.purple td:first-child { border-left-color: var(--check-purple); }

.reasons { margin: 4px 0 0; padding-left: 18px; font-size: .88rem; }
.reasons li { margin: 2px 0; }
.marks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.row-head { margin-bottom: 2px; }
tr.needs-action td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.next-hint { color: var(--accent); }
.next-step { font-weight: 600; }

/* --- Карточка ремонта ------------------------------------------------ */

.version > summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; }
.version > summary + * { margin-top: 10px; }
.version h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.version-body > * + * { margin-top: 10px; }
.version-docs { margin-top: 14px; }
.doc-list { list-style: none; padding: 0; margin: 0 0 12px; }
.doc-list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.doc-list li:last-child { border-bottom: none; }

.decision-bar {
  position: sticky; bottom: 0; z-index: 5; margin-top: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 -2px 10px rgb(16 24 40 / 10%); display: grid; gap: 8px;
}
.decision-bar p { margin: 0; }
.line-totals { font-weight: 600; }
.line-choice { margin: 0; }
/* Черновик решения по ПЗН (отчёт от 23.10.2026, И4): рубли в сводке цветов, «да» / «нет» без выбора по умолчанию. */
.check-summary .check-money { align-self: center; font-size: .9rem; }
fieldset.line-choice { flex-wrap: nowrap; min-width: 92px; }
.submit-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.add-rows { margin: 10px 0; }
.upload h3 { margin-bottom: 8px; }
.draft-collapsed > summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.draft-collapsed[open] > summary { margin-bottom: 10px; }
.tab-body > * + * { margin-top: 12px; }

/* --- Хронология и переписка ------------------------------------------- */

.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.event { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.event.is-message { border-left: 4px solid var(--accent); }
.event.kind-note { border-left-color: var(--warning); background: var(--warning-soft); }
.event.kind-zn_refused, .event.kind-pzn_decision { border-left: 4px solid var(--muted); }
.event p { margin: 6px 0 0; }
.event-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.message-form .toolbar { margin: 0; }

/* --- Выбор работ и строк справочника ---------------------------------- */

.pick-results, .chosen-works { list-style: none; padding: 0; margin: 6px 0 12px; display: grid; gap: 4px; }
.chosen-works li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--accent-soft); border-radius: var(--radius); padding: 4px 10px; }
.pick-list { max-height: 50vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 8px; }
.pick { padding: 4px 0; border-bottom: 1px solid var(--border); }
.narrow-wide { max-width: 760px; }

/* --- Оригинал с подсветкой строк -------------------------------------- */

dialog.wide { width: min(1100px, calc(100vw - 24px)); }
.original-tools { align-items: center; }
.original-tools select { width: auto; }
.details dd > div > p:last-child, .details dd > p:last-child { margin-bottom: 0; }
.original-detail { min-height: 1.5em; background: var(--surface-2); border-radius: var(--radius); padding: 6px 10px; }
.page-scroll { overflow: auto; max-height: 70vh; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); }
.page-view { position: relative; width: 100%; margin: 0 auto; }
.page-view img { display: block; width: 100%; height: auto; }
.marker {
  position: absolute; padding: 0; margin: 0; min-height: 0; border: 2px solid var(--check-gray);
  background: rgb(107 118 134 / 14%); border-radius: 3px; cursor: pointer;
}
.marker.green { border-color: var(--check-green); background: rgb(23 112 61 / 14%); }
.marker.yellow { border-color: var(--check-yellow); background: rgb(154 106 0 / 16%); }
.marker.red { border-color: var(--check-red); background: rgb(179 38 30 / 14%); }
.marker.purple { border-color: var(--check-purple); background: rgb(111 63 181 / 14%); }
.marker:hover, .marker:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.marker.focused { box-shadow: 0 0 0 3px var(--focus); }
.page-view.no-marks .marker { display: none; }

/* --- Уведомления в шапке ---------------------------------------------- */

.bell { position: relative; }
.bell-button { position: relative; padding: 6px 10px; }
.bell-count {
  position: absolute; top: 0; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center;
}
.bell-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(380px, calc(100vw - 24px));
  max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 12px 40px rgb(0 0 0 / 22%); padding: 10px;
}
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.bell-head h2 { margin: 0; font-size: 1rem; }
.bell-head h2:focus { outline: none; }
.bell-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.note-item {
  display: grid; gap: 2px; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius); padding: 8px 10px;
}
.note-item:hover { background: var(--surface-2); }
.note-item.unread { background: var(--accent-soft); font-weight: 600; }
.note-item .sub { font-weight: 400; }

@media (max-width: 640px) {
  table.responsive tr.check-row td:first-child { border-left: none; }
  table.responsive tr.check-row { border-left: 5px solid transparent; }
  table.responsive tr.check-row.green { border-left-color: var(--check-green); }
  table.responsive tr.check-row.yellow { border-left-color: var(--check-yellow); }
  table.responsive tr.check-row.red { border-left-color: var(--check-red); }
  table.responsive tr.check-row.gray { border-left-color: var(--check-gray); }
  table.responsive tr.check-row.purple { border-left-color: var(--check-purple); }
  .wide { min-width: 0; }
  .decision-bar { position: static; }
  .bell-panel { left: 0; right: auto; }
  .check-label { white-space: normal; }
}

/* Быстрые отборы механика над списком «Ремонты» (шаг 9). */
.quick-filters { margin-bottom: 12px; }
.quick-filters .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
