:root {
    --bg: #fffcf4; --card: #fff; --ink: #3a2e1f; --text: #2b241b; --muted: #6e6556;
    --line: #f1ebdd; --edge: #e2d9c4; --sand: #fbf8f0; --gold: #c9a02c; --gold-soft: #fbf3dc;
    --ok: #17683e; --ok-soft: #e6f6ec; --bad: #b42318; --bad-soft: #fdecec; --warn: #8a6a12; --warn-soft: #fff3d6;
    --shadow: 0 10px 30px rgba(90, 70, 20, .07), 0 1px 2px rgba(90, 70, 20, .05);
}
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #15120d; --card: #1f1b15; --ink: #f3ebdd; --text: #e9e1d2; --muted: #a89e8c;
        --line: #2e281f; --edge: #443c2e; --sand: #241f18; --gold: #d9b544; --gold-soft: #3a3020;
        --ok: #5edb91; --ok-soft: #16301f; --bad: #f38b83; --bad-soft: #3a1c1a; --warn: #e9c766; --warn-soft: #3a3020;
        --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 "Segoe UI", Tahoma, system-ui, sans-serif; }
a { color: inherit; text-underline-offset: 3px; }
h1 { margin: 0; font-size: 26px; color: var(--ink); overflow-wrap: anywhere; }
h2 { margin: 0; font-size: 18px; color: var(--ink); overflow-wrap: anywhere; }
small { display: block; color: var(--muted); font-size: 12.5px; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }
.muted { color: var(--muted); font-size: 13.5px; margin: 0; }
.bad-text { color: var(--bad); font-weight: 600; margin: 0; }

.test-banner { background: repeating-linear-gradient(45deg, #b42318, #b42318 14px, #8f1c13 14px, #8f1c13 28px); color: #fff; text-align: center; padding: 10px 16px; position: sticky; top: 0; z-index: 5; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; color: var(--ink); }
.brand span { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(145deg, #d9b544, #c29a26); color: #fff; }
.brand em { color: var(--gold); font-style: normal; }
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a { padding: 7px 13px; border-radius: 10px; text-decoration: none; font-weight: 600; }
nav a:hover { background: var(--sand); }
nav a[aria-current] { background: var(--gold-soft); color: var(--ink); }
.top-end { margin-inline-start: auto; display: flex; gap: 8px; }

main { max-width: 1240px; margin: 0 auto; padding: 26px 20px 60px; display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.narrow { width: 100%; max-width: 440px; margin: 40px auto 0; }
form > .card { margin-bottom: 18px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
td.actions { display: table-cell; white-space: nowrap; text-align: end; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 28px; color: var(--ink); line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; align-items: end; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.grow { flex: 1; min-width: 240px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13.5px; }
label.check { flex-direction: row; align-items: center; gap: 9px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--edge); border-radius: 10px; padding: 9px 12px; width: 100%; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--gold); }
input.ltr, textarea.ltr { text-align: left; }
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--sand); color: var(--ink); border: 1px solid var(--edge); border-radius: 10px; padding: 9px 16px; white-space: nowrap; }
.btn:hover { border-color: var(--gold); }
.btn.primary { background: linear-gradient(145deg, #d9b544, #c29a26); border-color: transparent; color: #fff; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.inline { display: inline; }
.search { display: flex; gap: 8px; max-width: 100%; }
.search input { width: 260px; min-width: 0; }
.sorts { display: flex; flex-wrap: wrap; gap: 6px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
td.empty { text-align: center; color: var(--muted); padding: 28px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.idle { background: var(--sand); color: var(--muted); }

dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
dt { color: var(--muted); font-size: 12.5px; }
dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; text-align: start; }
[dir=rtl] dd.ltr { text-align: right; }
details summary { cursor: pointer; font-weight: 600; }
pre { overflow: auto; max-height: 420px; background: var(--sand); border-radius: 12px; padding: 14px; font-size: 12.5px; }
.result { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.result p { margin: 0; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; }
.flash { border-radius: 14px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; font-weight: 600; }
.flash p { margin: 0; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
