:root {
  --ink: #182230;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --canvas: #f8fafc;
  --primary: #1565d8;
  --primary-strong: #0e4fb1;
  --primary-soft: #eaf2ff;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --shadow: 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
.hidden { display: none !important; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; }
.auth-card { width: min(100%, 480px); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.brand-mark { width: 42px; height: 42px; overflow: hidden; border-radius: 12px; background: #071b3a; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.auth-card h1 { margin: 22px 0 8px; font-size: 1.7rem; letter-spacing: -.03em; }
.auth-card p { color: var(--muted); margin: 0 0 24px; }

.field { display: grid; gap: 7px; margin: 0 0 16px; }
.field label { color: #344054; font-size: .88rem; font-weight: 600; }
input { width: 100%; border: 1px solid #d0d5dd; border-radius: 9px; padding: 11px 12px; color: var(--ink); background: #fff; }
input:focus { outline: 3px solid rgba(21,101,216,.16); border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.button { border: 1px solid transparent; border-radius: 9px; padding: 10px 14px; font-weight: 650; transition: background .15s, border-color .15s; }
.button-primary { color: #fff; background: var(--primary); }
.button-primary:hover { background: var(--primary-strong); }
.button-secondary { color: #344054; border-color: #d0d5dd; background: #fff; }
.button-secondary:hover { background: #f9fafb; }
.button-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.button-danger:hover { color: #fff; background: var(--danger); }
.button-block { width: 100%; }
.button-small { padding: 6px 12px; font-size: .82rem; font-weight: 600; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #f9fafb; }
.auth-switch { display: inline-block; margin-top: 18px; color: var(--primary); font-size: .9rem; font-weight: 650; text-decoration: none; }
.subtle { font-size: .84rem; color: var(--muted); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 254px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; padding: 22px 14px; background: #fff; border-right: 1px solid var(--line); }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 25px; }
.side-brand strong { display: block; letter-spacing: -.02em; }
.side-brand small { color: var(--muted); }
.sidebar nav { display: grid; gap: 2px; }
.nav-label { margin: 16px 10px 7px; color: #98a2b3; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 0; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 0; padding: 8px 10px; border-radius: 10px; color: #475467; font-weight: 600; text-decoration: none; }
.nav-link:hover { background: #f2f4f7; }
.nav-link.active { color: #0d4fa6; background: var(--primary-soft); }
.nav-icon { display: grid; flex: 0 0 32px; width: 32px; height: 32px; place-items: center; border: 1px solid transparent; border-radius: 9px; background: #f2f4f7; color: #475467; }
.nav-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.nav-link:hover .nav-icon { background: #eaf2ff; color: #0d4fa6; }
.nav-link.active .nav-icon { border-color: #1565d8; background: #1565d8; color: #fff; }
.sidebar-footer { margin-top: auto; padding: 14px 10px 2px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }

.main { min-width: 0; padding: 32px clamp(20px, 4vw, 56px); }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 0 auto 30px; max-width: 1280px; }
.eyebrow { margin: 0 0 4px; color: var(--primary); font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.topbar h1 { margin: 0; font-size: clamp(1.5rem, 2vw, 2rem); letter-spacing: -.04em; }
.topbar p { margin: 5px 0 0; color: var(--muted); }
.identity-chip { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; color: #344054; background: #fff; font-size: .84rem; white-space: nowrap; }
.identity-dot { width: 8px; height: 8px; border-radius: 50%; background: #12b76a; }
/* Page visibility is controlled by the shared `.hidden` utility in app.js. */
.page { margin: 0 auto; max-width: 1280px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: 0 1px 2px rgba(16,24,40,.03); }
.metric span { display: block; color: var(--muted); font-size: .84rem; font-weight: 600; }
.metric strong { display: block; margin-top: 7px; color: #101828; font-size: 1.75rem; letter-spacing: -.04em; }
.metric small { color: var(--muted); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 2px rgba(16,24,40,.03); }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-header h2 { margin: 0; font-size: 1rem; }
.card-header p { margin: 3px 0 0; color: var(--muted); font-size: .86rem; }
.card-body { padding: 20px; }
.two-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 22px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 20px; border-bottom: 1px solid #eaecf0; text-align: left; vertical-align: middle; }
th { color: #667085; font-size: .72rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
td { color: #344054; font-size: .9rem; }
tr:last-child td { border-bottom: 0; }
.company-name { color: #101828; font-weight: 650; }
.table-wrap { overflow-x: auto; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: .75rem; font-weight: 700; }
.badge.success { color: var(--success); background: var(--success-soft); }
.badge.warning { color: var(--warning); background: var(--warning-soft); }
.badge.neutral { color: #475467; background: #f2f4f7; }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.empty { padding: 34px 20px; color: var(--muted); text-align: center; }

.notice { position: fixed; z-index: 10; right: 24px; bottom: 24px; max-width: min(420px, calc(100vw - 36px)); padding: 13px 16px; border: 1px solid; border-radius: 10px; box-shadow: var(--shadow); font-weight: 600; }
.notice.success { color: var(--success); border-color: #abefc6; background: var(--success-soft); }
.notice.error { color: var(--danger); border-color: #fecdca; background: var(--danger-soft); }
.notice.info { color: #175cd3; border-color: #b2ddff; background: #eff8ff; }

.status-panel { display: grid; gap: 10px; }
.status-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #eaecf0; }
.status-item:last-child { border-bottom: 0; }
.status-item span { color: var(--muted); }
.session-card { max-width: 580px; }
.session-email { color: #101828; font-size: 1.15rem; font-weight: 700; }

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 4; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-brand { flex: 0 0 auto; padding: 0 16px 0 0; }
  .side-brand small, .nav-label, .sidebar-footer { display: none; }
  .sidebar nav { display: flex; }
  .nav-link { flex: 0 0 auto; }
  .main { padding: 25px 18px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-columns { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .auth-card { padding: 24px; }
  .topbar { display: block; }
  .identity-chip { display: inline-flex; margin-top: 14px; }
  .metrics { gap: 10px; }
  .metric { padding: 14px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  th, td { padding: 11px 14px; }
}
