/* ============================================================
   INTER — самостоятельно размещённый шрифт (woff2 из дизайн-кита,
   лицензия SIL OFL). Подсеты по диапазонам Unicode, как в дизайне;
   статические файлы покрывают веса 400–800 (тяжёлые синтезируются).
   ============================================================ */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/static/fonts/inter-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/static/fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/static/fonts/inter-greek-ext.woff2") format("woff2");
  unicode-range: U+1F00-1FFF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/static/fonts/inter-greek.woff2") format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/static/fonts/inter-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/static/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --mm-blue: #00659d;
  --mm-blue-deep: #003d7a;
  --mm-blue-soft: #eaf2f6;
  --mm-blue-tint: rgba(0, 101, 157, 0.08);
  --mm-ink: #0f2a3c;
  --mm-ink-2: #29475a;
  --mm-muted: #5e7384;
  --mm-bg: #f3f7f9;
  --mm-card: #ffffff;
  --mm-border: #d7e3ea;
  --mm-border-strong: #c3d4dd;

  --mm-red: #b73a36;
  --mm-red-soft: #fbe7e5;
  --mm-yellow: #b97a10;
  --mm-yellow-soft: #fcf2dc;
  --mm-green: #15775f;
  --mm-green-soft: #d8f1e7;

  --mm-shadow-sm: 0 1px 2px rgba(15, 42, 60, 0.04), 0 4px 12px rgba(15, 42, 60, 0.05);
  --mm-shadow-md: 0 2px 4px rgba(15, 42, 60, 0.05), 0 10px 24px rgba(15, 42, 60, 0.08);
  --mm-radius-sm: 10px;
  --mm-radius-md: 14px;
  --mm-radius-lg: 20px;
  --mm-focus: 0 0 0 3px rgba(0, 101, 157, 0.30);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--mm-bg);
  color: var(--mm-ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: none;
  box-shadow: var(--mm-focus);
  border-radius: 6px;
}

a {
  color: var(--mm-blue-deep);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ============ HEADER ============ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--mm-border);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}

.app-header__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--mm-ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand__logo {
  display: block;
  width: auto;
  height: 38px;
  max-width: 240px;
  object-fit: contain;
}

.brand__text {
  display: grid;
  gap: 1px;
}

.brand__text strong {
  font-size: 15px;
  line-height: 1.1;
}

.brand__text small {
  color: var(--mm-muted);
  font-size: 12px;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin-right: auto;
  margin-left: 12px;
}

.app-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--mm-ink-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background-color .12s, color .12s;
}

.app-nav a:hover {
  background: var(--mm-blue-soft);
  color: var(--mm-blue-deep);
  text-decoration: none;
}

/* Активный раздел подсвечивается мягкой синей таблеткой — как в дизайне
   (AppShell выделяет текущий пункт навигации). */
.app-nav a.is-active,
.app-nav a.is-active:hover {
  background: var(--mm-blue-soft);
  color: var(--mm-blue-deep);
  font-weight: 600;
}

.app-nav__technical {
  color: var(--mm-muted) !important;
  font-weight: 400;
}

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 24px 56px;
}

/* ============ HERO + PAGE HEADING ============ */

.hero-card {
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
  padding: 28px 30px;
  border-radius: var(--mm-radius-lg);
  background: linear-gradient(135deg, #ffffff 0%, #eaf3f7 100%);
  border: 1px solid var(--mm-border);
  box-shadow: var(--mm-shadow-md);
}

.hero-card::after {
  content: "";
  position: absolute;
  width: 200px;
  height: 200px;
  right: -64px;
  top: -64px;
  border-radius: 50%;
  background: rgba(0, 101, 157, 0.07);
}

.hero-card h1 {
  position: relative;
  max-width: 720px;
  margin: 0;
  font-size: clamp(26px, 3.6vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.hero-card__text {
  position: relative;
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--mm-ink-2);
  font-size: 16px;
  line-height: 1.55;
}

.hero-card__actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--mm-blue-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.page-heading {
  margin-bottom: 18px;
}

.page-heading--with-action {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-heading h1 {
  max-width: 760px;
  margin: 0 0 8px;
  font-size: clamp(22px, 2.8vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.page-heading .muted {
  max-width: 760px;
  font-size: 15px;
  line-height: 1.55;
}

/* ============ GRIDS / CARDS ============ */

.action-grid,
.steps-grid,
.legend-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.action-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.steps-grid,
.legend-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.action-card,
.step-card {
  background: var(--mm-card);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-md);
  box-shadow: var(--mm-shadow-sm);
}

.action-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 18px;
  color: var(--mm-ink);
  text-decoration: none;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.action-card:hover {
  transform: translateY(-1px);
  border-color: var(--mm-border-strong);
  box-shadow: var(--mm-shadow-md);
  text-decoration: none;
}

.action-card strong {
  font-size: 16px;
  font-weight: 600;
}

.action-card span:last-child,
.step-card p {
  margin: 0;
  color: var(--mm-muted);
  line-height: 1.45;
  font-size: 14px;
}

.action-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--mm-blue-soft);
  color: var(--mm-blue-deep);
  font-size: 18px;
  font-weight: 700;
}

.step-card {
  padding: 18px;
}

.step-card > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--mm-blue);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
}

