/* ilvi Management Portal — dark operations console */
:root {
    --bg: #0e1116;
    --bg-2: #141922;
    --surface: #181e28;
    --surface-2: #1f2633;
    --border: #2a3242;
    --text: #e7ebf2;
    --muted: #8d97a8;
    --accent: #5aa9ff;
    --ok: #35c98a;
    --warn: #f2b53c;
    --err: #ff5d5d;
    --info: #5aa9ff;
    --radius: 10px;
    --sidebar: 248px;
    --font: -apple-system, "Inter", "Segoe UI", system-ui, sans-serif;
    --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 0; color: var(--muted); }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.wrap { white-space: normal; word-break: break-word; }
.text-err { color: var(--err); }
.dim { opacity: 0.55; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.end { justify-content: flex-end; }
.wrap-sm { flex-wrap: wrap; }

/* shell */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.content { padding: 26px 32px 60px; min-width: 0; }
.brand { display: flex; align-items: baseline; gap: 8px; color: var(--text); padding: 4px 8px 18px; }
.brand:hover { text-decoration: none; }
.brand-mark { font-family: var(--mono); font-weight: 700; font-size: 18px; color: var(--accent); letter-spacing: -0.02em; }
.brand-name { font-size: 13px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 16px 8px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.nav-link:hover { background: var(--surface); text-decoration: none; }
.nav-link.active { background: var(--surface-2); color: #fff; }
.glyph { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); color: var(--accent); font-family: var(--mono); font-weight: 700; font-size: 12px; }
.sidebar-user { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 12px; }
.sidebar-user .name { font-weight: 600; }
.sidebar-user .meta { font-size: 12px; color: var(--muted); word-break: break-all; }
.user-actions { display: flex; gap: 12px; margin-top: 8px; font-size: 13px; }
.user-actions form { display: inline; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.linklike:hover { text-decoration: underline; }

/* auth */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, #17223a 0%, var(--bg) 60%); }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; }
.auth-card .brand { padding: 0 0 18px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card p { margin: 0 0 18px; }

/* page head */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; min-width: 0; }
.card.narrow { max-width: 520px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card-grid .card { margin: 0; }

/* stats */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: 2px; }
.stat-hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.ok .stat-value { color: var(--ok); }
.stat.warn .stat-value { color: var(--warn); }
.stat.err .stat-value { color: var(--err); }
.stat.info .stat-value { color: var(--info); }
.stat.muted .stat-value { color: var(--muted); }

/* pills, notices */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.pill.tiny { font-size: 10px; padding: 0 6px; }
.pill.ok { color: var(--ok); background: rgba(53, 201, 138, 0.12); border-color: rgba(53, 201, 138, 0.35); }
.pill.warn { color: var(--warn); background: rgba(242, 181, 60, 0.12); border-color: rgba(242, 181, 60, 0.35); }
.pill.err { color: var(--err); background: rgba(255, 93, 93, 0.12); border-color: rgba(255, 93, 93, 0.35); }
.pill.info { color: var(--info); background: rgba(90, 169, 255, 0.12); border-color: rgba(90, 169, 255, 0.35); }
.pill.muted { color: var(--muted); background: var(--surface-2); border-color: var(--border); }
.pill.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; font-size: 13px; }
.notice.ok { color: var(--ok); border-color: rgba(53, 201, 138, 0.4); background: rgba(53, 201, 138, 0.08); }
.notice.warn { color: var(--warn); border-color: rgba(242, 181, 60, 0.4); background: rgba(242, 181, 60, 0.08); }
.notice.err { color: var(--err); border-color: rgba(255, 93, 93, 0.4); background: rgba(255, 93, 93, 0.08); }
.notice.info { color: var(--info); border-color: rgba(90, 169, 255, 0.4); background: rgba(90, 169, 255, 0.08); }
.age.ok { color: var(--ok); } .age.warn { color: var(--warn); } .age.err { color: var(--err); } .age.muted { color: var(--muted); }

/* status strip */
.strip { border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); padding: 14px 18px; margin-bottom: 16px; }
.strip-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.strip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.strip.ok .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(53, 201, 138, 0.15); }
.strip.err { border-color: rgba(255, 93, 93, 0.4); }
.strip.err .dot { background: var(--err); box-shadow: 0 0 0 4px rgba(255, 93, 93, 0.15); }
.strip.busy { border-color: rgba(90, 169, 255, 0.4); }
.strip.busy .dot { background: var(--info); animation: pulse 1.2s ease-in-out infinite; }
.strip .phase { color: var(--text); }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress .bar { height: 100%; background: linear-gradient(90deg, var(--info), #8fd0ff); transition: width 0.6s ease; }
.strip-nums { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip-nums b { color: var(--text); font-weight: 600; margin-left: 4px; }

/* modules */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.module-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; color: var(--text); transition: border-color 0.15s, transform 0.15s; }
.module-card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.module-card.ok { border-left: 3px solid var(--ok); }
.module-card.warn { border-left: 3px solid var(--warn); }
.module-card.err { border-left: 3px solid var(--err); }
.module-head { display: flex; align-items: flex-start; gap: 12px; }
.module-head > div { flex: 1; min-width: 0; }
.module-glyph { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--surface-2); color: var(--accent); font-family: var(--mono); font-weight: 700; font-size: 16px; flex: none; }
.module-title { font-weight: 650; font-size: 15px; }
.module-desc { font-size: 12.5px; color: var(--muted); }
.module-summary { margin-top: 12px; font-size: 13.5px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 12px 0 0; font-size: 12.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 7px 8px; border-bottom: 1px solid rgba(42, 50, 66, 0.6); vertical-align: middle; }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.table tr.open { background: var(--surface-2); }
.table tr.detail td { background: var(--bg-2); padding: 10px 14px; }
.table select { padding: 3px 6px; }
.card > .table { display: block; overflow-x: auto; }
.card > .table thead, .card > .table tbody { display: table; width: 100%; }

/* forms & buttons */
label { display: block; margin-bottom: 12px; }
label > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
label.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
label.inline > span { margin: 0; white-space: nowrap; }
input, select { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; font: inherit; }
label.inline input { width: 190px; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(90, 169, 255, 0.2); }
select { width: auto; }
.validation-message { color: var(--err); font-size: 12px; margin-top: 4px; }
.btn { display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b1424; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #74b8ff; }
.btn.danger:hover:not(:disabled) { border-color: var(--err); color: var(--err); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; align-items: center; margin-top: 6px; }
.trigger-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.trigger-grid .btn { padding: 12px 14px; }
.trigger-grid .btn span { font-size: 12px; }

/* blazor error ui */
#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; color: #111; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }
    .content { padding: 18px 16px 40px; }
}
