/* Админка «Сновеи». Палитра — индиго и марена, нейтральные тона уведены в синеву. */
:root {
    --paper: #F1F2F5; --surface: #FBFBFC; --surface-2: #E7E9EE; --ink: #191C24; --ink-soft: #545C6B;
    --line: #D2D6DF; --indigo: #33508F; --indigo-dim: #E4E9F5; --madder: #A63B34; --madder-dim: #F6E4E2;
    --moss: #446E52; --moss-dim: #E2EDE5;
}
@media (prefers-color-scheme: dark) {
    :root {
        --paper: #12141A; --surface: #191C24; --surface-2: #232833; --ink: #E8EAEF; --ink-soft: #99A1B0;
        --line: #2F3542; --indigo: #8BA6E0; --indigo-dim: #1E2839; --madder: #E0857D; --madder-dim: #32211F;
        --moss: #85B795; --moss-dim: #1C2922;
    }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink);
    font: 15px/1.55 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--indigo); }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 18px; margin: 36px 0 6px; }
p { margin: 0 0 12px; }
.muted, .hint { color: var(--ink-soft); }
.hint, small { font-size: 13px; font-weight: 400; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

.topbar { display: flex; align-items: center; gap: 28px; padding: 12px 24px;
    background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .brand { font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { padding: 6px 12px; border-radius: 4px; color: var(--ink-soft); text-decoration: none; }
.topbar nav a.on { background: var(--indigo-dim); color: var(--indigo); font-weight: 600; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 28px 24px 80px; }
.crumbs { font-size: 14px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

button, .button { font: inherit; padding: 8px 16px; border-radius: 4px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { border-color: var(--indigo); }
button.primary, .button.primary { background: var(--indigo); border-color: var(--indigo); color: var(--surface); font-weight: 600; }
button.danger { color: var(--madder); border-color: var(--madder); }
button.link { border: 0; background: none; padding: 0; color: var(--indigo); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

input[type=text], input[type=search], input[type=password], textarea {
    font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px;
    background: var(--surface); color: var(--ink); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; margin-top: 16px; }
label.check { flex-direction: row; align-items: baseline; gap: 8px; font-weight: 400; flex-wrap: wrap; }
form.edit { display: flex; flex-direction: column; gap: 22px; margin-top: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 22px 22px; margin: 0; min-width: 0; }
.card legend { font-weight: 700; padding: 0 8px; margin-left: -8px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 20px; }
.danger-zone { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.search { display: flex; gap: 10px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
.search input { flex: 1; min-width: 220px; }

.notice { padding: 10px 14px; border-radius: 4px; margin: 12px 0; }
.notice p { margin: 0; }
.notice.ok { background: var(--moss-dim); color: var(--moss); }
.notice.bad, .error { background: var(--madder-dim); color: var(--madder); }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft);
    background: var(--surface-2); white-space: nowrap; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.off td { color: var(--ink-soft); }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; white-space: nowrap;
    background: var(--surface-2); color: var(--ink-soft); }
.pill.applied { background: var(--moss-dim); color: var(--moss); }
.pill.quarantined, .pill.failed, .pill.discrepancy { background: var(--madder-dim); color: var(--madder); }
.pager { display: flex; gap: 18px; align-items: center; margin-top: 16px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px;
    text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.tile b { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { color: var(--ink-soft); font-size: 13px; }

/* редактор */
.editor { margin-top: 5px; }
.editor .toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border: 1px solid var(--line);
    border-bottom: 0; border-radius: 4px 4px 0 0; background: var(--surface-2); }
.editor .toolbar button { padding: 4px 10px; font-size: 13px; }
.editor .toolbar .right { margin-left: auto; }
.editor .surface { min-height: 240px; max-height: 70vh; overflow-y: auto; padding: 12px 16px;
    border: 1px solid var(--line); border-radius: 0 0 4px 4px; background: var(--surface); }
.editor .surface:focus { outline: 2px solid var(--indigo); outline-offset: -1px; }
.editor .surface h2, .supplier-text h2 { font-size: 19px; margin: 18px 0 6px; }
.editor .surface h3, .supplier-text h3 { font-size: 16px; margin: 14px 0 4px; }
.editor.js textarea { display: none; }
.editor.js.source textarea { display: block; font-family: ui-monospace, Menlo, monospace; font-size: 13px;
    border-radius: 0 0 4px 4px; }
.editor.js.source .surface { display: none; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--indigo); }
.supplier-text { margin-top: 10px; padding: 12px 16px; border-left: 3px solid var(--line); color: var(--ink-soft); }

/* SEO */
.snippet { border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; margin: 8px 0 4px; max-width: 620px;
    background: var(--paper); overflow-wrap: anywhere; }
.snippet-url { font-size: 13px; color: var(--moss); }
.snippet-title { font-size: 18px; color: var(--indigo); line-height: 1.3; margin: 2px 0; }
.snippet-text { font-size: 13.5px; color: var(--ink-soft); }
.counter.over { color: var(--madder); }
.slug-row { display: flex; align-items: center; gap: 6px; font-weight: 400; flex-wrap: wrap; }
.slug-row input { flex: 1; min-width: 200px; }
.slug-prefix { color: var(--ink-soft); font-size: 14px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.photos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 4px; background: var(--surface-2); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 8px; padding: 28px; }
.login-card button { margin-top: 20px; width: 100%; }

/* цены */
.tabs { display: flex; gap: 4px; margin: 16px 0 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs a { padding: 8px 16px; text-decoration: none; color: var(--ink-soft); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--indigo); border-bottom-color: var(--indigo); font-weight: 600; }
form.card { padding: 18px 22px 22px; margin-top: 14px; }
.card-title { margin: 0 0 4px; font-size: 17px; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 22px; }
.rule { padding-top: 12px; }
.rule b { font-size: 15px; }
.rule label { margin-top: 8px; font-weight: 400; font-size: 14px; }
input.narrow { width: 90px; }
.calc { display: grid; grid-template-columns: minmax(180px, 220px) 1fr; gap: 22px; align-items: start;
    margin: 22px 0 10px; padding: 16px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.calc-in { margin-top: 0; }
.calc-out { display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.calc-out div { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-soft); }
.calc-out b { color: var(--ink); font-weight: 600; }
.calc-out .total { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px; color: var(--ink); font-weight: 600; }
.calc-out .total b { color: var(--moss); font-size: 17px; }
.calc-out .total small { color: var(--ink-soft); }
.calc-out .total.loss b, .loss { color: var(--madder); font-weight: 600; }
td small { display: block; }
@media (max-width: 620px) { .calc { grid-template-columns: 1fr; } }