.step-card strong {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.legend-grid > div {
  padding: 14px 16px;
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-md);
  background: var(--mm-card);
}

.legend-grid p {
  margin: 6px 0 0;
}

/* ============ UPLOAD ============ */

/* Классы с display (например, .form-stack { display: grid }) иначе
   перебивают UA-правило [hidden] { display: none }. */
[hidden] {
  display: none !important;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  margin-bottom: 18px;
  background: var(--mm-blue-soft);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-md);
}

.mode-switch__btn {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--mm-radius-sm);
  background: transparent;
  color: var(--mm-ink-2);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}

.mode-switch__btn:hover {
  color: var(--mm-blue);
}

.mode-switch__btn.is-active {
  background: var(--mm-card);
  border-color: var(--mm-border-strong);
  color: var(--mm-blue);
  box-shadow: 0 1px 2px rgba(15, 60, 90, 0.08);
}

.check-textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  line-height: 1.5;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.upload-card,
.help-card {
  min-height: 100%;
}

.segments-panel {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--surface-muted, #f8fafc);
}

.segments-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.segments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
}

.segment-item {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.segment-item--done {
  opacity: 0.7;
}

.segment-label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}

.segment-label input[type="checkbox"] {
  margin-top: 4px;
  flex: 0 0 auto;
}

.segment-meta {
  min-width: 0;
}

.segment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.segment-snippet {
  margin: 4px 0 0;
  font-size: 0.86rem;
  word-break: break-word;
}

.form-stack {
  display: grid;
  gap: 14px;
}

.field-group {
  display: grid;
  gap: 6px;
}

.field-group > span {
  font-weight: 600;
  font-size: 14px;
}

.field-group small {
  color: var(--mm-muted);
  line-height: 1.4;
  font-size: 13px;
}

.clean-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--mm-ink-2);
  line-height: 1.5;
  font-size: 14px;
}

.detect-status {
  padding: 10px 12px;
  border-radius: var(--mm-radius-sm);
  background: var(--mm-blue-soft);
  color: var(--mm-ink);
  border: 1px solid var(--mm-border);
  font-size: 13px;
  line-height: 1.45;
}

.detect-hint {
  color: var(--mm-yellow);
  font-weight: 600;
}

.field-group em {
  color: var(--mm-muted);
  font-style: normal;
  font-weight: 400;
}

/* ============ NOTES & ALERTS ============ */

.soft-note,
.success-note,
.empty-state,
.alert {
  padding: 12px 14px;
  margin: 14px 0 0;
  border-radius: var(--mm-radius-sm);
  line-height: 1.5;
  font-size: 14px;
  border: 1px solid transparent;
}

.soft-note {
  background: var(--mm-blue-soft);
  color: var(--mm-ink);
  border-color: var(--mm-border);
}

.success-note {
  background: var(--mm-green-soft);
  color: var(--mm-green);
  border-color: rgba(21, 119, 95, 0.22);
  font-weight: 600;
}

.alert {
  background: var(--mm-yellow-soft);
  color: #6c4607;
  border-color: rgba(185, 122, 16, 0.28);
}

.alert-danger {
  background: var(--mm-red-soft);
  color: var(--mm-red);
  border-color: rgba(183, 58, 54, 0.24);
}

.empty-state {
  border: 1px dashed var(--mm-border-strong);
  background: var(--mm-card);
}

.empty-state--large {
  display: grid;
  gap: 10px;
  justify-items: start;
  margin: 0;
  padding: 28px;
  border-radius: var(--mm-radius-lg);
}

.empty-state--large > strong {
  font-size: 18px;
  font-weight: 600;
}

/* ============ RESULT CARD ============ */

.result-card {
  margin-top: 18px;
  padding: 22px;
  border-radius: var(--mm-radius-lg);
  background: var(--mm-card);
  border: 1px solid var(--mm-border);
  box-shadow: var(--mm-shadow-md);
}

.result-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
}

