:root {
    --bg: #f3f5f9;
    --card: #fff;
    --text: #1d2433;
    --muted: #677189;
    --line: #e2e6ef;
    --primary: #2f6fed;
    --ok: #1e8e4e;
    --warn: #b7791f;
    --err: #c62828;
    --info: #2f6fed;
}

* { box-sizing: border-box; }
html, body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
a { color: var(--primary); }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
code { background: #eef1f7; padding: 1px 4px; border-radius: 4px; font-size: 12px; }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #141a2a; color: #cdd3e1; padding: 16px 0; flex-shrink: 0; }
.sidebar .brand { font-weight: 700; font-size: 18px; color: #fff; padding: 0 18px 18px; }
.sidebar .brand span { color: #8ea8ff; font-weight: 500; }
.sidebar a { display: block; padding: 9px 18px; color: #cdd3e1; text-decoration: none; }
.sidebar a.active, .sidebar a:hover { background: #222b42; color: #fff; }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 10px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .user { font-weight: 600; }
.content { padding: 24px; max-width: 1400px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + section { margin-top: 16px; }
.stat .value { font-size: 30px; font-weight: 700; }
.stat .label { color: var(--muted); margin-bottom: 8px; }

.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .btn { margin-left: auto; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
td.actions { white-space: nowrap; }
table.texts td:first-child { width: 280px; }
table.texts input { width: 100%; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; background: #e9edf5; color: #42506b; }
.badge.ok { background: #e3f4ea; color: var(--ok); }
.badge.warn { background: #fdf1dc; color: var(--warn); }
.badge.err { background: #fde7e7; color: var(--err); }
.badge.info { background: #e6eeff; color: var(--info); }

.btn { display: inline-block; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; text-decoration: none; font-size: 14px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0 6px; font-size: 13px; }

input, select { padding: 7px 9px; border: 1px solid #cbd2df; border-radius: 6px; font-size: 14px; background: #fff; }
.form label { display: block; margin-bottom: 12px; font-weight: 600; }
.form label input, .form label select { display: block; width: 100%; max-width: 520px; margin-top: 4px; font-weight: 400; }
.form label textarea { display: block; width: 100%; max-width: 720px; margin-top: 4px; font-weight: 400; font-family: Consolas, monospace; font-size: 13px; padding: 7px 9px; border: 1px solid #cbd2df; border-radius: 6px; }
.form .hint, .form label .hint { display: block; margin: -6px 0 12px; font-weight: 400; font-size: 12px; color: var(--muted); }
tr.group td { border-top: 2px solid var(--line); }
.page-head h2 { margin: 0; }
.form label.inline { display: flex; align-items: center; gap: 6px; }
.form label.inline input { width: auto; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.toolbar label { display: flex; align-items: center; gap: 6px; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert.ok { background: #e3f4ea; border-color: #b9e2c9; }
.alert.warn { background: #fdf1dc; border-color: #f1d49a; }
.alert.error { background: #fde7e7; border-color: #f3b9b9; }
.alert.info { background: #e6eeff; border-color: #bccdfa; }

.muted { color: var(--muted); }
.ok { color: var(--ok); }
.version { font-size: 20px; font-weight: 700; }
.env.dev { border-top: 4px solid var(--info); }
.env.prod { border-top: 4px solid var(--ok); }

.issues { list-style: none; padding: 0; margin: 0; }
.issues li { padding: 6px 10px; border-radius: 6px; margin-bottom: 6px; }
.issues li.error { background: #fde7e7; }
.issues li.warning { background: #fdf6e6; }

.frame-wrap { background: #dfe4ee; border-radius: 10px; padding: 16px; overflow: auto; text-align: center; }
.frame-wrap iframe { height: 760px; max-width: 100%; border: 0; border-radius: 8px; background: #fff; box-shadow: 0 4px 20px rgba(20, 30, 60, .15); }

#blazor-error-ui { background: #fdf1dc; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

.topbar a.link, .topbar button.link { font-size: 13px; }
.topbar form.inline { display: inline; margin: 0; }
.account { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.account-card { width: 100%; max-width: 420px; }
.account-card .brand { font-weight: 700; font-size: 18px; margin-bottom: 16px; }
.account-card .brand span { color: var(--primary); font-weight: 500; }
.account-card .form label input { max-width: none; }
