:root {
  color-scheme: dark;

  --bg: #282828;
  --bg-card: #32302f;
  --bg-elevated: #3c3836;
  --bg-input: #1d2021;
  --bg-hover: #504945;
  --bg-drop-drag: #343b2b;

  --border: #504945;
  --border-subtle: #3c3836;
  --border-muted: #32302f;
  --border-drop: #665c54;

  --fg: #ebdbb2;
  --fg-secondary: #d5c4a1;
  --fg-label: #bdae93;
  --fg-muted: #a89984;
  --fg-faint: #928374;

  --accent: #a9b665;
  --accent-bg: #343b2b;
  --btn-primary-bg: #a9b665;
  --btn-primary-fg: #282828;
  --btn-primary-hover: #b8bb26;

  --btn-sec-bg: #3c3836;
  --btn-sec-fg: #ebdbb2;
  --btn-sec-hover: #504945;

  --btn-del-bg: #422d2e;
  --btn-del-fg: #fb4934;
  --btn-del-hover: #5a3434;

  --clr-verified: #b8bb26;
  --clr-verified-bg: #343b2b;
  --clr-verified-border: #667844;

  --clr-clean: #a9b665;
  --clr-clean-bg: #32372a;
  --clr-clean-border: #5d6740;
  --clr-clean-unverified-bg: #32302f;
  --clr-clean-unverified-border: #504945;
  --clr-clean-unverified-fg: #a89984;

  --clr-suspicious: #fabd2f;
  --clr-suspicious-bg: #3c3220;
  --clr-suspicious-border: #806323;

  --clr-detected: #fb4934;
  --clr-detected-bg: #3c2525;
  --clr-detected-border: #8f3f36;

  --clr-error: #fb4934;
  --clr-error-bg: #3c2525;
  --clr-error-border: #8f3f36;

  --clr-alert: #fe8019;
  --clr-alert-bg: #3c2b20;

  --badge-admin-fg: #fb4934;
  --badge-admin-bg: #3c2525;
  --badge-user-fg: #bdae93;
  --badge-user-bg: #3c3836;
  --badge-totp-off-fg: #a89984;
  --badge-totp-off-bg: #32302f;

  --event-purple-fg: #d3869b;
  --event-purple-bg: #3c2d36;

  --toast-err-bg: #3c2525;
  --toast-err-fg: #fb4934;
  --toast-err-border: #8f3f36;

  --toast-ok-bg: #343b2b;
  --toast-ok-fg: #b8bb26;
  --toast-ok-border: #667844;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-btn: 4px;
  --radius-pill: 4px;

  --syn-keyword: #fb4934;
  --syn-function: #a9b665;
  --syn-class: #fabd2f;
  --syn-string: #b8bb26;
  --syn-number: #d3869b;
  --syn-operator: #fe8019;
  --syn-annotation: #83a598;
  --syn-property: #fabd2f;
  --syn-variable: #fabd2f;
  --syn-namespace: var(--fg-label);
  --syn-comment: var(--fg-faint);
  --syn-punctuation: var(--fg-muted);
}
/* Modal Dialog System */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-width: 460px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.btn-close {
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.btn-close:hover {
  color: var(--fg);
}
.active-choice {
  background: var(--btn-primary-bg) !important;
  color: var(--btn-primary-fg) !important;
}

[x-cloak] { display: none !important; }
* { box-sizing: border-box; }
body { margin:0; font-family:system-ui,sans-serif; background:var(--bg); color:var(--fg); }
main { max-width:1180px; margin:0 auto; padding:30px 18px 60px; }
h1 { margin:0 0 8px; }
.sub { color:var(--fg-muted); margin-bottom:22px; }
.nav { margin:-14px 0 18px; }
.nav a { color:var(--accent); text-decoration:none; margin-right:16px; font-size:14px; }

/* Drop zone */
.drop { border:2px dashed var(--border-drop); border-radius:var(--radius-lg); padding:34px 20px; text-align:center; background:var(--bg-card); }
.drop.drag { border-color:var(--accent); background:var(--bg-drop-drag); }
.drop input { display:none; }
.drop label { display:block; cursor:pointer; }
.drop strong { display:block; font-size:20px; margin-bottom:8px; }
.drop span { color:var(--fg-muted); }

/* Controls */
.toolbar { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-top:15px; }
button { border:0; border-radius:var(--radius-btn); padding:10px 16px; background:var(--btn-primary-bg); color:var(--btn-primary-fg); cursor:pointer; font-weight:700; }
button:hover { background:var(--btn-primary-hover); }
button.secondary { background:var(--btn-sec-bg); color:var(--btn-sec-fg); }
button.secondary:hover { background:var(--btn-sec-hover); }
button:disabled { opacity:.5; cursor:default; }
button.del { background:var(--btn-del-bg); color:var(--btn-del-fg); }
button.del:hover { background:var(--btn-del-hover); }
.btn-sm { padding:5px 10px; font-size:12px; border-radius:var(--radius-sm); }
a.btn-sm { text-decoration:none; display:inline-flex; align-items:center; justify-content:center; font-weight:700; background:var(--btn-primary-bg); color:var(--btn-primary-fg); line-height:normal; border-radius:var(--radius-sm); }
a.btn-sm:hover { background:var(--btn-primary-hover); text-decoration:none; }
a.btn-sm.secondary { background:var(--btn-sec-bg); color:var(--btn-sec-fg); }
a.btn-sm.secondary:hover { background:var(--btn-sec-hover); text-decoration:none; }
.check { display:flex; gap:8px; align-items:center; color:var(--fg-label); font-size:14px; }
.progress { margin-top:16px; color:var(--fg-muted); }

/* Summary pills */
.summary { display:flex; gap:10px; flex-wrap:wrap; margin-top:22px; }
.pill { border:0; background:var(--bg-card); border-radius:var(--radius-pill); padding:7px 11px; color:var(--fg-secondary); cursor:pointer; }
.pill:hover { background:var(--border-subtle); }
.pill.active { background:var(--btn-primary-bg); color:var(--btn-primary-fg); }
.pill.all { font-weight:700; }

/* Result cards */
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(360px,1fr)); gap:14px; margin-top:18px; }
.card { border:1px solid var(--border); border-radius:var(--radius-md); padding:16px; background:var(--bg-card); }
.verified { border-color:var(--clr-verified-border); }
.clean { border-color:var(--clr-clean-border); }
.clean.unverified { border-color:var(--clr-clean-unverified-border); background:var(--clr-clean-unverified-bg); }
.suspicious { border-color:var(--clr-suspicious-border); }
.detected { border-color:var(--clr-detected-border); }
.error { border-color:var(--clr-error-border); }
.name { font-weight:700; word-break:break-all; }
.meta { color:var(--fg-muted); margin-top:6px; font-size:14px; }
.parent { margin-top:8px; padding:8px 10px; border-radius:var(--radius-sm); background:var(--bg-hover); color:var(--fg-label); font-size:13px; }
.child { box-shadow:inset 3px 0 0 var(--border); }