.result-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.result-summary-item {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--mm-radius-md);
  background: #f8fbfc;
  border: 1px solid var(--mm-border);
}

.result-summary-item span {
  color: var(--mm-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-summary-item strong {
  font-size: 22px;
  font-weight: 700;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

/* ============ GENERIC CARD ============ */

.card,
.stat-box,
.table-card {
  background: var(--mm-card);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-lg);
  box-shadow: var(--mm-shadow-sm);
}

.card {
  padding: 22px;
  margin-bottom: 18px;
}

.table-card {
  overflow: hidden;
}

.card h2,
.card h3 {
  margin-top: 0;
  font-weight: 700;
}

.card h2 {
  font-size: 18px;
}

.card h3 {
  font-size: 16px;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  color: var(--mm-muted);
  font-size: 12.5px;
  background: rgba(15, 42, 60, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ============ ZONES ============ */

.zone-red,
.zone-yellow,
.zone-green {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.zone-red {
  color: var(--mm-red);
}

.zone-yellow {
  color: var(--mm-yellow);
}

.zone-green {
  color: var(--mm-green);
}

/* ============ TABLES ============ */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--mm-card);
  border: 0;
  border-radius: var(--mm-radius-lg);
  overflow: hidden;
  font-size: 14px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--mm-border);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f6fafc;
  color: var(--mm-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tbody tr {
  transition: background-color .1s ease;
}

tbody tr:nth-child(even) td {
  background: #fafcfd;
}

tbody tr:hover td {
  background: var(--mm-blue-soft);
}

tr:last-child td {
  border-bottom: 0;
}

td strong {
  font-weight: 600;
}

/* ============ BUTTONS ============ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--mm-blue);
  color: #ffffff;
  text-decoration: none;
  /* <button> по умолчанию не наследует шрифт страницы (берёт Arial),
     из-за чего текст «Удалить» визуально не совпадал с «Открыть».
     Принудительно выравниваем метрики и сбрасываем UA-стили кнопки. */
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  vertical-align: middle;
  cursor: pointer;
  transition: background-color .12s, box-shadow .12s, transform .12s;
  box-shadow: 0 1px 2px rgba(0, 61, 122, 0.18);
}

.button:hover {
  background: var(--mm-blue-deep);
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 61, 122, 0.25);
}

.button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0, 61, 122, 0.20);
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
  box-shadow: none;
}

.button:disabled:hover,
.button[aria-disabled="true"]:hover {
  box-shadow: none;
}

.button-secondary {
  background: var(--mm-card);
  color: var(--mm-ink-2);
  border-color: var(--mm-border-strong);
  box-shadow: none;
}

.button-secondary:hover {
  background: var(--mm-blue-soft);
  color: var(--mm-blue-deep);
  border-color: var(--mm-border-strong);
  box-shadow: none;
}

.button-secondary:disabled:hover,
.button-secondary[aria-disabled="true"]:hover {
  background: var(--mm-card);
  color: var(--mm-ink-2);
}

.button-danger {
  background: #fff;
  color: #b42318;
  border-color: #f1aa9b;
  box-shadow: none;
}

.button-danger:hover {
  background: #b42318;
  color: #fff;
  border-color: #b42318;
}

.muted {
  color: var(--mm-muted);
  font-size: 14px;
}

/* ============ CHIPS / BADGES ============ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--mm-yellow);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.chip,
.status-chip,
.status-pending,
.status-approved,
.status-rejected {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid transparent;
  white-space: nowrap;
}

.chip,
.status-chip {
  margin: 2px 4px 2px 0;
  background: var(--mm-blue-tint);
  color: var(--mm-blue-deep);
  border-color: rgba(0, 101, 157, 0.12);
}

.status-pending {
  background: var(--mm-yellow-soft);
  color: #6c4607;
  border-color: rgba(185, 122, 16, 0.22);
}

.status-approved {
  background: var(--mm-green-soft);
  color: var(--mm-green);
  border-color: rgba(21, 119, 95, 0.20);
}

.status-rejected {
  background: var(--mm-red-soft);
  color: var(--mm-red);
  border-color: rgba(183, 58, 54, 0.20);
}

.score-value {
  color: var(--mm-blue-deep);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.table-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

/* Кнопки действий не сжимаются и не переносятся на новую строку,
   иначе «Удалить» уезжает под «Открыть». Узкие экраны решаются
   горизонтальной прокруткой .table-card. */
.table-actions > * {
  flex: 0 0 auto;
}

/* Форма-обёртка вокруг одной кнопки не должна ломать выравнивание
   в рядах действий (история проверок, шапка детали проверки). */
