:root {
    --bg: #0d0e11;
    --panel: #15171c;
    --panel-2: #1b1e24;
    --line: #2a2e36;
    --text: #e9e6df;
    --muted: #9a9790;
    --gold: #d8b25a;
    --gold-dim: #8a7038;
    --green: #3fbf7f;
    --red: #e05a5a;
    --amber: #e0a43a;
    --radius: 10px;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--gold); }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
p.lead { color: var(--muted); margin: 0 0 22px; }
code, pre, textarea.code { font-family: Consolas, "Cascadia Mono", monospace; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--gold); color: #1a1406; font-weight: 800; display: grid; place-items: center; }
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }
.side a.nav { color: var(--text); text-decoration: none; padding: 9px 12px; border-radius: 8px; display: block; }
.side a.nav:hover { background: var(--panel-2); }
.side a.nav.active { background: #2a2414; color: var(--gold); }
.side .grow { flex: 1; }
.side form button { width: 100%; }
main { padding: 28px 34px; max-width: 1100px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.tile .v { font-size: 18px; font-weight: 600; margin-top: 4px; }

.row { display: grid; grid-template-columns: 230px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.row:first-of-type { border-top: 0; }
.row .lbl b { display: block; }
.row .lbl small { color: var(--muted); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

input[type=text], input[type=password], select, textarea {
    background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold-dim); border-color: var(--gold-dim); }
textarea.code { font-size: 12.5px; min-height: 220px; resize: vertical; }
label.check { display: flex; gap: 8px; align-items: center; padding: 3px 0; cursor: pointer; }

button, .btn {
    background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; white-space: nowrap;
}
button:hover { border-color: var(--gold-dim); }
button.primary { background: var(--gold); color: #1a1406; border-color: var(--gold); font-weight: 600; }
button.danger { color: var(--red); }
button:disabled { opacity: .5; cursor: default; }

.pill { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--green); border-color: #24563d; }
.pill.bad { color: var(--red); border-color: #5c2a2a; }
.pill.warn { color: var(--amber); border-color: #5c4520; }
.pill.gold { color: var(--gold); border-color: var(--gold-dim); }
.msg { margin-top: 10px; font-size: 14px; }
.msg.ok { color: var(--green); }
.msg.bad { color: var(--red); }
.muted { color: var(--muted); }
.mono { font-family: Consolas, monospace; font-size: 13px; word-break: break-all; }

table.log { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.log th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.log td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.log tr.sel td { background: var(--panel-2); }
table.log tr { cursor: pointer; }

/* Telegram-like preview bubble */
.tg { background: #17212b; border-radius: 12px; padding: 14px; max-width: 420px; }
.tg .bubble { background: #182533; border: 1px solid #22344a; border-radius: 10px; padding: 10px 12px; line-height: 1.55; font-size: 14.5px; }
.tg .who { color: #6ab3f3; font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.tg code { background: #0f1923; padding: 0 4px; border-radius: 4px; }
.tg .time { text-align: right; color: #6d7f8f; font-size: 11.5px; margin-top: 4px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } .split, .row { grid-template-columns: 1fr; } }

.login { max-width: 380px; margin: 12vh auto; }
.login .brand { justify-content: center; }

#blazor-error-ui { background: #3a1d1d; bottom: 0; display: none; left: 0; padding: 10px 20px; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 12px; top: 8px; }