/* Status badges */
.status { display:inline-block; margin-top:10px; border-radius:var(--radius-pill); padding:5px 9px; font-weight:700; font-size:12px; text-transform:uppercase; }
.status.verified { background:var(--clr-verified-bg); color:var(--clr-verified); }
.status.clean { background:var(--clr-clean-bg); color:var(--clr-clean); }
.status.clean.unverified { background:var(--clr-clean-unverified-bg); color:var(--clr-clean-unverified-fg); border:1px solid var(--clr-clean-unverified-border); }
.status.suspicious { background:var(--clr-suspicious-bg); color:var(--clr-suspicious); }
.status.detected { background:var(--clr-detected-bg); color:var(--clr-detected); }
.status.error { background:var(--clr-error-bg); color:var(--clr-error); }

/* Match evidence */
.matches { margin-top:14px; }
.match { background:var(--bg-input); border-radius:var(--radius-btn); padding:10px; margin-top:8px; }
.match code { color:var(--fg-secondary); white-space:pre-wrap; word-break:break-word; }
.muted { color:var(--fg-faint); }
.errbox { margin-top:12px; padding:10px; border-radius:var(--radius-btn); background:var(--clr-alert-bg); color:var(--clr-alert); }
.successbox { margin-top:12px; padding:10px; border-radius:var(--radius-btn); background:var(--clr-verified-bg); color:var(--clr-verified); }
.unverified-notice { margin-top:10px; padding:8px 10px; border-radius:var(--radius-sm); background:var(--border-subtle); color:var(--fg-faint); font-size:13px; border:1px solid var(--border); }

