:root {
    --bg: #d9e2ef;
    --surface: #ffffff;
    --surface-2: #eef3f9;
    --border: #b7c4d8;
    --text: #0f1a2b;
    --ink: #1c2434;
    --muted: #4a5d78;
    --accent: #15803d;
    --accent-hover: #166534;
    --accent-soft: #e8f5e9;
    --btn: #16a34a;
    --danger: #dc2626;
    --card: var(--surface);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

header {
    background: var(--surface);
    color: var(--ink);
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}

header .top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

header a { color: var(--accent); text-decoration: none; }
header .top strong a { color: var(--ink); }
header .top strong a:hover { color: var(--accent); }

header nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: .95rem;
}

header nav a {
    color: var(--muted);
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
}

header nav a:hover,
header nav a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

main { max-width: 1040px; margin: 28px auto; padding: 0 16px; }
main.wide { max-width: 1480px; }

.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(15, 26, 43, .06);
    margin-bottom: 16px;
}

h1 { margin: 0 0 8px; font-size: 1.4rem; color: var(--text); }
p.muted { color: var(--muted); }

label { display: block; margin: 12px 0 4px; font-size: .9rem; color: var(--muted); }

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
}

input[type=checkbox] { width: auto; }

button, .btn {
    appearance: none;
    border: 0;
    background: var(--btn);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
}

button:hover, .btn:hover { background: var(--accent-hover); }

.btn.ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn.ghost:hover { background: var(--accent-soft); color: var(--accent-hover); }

.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }

header button {
    background: var(--surface-2);
    color: var(--ink);
    border: 1px solid var(--border);
}

header button:hover { background: var(--accent-soft); color: var(--accent); }

.error { color: var(--danger); font-size: .9rem; }

.flash {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #bbf7d0;
}

.flash.warn {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
}

table { width: 100%; border-collapse: collapse; }

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

th { color: var(--muted); font-weight: 600; font-size: .85rem; background: var(--surface-2); }

.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.tile {
    display: block;
    background: var(--surface-2);
    border-radius: 10px;
    padding: 16px;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
}

.tile:hover { border-color: var(--accent); background: var(--accent-soft); }
.tile h2 { margin: 0 0 6px; font-size: 1.05rem; }

.note { font-size: .9rem; color: var(--muted); }

.store-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin: 12px 0;
}

.store-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.store-card img.store-photo {
    display: block;
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.store-card .body { padding: 12px 14px 14px; }
.store-card h2 { margin: 0 0 6px; font-size: 1.1rem; }
.store-card p { margin: 4px 0; font-size: .9rem; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; }

.chip {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    min-width: 120px;
}

.chip .k { display: block; color: var(--muted); font-size: .75rem; }
.chip .v { font-weight: 650; }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filters label { margin: 0; }
.filters select { width: auto; min-width: 180px; }

.scroll { overflow-x: auto; }

table.kuzya { font-size: .78rem; }
table.kuzya th, table.kuzya td { padding: 4px 5px; white-space: nowrap; text-align: right; }
table.kuzya th.l, table.kuzya td.l { text-align: left; }
table.kuzya thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
table.kuzya .tot { font-weight: 700; background: var(--surface-2); }

.heat { display: inline-block; min-width: 1.4em; text-align: center; border-radius: 3px; padding: 1px 2px; }
.blk { color: var(--accent); }

table.catalog { font-size: .88rem; }
table.catalog th.num, table.catalog td.num { text-align: right; white-space: nowrap; }
.pager { display: flex; gap: 16px; align-items: center; margin-top: 12px; }
.filters input[type=search] { min-width: 240px; width: auto; }

table.journal { font-size: .86rem; }
table.journal th.num, table.journal td.num { text-align: right; white-space: nowrap; }
table.journal tr.unmapped td { background: #fff7ed; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.kv dt { color: var(--muted); font-size: .78rem; }
.kv dd { margin: 0; }
