:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #182234;
  --muted: #69758a;
  --line: #dce3ed;
  --brand: #263f72;
  --brand-2: #365da7;
  --good: #19734a;
  --warn: #9a6200;
  --bad: #a12b34;
  --status-good: #00c853;
  --status-warn: #ffc400;
  --status-bad: #ff1744;
  --shadow: 0 14px 34px rgba(31, 48, 78, .10);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.shell { min-height: 100vh; }
.topbar { height: 68px; background: #15233c; color: white; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.brand { display:flex; align-items:center; gap:12px; font-weight:750; letter-spacing:.2px; }
.brand-mark { width:34px; height:34px; display:grid; place-items:center; border-radius:9px; background:#fff; color:#15233c; font-size:19px; }
.top-user { display:flex; align-items:center; gap:14px; font-size:14px; }
.badge { display:inline-flex; align-items:center; padding:4px 9px; border-radius:999px; font-size:12px; font-weight:700; background:#e8eef9; color:#27426f; }
.badge.good { background:#e4f4eb; color:var(--good); }
.badge.warn { background:#fff4da; color:var(--warn); }
.badge.bad { background:#fff0f1; color:var(--bad); }
.badge.muted { background:#eef0f3; color:#606b7c; }
.badge.shared { background:#eee9ff; color:#5d46a4; }
.layout { display:grid; grid-template-columns: 230px minmax(0, 1fr); min-height:calc(100vh - 68px); }
.sidebar { background:#fff; border-right:1px solid var(--line); padding:20px 14px; }
.nav-title { color:var(--muted); font-size:11px; text-transform:uppercase; letter-spacing:.12em; margin: 8px 10px; font-weight:800; }
.nav button { width:100%; border:0; background:transparent; color:#354158; border-radius:9px; text-align:left; padding:11px 12px; margin:2px 0; }
.nav button:hover { background:#f1f5fb; }
.nav button.active { background:#e9eff9; color:#1f3d72; font-weight:750; }
.content { padding:30px; max-width:1500px; width:100%; margin:0 auto; }
.page-head { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; margin-bottom:22px; }
h1 { margin:0 0 5px; font-size:27px; }
h2 { margin:0 0 14px; font-size:20px; }
p.sub { margin:0; color:var(--muted); }
.card { background:var(--surface); border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow); }
.card.pad { padding:20px; }
.toolbar { display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-bottom:15px; }
.search { min-width:280px; flex:1; }
input, select, textarea { width:100%; border:1px solid #cfd7e4; background:white; color:var(--ink); border-radius:9px; padding:10px 11px; outline:none; }
input:focus, select:focus, textarea:focus { border-color:#7994c5; box-shadow:0 0 0 3px rgba(67,105,171,.12); }
textarea { min-height:90px; resize:vertical; }
.btn { border:1px solid #cfd7e4; background:white; color:#2f3c52; border-radius:9px; padding:9px 13px; font-weight:700; }
.btn:hover { background:#f6f8fb; }
.btn.primary { border-color:var(--brand); background:var(--brand); color:white; }
.btn.primary:hover { background:var(--brand-2); }
.btn.danger { color:var(--bad); border-color:#e4bec2; background:#fff8f8; }
.btn.ghost { border-color:transparent; background:transparent; }
.segment { display:flex; border:1px solid #cfd7e4; border-radius:9px; overflow:hidden; }
.segment button { border:0; border-right:1px solid #cfd7e4; background:white; padding:9px 12px; color:#566177; }
.segment button:last-child { border-right:0; }
.segment button.active { background:#e9eff9; color:#1f3d72; font-weight:800; }
table { width:100%; border-collapse:collapse; }
th, td { text-align:left; border-bottom:1px solid #e6ebf2; padding:12px 13px; vertical-align:middle; }
th { background:#f8fafc; color:#5f6c80; font-size:12px; text-transform:uppercase; letter-spacing:.04em; }
tr:last-child td { border-bottom:0; }
.actions { display:flex; gap:5px; }
.tenant-actions { flex-wrap:wrap; min-width:290px; }
.tenant-actions .btn { padding:6px 9px; font-size:12px; }
.tenant-deleted td { background:#fbfbfc; color:#69758a; }
.icon-btn { border:1px solid #d8dfe9; background:white; border-radius:8px; padding:6px 8px; }
.empty { padding:45px 20px; text-align:center; color:var(--muted); }
.login-wrap { min-height:100vh; display:grid; place-items:center; padding:24px; background: radial-gradient(circle at 15% 20%, #dfe8f8 0, transparent 34%), radial-gradient(circle at 90% 80%, #e9edf6 0, transparent 32%), #f4f6fa; }
.login-card { width:min(430px, 100%); padding:28px; }
.login-logo { width:54px; height:54px; display:grid; place-items:center; background:#172642; color:white; border-radius:14px; font-size:28px; margin-bottom:18px; }
.field { margin-bottom:14px; }
.field label { display:block; font-size:13px; font-weight:750; margin-bottom:6px; color:#445166; }
.notice { border-radius:10px; padding:11px 13px; font-size:13px; margin:12px 0; background:#eef4ff; color:#36527f; border:1px solid #d8e4f8; }
.notice.warn { background:#fff8e8; color:#795415; border-color:#f0dfb5; }
.notice.bad { background:#fff0f1; color:#8a2a33; border-color:#efcbd0; }
.demo-accounts { font-size:12px; color:#667287; line-height:1.55; background:#f8fafc; border:1px solid #e1e7ef; padding:11px; border-radius:9px; margin-top:16px; }
.grid2 { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.grid3 { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin-bottom:20px; }
.stat { padding:18px; }
.stat .num { font-size:29px; font-weight:800; margin-top:4px; }
.stat .label { color:var(--muted); font-size:13px; }
.modal-backdrop { position:fixed; inset:0; background:rgba(17,28,48,.56); display:grid; place-items:center; padding:20px; z-index:50; }
.modal { width:min(620px,100%); max-height:92vh; overflow:auto; background:white; border-radius:15px; box-shadow:0 24px 70px rgba(0,0,0,.25); border:1px solid #d7dee9; }
.modal-head { display:flex; justify-content:space-between; align-items:center; padding:18px 20px; border-bottom:1px solid #e4e9f0; }
.modal-body { padding:20px; }
.modal-foot { padding:15px 20px; border-top:1px solid #e4e9f0; display:flex; justify-content:flex-end; gap:8px; }
.pw-line { display:flex; gap:8px; }
.pw-box { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; background:#f5f7fa; border:1px solid #dce3ed; border-radius:9px; padding:10px 12px; word-break:break-all; flex:1; }
.tags { display:flex; gap:6px; flex-wrap:wrap; }
.tag { padding:3px 7px; border-radius:6px; background:#edf2f8; color:#4e607b; font-size:12px; }
.kicker { font-size:12px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); font-weight:800; margin:16px 0 6px; }
.secret { font-family:ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing:.08em; border:1px dashed #9dabc0; background:#f9fbfd; padding:10px; border-radius:8px; word-break:break-all; }
.dev-banner { background:#fff2cb; color:#765309; border-bottom:1px solid #ead48c; padding:8px 20px; text-align:center; font-size:12px; }
@media (max-width: 800px) {
  .layout { grid-template-columns:1fr; }
  .sidebar { border-right:0; border-bottom:1px solid var(--line); }
  .nav { display:flex; overflow:auto; gap:5px; }
  .nav-title { display:none; }
  .nav button { white-space:nowrap; width:auto; }
  .content { padding:20px 14px; }
  .grid2,.grid3 { grid-template-columns:1fr; }
  .page-head { flex-direction:column; }
  .topbar { padding:0 15px; }
  .top-user .email { display:none; }
}
.vault-password { display:flex; align-items:center; gap:5px; min-width:185px; }
.vault-password-value { display:inline-block; min-width:105px; max-width:220px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace; }
.icon-btn.mini { padding:4px 6px; font-size:12px; line-height:1.15; }
.btn:disabled { opacity:.6; cursor:not-allowed; }

.site-footer { color:var(--muted); font-size:12px; text-align:center; }
.login-footer { border-top:1px solid var(--line); margin-top:18px; padding-top:14px; }
.app-footer { border-top:1px solid var(--line); background:#fff; padding:12px 20px; }

/* v2.6 security/recovery UI */
.login-help { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); text-align:center; font-size:13px; color:var(--muted); }
.login-help a { color:var(--brand-2); font-weight:750; text-decoration:none; }
.login-help a:hover { text-decoration:underline; }
.recovery-choice-grid { display:grid; gap:12px; margin-top:20px; }
.recovery-choice { width:100%; text-align:left; border:1px solid #cfd7e4; background:#fff; color:var(--ink); border-radius:11px; padding:15px 16px; }
.recovery-choice:hover { border-color:#8ca3cc; background:#f7f9fd; box-shadow:0 5px 16px rgba(31,48,78,.08); }
.recovery-choice b { display:block; font-size:14px; margin-bottom:4px; color:#20385f; }
.recovery-choice span { display:block; font-size:12px; line-height:1.45; color:var(--muted); }
.system-status { margin: 22px 8px 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.status-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--muted); margin-bottom: 8px; }
.status-item { display: flex; align-items: center; gap: 8px; font-size: 12px; margin: 6px 0; color: #445166; }
.status-dot { width: 11px; height: 11px; flex:0 0 11px; border-radius: 999px; background: var(--status-bad); border:1px solid rgba(0,0,0,.08); box-shadow: 0 0 0 3px rgba(255,23,68,.13), 0 0 9px rgba(255,23,68,.35); }
.status-dot.up { background: var(--status-good); box-shadow: 0 0 0 3px rgba(0,200,83,.13), 0 0 9px rgba(0,200,83,.35); }
.status-dot.warn { background: var(--status-warn); box-shadow: 0 0 0 3px rgba(255,196,0,.15), 0 0 9px rgba(255,196,0,.40); }
.status-dot.down { background: var(--status-bad); box-shadow: 0 0 0 3px rgba(255,23,68,.13), 0 0 9px rgba(255,23,68,.35); }
.qr-box { min-height: 210px; display: grid; place-items: center; padding: 8px; margin: 16px 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.qr-box img, .qr-box canvas { max-width: 196px; max-height: 196px; }
.recovery-code-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 16px; }
.recovery-code-grid code { display:block; padding:8px; border-radius:8px; background:#f6f8fb; border:1px solid var(--line); font-size:12px; text-align:center; }
.alternate-sep { text-align:center; color:var(--muted); margin:12px 0; font-size:12px; }
.check-line, .radio-line { display:flex; gap:10px; align-items:flex-start; padding:10px; border:1px solid var(--line); border-radius:9px; margin:8px 0; background:#fff; }
.check-line input, .radio-line input { width:auto; margin-top:3px; }
.recovery-user-list { max-height: 320px; overflow:auto; margin: 10px 0; }
.mfa-device { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); }
.mfa-device:last-child { border-bottom:0; }
.goodish { background:#eaf6ef; color:#286345; border-color:#cee8d8; }
.stat-inline { font-size:14px; margin-top:8px; }
.stat-inline b { font-size:24px; color:var(--brand); }
.security-grid { align-items:start; }
@media (max-width: 800px) {
  .system-status { margin: 12px 0 0; }
  .recovery-code-grid { grid-template-columns:1fr; }
}