/* Entropy & bytecode metrics */
.entropy-box { margin-top:12px; padding:10px 12px; background:var(--bg-input); border:1px solid var(--border-subtle); border-radius:var(--radius-btn); font-size:13px; }
.entropy-box-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; padding-bottom:6px; border-bottom:1px solid var(--border-muted); }
.entropy-box-title { font-weight:600; color:var(--fg); font-size:13px; }
.entropy-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(130px, 1fr)); gap:8px; }
.entropy-stat { display:flex; flex-direction:column; gap:2px; }
.entropy-stat-label { font-size:11px; color:var(--fg-faint); text-transform:uppercase; letter-spacing:0.5px; }
.entropy-stat-val { font-weight:600; color:var(--fg-secondary); font-family:monospace; font-size:13px; }
.entropy-stat-val.high { color:var(--clr-alert); }
.entropy-stat-val.critical { color:var(--clr-detected); }

/* Samples page */
.samples h2 { margin:26px 0 10px; font-size:18px; display:flex; align-items:center; gap:12px; }
.samples h2 .count { color:var(--fg-muted); font-weight:400; font-size:14px; }
.srow { display:flex; align-items:center; gap:10px; padding:9px 10px; border:1px solid var(--border); border-radius:var(--radius-btn); background:var(--bg-card); margin-top:8px; }
.srow .arrow { cursor:pointer; color:var(--accent); width:18px; text-align:center; flex:none; user-select:none; }
.srow .fname { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; min-width:0; }
.srow .sha, .srow .size, .srow .date { color:var(--fg-muted); font-size:13px; flex:none; }
.srow .uploader-tag { color:var(--accent); font-size:12px; background:var(--accent-bg); padding:3px 8px; border-radius:var(--radius-sm); flex:none; display:inline-flex; align-items:center; gap:4px; font-weight:500; }
.srow button { padding:6px 10px; font-size:13px; }
.sitem { margin-top:8px; }
.sitem .srow { position:sticky; top:0; z-index:2; margin-top:0; }
.srow .del { background:var(--btn-del-bg); color:var(--btn-del-fg); }
.jsonpre { margin:6px 0 0 28px; padding:10px; background:var(--bg-input); border-radius:var(--radius-btn); overflow:auto; max-height:420px; font-size:12px; white-space:pre-wrap; word-break:break-word; }
.tokenbox { display:flex; gap:10px; margin:18px 0; max-width:520px; }
.tokenbox input { flex:1; background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-btn); padding:10px 12px; color:var(--fg); }

/* Topbar */
.topbar { background:var(--bg-elevated); border-bottom:1px solid var(--border-subtle); position:sticky; top:0; z-index:100; }
.topbar-inner { max-width:1180px; margin:0 auto; padding:10px 18px; display:flex; align-items:center; gap:20px; flex-wrap:wrap; min-height:52px; }
.brand { flex-shrink:0; }
.brand a { font-weight:700; font-size:17px; color:var(--fg); text-decoration:none; display:inline-flex; align-items:center; gap:8px; }
.brand-icon { width:22px; height:22px; vertical-align:middle; flex-shrink:0; }
.title-icon { width:32px; height:32px; vertical-align:middle; flex-shrink:0; }
.page-title { display:flex; align-items:center; gap:10px; margin-bottom:20px; }
.auth-title { display:flex; align-items:center; justify-content:center; gap:10px; }
.nav-links { display:flex; gap:16px; align-items:center; flex-shrink:0; }
.nav-links a { color:var(--fg-muted); text-decoration:none; font-size:14px; font-weight:500; transition:color .15s; }
.nav-links a:hover, .nav-links a.active { color:var(--accent); }
.user-info { margin-left:auto; display:flex; align-items:center; gap:10px; flex-shrink:0; }
.user-info .uname { color:var(--fg-secondary); font-weight:500; font-size:14px; }
.lang-switch { display:inline-flex; align-items:center; gap:2px; font-size:12px; font-weight:700; border:1px solid var(--border-subtle); border-radius:var(--radius-sm); padding:2px 4px; background:var(--bg-card); flex-shrink:0; }
.lang-switch a { color:var(--fg-muted); text-decoration:none; padding:1px 5px; border-radius:var(--radius-sm); transition:all .15s; }
.lang-switch a:hover { color:var(--accent); background:var(--bg-hover); }
.lang-switch .lang-current { color:var(--accent); background:var(--bg-hover); padding:1px 5px; border-radius:var(--radius-sm); }