.inline-form {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.table-actions .inline-form .button,
.detail-hero__actions .inline-form .button {
  display: inline-flex;
  align-items: center;
}

/* ============ ADMIN USERS ============ */

.admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-panel,
.invite-result {
  background: var(--mm-card);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-sm);
  box-shadow: var(--mm-shadow-sm);
}

.admin-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.admin-panel--wide {
  min-width: 0;
}

.admin-panel h2,
.invite-result h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.admin-panel label {
  display: grid;
  gap: 6px;
  color: var(--mm-ink-2);
  font-size: 14px;
}

/* Чекбокс scope: флажок + подпись в строку, без «коробочного» вида,
   который глобальный input-стиль навязывает обычным полям. */
.scope-option {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.scope-option input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0;
  flex: 0 0 auto;
}

.admin-panel input,
.admin-panel select,
.users-table select,
.invite-result__link {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--mm-border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--mm-ink);
  font: inherit;
}

.invite-result {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
}

.invite-result__controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.invite-result__link {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  color: var(--mm-blue-deep);
}

.users-table-wrap {
  overflow-x: hidden;
}

.users-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.users-table__col-user {
  width: 17%;
}

.users-table__col-role {
  width: 150px;
}

.users-table__col-status {
  width: 136px;
}

.users-table__col-login {
  width: 98px;
}

.users-table__col-actions {
  width: auto;
}

.users-table th,
.users-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--mm-border);
  text-align: left;
  vertical-align: middle;
}

.users-table th {
  color: var(--mm-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.user-status {
  display: inline-flex;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.user-status--active {
  background: var(--mm-green-soft);
  color: var(--mm-green);
  border-color: rgba(21, 119, 95, 0.20);
}

.user-status--invited {
  background: var(--mm-yellow-soft);
  color: #6c4607;
  border-color: rgba(185, 122, 16, 0.22);
}

.user-status--blocked {
  background: var(--mm-red-soft);
  color: var(--mm-red);
  border-color: rgba(183, 58, 54, 0.20);
}

.users-table .table-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  white-space: normal;
}

.users-table .table-actions > * {
  flex: 0 0 auto;
}

.users-table .button {
  min-height: 36px;
  padding: 8px 14px;
  font-size: 13px;
  line-height: 1.2;
}

.users-table select {
  min-width: 0;
  padding-right: 28px;
}

.users-table td:first-child strong,
.users-table td:first-child .muted {
  overflow-wrap: anywhere;
}

/* ============ API TOKENS TABLE ============ */

/* У таблицы токенов 7 колонок — её нельзя зажимать в узкую боковую колонку
   двухколоночной admin-grid (там оставалось ~480px, и кнопки не влезали).
   Раскладываем страницу в один столбец: компактная форма сверху, таблица —
   на всю ширину контента. */
.token-admin {
  display: grid;
  gap: 16px;
  align-items: start;
}

.token-admin__form {
  max-width: 460px;
}

/* table-layout:fixed держит ширину таблицы = 100% карточки (иначе авто-ширина
   + кнопки в одну строку распирали её шире .table-card, и overflow:hidden
   обрезал «Действия»). Кнопки действий переносятся, а не уезжают за край. */
.api-tokens-table .table-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  white-space: normal;
  gap: 6px;
}

@media (min-width: 641px) {
  .api-tokens-table {
    table-layout: fixed;
  }
  .api-tokens-table th,
  .api-tokens-table td,
  .api-tokens-table td code {
    overflow-wrap: anywhere;
  }
  .api-tokens-table th:nth-child(1),
  .api-tokens-table td:nth-child(1) { width: 14%; }   /* Название */
  .api-tokens-table th:nth-child(2),
  .api-tokens-table td:nth-child(2) { width: 15%; }   /* Префикс */
  .api-tokens-table th:nth-child(3),
  .api-tokens-table td:nth-child(3) { width: 15%; }   /* Доступы */
  .api-tokens-table th:nth-child(4),
  .api-tokens-table td:nth-child(4) { width: 11%; }   /* Создан */
  .api-tokens-table th:nth-child(5),
  .api-tokens-table td:nth-child(5) { width: 13%; }   /* Использован */
  .api-tokens-table th:nth-child(6),
  .api-tokens-table td:nth-child(6) { width: 12%; }   /* Статус */
  .api-tokens-table th:nth-child(7),
  .api-tokens-table td:nth-child(7) { width: 20%; }   /* Действия */
  .api-tokens-table .button {
    min-height: 32px;
    padding: 6px 12px;
    font-size: 13px;
  }
}

/* ============ STATS ============ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-box {
  position: relative;
  padding: 16px 18px;
  overflow: hidden;
}

.stat-box::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--mm-blue);
  border-top-left-radius: var(--mm-radius-lg);
  border-bottom-left-radius: var(--mm-radius-lg);
}

.stat-box > span {
  color: var(--mm-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-number {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  font-weight: 700;
  color: var(--mm-ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-box:has(.zone-red)::before { background: var(--mm-red); }
.stat-box:has(.zone-yellow)::before { background: var(--mm-yellow); }
.stat-box:has(.zone-green)::before { background: var(--mm-green); }

/* ============ INPUTS ============ */

input,
select,
textarea {
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--mm-border-strong);
  border-radius: 8px;
  background: var(--mm-card);
  color: var(--mm-ink);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .12s, box-shadow .12s;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--mm-blue);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--mm-blue);
  box-shadow: var(--mm-focus);
}

