:root {
    --bg: #f3eee6;
    --ink: #243024;
    --muted: #5e675c;
    --forest: #2c3b28;
    --card: #fffdf8;
    --line: #e3d9cc;
    --green: #1f7a45;
    --green-bg: #e7f3eb;
    --amber: #8a5200;
    --amber-bg: #fff3df;
    --red: #8d2e2a;
    --red-bg: #fdeceb;
    --shadow: 0 10px 30px rgba(36, 48, 36, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font: 18px/1.45 "Segoe UI", system-ui, sans-serif;
    padding: 20px 16px 108px;
}
a { color: var(--forest); }
h1, h2 { font-family: Georgia, "Palatino Linotype", serif; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
main { max-width: 980px; margin: 0 auto; }

.top { max-width: 980px; margin: 0 auto 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { font-family: Georgia, serif; font-size: 1.35rem; text-decoration: none; color: var(--forest); }
.top-links { display: flex; gap: 14px; align-items: center; }
.top-links form { margin: 0; }
.top-links button { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 8px; }

.card, .stat, .sheet, .log li {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.card { padding: 18px; margin: 0 0 14px; }
.narrow { max-width: 460px; margin: 8vh auto; }

label { display: block; font-size: 0.92rem; color: var(--muted); margin: 12px 0; }
input, select, textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 14px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font: inherit;
}
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--forest);
    background: #fff;
    color: var(--forest);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}
button.primary, a.primary { background: var(--forest); color: #f6f1e8; }
button.ghost { background: transparent; }
button.small, a.small { min-height: 44px; padding: 8px 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stack { margin-top: 16px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { display: flex; flex-direction: column; padding: 14px; text-decoration: none; color: inherit; }
.stat strong { font-size: 2rem; line-height: 1; }
.stat span { color: var(--muted); margin-top: 6px; }
.stat.ok { background: var(--green-bg); }
.stat.low { background: var(--amber-bg); }
.stat.order { background: var(--red-bg); }

.pill { border-radius: 999px; padding: 4px 10px; font-size: 0.85rem; background: var(--line); }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.low { background: var(--amber-bg); color: var(--amber); }
.pill.order { background: var(--red-bg); color: var(--red); }
.pill.unknown { background: #eeeae4; color: var(--muted); }

.sync { border-radius: 12px; padding: 10px 12px; background: #eeeae4; }
.sync.ok { background: var(--green-bg); }
.sync.bad { background: var(--red-bg); }
.muted { color: var(--muted); }
.big-num { font-size: 3.2rem; line-height: 1; margin: 8px 0; font-variant-numeric: tabular-nums; }
.flash { white-space: pre-line; padding: 12px 14px; border-radius: 14px; background: var(--green-bg); }
.flash.bad { background: var(--red-bg); }
.lead { font-size: 1.2rem; }

.attention, .plain, .log { list-style: none; padding: 0; margin: 0; }
.attention li, .plain li { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.attention li div { display: flex; flex-direction: column; flex: 1; }
.plain li { display: block; }

.search, .filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.search input, .filters input, .filters select { margin: 0; flex: 1 1 180px; }
.filters button, .search button { flex: 0 0 auto; }

.sheet { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.sheet th, .sheet td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sheet th { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.log li { list-style: none; padding: 14px; margin: 0 0 10px; }
.log time { display: block; color: var(--muted); font-size: 0.9rem; }
.log p { margin: 6px 0 0; }

.dock {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #fffdf8;
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.dock a { text-align: center; text-decoration: none; color: var(--muted); padding: 10px 0; border-radius: 12px; font-size: 0.95rem; }
.dock a.on { background: var(--forest); color: #f6f1e8; }

@media (max-width: 720px) {
    .sheet thead { display: none; }
    .sheet, .sheet tbody, .sheet tr, .sheet td { display: block; width: auto; }
    .sheet tr { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 16px; padding: 8px 12px; background: var(--card); }
    .sheet td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 0; }
    .sheet td::before { content: attr(data-label); color: var(--muted); }
    .split { grid-template-columns: 1fr; }
}
@media (min-width: 900px) {
    body { padding-bottom: 40px; }
    .dock { position: static; max-width: 980px; margin: -8px auto 16px; border: 1px solid var(--line); border-radius: 16px; }
}