/* Badges */
.badge { display:inline-block; font-size:11px; font-weight:700; padding:2px 7px; border-radius:var(--radius-pill); text-transform:uppercase; }
.badge.admin { background:var(--badge-admin-bg); color:var(--badge-admin-fg); }
.badge.user { background:var(--badge-user-bg); color:var(--badge-user-fg); }
.badge.verified { background:var(--clr-verified-bg); color:var(--clr-verified); }
.badge.clean { background:var(--clr-clean-bg); color:var(--clr-clean); }
.badge.suspicious { background:var(--clr-suspicious-bg); color:var(--clr-suspicious); }
.badge.detected { background:var(--clr-detected-bg); color:var(--clr-detected); }
.badge.error { background:var(--clr-error-bg); color:var(--clr-error); }
.badge.unknown { background:var(--clr-clean-unverified-bg); color:var(--clr-clean-unverified-fg); }
.badge.totp-on { background:var(--clr-verified-bg); color:var(--clr-verified); }
.badge.totp-off { background:var(--badge-totp-off-bg); color:var(--badge-totp-off-fg); }

.summary-pill { border:0; background:var(--bg-card); border-radius:var(--radius-pill); padding:6px 12px; color:var(--fg-secondary); font-size:13px; cursor:pointer; display:inline-flex; align-items:center; gap:6px; user-select:none; }
.summary-pill:hover { background:var(--border-subtle); }
.summary-pill.active { background:var(--btn-primary-bg); color:var(--btn-primary-fg); font-weight:600; }
.summary-pill.detected.active { background:var(--clr-detected); color:#111; }
.summary-pill.suspicious.active { background:var(--clr-suspicious); color:#111; }
.summary-pill.clean.active { background:var(--clr-clean); color:#111; }
.summary-pill.verified.active { background:var(--clr-verified); color:#111; }
.summary-pill.error.active { background:var(--clr-error); color:#111; }

/* Auth pages */
.auth-page { display:flex; min-height:100vh; align-items:center; justify-content:center; }
.auth-container { width:100%; max-width:400px; padding:24px; }
.auth-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:32px 28px; }
.auth-header { text-align:center; margin-bottom:24px; }
.auth-header h1 { font-size:24px; }
.auth-form .field { margin-bottom:16px; }
.auth-form label { display:block; margin-bottom:6px; font-size:14px; color:var(--fg-label); }
.auth-form input[type="text"], .auth-form input[type="password"],
.inline-form input, .inline-form select { width:100%; padding:10px 14px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--fg); font-size:14px; outline:none; }
.auth-form input:focus, .inline-form input:focus, .inline-form select:focus { border-color:var(--accent); }
.auth-actions { margin-top:24px; }
.auth-actions button { width:100%; padding:12px; font-size:15px; }
.auth-err { margin-bottom:18px; margin-top:0; }

/* Admin panel */
.admin-panel { max-width:1180px; margin:0 auto; padding:30px 18px 60px; }
.admin-section { margin-top:32px; }
.admin-section h2 { font-size:20px; margin-bottom:14px; }
.table-wrap { overflow-x:auto; border:1px solid var(--border); border-radius:var(--radius-md); background:var(--bg-card); }
.admin-table { width:100%; border-collapse:collapse; text-align:left; font-size:14px; }
.admin-table th, .admin-table td { padding:12px 14px; border-bottom:1px solid var(--border-muted); }
.admin-table th { background:var(--bg-elevated); color:var(--fg-muted); font-weight:600; font-size:13px; }
.admin-table tr:last-child td { border-bottom:none; }
.table-actions { display:flex; gap:6px; align-items:center; flex-wrap:nowrap; white-space:nowrap; }
.table-actions button, .table-actions a { white-space:nowrap; flex-shrink:0; }
.bold { font-weight:600; }
.mono { font-family:monospace; font-size:13px; }
.status-indicator { font-size:12px; font-weight:600; }
.status-indicator.active { color:var(--clr-verified); }
.status-indicator.disabled { color:var(--clr-detected); }
.event-badge { display:inline-block; font-size:11px; padding:2px 8px; border-radius:var(--radius-sm); font-family:monospace; }
.event-badge.login_success { background:var(--clr-verified-bg); color:var(--clr-verified); }
.event-badge.login_failed, .event-badge.lockout { background:var(--clr-detected-bg); color:var(--clr-detected); }
.event-badge.logout { background:var(--badge-user-bg); color:var(--badge-user-fg); }
.event-badge.user_created, .event-badge.role_changed { background:var(--accent-bg); color:var(--accent); }
.event-badge.user_deleted { background:var(--clr-alert-bg); color:var(--clr-alert); }
.event-badge.admin_password_reset, .event-badge.password_changed { background:var(--event-purple-bg); color:var(--event-purple-fg); }
.event-badge.admin_totp_disabled, .event-badge.totp_disabled { background:var(--clr-detected-bg); color:var(--clr-detected); }
.event-badge.totp_enabled { background:var(--clr-verified-bg); color:var(--clr-verified); }
.event-badge.user_suspended { background:var(--clr-detected-bg); color:var(--clr-detected); }
.event-badge.user_activated { background:var(--clr-verified-bg); color:var(--clr-verified); }
.event-badge.admin_sessions_revoked { background:var(--clr-alert-bg); color:var(--clr-alert); }
.event-badge.admin_link_deleted { background:var(--clr-detected-bg); color:var(--clr-detected); }
.add-user-box { margin-top:16px; padding:20px; }
.add-user-box h3 { margin:0 0 14px; font-size:16px; }
.inline-form { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.inline-form input { flex:1; min-width:180px; }
.inline-form select { width:auto; min-width:110px; cursor:pointer; }

/* Profile */
.profile-panel { max-width:1180px; margin:0 auto; padding:30px 18px 60px; }
.profile-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(320px, 1fr)); gap:20px; }
.tabs { display:flex; gap:8px; border-bottom:1px solid var(--border-subtle); margin-bottom:24px; overflow-x:auto; }
.tab-btn { background:transparent; color:var(--fg-muted); border-radius:var(--radius-sm) var(--radius-sm) 0 0; padding:10px 18px; font-size:14px; font-weight:600; border:none; cursor:pointer; border-bottom:2px solid transparent; transition:color .15s, border-color .15s; }
.tab-btn:hover { color:var(--fg); }
.tab-btn.active { color:var(--accent); border-bottom-color:var(--accent); background:var(--bg-card); }
.tab-content { display:none; }
.tab-content.active { display:block; }
.inline-input { padding:10px 14px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--fg); font-size:14px; outline:none; }
.inline-input:focus { border-color:var(--accent); }
.stub-card { text-align:center; padding:48px 24px; margin-top:20px; }
.stub-card h2 { font-size:20px; margin-bottom:8px; }
.stub-badge { display:inline-block; margin-top:16px; font-size:12px; font-weight:700; color:var(--accent); background:var(--accent-bg); padding:4px 12px; border-radius:var(--radius-pill); text-transform:uppercase; }

/* Avatars */
.avatar-wrap { display:flex; align-items:center; gap:20px; flex-wrap:wrap; }
.avatar-circle { width:84px; height:84px; border-radius:50%; background:var(--accent-bg); display:flex; align-items:center; justify-content:center; font-size:32px; font-weight:700; color:var(--accent); user-select:none; flex-shrink:0; }
.avatar-img { width:84px; height:84px; border-radius:50%; object-fit:cover; flex-shrink:0; display:block; background:var(--bg-input); }
.avatar-mini { width:24px; height:24px; border-radius:50%; object-fit:cover; flex-shrink:0; display:inline-block; vertical-align:middle; }
.avatar-mini-circle { width:24px; height:24px; border-radius:50%; background:var(--accent-bg); display:inline-flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; color:var(--accent); vertical-align:middle; user-select:none; }
.stats-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(110px, 1fr)); gap:12px; margin-top:14px; }
.stat-box { background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-btn); padding:14px; text-align:center; }
.stat-box .val { font-size:22px; font-weight:700; color:var(--fg); }
.stat-box .lbl { font-size:12px; color:var(--fg-muted); margin-top:4px; text-transform:uppercase; font-weight:600; }