input[type="file"] {
  padding: 10px;
}

select,
input[type="date"],
input[type="file"] {
  width: 100%;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 900px) {
  .upload-layout {
    grid-template-columns: 1fr;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .invite-result__controls {
    grid-template-columns: 1fr;
  }

  .invite-result__controls .inline-form,
  .invite-result__controls .button {
    width: 100%;
  }
}

@media (max-width: 760px) {
  /* На телефоне развёрнутая навигация (5 пунктов в 2 ряда) + бренд +
     индикатор ИИ дают шапку ~230px. Липкой она съедала бы ~25% экрана
     постоянно, поэтому на узких экранах шапку отклеиваем — она уезжает
     при прокрутке и возвращается скроллом вверх; все пункты остаются
     видимыми (без скрытого «бургер»-меню). */
  .app-header {
    position: static;
  }

  .app-header__inner {
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 14px;
  }

  .app-nav {
    order: 3;
    flex-basis: 100%;
    margin: 4px 0 0;
    padding-top: 6px;
    border-top: 1px solid var(--mm-border);
    justify-content: flex-start;
  }

  .brand__logo {
    height: 34px;
    max-width: 200px;
  }

  .page-heading--with-action {
    flex-direction: column;
  }

  main {
    padding: 16px 14px 40px;
  }

  .hero-card,
  .result-card {
    padding: 22px;
  }

  .table-card {
    overflow-x: auto;
  }

  table {
    min-width: 700px;
  }

  /* iOS Safari зумит страницу при фокусе поля со шрифтом < 16px —
     ставим 16px, чтобы ввод отчёта с телефона был без рывков. */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  /* Комфортные тап-таргеты на телефоне (Apple HIG ≥ 44px). */
  .button,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  .app-nav a {
    min-height: 44px;
    padding: 8px 14px;
  }
}

/* ====== ШИРОКИЕ ТАБЛИЦЫ → КАРТОЧКИ НА ТЕЛЕФОНЕ ====== */
@media (max-width: 640px) {
  /* История, рейтинг и профиль точки — широкие таблицы; листать их
     вбок на узком экране неудобно. Превращаем каждую строку в карточку,
     а ячейки — в строки "подпись: значение" (подпись из data-label). */
  .table-card {
    overflow-x: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  table {
    min-width: 0;
    border: 0;
    background: transparent;
    font-size: 15px;
  }

  table thead {
    display: none;
  }

  table,
  table tbody,
  table tr,
  table td {
    display: block;
    width: 100%;
  }

  table tr {
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid var(--mm-border);
    border-radius: var(--mm-radius-md);
    background: var(--mm-card);
    box-shadow: var(--mm-shadow-sm);
  }

  table td {
    padding: 6px 0;
    border: 0;
    background: transparent;
  }

  table td:not(:last-child) {
    border-bottom: 1px solid var(--mm-border);
  }

  table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--mm-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  /* Действия — кнопки на всю ширину карточки, легко попасть пальцем. */
  table .table-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  table td .inline-form {
    width: 100%;
  }

  table td .button {
    width: 100%;
  }
}

/* ============ PRINT ============ */

@media print {
  .app-header,
  .button,
  .button-secondary {
    display: none;
  }
  main {
    padding: 0;
  }
  .card,
  .result-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

.refresh-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 14px;
}

.refresh-bar .button {
  flex: 0 0 auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Панель управления списком проверок ---- */
.checks-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-md);
  background: var(--mm-card);
  box-shadow: var(--mm-shadow-sm);
}

.checks-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.checks-controls__search {
  position: relative;
  flex: 1 1 240px;
  min-width: 180px;
}
.checks-controls__search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  opacity: 0.6;
  pointer-events: none;
}
.checks-controls__search input {
  width: 100%;
  padding-left: 30px;
}

.chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--mm-border);
  border-radius: 999px;
  background: var(--mm-bg);
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.1;
  color: var(--mm-muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background 0.12s, color 0.12s;
}
.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.chip:hover { color: var(--mm-ink); background: var(--mm-blue-soft); }
.chip--on,
.chip--on:hover { background: var(--mm-blue); color: #fff; }
.chip:focus-within { box-shadow: var(--mm-focus); }
/* Фильтр-чипы (внутри .chip-group) — комфортный тап-таргет. Статичные
   бейджи .chip вне группы (история нарушений и т.п.) не трогаем. */
.chip-group .chip { min-height: 36px; }

.checks-controls__sort select { min-width: 190px; }

.checks-advanced { font-size: 13px; }
.checks-advanced > summary {
  cursor: pointer;
  color: var(--mm-blue);
  list-style: none;
  padding: 6px 4px;
}
.checks-advanced > summary::-webkit-details-marker { display: none; }
.checks-advanced > summary::before { content: "⚙ "; }
.checks-advanced__body {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-sm);
  background: var(--mm-bg);
}
.checks-controls__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--mm-muted);
}
.checks-controls__field select { min-width: 160px; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.active-filters__label { font-size: 12px; }
.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  text-decoration: none;
  color: var(--mm-ink);
  background: var(--mm-blue-soft);
  border: 1px solid transparent;
}
.active-chip:hover { border-color: var(--mm-red); color: var(--mm-red); }
.active-chip span { font-weight: 700; }
.active-filters__reset {
  font-size: 12px;
  color: var(--mm-blue);
  text-decoration: none;
  margin-left: 4px;
}
.active-filters__reset:hover { text-decoration: underline; }

.checks-toolbar__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.checks-summary {
  margin: 0 0 10px;
  font-size: 13px;
}

/* ---- Пагинация ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 18px 0 4px;
}
.pagination__pages {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}
.pagination__btn,
.pagination__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-sm);
  background: var(--mm-card);
  color: var(--mm-ink);
  text-decoration: none;
  font-size: 14px;
}
.pagination__btn:hover,
.pagination__page:hover {
  border-color: var(--mm-blue);
  color: var(--mm-blue);
}
.pagination__page--current {
  background: var(--mm-blue);
  border-color: var(--mm-blue);
  color: #fff;
  font-weight: 700;
  pointer-events: none;
}
.pagination__gap {
  display: inline-flex;
  align-items: flex-end;
  padding: 0 2px;
  color: var(--mm-muted);
}
.pagination__btn--off {
  opacity: 0.4;
  pointer-events: none;
}
.pagination__compact { display: none; }

@media (max-width: 640px) {
  .checks-controls { gap: 8px; }
  .checks-controls__search { flex: 1 1 100%; }
  .chip-group {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Комфортный тап-таргет фильтр-чипов на телефоне (Apple HIG ≥ 44px). */
  .chip-group .chip { min-height: 44px; }
  .checks-controls__sort { flex: 1 1 100%; }
  .checks-controls__sort select { width: 100%; min-width: 0; }
  .checks-advanced { width: 100%; }
  .checks-controls__field { flex: 1 1 100%; }
  .checks-controls__field select { width: 100%; min-width: 0; }

  /* компактная пагинация: «‹ Назад · 2 / 8 · Вперёд ›» */
  .pagination__pages { display: none; }
  .pagination__compact {
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
    color: var(--mm-muted);
    font-size: 14px;
  }
}

/* ============ CHECKS LIST (история проверок) ============ */

/* Вся ключевая навигация строки — ссылки, а не только кнопка «Открыть». */
.check-link {
  color: var(--mm-ink);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}

.check-link:hover {
  color: var(--mm-blue);
  border-bottom-color: var(--mm-blue);
}

/* Зона проверки — цветная кромка слева у строки/карточки. */
.checks-table tr.check-row--red > td:first-child { box-shadow: inset 3px 0 0 var(--mm-red); }
.checks-table tr.check-row--yellow > td:first-child { box-shadow: inset 3px 0 0 var(--mm-yellow); }
.checks-table tr.check-row--green > td:first-child { box-shadow: inset 3px 0 0 var(--mm-green); }

/* Балл в цвете зоны: главный сигнал строки. */
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--mm-blue-soft);
  color: var(--mm-blue-deep);
}

