:root {
  --bg: #f6f7f9; --surface: #fff; --text: #1b1f24; --muted: #667085; --line: #e3e6ea;
  --accent: #2f5bea; --accent-text: #fff; --ok: #177245; --ok-bg: #e5f4ec; --bad: #b42318; --bad-bg: #fdeceb;
  --note-bg: #fff6e0; --wb: #7a2ea6; --ozon: #005bff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --surface: #1a1e24; --text: #e7e9ec; --muted: #9aa3ae; --line: #2c323a;
    --accent: #6d8dff; --accent-text: #0d1020; --ok: #5fd39a; --ok-bg: #173226; --bad: #ff8a80; --bad-bg: #3a1c1a;
    --note-bg: #3a3218; --wb: #c98ff0; --ozon: #7aa5ff;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 8px; }
.top { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); }
.top nav { display: flex; gap: 16px; flex: 1; }
.me { display: flex; gap: 12px; align-items: center; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin: 0 0 20px; }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
label { display: block; margin: 0 0 14px; font-weight: 500; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check input { flex: none; margin: 0; }
input:not([type=checkbox]):not([type=radio]) { display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button { display: inline-block; padding: 7px 14px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); padding: 9px 18px; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); }
button.danger, a.danger { color: var(--bad); }
button.danger-btn { background: var(--bad); color: #fff; border-color: var(--bad); }
form.inline { display: inline; margin: 0; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin: 0 0 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tr.warn td { background: var(--bad-bg); }
td.row-actions { white-space: nowrap; }
td.row-actions > * + * { margin-left: 10px; }
div.row-actions { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: flex-end; }
td.actions-cell { width: 1%; min-width: 220px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.mp { font-weight: 600; }
.mp-wb { color: var(--wb); }
.mp-ozon { color: var(--ozon); }
.status { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 13px; }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.bad { background: var(--bad-bg); color: var(--bad); }
.error { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: 8px; max-width: 460px; margin: 0 auto 16px; }
.note { background: var(--note-bg); padding: 10px 14px; border-radius: 8px; }
.qr { display: block; margin: 12px auto; background: #fff; padding: 8px; border-radius: 8px; }
code.secret { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg); padding: 2px 6px; border-radius: 5px; word-break: break-all; }
code.big { font-size: 20px; }
.soon { border-style: dashed; }
@media (max-width: 640px) { .top { padding: 12px 16px; } .me { width: 100%; } }
fieldset.access { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 4px; margin: 0 0 14px; }
fieldset.access legend { font-weight: 500; padding: 0 4px; }
fieldset.access label.check { margin-bottom: 8px; }
.store-list { margin: 0 0 6px 26px; max-height: 260px; overflow-y: auto; }
.tag { display: inline-block; font-size: 13px; padding: 1px 8px; margin: 1px 0; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 8px 0 20px; }
a.card.tool { display: flex; flex-direction: column; gap: 4px; margin: 0; color: var(--text); }
a.card.tool strong { color: var(--accent); }
a.card.tool:hover { border-color: var(--accent); text-decoration: none; }
button, .button { transition: transform .06s, filter .12s, background-color .12s; }
button:active:not(:disabled) { transform: translateY(1px) scale(.98); filter: brightness(.9); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button:disabled { cursor: default; }
button.loading { opacity: .85; }
button.loading::before { content: ""; display: inline-block; width: 14px; height: 14px; margin: 0 8px -2px 0; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
button.primary.done { background: var(--ok); border-color: var(--ok); color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button.loading::before { animation-duration: 2s; } button:active:not(:disabled) { transform: none; } }
.check-cell { width: 1%; }
.check-cell input { width: 18px; height: 18px; margin: 2px 0 0; cursor: pointer; }
.check-cell input:disabled { cursor: not-allowed; }
label.plain { display: inline; margin: 0; font-weight: inherit; cursor: pointer; }
form > .table-wrap + button { margin-bottom: 12px; }
table.labels tbody + tbody { border-top: 2px solid var(--line); }
tr.group-row td { background: var(--bg); }
tr.child-row td:nth-child(2) { padding-left: 30px; }
th.num, td.num { text-align: right; }
.actions .more { margin-left: auto; }
.key-mark { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 700; font-size: 13px; margin-right: 6px; vertical-align: middle; }
.key-mark.ok { background: var(--ok-bg); color: var(--ok); }
.key-mark.bad { background: var(--bad-bg); color: var(--bad); }
.key-mark.unknown { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.key-line { position: relative; display: flex; align-items: center; white-space: nowrap; cursor: help; outline: none; }
.key-line[data-tip]:hover::after, .key-line[data-tip]:focus::after {
  content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 20;
  width: max-content; max-width: min(320px, 80vw); white-space: normal;
  padding: 7px 10px; border-radius: 7px; font-size: 13px; line-height: 1.4; font-weight: 400;
  background: var(--text); color: var(--bg); box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.key-line:focus-visible .key-mark { outline: 2px solid var(--accent); outline-offset: 1px; }
.table-wrap:has(.key-line) { overflow: visible; }
.key-line + .key-line { margin-top: 4px; }