/* Upload links */
.link-badge { display:inline-block; font-size:11px; font-weight:700; padding:3px 8px; border-radius:var(--radius-pill); text-transform:uppercase; }
.link-badge.active { background:var(--clr-verified-bg); color:var(--clr-verified); }
.link-badge.expired { background:var(--clr-suspicious-bg); color:var(--clr-suspicious); }
.link-badge.maxed { background:var(--clr-alert-bg); color:var(--clr-alert); }
.link-badge.revoked { background:var(--clr-detected-bg); color:var(--clr-detected); }
.link-badge.used { background:var(--accent-bg); color:var(--accent); }
.quota-bar-bg { background:var(--border-subtle); border-radius:var(--radius-sm); height:8px; overflow:hidden; }
.quota-bar-fill { height:100%; border-radius:var(--radius-sm); transition:width .3s ease; }

/* Modals */
.modal-overlay { position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.75); display:flex; align-items:center; justify-content:center; z-index:1000; padding:20px; }
.modal-content { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-md); max-width:920px; width:100%; max-height:90vh; display:flex; flex-direction:column; overflow:hidden; box-shadow:0 10px 30px rgba(0,0,0,0.6); }
.modal-header { display:flex; justify-content:space-between; align-items:center; padding:18px 24px; border-bottom:1px solid var(--border-subtle); flex-shrink:0; background:var(--bg-elevated); }
.modal-body { padding:20px 24px; overflow-y:auto; flex:1; }
.modal-footer { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:14px 24px; border-top:1px solid var(--border-subtle); background:var(--bg-elevated); flex-shrink:0; }