.score-pill--red { background: var(--mm-red-soft); color: var(--mm-red); }
.score-pill--yellow { background: var(--mm-yellow-soft); color: #6c4607; }
.score-pill--green { background: var(--mm-green-soft); color: var(--mm-green); }
/* Балл есть, но зона не определена (легаси/частичные данные): нейтральный
   серый, чтобы не опираться на несуществующий класс и не выдавать «балл без
   зоны» за обычный синий результат. */
.score-pill--none { background: var(--mm-border); color: var(--mm-muted); }

.verdict {
  display: flex;
  align-items: center;
  gap: 10px;
}

.verdict__meta {
  display: grid;
  gap: 3px;
  justify-items: start;
}

.verdict__label {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
}

.verdict__label--red { color: var(--mm-red); }
.verdict__label--yellow { color: var(--mm-yellow); }
.verdict__label--green { color: var(--mm-green); }
.verdict__label--none { color: var(--mm-muted); }

/* Счётчики нарушений: цветная точка + число, нули приглушены. */
.vio-dots {
  display: inline-flex;
  gap: 10px;
}

.vio-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.vio-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.vio-dot--red { color: var(--mm-red); }
.vio-dot--red::before { background: var(--mm-red); }
.vio-dot--yellow { color: var(--mm-yellow); }
.vio-dot--yellow::before { background: var(--mm-yellow); }
.vio-dot--green { color: var(--mm-green); }
.vio-dot--green::before { background: var(--mm-green); }

.vio-dot--zero {
  opacity: 0.35;
  font-weight: 500;
}

/* Проверка ещё обрабатывается — мягкая пульсация чипа. */
@keyframes chip-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.status-chip--processing {
  animation: chip-pulse 1.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .status-chip--processing { animation: none; }
}

/* Счётчики на детали проверки кликабельны (якоря к секциям). */
a.stat-box {
  text-decoration: none;
  color: inherit;
}

.stat-box--link {
  cursor: pointer;
  transition: box-shadow .12s, transform .12s;
}

.stat-box--link:hover {
  box-shadow: var(--mm-shadow-md);
  transform: translateY(-1px);
}

@media (max-width: 640px) {
  /* В мобильных карточках зона — кромка всей карточки. */
  .checks-table tr.check-row--red > td:first-child,
  .checks-table tr.check-row--yellow > td:first-child,
  .checks-table tr.check-row--green > td:first-child {
    box-shadow: none;
  }

  .checks-table tr.check-row--red { border-left: 4px solid var(--mm-red); }
  .checks-table tr.check-row--yellow { border-left: 4px solid var(--mm-yellow); }
  .checks-table tr.check-row--green { border-left: 4px solid var(--mm-green); }
}

/* ============ LLM INDICATOR (статус ИИ в шапке) ============ */

.llm-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--mm-border);
  border-radius: 999px;
  background: var(--mm-card);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--mm-muted);
}

.llm-indicator__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mm-muted);
  flex: 0 0 auto;
}

.llm-indicator--ok {
  color: var(--mm-green);
  border-color: rgba(21, 119, 95, 0.25);
  background: var(--mm-green-soft);
}
.llm-indicator--ok .llm-indicator__dot { background: var(--mm-green); }

.llm-indicator--down {
  color: var(--mm-red);
  border-color: rgba(183, 58, 54, 0.25);
  background: var(--mm-red-soft);
}
.llm-indicator--down .llm-indicator__dot {
  background: var(--mm-red);
  animation: chip-pulse 1.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .llm-indicator--down .llm-indicator__dot { animation: none; }
}

/* ============ SEGMENT INLINE EDIT (карандаши в списке проверок) ============ */

.segment-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

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

.seg-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.segment-snippet-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.segment-snippet-row .segment-snippet {
  flex: 1 1 auto;
  min-width: 0;
}

/* Маленькая иконка-карандаш рядом с полем. */
.seg-edit {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--mm-border);
  border-radius: 6px;
  background: var(--mm-card);
  color: var(--mm-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .12s, color .12s, border-color .12s;
}

.seg-edit:hover {
  background: var(--mm-blue-soft);
  color: var(--mm-blue);
  border-color: var(--mm-blue);
}

/* Подсветка отредактированного значения. */
.is-edited {
  color: var(--mm-blue-deep);
}

.segment-snippet.is-edited {
  color: var(--mm-ink-2);
  font-style: italic;
}

