/* Loxada HV - Human Verification Portal
   Recreated from the hi-fi handoff: light left sidebar, sticky top header,
   teal accent, Hanken Grotesk UI with JetBrains Mono for codes and IDs.
   Adaptive: the sidebar collapses off-canvas behind a hamburger on mobile. */

:root {
  --brand: #0E8C7A;
  --brand-hover: #0B7567;
  --brand-deep: #0B6F61;
  --brand-bright: #10A693;
  --nav-active-bg: #E6F4F1;
  --nav-active-text: #0B7567;

  --ink: #0E2433;
  --body: #5E6F79;
  --muted: #7C8C96;
  --muted2: #8A99A2;
  --nav-inactive: #44555E;

  --app-bg: #EEF2F5;
  --surface: #FFFFFF;
  --input-bg: #F8FAFB;

  --border-card: #E7ECEF;
  --divider: #EEF2F4;
  --divider2: #EDF1F3;
  --border-input: #DCE3E7;
  --border-btn: #D7DEE3;
  --border-btn2: #D2DBE0;

  --code-dark-bg: #0E2433;
  --code-dark-text: #EAF1F0;
  --code-light-bg: #EFF3F5;
  --code-light-border: #E2E8EB;

  --pill-bg: #EAF7F4;
  --pill-border: #CFEAE3;
  --pill-text: #0B6F61;

  --success: #1F9D57;
  --danger: #C0392B;
  --danger-wash: #FBEAE8;

  --t3-bg: #DCF0E4; --t3: #1F7A4D;
  --t2-bg: #FBEBCF; --t2: #9A6B1E;
  --t1-bg: #E2E8F8; --t1: #3B5BA9;

  --shadow: 0 1px 2px rgba(16, 40, 55, 0.04);
  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --sidebar-w: 252px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--app-bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: var(--brand-deep); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }

/* ===================== App shell ===================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border-card);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.brand-block { padding: 22px 22px 20px; border-bottom: 1px solid var(--divider2); }
.brand-row { display: flex; align-items: center; gap: 11px; }
.brand-dot {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--brand-bright);
  box-shadow: 0 0 0 4px rgba(14, 140, 122, 0.14);
  flex: none;
}
.brand-title { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.brand-sub { font-size: 13px; color: var(--muted2); margin-top: 6px; margin-left: 24px; }

.nav { padding: 18px 14px; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-group.second { padding-top: 20px; }
.nav-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.11em;
  text-transform: uppercase; color: #9AA8B0; padding: 0 12px 9px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  font-size: 15px; font-weight: 600; color: var(--nav-inactive);
  text-decoration: none; transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: #F2F6F7; }
.nav-item .icon { flex: none; }
.nav-item.active { background: var(--nav-active-bg); color: var(--nav-active-text); font-weight: 700; }

.sidebar-footer { margin-top: auto; padding: 16px 22px; border-top: 1px solid var(--divider2); }
.status-row { display: flex; align-items: center; gap: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-bright); flex: none; }
.status-title { font-size: 12.5px; font-weight: 600; color: #3A4A53; }
.status-sub { font-size: 12px; color: var(--muted2); }
.version { text-align: center; font-size: 12px; color: #B4C0C7; margin-top: 14px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ===================== Header ===================== */
.topbar {
  position: sticky; top: 0; z-index: 5;
  height: 74px; background: var(--surface);
  border-bottom: 1px solid var(--border-card);
  padding: 0 38px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.hamburger {
  display: none;
  width: 40px; height: 40px; border-radius: 9px;
  border: 1px solid var(--border-input); background: var(--surface);
  color: var(--ink); cursor: pointer;
  align-items: center; justify-content: center;
}
.hamburger:hover { background: #F4F7F8; }

.session-pill {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px; background: var(--pill-bg);
  border: 1px solid var(--pill-border); border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--pill-text);
}
.session-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-bright); flex: none; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-chip { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex: none;
}
.user-meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.user-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.user-role { font-size: 12px; color: #7C8C96; }

.signout {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 16px; background: var(--surface);
  border: 1px solid var(--border-btn); border-radius: 9px;
  font-size: 13.5px; font-weight: 600; color: #43555F;
  text-decoration: none; transition: all .12s ease;
}
.signout:hover { background: #F4F7F8; border-color: #C2CCD2; color: var(--ink); }

/* ===================== Content ===================== */
.content { flex: 1; overflow: auto; padding: 40px 38px 64px; }
.content-inner { max-width: 1180px; margin: 0 auto; }
.content-inner.narrow { max-width: 680px; }

.page-title {
  font-size: 38px; font-weight: 800; color: var(--ink);
  letter-spacing: -0.025em; margin: 0 0 30px;
}

.card {
  background: var(--surface); border: 1px solid var(--border-card);
  border-radius: 18px; padding: 30px 32px; box-shadow: var(--shadow);
  margin-bottom: 26px;
}
.card:last-child { margin-bottom: 0; }
.card h1 { font-size: 23px; font-weight: 700; margin: 0 0 8px; }
.card h2 { font-size: 23px; font-weight: 700; margin: 0 0 8px; }
.sub { font-size: 15.5px; color: var(--body); line-height: 1.55; margin: 0 0 20px; }
.muted { color: var(--muted); font-size: 14.5px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-bottom: 26px; }
.verify-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }

/* ===================== Buttons ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 15.5px; font-weight: 700;
  padding: 14px 24px; border-radius: 11px;
  border: 1px solid var(--border-btn2); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; transition: all .12s ease;
}
.btn:hover { border-color: var(--brand); color: var(--brand-deep); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn.block { width: 100%; }
.btn.small { padding: 8px 14px; font-size: 13.5px; border-radius: 9px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===================== Forms ===================== */
.form { display: flex; flex-direction: column; gap: 16px; }
.form.inline { flex-direction: row; align-items: stretch; gap: 14px; }
.form.inline .code-input { flex: 1; }
.form label { display: flex; flex-direction: column; gap: 7px; font-size: 14px; font-weight: 600; color: #43555F; }
.form.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 28px; }
.form.grid2 .full { grid-column: 1 / -1; }
.form .check { flex-direction: row; align-items: center; gap: 10px; align-self: end; }
.form .check input { width: 18px; height: 18px; accent-color: var(--brand); }

input, select {
  font-family: inherit; font-size: 15px; color: var(--ink);
  padding: 13px 15px; border: 1px solid var(--border-input);
  border-radius: 10px; background: var(--input-bg); width: 100%;
}
input::placeholder { color: #A9B6BD; }
input:focus, select:focus { outline: none; border-color: var(--brand); background: #fff; }

.code-input {
  font-family: var(--mono); font-size: 16px; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 16px 18px; border-radius: 11px;
}
.code-input::placeholder { letter-spacing: 0.12em; }

/* ===================== Key/value rows ===================== */
.kv {
  display: flex; justify-content: space-between; gap: 18px;
  padding: 15px 0; border-top: 1px solid var(--divider); font-size: 15px;
}
.kv:first-child { border-top: 0; }
.kv span { color: #7C8C96; }
.kv b { font-size: 15.5px; font-weight: 700; text-align: right; }

/* ===================== Trust badges ===================== */
.badge {
  display: inline-block; min-width: 34px; text-align: center;
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
}
.trust-3 { background: var(--t3-bg); color: var(--t3); }
.trust-2 { background: var(--t2-bg); color: var(--t2); }
.trust-1 { background: var(--t1-bg); color: var(--t1); }

/* ===================== Alerts ===================== */
.alert { padding: 13px 15px; border-radius: 10px; font-size: 14.5px; }
.alert.error { background: var(--danger-wash); color: var(--danger); border: 1px solid #EFCDC9; }
.alert.success { background: #E7F6EC; color: var(--success); border: 1px solid #C6E6D1; }

/* ===================== Waiting room ===================== */
.invite-code {
  font-family: var(--mono); font-weight: 700; font-size: clamp(38px, 8.5vw, 72px);
  letter-spacing: 0.18em; color: var(--ink); text-align: center;
  text-indent: 0.18em; white-space: nowrap;
  background: var(--code-light-bg); border: 1px solid var(--code-light-border);
  border-radius: 14px; padding: 46px 20px; margin: 8px 0 16px;
}
.spinner {
  width: 30px; height: 30px; border: 3px solid #DCE6E4;
  border-top-color: var(--brand); border-radius: 50%;
  animation: spin 0.9s linear infinite; margin: 16px 0 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== Challenge ===================== */
.my-code {
  font-family: var(--mono); font-weight: 700; font-size: clamp(40px, 9vw, 78px);
  letter-spacing: 0.14em; color: var(--code-dark-text); text-align: center;
  text-indent: 0.14em; white-space: nowrap;
  background: var(--code-dark-bg); border-radius: 14px;
  padding: 44px 20px; margin: 8px 0 14px;
}

/* Size the code displays to fit the card they sit in, so 6 digits never wrap
   whether the verification cards are side by side or stacked. */
.code-card { container-type: inline-size; }
@supports (font-size: 1cqi) {
  .my-code { font-size: min(78px, 17cqi); }
  .invite-code { font-size: min(72px, 16cqi); }
}
#their-code {
  font-family: var(--mono); font-size: 24px; text-align: center;
  letter-spacing: 0.14em; padding: 20px 22px; border-radius: 12px;
  margin-bottom: 4px;
}

/* ===================== Result ===================== */
.result { text-align: center; }
.result-icon {
  width: 88px; height: 88px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px; color: #fff;
}
.result.ok .result-icon { background: var(--success); }
.result.fail .result-icon { background: var(--danger); }
.result.fail .result-icon::before { content: "\2715"; font-size: 40px; }
.result h1 { font-size: 30px; font-weight: 800; margin: 0 0 6px; }
.result .big { font-size: 16px; color: var(--body); margin: 0 0 4px; }
.identity {
  background: var(--code-light-bg); border-radius: 14px;
  padding: 26px 24px; margin: 18px 0; text-align: center;
}
.identity-name { font-size: 24px; font-weight: 800; }
.identity-role { font-size: 16px; color: #4A5B65; margin-top: 4px; }
.identity-dept { font-size: 14.5px; color: var(--muted2); margin-top: 2px; }
.identity-email { margin-top: 10px; }
.identity-email a { color: var(--brand-deep); text-decoration: underline; }
.result-meta { text-align: left; margin: 18px 0 22px; }
.result-meta .kv b { font-family: inherit; }

/* ===================== Tables ===================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table.users { min-width: 760px; }
.table.audit { min-width: 980px; }
.table th {
  text-align: left; padding: 12px 15px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted2);
  border-bottom: 1px solid var(--divider);
}
.table td {
  padding: 15px; font-size: 15px; border-top: 1px solid var(--divider);
  vertical-align: top;
}
.table td.mono { font-family: var(--mono); font-size: 14px; }
.table .evt { font-weight: 600; }
.table .small-cell { font-size: 13px; }
.table .muted-cell { color: var(--muted); }
.back-link { color: var(--brand-deep); text-decoration: underline; font-weight: 600; font-size: 14.5px; }

/* ===================== POC helper boxes ===================== */
.dev-box {
  margin-top: 20px; padding: 14px 16px;
  border: 1px dashed var(--border-input); border-radius: 10px;
  background: #FBFDFD; font-size: 13px; color: var(--body);
}
.dev-box code { font-family: var(--mono); }
.dev-accounts { margin-top: 9px; font-family: var(--mono); font-size: 12px; color: var(--muted); line-height: 1.7; }
.mfa-reveal { font-family: var(--mono); font-weight: 700; font-size: 18px; margin-left: 10px; color: var(--brand-deep); }

/* ===================== Auth layout ===================== */
body.auth { display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-main { width: 100%; max-width: 440px; }
.auth-brand { display: flex; align-items: center; gap: 11px; justify-content: center; margin-bottom: 20px; }
.auth-card { padding: 32px; }
.auth-card h1 { font-size: 24px; font-weight: 800; }

/* ===================== Scrim (mobile sidebar) ===================== */
.scrim {
  position: fixed; inset: 0; background: rgba(14, 36, 51, 0.42);
  opacity: 0; visibility: hidden; transition: opacity .2s ease; z-index: 30;
}
body.nav-open .scrim { opacity: 1; visibility: visible; }

/* ===================== Responsive ===================== */
@media (max-width: 900px) {
  .hamburger { display: flex; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 12px 40px rgba(14, 36, 51, 0.18);
  }
  body.nav-open .sidebar { transform: translateX(0); }

  .topbar { padding: 0 18px; }
  .content { padding: 28px 18px 56px; }
  .page-title { font-size: 30px; margin-bottom: 22px; }
  .grid, .verify-grid { grid-template-columns: 1fr; gap: 18px; }
  .form.grid2 { grid-template-columns: 1fr; gap: 16px; }
  .card { padding: 24px 22px; border-radius: 16px; }

  .session-pill { font-size: 12px; padding: 6px 11px; }
  .user-meta { display: none; }
  .signout span { display: none; }
  .signout { padding: 9px 11px; }

  .invite-code { padding: 34px 16px; }
  .my-code { padding: 34px 16px; }
}

@media (max-width: 480px) {
  .session-pill { display: none; }
  .invite-code { letter-spacing: 0.16em; }
  .my-code { letter-spacing: 0.12em; }
}

/* Respect reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .sidebar, .scrim, .btn, .signout { transition: none; }
}