/* Admin overview */
.user-link { color:var(--fg); cursor:pointer; text-decoration:none; font-weight:600; display:inline-flex; align-items:center; gap:8px; transition:color .15s, text-decoration .15s; }
.user-link:hover { text-decoration:underline; color:var(--accent); }
.overview-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr)); gap:16px; margin-top:20px; }
.kpi-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-md); padding:18px 20px; display:flex; flex-direction:column; justify-content:space-between; }
.kpi-title { font-size:12px; font-weight:700; color:var(--fg-muted); text-transform:uppercase; letter-spacing:0.5px; }
.kpi-val { font-size:26px; font-weight:700; color:var(--fg); margin:8px 0 4px; }
.kpi-sub { font-size:12px; color:var(--fg-muted); display:flex; gap:12px; flex-wrap:wrap; }
.kpi-sub span { font-weight:600; }

/* Audit */
.audit-toolbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:14px; }
.audit-toolbar input, .audit-toolbar select { padding:8px 12px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--fg); font-size:13px; outline:none; }
.audit-toolbar input:focus, .audit-toolbar select:focus { border-color:var(--accent); }
.audit-search { flex:1; min-width:200px; }
.pagination-wrap { display:flex; justify-content:space-between; align-items:center; margin-top:14px; flex-wrap:wrap; gap:12px; }
.pagination-controls { display:flex; gap:6px; align-items:center; }
.page-btn { background:var(--bg-card); border:1px solid var(--border); color:var(--fg); border-radius:var(--radius-sm); padding:6px 12px; font-size:13px; cursor:pointer; transition:background .15s, border-color .15s; }
.page-btn:hover:not(:disabled) { background:var(--border-subtle); border-color:var(--accent); }
.page-btn.active { background:var(--accent-bg); border-color:var(--accent); color:var(--accent); font-weight:700; }
.page-btn:disabled { opacity:0.4; cursor:not-allowed; }
.page-info { font-size:13px; color:var(--fg-muted); }

