/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --sidebar-bg:      #1a1d24;
  --sidebar-width:   220px;
  --topbar-height:   56px;
  --brand:           #7b74e2;
  --brand-light:     #9b95ef;
  --brand-dark:      #5f58c4;
  --body-bg:         #eef0f6;
  --card-bg:         #ffffff;
  --text-main:       #2d3748;
  --text-muted:      #718096;
  --text-light:      #a0aec0;
  --border:          #e2e8f0;
  --shadow-sm:       0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:       0 4px 12px rgba(0,0,0,0.08);
  --radius:          6px;
  --font:            'Open Sans', sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-main);
  background: var(--body-bg);
  height: 100%;
  overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
h1,h2,h3,h4,h5,h6 { font-weight: 600; color: var(--text-main); line-height: 1.3; }

/* ── App layout ─────────────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  flex-shrink: 0;
}

/* Brand block */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-logo {
  width: 36px;
  height: 36px;
  background: rgba(155,149,239,0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-brand-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.sidebar-brand-sub {
  font-size: 10px;
  color: rgba(155,149,239,0.7);
  white-space: nowrap;
}

/* Nav section label */
.sidebar-nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.25);
  padding: 18px 18px 6px;
}

/* Nav item */
.sidebar-nav {
  padding: 10px 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
}
.nav-item:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.05);
}
.nav-item.active {
  color: #fff;
  background: rgba(123,116,226,0.15);
  border-left-color: var(--brand-light);
}
.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active svg { opacity: 1; }
.nav-item:hover svg { opacity: 0.9; }

/* Report sub-menu items */
.nav-sub-item {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
}
.nav-sub-item:hover {
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.05);
}
.nav-sub-item.active {
  color: #fff;
  background: rgba(123,116,226,0.2);
  font-weight: 600;
}

/* Sidebar user block */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: auto;
}
.sidebar-avatar {
  width: 32px;
  height: 32px;
  background: rgba(123,116,226,0.3);
  color: var(--brand-light);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}
.sidebar-user-name {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10px;
  color: rgba(255,255,255,0.35);
}
.sidebar-signout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
  flex-shrink: 0;
}
.sidebar-signout:hover { color: #fc8181; }

/* ── Main area ──────────────────────────────────────────────────────────────── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Top bar ────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.page-title-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}
.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-right: 8px;
}
.topbar-user-info #topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}
.topbar-user-info #topbar-user-role {
  font-size: 11px;
  color: var(--text-light);
}
.topbar-action {
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.topbar-action:hover {
  background: var(--body-bg);
  color: var(--text-main);
  border-color: #c4cada;
}

/* ── Content area ───────────────────────────────────────────────────────────── */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: var(--body-bg);
}