.seg-editor {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.seg-editor__input {
  width: 100%;
}

textarea.seg-editor__input {
  min-height: 140px;
  resize: vertical;
  line-height: 1.5;
}

.seg-editor__actions {
  display: flex;
  gap: 8px;
}

/* ============ CHECK RESULT EDITOR ============ */

/* ============ RESULT EDITOR ============ */

.ec-toolbar { display: grid; gap: 12px; }
.ec-intro { margin: 0; }

.ec-datebar { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.ec-date-field {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 13px; font-weight: 600; color: var(--mm-ink-2);
}
.ec-date-field input[type="date"] {
  font: inherit; padding: 9px 11px;
  border: 1px solid var(--mm-border-strong); border-radius: var(--mm-radius-sm);
  background: var(--mm-card); color: var(--mm-ink);
}
.ec-date-field input[type="date"]:focus-visible { outline: none; box-shadow: var(--mm-focus); }

.ec-groups { display: grid; gap: 16px; }

.ec-group { padding: 0; overflow: hidden; }
.ec-group__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--mm-border);
}
.ec-group__title { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 16px; }
.ec-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; }
.ec-dot--red { background: var(--mm-red); }
.ec-dot--yellow { background: var(--mm-yellow); }
.ec-dot--green { background: var(--mm-green); }
.ec-dot--positive { background: var(--mm-blue); }
.ec-dot--unclear { background: var(--mm-muted); }
.ec-count {
  display: inline-flex; min-width: 24px; height: 22px; align-items: center;
  justify-content: center; padding: 0 8px; border-radius: 999px;
  background: var(--mm-bg); color: var(--mm-ink-2);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}

.ec-list { display: grid; gap: 10px; padding: 14px 16px; }
.ec-list:empty { padding: 0; }
.ec-empty { margin: 0; padding: 16px; text-align: center; color: var(--mm-muted); font-size: 13px; }

.ec-card {
  display: grid; gap: 9px; padding: 12px 13px;
  border: 1px solid var(--mm-border); border-left: 4px solid var(--mm-border-strong);
  border-radius: var(--mm-radius-sm); background: var(--mm-card);
}
.ec-card--red { border-left-color: var(--mm-red); }
.ec-card--yellow { border-left-color: var(--mm-yellow); }
.ec-card--green { border-left-color: var(--mm-green); }
.ec-card--positive { border-left-color: var(--mm-blue); }
.ec-card--unclear { border-left-color: var(--mm-muted); }

.ec-card__top { display: flex; align-items: center; gap: 8px; }
.ec-zone { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.ec-del {
  flex: 0 0 auto; width: 36px; height: 36px;
  border: 1px solid var(--mm-border); border-radius: var(--mm-radius-sm);
  background: var(--mm-card); color: var(--mm-muted);
  cursor: pointer; font-size: 15px; line-height: 1;
}
.ec-del:hover { color: var(--mm-red); border-color: var(--mm-red); background: var(--mm-red-soft); }

.ec-text {
  width: 100%; resize: vertical; min-height: 44px; font: inherit;
  padding: 9px 11px; border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius-sm); background: var(--mm-card); color: var(--mm-ink);
}
.ec-evidence { margin: 0; color: var(--mm-muted); font-size: 12.5px; font-style: italic; }

.ec-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.ec-field {
  display: flex; flex-direction: column; gap: 4px;
  flex: 1 1 150px; font-size: 12px; color: var(--mm-muted);
}
.ec-field--cat { flex: 1 1 190px; }
.ec-field input, .ec-field select {
  font: inherit; padding: 8px 10px;
  border: 1px solid var(--mm-border); border-radius: var(--mm-radius-sm);
  background: var(--mm-card); color: var(--mm-ink);
}

.ec-sticky {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: 10px;
  margin: 18px 0 0; padding: 14px 0 6px;
  background: linear-gradient(to top, var(--mm-bg) 72%, rgba(243, 247, 249, 0));
}

.button-ghost {
  background: transparent; border: 1px dashed var(--mm-border-strong);
  color: var(--mm-ink-2);
}
.button-ghost:hover { border-color: var(--mm-blue); color: var(--mm-blue); background: var(--mm-blue-tint); }

/* ============ SCORE BREAKDOWN ============ */

.score-breakdown {
  margin: 4px 0 2px;
}

.score-breakdown > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--mm-ink-2);
}

.score-breakdown__list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
  max-width: 460px;
}

.score-breakdown__list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.score-breakdown__list li span {
  color: var(--mm-ink-2);
}

.score-breakdown__total {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--mm-border);
  font-weight: 700;
}

@media (max-width: 640px) {
  .ec-meta { flex-direction: column; }
  .ec-field, .ec-field--cat { width: 100%; flex-basis: auto; }
  .ec-sticky { flex-direction: column-reverse; }
  .ec-sticky .button { width: 100%; text-align: center; }
  .ec-group__head { flex-wrap: wrap; }
}