/* Rule Documentation Link */
.match-heading { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.rule-doc-link { display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; border-radius:var(--radius-sm); background:var(--accent-bg); color:var(--accent); border:1px solid var(--accent); font-size:11px; font-weight:700; text-decoration:none; line-height:1; transition:all .15s ease; margin-left:6px; flex-shrink:0; vertical-align:middle; }
.rule-doc-link:hover { background:var(--accent); color:var(--btn-primary-fg); border-color:var(--accent); transform:scale(1.1); }

/* FastAPI/Pandas-style Documentation Layout */
.docs-shell { display:flex; min-height:calc(100vh - 49px); max-width:1440px; margin:0 auto; width:100%; }

/* Left Sidebar */
.docs-sidebar { width:290px; flex-shrink:0; background:var(--bg-elevated); border-right:1px solid var(--border-subtle); position:sticky; top:49px; height:calc(100vh - 49px); overflow-y:auto; display:flex; flex-direction:column; z-index:10; }
.sidebar-header { padding:14px 14px 10px; border-bottom:1px solid var(--border-subtle); position:sticky; top:0; background:var(--bg-elevated); z-index:2; }
.sidebar-search-box { position:relative; display:flex; align-items:center; }
.sidebar-search-input { width:100%; padding:8px 24px 8px 10px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--fg); font-size:13px; outline:none; transition:border-color .15s; }
.sidebar-search-input:focus { border-color:var(--accent); }
.sidebar-search-clear { position:absolute; right:6px; background:transparent; border:none; color:var(--fg-muted); cursor:pointer; font-size:16px; line-height:1; padding:2px 4px; }
.sidebar-search-clear:hover { color:var(--fg); }
.sidebar-nav { padding:12px 10px 40px; display:flex; flex-direction:column; gap:14px; }
.sidebar-section { margin-bottom:2px; }
.sidebar-nav-link.overview-link { display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:var(--radius-sm); color:var(--fg); text-decoration:none; font-size:13px; font-weight:600; background:var(--bg-input); border:1px solid var(--border-subtle); transition:all .15s; }
.sidebar-nav-link.overview-link.active, .sidebar-nav-link.overview-link:hover { background:var(--accent-bg); color:var(--accent); border-color:var(--accent); }
.sidebar-category-group { display:flex; flex-direction:column; gap:2px; }
.sidebar-cat-title { display:flex; justify-content:space-between; align-items:center; padding:6px 8px 4px; font-size:11px; font-weight:700; color:var(--fg-muted); text-transform:uppercase; letter-spacing:0.5px; }
.cat-count-badge { background:var(--bg-input); border:1px solid var(--border-subtle); border-radius:var(--radius-sm); font-size:10px; padding:1px 5px; color:var(--fg-faint); font-weight:600; }
.sidebar-rule-tree { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:2px; }
.sidebar-rule-link { display:flex; justify-content:space-between; align-items:center; padding:6px 10px; border-radius:var(--radius-sm); color:var(--fg-secondary); text-decoration:none; font-size:13px; transition:all .12s; border-left:2px solid transparent; }
.sidebar-rule-link:hover { background:var(--bg-hover); color:var(--fg); }
.sidebar-rule-link.active { background:var(--accent-bg); color:var(--accent); font-weight:600; border-left-color:var(--accent); }
.rule-link-text { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:200px; }
.rule-score-badge { font-size:10px; font-weight:700; color:var(--fg-muted); background:var(--bg-card); padding:1px 5px; border-radius:var(--radius-sm); border:1px solid var(--border-subtle); flex-shrink:0; }

/* Main Reading Pane */
.docs-main-pane { flex:1; min-width:0; padding:28px 36px 80px; max-width:1050px; }
.docs-overview-hero { margin-bottom:30px; }
.docs-hero-header { margin-bottom:18px; }
.docs-hero-title { display:flex; align-items:center; gap:10px; margin:0 0 8px; font-size:24px; font-weight:700; }
.docs-hero-desc { color:var(--fg-muted); font-size:14px; line-height:1.6; max-width:800px; margin:0; }
.docs-stats-row { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:10px; margin:18px 0; }
.doc-stat-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px; }
.doc-stat-card .stat-number { font-size:22px; font-weight:700; color:var(--accent); }
.doc-stat-card .stat-label { font-size:11px; font-weight:600; color:var(--fg-muted); text-transform:uppercase; margin-top:2px; letter-spacing:0.3px; }

/* Filter Bar & Chips */
.docs-filter-bar { display:flex; flex-direction:column; gap:10px; margin-top:16px; }
.docs-filter-input { width:100%; padding:10px 12px; background:var(--bg-input); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--fg); font-size:14px; outline:none; transition:border-color .15s; }
.docs-filter-input:focus { border-color:var(--accent); }
.docs-category-chips { display:flex; gap:6px; flex-wrap:wrap; }
.chip-btn { background:var(--bg-card); border:1px solid var(--border); color:var(--fg-secondary); border-radius:var(--radius-sm); padding:5px 12px; font-size:12px; font-weight:600; cursor:pointer; transition:all .15s ease; }
.chip-btn:hover { background:var(--bg-hover); border-color:var(--accent); color:var(--fg); }
.chip-btn.active { background:var(--accent-bg); border-color:var(--accent); color:var(--accent); }