/* ── Stat tiles (Codex style) ───────────────────────────────────────────────── */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-tile {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  border-left: 4px solid transparent;
  position: relative;
  overflow: hidden;
}
.stat-tile:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.stat-tile-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-tile-body { flex: 1; min-width: 0; }
.stat-tile-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-main);
}
.stat-tile-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 4px;
}
.stat-tile-sub {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* Tile colour variants */
.tile-blue   { border-left-color: #4299e1; } .tile-blue   .stat-tile-icon { background: #ebf8ff; color: #2b6cb0; }
.tile-purple { border-left-color: #7b74e2; } .tile-purple .stat-tile-icon { background: #f3f2fd; color: #5f58c4; }
.tile-teal   { border-left-color: #38b2ac; } .tile-teal   .stat-tile-icon { background: #e6fffa; color: #285e61; }
.tile-amber  { border-left-color: #d69e2e; } .tile-amber  .stat-tile-icon { background: #fffff0; color: #975a16; }
.tile-orange { border-left-color: #dd6b20; } .tile-orange .stat-tile-icon { background: #fff5eb; color: #7b341e; }
.tile-red    { border-left-color: #e53e3e; } .tile-red    .stat-tile-icon { background: #fff5f5; color: #9b2c2c; }
.tile-green  { border-left-color: #38a169; } .tile-green  .stat-tile-icon { background: #f0fff4; color: #276749; }
.tile-sky    { border-left-color: #0bc5ea; } .tile-sky    .stat-tile-icon { background: #edfdfd; color: #086f83; }

/* ── Panel / Card ───────────────────────────────────────────────────────────── */
.panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-heading {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}
.panel-body { padding: 20px; }
.panel-body-flush { padding: 0; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.sdv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sdv-table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sdv-table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-main);
  vertical-align: middle;
}
.sdv-table tbody tr:last-child td { border-bottom: none; }
.sdv-table tbody tr:hover td { background: #f8fafc; }

/* ── Form controls ──────────────────────────────────────────────────────────── */
.field {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-main);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(123,116,226,0.15);
}
select.field { cursor: pointer; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--brand);   color: #fff; border-color: var(--brand);   }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-secondary { background: #fff; color: var(--text-main); border-color: var(--border); }
.btn-secondary:hover { background: var(--body-bg); }
.btn-danger    { background: #e53e3e; color: #fff; border-color: #e53e3e; }
.btn-danger:hover { background: #c53030; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }

/* ── Status badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
}
.badge-draft            { background: #edf2f7; color: #718096; }
.badge-processing       { background: #faf5ff; color: #6b46c1; }
.badge-validated        { background: #e6fffa; color: #285e61; }
.badge-flagged          { background: #fffbeb; color: #92400e; }
.badge-failed           { background: #fff5eb; color: #7b341e; }
.badge-pending_approval { background: #ebf4ff; color: #2b4acb; }
.badge-auto_approved    { background: #f0fff4; color: #276749; }
.badge-approved         { background: #c6f6d5; color: #22543d; }
.badge-rejected         { background: #fff5f5; color: #9b2c2c; }
.badge-withdrawn        { background: #f7fafc; color: #a0aec0; }

/* ── Status filter bar ──────────────────────────────────────────────────────── */
.status-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.status-filter-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid transparent;
  cursor: pointer;
  background: #fff;
  color: var(--text-muted);
  border-color: var(--border);
  transition: all 0.12s;
}
.status-filter-btn:hover { border-color: #c4cada; color: var(--text-main); }
.status-filter-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ── Doc-type tab strip ─────────────────────────────────────────────────────── */
.doc-type-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  overflow-x: auto;
  padding: 0 16px;
}
.doc-type-tab {
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
}
.doc-type-tab:hover { color: var(--text-main); }
.doc-type-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ── Toolbar ────────────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.toolbar-spacer { flex: 1; }

/* ── Modals ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box-lg { max-width: 720px; }
.modal-box-xl { max-width: 900px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-main); }
.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.12s;
}
.modal-close:hover { color: var(--text-main); }
.modal-body  { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Toast ──────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: #2d3748;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 9999;
  max-width: 340px;
  transition: all 0.2s;
}
#toast.toast-error { background: #e53e3e; }

/* ── Upload drop zone ───────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: #fafbfc;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--brand);
  background: #f3f2fd;
}

/* ── Animations ─────────────────────────────────────────────────────────────── */
.spinner { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.animate-shake { animation: shake 0.35s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
  10%, 90% { transform: translate3d(-1px,0,0); }
  20%, 80% { transform: translate3d(2px,0,0); }
  30%, 50%, 70% { transform: translate3d(-4px,0,0); }
  40%, 60% { transform: translate3d(4px,0,0); }
}

/* ── Entity type cards ──────────────────────────────────────────────────────── */
.entity-type-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.entity-type-card.selected {
  border-color: var(--brand);
  background: #f3f2fd;
}

/* ── Login page ─────────────────────────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  z-index: 500;
}

/* Left branding panel */
.login-brand-panel {
  width: 420px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 40px 32px;
  position: relative;
  overflow: hidden;
}
.login-brand-panel::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(123,116,226,0.25) 0%, transparent 70%);
  pointer-events: none;
}
.login-brand-panel::after {
  content: '';
  position: absolute;
  bottom: -60px; left: -60px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(155,149,239,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.login-brand-inner { position: relative; z-index: 1; }
.login-logo-wrap {
  width: 72px; height: 72px;
  background: rgba(123,116,226,0.2);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
}
.login-brand-title {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 10px;
}
.login-brand-sub {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
  margin-bottom: 40px;
}
.login-features { display: flex; flex-direction: column; gap: 14px; }
.login-feature {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: rgba(255,255,255,0.65);
}
.login-feature-dot {
  width: 6px; height: 6px;
  background: var(--brand-light);
  border-radius: 50%;
  flex-shrink: 0;
}
.login-brand-footer {
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.05em;
  position: relative; z-index: 1;
}

/* Right form panel */
.login-form-panel {
  flex: 1;
  background: var(--body-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
}
.login-form-wrap {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  padding: 36px 32px;
}
.login-form-header { margin-bottom: 28px; }
.login-form-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}
.login-form-sub { font-size: 13px; color: var(--text-muted); }

.login-step { display: flex; flex-direction: column; gap: 18px; }
.login-field-group { display: flex; flex-direction: column; gap: 6px; }
.login-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}
.login-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-main);
  background: var(--card-bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.login-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(123,116,226,0.15);
}
.login-input::placeholder { color: var(--text-light); }

.otp-input {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5em;
  padding: 14px;
}

.login-eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: color 0.12s;
}
.login-eye-btn:hover { color: var(--text-muted); }

.login-error {
  font-size: 12px;
  color: #e53e3e;
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-weight: 500;
}

.login-btn {
  width: 100%;
  padding: 13px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 4px 14px rgba(123,116,226,0.35);
}
.login-btn:hover { background: var(--brand-dark); }
.login-btn:active { transform: scale(0.98); }

.login-mode-switch {
  background: none;
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.12s;
}
.login-mode-switch:hover { color: var(--brand-dark); }

/* Responsive: stack on small screens */
@media (max-width: 700px) {
  .login-brand-panel { display: none; }
  .login-form-panel  { background: var(--card-bg); }
}

.login-gradient {
  background: radial-gradient(ellipse at top left, #e9e8fb 0%, #f3f2fd 50%, var(--body-bg) 100%);
}
.glass {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0,0,0,0.1);
}

/* ── Utility ────────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-brand { color: var(--brand); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Scrollbar (webkit) ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c4cada; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0aec0; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-brand-text, .nav-item span, .sidebar-user-info, .sidebar-user-name,
  .sidebar-user-role, .sidebar-brand-sub { display: none; }
  .sidebar-brand { justify-content: center; padding: 14px 10px; }
  .nav-item { justify-content: center; padding: 12px; }
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
  .content-area { padding: 16px; }
}

/* ── Dark mode ──────────────────────────────────────────────────────────────── */
html.dark {
  --body-bg:    #111318;
  --card-bg:    #1a1d24;
  --text-main:  #e9e8e4;
  --text-muted: #9ca3af;
  --text-light: #6b7280;
  --border:     #2d3140;
}
html.dark body           { background: #111318; }
html.dark .sidebar       { background: #0d0f14; border-right: 1px solid #1a1d24; }
html.dark .topbar        { background: #1a1d24; border-bottom-color: #2d3140; }
html.dark .sdv-table thead th  { background: #22262f; }
html.dark .sdv-table tbody tr:hover td { background: #22262f; }
html.dark .status-filter-bar   { background: #22262f; }
html.dark .status-filter-btn   { background: #2a2f3e; border-color: #3d4154; color: #9ca3af; }
html.dark .doc-type-tabs        { background: #1a1d24; }
html.dark .drop-zone            { background: #22262f; border-color: #3d4154; }
html.dark .drop-zone.dragover   { background: #1e2030; border-color: var(--brand-light); }
html.dark .glass                { background: rgba(26,29,36,0.94); border-color: rgba(45,49,64,0.55); }
html.dark .field                { background: #22262f; border-color: #3d4154; color: #f5f4f0; }
html.dark .field:focus          { border-color: var(--brand-light); }
html.dark select option         { background: #22262f; color: #f5f4f0; }
html.dark .stat-tile            { background: #1a1d24; }
html.dark .login-gradient       { background: radial-gradient(ellipse at top left, #1a1d30 0%, #111318 55%, #0d1017 100%); }
html.dark .login-brand-panel   { background: #0d0f14; }
html.dark .login-form-panel    { background: #111318; }
html.dark .login-form-wrap     { background: #1a1d24; box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
html.dark .login-input         { background: #22262f; border-color: #3d4154; color: #f5f4f0; }
html.dark .login-input:focus   { border-color: var(--brand-light); }
html.dark .login-error         { background: rgba(254,178,178,0.1); border-color: rgba(252,129,129,0.3); color: #fc8181; }
html.dark #toast                { background: #22262f; color: #f5f4f0; }
html.dark .topbar-action        { background: #22262f; border-color: #3d4154; color: #9ca3af; }
html.dark .topbar-action:hover  { background: #2a2f3e; color: #e9e8e4; }
