/* ===== Prime TI Platform — Design System Prime TI (roxo escuro premium, Fluent/Win11) =====
   Mesmos tokens do painel Prime Backup para a família ficar coerente. */
:root {
    --bg: #14101f;
    --surface: #1d1730;
    --surface-2: #251d3a;
    --surface-3: #2c2346;
    --border: #342b4d;
    --border-soft: #2a2340;
    --text: #ece9f5;
    --muted: #a79fc4;
    --faint: #7d7599;
    --accent: #7c5cff;
    --accent-2: #9d7bff;
    --accent-soft: rgba(124, 92, 255, .14);
    --good: #3fbf87;
    --good-soft: rgba(63, 191, 135, .14);
    --warn: #e0a63a;
    --warn-soft: rgba(224, 166, 58, .14);
    --crit: #e5484d;
    --crit-soft: rgba(229, 72, 77, .15);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 30px rgba(0, 0, 0, .35);
    --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
h1 { font-size: 24px; letter-spacing: -.01em; }
h2 { font-size: 16px; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
code { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; }

/* ===================== shell ===================== */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
    background: linear-gradient(180deg, var(--surface) 0%, #191327 100%);
    border-right: 1px solid var(--border-soft);
    display: flex; flex-direction: column; padding: 20px 14px; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; color: var(--text); }
.brand-mark { width: 34px; height: 34px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 15px; }
.brand-text small { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { color: var(--faint); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 14px 10px 6px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--muted); transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav-item-disabled { color: var(--faint); cursor: default; }
.nav-item-disabled:hover { background: transparent; color: var(--faint); }
.nav-item em { margin-left: auto; font-style: normal; font-size: 10px; color: var(--faint); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.nav-ico { width: 18px; text-align: center; color: var(--accent-2); font-size: 13px; }
.sidebar-foot { padding: 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 28px; border-bottom: 1px solid var(--border-soft);
    background: rgba(20, 16, 31, .85); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 5;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.crumb { color: var(--muted); font-size: 13px; }
.tenant-form { margin: 0; }
.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-2); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.user-name { color: var(--muted); font-size: 13px; }
.content { padding: 28px; max-width: 1200px; width: 100%; display: flex; flex-direction: column; gap: 20px; }

/* ===================== componentes ===================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow { display: block; color: var(--accent-2); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 4px; }
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h2 { margin-bottom: 12px; }
.card-table { padding: 0; overflow-x: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.kpi-value { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.kpi-sub { color: var(--faint); font-size: 12px; }
.kpi-muted .kpi-value { color: var(--faint); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 18px; text-align: left; border-bottom: 1px solid var(--border-soft); }
.table th { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; background: var(--surface-2); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .empty { color: var(--faint); text-align: center; padding: 28px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid transparent; }
.pill-muted { background: var(--surface-3); color: var(--muted); border-color: var(--border); }
.pill-accent { background: var(--accent-soft); color: var(--accent-2); }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-crit { background: var(--crit-soft); color: var(--crit); }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { padding-left: 26px; position: relative; color: var(--text); }
.checklist li::before { content: ""; position: absolute; left: 0; top: 5px; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--border); }
.checklist li.ok::before { background: var(--good-soft); border-color: var(--good); box-shadow: inset 0 0 0 3px var(--surface); background: var(--good); }
.checklist li.next { color: var(--muted); }
.checklist li.next::before { border-style: dashed; border-color: var(--accent-2); }

.empty-state { text-align: center; padding: 48px 20px; }
.empty-state p { color: var(--muted); max-width: 46ch; margin: 8px auto 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; transition: filter .15s, background .15s; }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.btn-primary { background: linear-gradient(135deg, var(--accent) 0%, #6a48f0 100%); color: #fff; box-shadow: 0 6px 18px rgba(124, 92, 255, .3); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

.input, .select { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font: inherit; transition: border-color .15s, box-shadow .15s; }
.select { width: auto; min-width: 220px; padding: 7px 10px; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.validation-message { color: var(--crit); font-size: 12px; }
.alert { padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.alert-crit { background: var(--crit-soft); color: #ff8a8e; border: 1px solid rgba(229, 72, 77, .35); }

/* ===================== auth ===================== */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, rgba(124, 92, 255, .18), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.auth-brand img { width: 46px; height: 46px; object-fit: contain; }
.auth-brand h1 { font-size: 20px; }
.auth-brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.auth-foot { margin: 18px 0 0; color: var(--faint); font-size: 12px; text-align: center; }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--warn-soft); color: var(--warn); border-top: 1px solid var(--warn); padding: 10px 20px; z-index: 100; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

@media (max-width: 860px) {
    .sidebar { display: none; }
    .content { padding: 18px; }
    .topbar { padding: 10px 16px; }
    .user-name { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
