:root {
  --bg: #f5f7fb; --fg: #18243a; --muted: #52627a; --line: #d9e1ed; --card: #fff;
  --accent: #2358d8; --accent-fg: #fff; --ok: #17734b; --warn: #8a4b00; --bad: #b3261e; --info: #1d5fa8;
  --ok-bg: #e5f5ec; --warn-bg: #fff3dc; --bad-bg: #fde8e6; --info-bg: #e6f0fb; --neutral-bg: #eceff4;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c; --fg: #e6ebf2; --muted: #a3b0c2; --line: #2c3544; --card: #19202a;
    --accent: #7aa2ff; --accent-fg: #0b1220; --ok: #6fd3a0; --warn: #f4c06b; --bad: #ff9a90; --info: #8fc1ff;
    --ok-bg: #16362a; --warn-bg: #3a2c12; --bad-bg: #3d1c1a; --info-bg: #182c45; --neutral-bg: #262e3a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
main:focus { outline: none; }
h1 { font-size: 1.6rem; margin: 8px 0 12px; line-height: 1.25; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
h3, .h3 { font-size: 1.05rem; margin: 0 0 8px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumbs { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--card); padding: 8px; z-index: 10; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.top nav a { text-decoration: none; padding: 4px 0; }
.top nav .nav-count { display: inline-block; min-width: 1.5em; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-size: .8125rem; font-weight: 600; line-height: 1.5; text-align: center; }
.top nav a[aria-current] { font-weight: 700; border-bottom: 2px solid var(--accent); }

.panel, .card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 16px 0; }
.card { margin: 0; }
.cards { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.row { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.wrap { display: flex; }
ul.plain { list-style: none; padding: 0; margin: 0 0 12px; }
.list { list-style: none; padding: 0; margin: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list.compact > li { padding: 6px 0; }
.dot { display: inline-block; width: .6em; height: .6em; border-radius: 50%; margin-right: 6px; }
.dot-ok { background: var(--ok); } .dot-bad { background: var(--bad); }

.btn { display: inline-block; font: inherit; min-height: 44px; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); cursor: pointer; text-decoration: none; }
.btn-secondary { background: transparent; color: var(--accent); }
.btn-link { background: transparent; border-color: transparent; color: var(--accent); text-decoration: underline; padding-inline: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .875rem; font-weight: 600; border: 1px solid currentColor; }
.tone-ok { color: var(--ok); background: var(--ok-bg); }
.tone-warn { color: var(--warn); background: var(--warn-bg); }
.tone-bad { color: var(--bad); background: var(--bad-bg); }
.tone-info { color: var(--info); background: var(--info-bg); }
.tone-neutral { color: var(--muted); background: var(--neutral-bg); }

.notice { border-radius: 8px; padding: 10px 14px; margin: 12px 0; border-left: 4px solid; }
.notice p { margin: 0; }
.notice p + p { margin-top: 4px; }
.notice-error { background: var(--bad-bg); border-color: var(--bad); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn); }
.notice-success { background: var(--ok-bg); border-color: var(--ok); }
/* UI-02: under the header for viewers. */
.viewer-note { margin: 0; padding: 6px 16px; font-size: .875rem; color: var(--info); background: var(--info-bg); border-bottom: 1px solid var(--line); }

.field { margin: 0 0 16px; max-width: 520px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field p { margin: 4px 0 0; }
.req { color: var(--bad); }
input[type=text], input[type=date], select { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 8px; width: 100%; min-height: 44px; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; margin: 2px 8px 0 0; flex: none; accent-color: var(--accent); }
input:disabled, select:disabled { opacity: .65; }

fieldset.choices { border: 0; padding: 0; margin: 0 0 16px; }
fieldset.choices legend { font-weight: 600; margin-bottom: 8px; }
.choice { display: flex; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.choice label { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.choice.ack { background: var(--warn-bg); }
.checklist .check { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; }
.checklist .check label { cursor: pointer; overflow-wrap: anywhere; }
.checklist .check input { margin-top: 3px; flex: none; }

.stepper { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: s; }
.stepper li { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--neutral-bg); color: var(--muted); font-size: .875rem; }
.stepper .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--card); }
.stepper li.current { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.stepper li.done { color: var(--fg); }
.wizard-nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 20px; }

.table-wrap { overflow-x: auto; margin: 0 0 12px; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
caption { text-align: left; font-weight: 600; padding-bottom: 8px; }
.preview .dirs td { font-size: .8rem; color: var(--muted); }
.dir { font-size: .8rem; } .dir.on { color: var(--ok); font-weight: 600; } .dir.off { color: var(--muted); }
.inline-label { font-size: .875rem; }
.mapping td:nth-child(5) { white-space: nowrap; }

.summary, .metrics { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
.summary dt, .metrics dt { color: var(--muted); }
.summary dd, .metrics dd { margin: 0; overflow-wrap: anywhere; }

/* Phones: mapping table becomes stacked cards; metrics become one column. */
@media (max-width: 720px) {
  main { padding: 12px 16px; }
  .mapping thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mapping, .mapping tbody, .mapping tr, .mapping td { display: block; width: 100%; }
  .mapping tr { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 12px; }
  .mapping td { border: 0; padding: 4px 0; }
  .mapping td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: .8rem; color: var(--muted); }
  .summary, .metrics { grid-template-columns: 1fr; }
  .summary dd, .metrics dd { margin-bottom: 8px; }
  .wizard-nav .btn, .row .btn { flex: 1 1 auto; }
}
.stepper li.current .num { color: var(--accent); }

/* UI-01: lookup column editor inside the mapping table, unread notifications. */
.lookup { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.list > li.unread { border-left: 3px solid var(--info); padding-left: 10px; }
@media (max-width: 720px) {
  .lag thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .lag, .lag tbody, .lag tr, .lag td { display: block; width: 100%; }
  .lag tr { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 12px; }
  .lag td { border: 0; padding: 4px 0; }
  .lag td[data-label]::before { content: attr(data-label); display: block; font-size: .8rem; color: var(--muted); }
}

/* F19b «Массовые операции»: progress bar and dry-run result. */
progress { display: block; width: 100%; height: 12px; margin: 8px 0 4px; accent-color: var(--info); }
.bulk-plan { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.bulk-plan li { overflow-wrap: anywhere; }

/* CUR-01: «EUR / USD» price switcher on the «Plan» screen (aria-pressed buttons, 44 px targets). */
.currency-switch { display: inline-flex; margin: 4px 0 8px; border: 1px solid var(--accent); border-radius: 8px; overflow: hidden; }
.currency-option { font: inherit; font-weight: 600; min-height: 44px; min-width: 64px; padding: 8px 16px; border: 0; background: transparent; color: var(--accent); cursor: pointer; }
.currency-option + .currency-option { border-left: 1px solid var(--accent); }
.currency-option[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
