/* LP Lite Admin. One stylesheet: tokens, layout, components. Mobile: the sidebar becomes a drawer below 900px. */
:root {
    --bg: #f5f6fa;
    --card: #fff;
    --text: #172033;
    --muted: #64708a;
    --line: #e3e7ef;
    --line-strong: #cdd4e1;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eaf1ff;
    --ok: #15803d;
    --ok-soft: #e6f6ec;
    --warn: #a16207;
    --warn-soft: #fdf3dc;
    --err: #c02626;
    --err-soft: #fdeaea;
    --info: #2563eb;
    --nav: #0f172a;
    --nav-text: #b8c2d6;
    --nav-hover: #1c2740;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
    --shadow-lg: 0 10px 30px rgba(15, 23, 42, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; margin: 0 0 16px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
h1:focus, h1:focus-visible { outline: none; }
code { background: #eef1f7; padding: 1px 5px; border-radius: 4px; font-size: 12px; font-family: ui-monospace, Consolas, monospace; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Shell: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; background: linear-gradient(to right, var(--nav) 232px, var(--bg) 232px); }
.sidebar { width: 232px; flex-shrink: 0; background: var(--nav); color: var(--nav-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 16px; }
.brand .logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #3b82f6, #6366f1); font-size: 12px; letter-spacing: .02em; }
.brand em { font-style: normal; color: #8fb0ff; font-weight: 500; }
.nav { padding: 6px 10px 20px; }
.nav-section { margin: 14px 8px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #64708a; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--nav-text); text-decoration: none; font-weight: 500; }
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav a:hover { background: var(--nav-hover); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav a.active svg { opacity: 1; }
.sidebar .env-note { margin: auto 18px 16px; font-size: 11px; color: #64708a; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); min-height: 56px; }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px; cursor: pointer; color: var(--text); }
.menu-toggle svg { width: 20px; height: 20px; display: block; }
.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; font-size: 12px; text-transform: uppercase; }
.user-chip .name { font-weight: 600; }
.user-chip .roles { display: flex; gap: 4px; }
.topbar a.link, .topbar button.link { font-size: 13px; }
.topbar form.inline { display: inline; margin: 0; }
.content { padding: 24px; width: 100%; max-width: 1440px; }
.backdrop { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.page-head h1, .page-head h2 { margin: 0; }
.page-head .btn, .page-head .actions { margin-left: auto; }
.page-sub { margin: -8px 0 18px; color: var(--muted); max-width: 900px; }

/* ---------- Cards, grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); overflow-x: auto; }
.card > h2:first-child { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head .actions, .card-head > .btn { margin-left: auto; }
.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.four { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + section, .grid + .grid { margin-top: 16px; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat .label { color: var(--muted); }
.stat a { margin-top: 8px; font-size: 13px; }
.stat.accent { border-top: 3px solid var(--primary); }

.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.attention li:last-child { border-bottom: 0; }
.attention .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--warn); }
.attention .dot.err { background: var(--err); }
.attention .dot.info { background: var(--info); }
.attention a.go { margin-left: auto; white-space: nowrap; font-size: 13px; }
.all-clear { display: flex; align-items: center; gap: 8px; color: var(--ok); font-weight: 600; }

.quick { display: flex; flex-wrap: wrap; gap: 8px; }

.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; background: #fafbfd; }
tbody tr:hover td { background: #fafbff; }
td.actions { white-space: nowrap; text-align: right; }
td.num, th.num { text-align: right; }
td.nowrap { white-space: nowrap; }
tr.group td { border-top: 2px solid var(--line); background: #fcfcfe; }
table.texts td:first-child { width: 280px; }
table.texts input { width: 100%; }

/* ---------- Badges, buttons, inputs ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #eef1f6; color: #45516b; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--primary-soft); color: var(--info); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; color: var(--text); cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 500; line-height: 1.2; }
.btn:hover { background: #f6f8fc; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; color: var(--primary); cursor: pointer; padding: 0 6px; font-size: 13px; font-weight: 500; }
button.link:hover { text-decoration: underline; }

input, select, textarea { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 14px; background: #fff; color: var(--text); font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.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: ui-monospace, Consolas, monospace; font-size: 13px; }
.form .hint, .form label .hint { display: block; margin: -6px 0 12px; font-weight: 400; font-size: 12px; color: var(--muted); }
.form label.inline { display: flex; align-items: center; gap: 6px; }
.form label.inline input { width: auto; margin: 0; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; max-width: 720px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.toolbar label { display: flex; align-items: center; gap: 6px; }
.search { min-width: 240px; }

/* ---------- Alerts, toast ---------- */
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.alert.ok { background: var(--ok-soft); border-color: #bfe3cc; }
.alert.warn { background: var(--warn-soft); border-color: #f0d79f; }
.alert.error { background: var(--err-soft); border-color: #f2bcbc; }
.alert.info { background: var(--primary-soft); border-color: #c4d6fb; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 1100; padding: 10px 16px; border-radius: 10px; background: #0f172a; color: #fff; box-shadow: var(--shadow-lg); font-weight: 500; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 9px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { border-bottom-color: var(--primary); color: var(--text); font-weight: 600; }
.tab .count { margin-left: 6px; padding: 0 7px; border-radius: 999px; background: #eef1f6; font-size: 11px; color: var(--muted); }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.version { font-size: 20px; font-weight: 700; }
.env.dev { border-top: 3px solid var(--info); }
.env.prod { border-top: 3px solid var(--ok); }
.url { display: flex; align-items: center; gap: 6px; min-width: 0; }
.url code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; display: inline-block; vertical-align: middle; }

.issues { list-style: none; padding: 0; margin: 0; }
.issues li { padding: 6px 10px; border-radius: 6px; margin-bottom: 6px; }
.issues li.error { background: var(--err-soft); }
.issues li.warning { background: var(--warn-soft); }

.frame-wrap { background: #e4e8f1; 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: var(--warn-soft); 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; }

.account { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at 20% 0, #e9efff, var(--bg) 60%); }
.account-card { width: 100%; max-width: 420px; }
.account-card .brand { padding: 0 0 14px; color: var(--text); }
.account-card .brand em { color: var(--primary); }
.account-card .form label input { max-width: none; }

.card .toolbar h2 { margin: 0; }
.form textarea { width: 100%; max-width: 640px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
pre.result { margin: 0 0 12px; padding: 10px 12px; max-height: 360px; overflow: auto; background: #eef1f7; border-radius: 8px; font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.call { padding: 8px 0; border-top: 1px solid var(--line); }
.call summary { cursor: pointer; }
.call h3 { margin: 10px 0 6px; font-size: 13px; }
.text-value { max-width: 520px; white-space: pre-wrap; word-break: break-word; font-size: 13px; }

/* ---------- Phones and small tablets ---------- */
@media (max-width: 900px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
    .shell { background: var(--bg); }
    .shell.nav-open .sidebar { box-shadow: var(--shadow-lg); }
    .shell.nav-open .sidebar { transform: none; }
    .shell.nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 42, .45); }
    .menu-toggle { display: inline-block; }
    .topbar { padding: 8px 16px; }
    .user-chip .roles, .user-chip .name { display: none; }
    .content { padding: 16px; }
    .grid.split { grid-template-columns: 1fr; }
    .card { padding: 14px 16px; }
    h1 { font-size: 20px; }
    .search { min-width: 0; width: 100%; }
    .frame-wrap iframe { height: 640px; }
}