/* Square Rule Cards Grid */
.docs-rules-sections { display:flex; flex-direction:column; gap:28px; }
.docs-cat-section { margin-bottom:10px; }
.cat-section-heading { display:flex; align-items:baseline; gap:10px; font-size:18px; font-weight:700; color:var(--fg); padding-bottom:8px; border-bottom:1px solid var(--border); margin-bottom:14px; }
.cat-section-count { font-size:12px; font-weight:500; color:var(--fg-muted); }
.rules-card-grid { display:grid; grid-template-columns:1fr; gap:12px; }
.rule-summary-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); padding:16px 18px; transition:border-color .15s ease; }
.rule-summary-card:hover { border-color:var(--border-drop); }
.card-top-row { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom:10px; flex-wrap:wrap; }
.card-titles { display:flex; flex-direction:column; gap:3px; }
.card-title { font-size:16px; font-weight:700; margin:0; }
.card-title-link { color:var(--fg); text-decoration:none; transition:color .15s; }
.card-title-link:hover { color:var(--accent); text-decoration:underline; }
.card-meta { display:flex; align-items:center; gap:8px; font-size:12px; }
.rule-id-code { background:var(--bg-input); border:1px solid var(--border-subtle); padding:2px 6px; border-radius:var(--radius-sm); color:var(--accent); font-family:monospace; font-size:12px; }
.card-cat-badge { font-size:12px; color:var(--fg-muted); font-weight:500; }
.card-badges { display:flex; align-items:center; gap:6px; }
.card-body { display:flex; flex-direction:column; gap:10px; }
.card-impact-text { font-size:13px; color:var(--fg-secondary); line-height:1.55; margin:0; }
.card-footer-row { display:flex; align-items:center; margin-top:2px; }
.card-open-link { display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:600; color:var(--accent); text-decoration:none; transition:gap .15s ease; }
.card-open-link:hover { text-decoration:underline; gap:10px; }

/* Dedicated Rule Detail Page */
.docs-breadcrumb { display:flex; align-items:center; gap:8px; font-size:13px; margin-bottom:18px; color:var(--fg-muted); flex-wrap:wrap; }
.docs-breadcrumb a { color:var(--accent); text-decoration:none; }
.docs-breadcrumb a:hover { text-decoration:underline; }
.docs-breadcrumb .sep { opacity:0.4; }
.docs-breadcrumb .current { color:var(--fg); font-weight:600; font-family:monospace; }

.doc-detail-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-sm); padding:26px 28px; }
.doc-detail-header { border-bottom:1px solid var(--border-subtle); padding-bottom:16px; margin-bottom:24px; }
.doc-detail-title { font-size:24px; font-weight:700; color:var(--fg); margin:0 0 10px; letter-spacing:-0.2px; }
.doc-meta-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

.doc-sections { display:flex; flex-direction:column; gap:26px; }
.doc-section { display:flex; flex-direction:column; gap:8px; }
.doc-section-title { font-size:14px; font-weight:700; color:var(--fg-label); margin:0; display:flex; align-items:center; gap:8px; text-transform:uppercase; letter-spacing:0.4px; }
.doc-section-text { font-size:14px; color:var(--fg-secondary); line-height:1.65; margin:0; }
.doc-paragraph { margin:0 0 12px 0; }
.doc-section-text.code-font { font-size:13px; color:var(--fg); background:var(--bg-input); padding:10px 14px; border-radius:var(--radius-sm); border:1px solid var(--border-subtle); font-family:monospace; }
.doc-section-text code { background:var(--bg-input); border:1px solid var(--border-subtle); padding:2px 6px; border-radius:var(--radius-sm); color:var(--accent); font-family:monospace; font-size:12.5px; }
.doc-list { margin:0 0 12px 18px; padding:0; display:flex; flex-direction:column; gap:6px; }
.doc-list li { color:var(--fg-secondary); line-height:1.6; }

.func-list { display:flex; flex-direction:column; gap:8px; margin-top:2px; }
.func-item { background:var(--bg-input); border:1px solid var(--border-subtle); border-radius:var(--radius-sm); padding:10px 14px; display:flex; flex-direction:column; gap:3px; }
.func-name { color:var(--accent); font-size:13px; font-weight:600; font-family:monospace; }
.func-desc { font-size:13px; color:var(--fg-muted); line-height:1.5; margin:0; }

.code-caption { font-size:13px; color:var(--fg-muted); margin:0 0 4px; }
.code-box { background:var(--bg-input); border:1px solid var(--border-subtle); border-radius:var(--radius-sm); padding:12px 14px; overflow-x:auto; font-family:monospace; font-size:13px; line-height:1.5; color:var(--fg); margin:0; white-space:pre; }

.doc-detail-footer { margin-top:28px; padding-top:18px; border-top:1px solid var(--border-subtle); }

@media (max-width: 860px) {
  .docs-shell { flex-direction:column; }
  .docs-sidebar { width:100%; height:auto; position:static; border-right:none; border-bottom:1px solid var(--border-subtle); }
  .docs-main-pane { padding:20px 16px 60px; }
}


