:root {
  --bg: #0f1115; --panel: #171a21; --border: #2a2e38; --text: #e6e8ee; --muted: #9aa1af;
  --accent: #4f7cff; --danger: #e5484d; --warn: #d9822b; --ok: #2fb35c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }

.admin-banner {
  background: #3a1414; color: #ffb3b3; text-align: center; font-size: 12px; font-weight: 600;
  letter-spacing: .03em; padding: 6px; border-bottom: 1px solid #5a1f1f;
}
.admin-shell { display: flex; min-height: calc(100vh - 30px); }
.admin-nav {
  width: 200px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--border);
  padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
}
.admin-nav-brand { font-weight: 700; font-size: 15px; margin-bottom: 12px; color: #fff; }
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.nav-group-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: #5a6070; margin: 10px 0 4px; padding: 0 10px;
}
.admin-nav a { padding: 9px 10px; border-radius: 6px; color: var(--muted); line-height: 1.3; }
.admin-nav a:hover, .admin-nav a.active { background: #1f232d; color: var(--text); }
.admin-nav a.active { color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.admin-nav a:focus-visible, .skip-link:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.admin-nav-spacer { flex: 1; }
.skip-link {
  position: absolute; left: -999px; top: -999px; background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: 0 0 6px 0; z-index: 100; font-size: 13px;
}
.skip-link:focus { left: 0; top: 0; }
.admin-nav-user { font-size: 12px; color: var(--muted); padding: 0 10px; display: block; margin-bottom: 4px; }
.role-badge { display: inline-block; background: #232838; color: var(--accent); border-radius: 4px; padding: 1px 6px; font-size: 11px; margin-left: 4px; }
.notif-badge {
  display: inline-block; background: var(--danger); color: #fff; border-radius: 10px;
  padding: 0 6px; font-size: 10.5px; font-weight: 700; line-height: 16px; min-width: 16px;
  text-align: center; vertical-align: middle;
}

.admin-main { flex: 1; padding: 24px 32px; max-width: 1400px; }
h1 { font-size: 20px; margin: 0 0 16px; color: #fff; }

.content-with-help { display: flex; gap: 24px; align-items: flex-start; }
.content-primary { flex: 1; min-width: 0; }
.help-panel {
  width: 280px; flex-shrink: 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 18px; position: sticky; top: 20px;
}
.help-panel-title { font-size: 14px; margin: 0 0 8px; color: #fff; }
.help-panel-desc { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.5; }
.help-panel-subhead {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 16px 0 6px;
}
.help-panel-subhead-warn { color: var(--warn); }
.help-panel-list { margin: 0; padding-left: 16px; font-size: 12.5px; color: var(--text); line-height: 1.5; }
.help-panel-list li { margin-bottom: 7px; }
.help-panel-list li:last-child { margin-bottom: 0; }
.help-panel-warn-list li { color: #f0c48a; }
@media (max-width: 900px) {
  .content-with-help { flex-direction: column; }
  .help-panel { width: 100%; position: static; }
}

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
tr:hover td { background: #1b1f28; }

.btn { display: inline-block; background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 8px 14px; font-size: 13px; cursor: pointer; }
.btn:hover { filter: brightness(1.1); }
.btn-danger { background: var(--danger); }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.link-btn:hover { color: var(--text); }

input, select, textarea {
  background: #0d0f14; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 8px 10px; font-size: 13px; width: 100%;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.7; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; margin-top: 12px; }

.firm-search-results {
  position: absolute; z-index: 20; left: 0; right: 0; margin: 2px 0 0; padding: 4px;
  list-style: none; background: #0d0f14; border: 1px solid var(--border); border-radius: 6px;
  max-height: 220px; overflow-y: auto; box-shadow: 0 8px 20px rgba(0,0,0,.4);
}
.firm-search-results li { padding: 7px 8px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.firm-search-results li:hover { background: #1f232d; }
.firm-search-results li.firm-search-empty { color: var(--muted); cursor: default; }
.firm-search-results li.firm-search-empty:hover { background: none; }
.firm-search-status { color: var(--muted); font-size: 11px; }
.firm-search-id { color: var(--muted); font-size: 11px; }

.progress-track { display: none; height: 4px; background: #0d0f14; border-radius: 2px; overflow: hidden; margin-top: 12px; }
.progress-track.active { display: block; }
.progress-track .progress-bar {
  height: 100%; width: 35%; background: var(--accent); border-radius: 2px;
  animation: progress-slide 1.1s ease-in-out infinite;
}
@keyframes progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(285%); }
}

.badge { display: inline-block; border-radius: 4px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.badge-ok { background: #133620; color: var(--ok); }
.badge-danger { background: #3a1414; color: var(--danger); }
.badge-warn { background: #3a2c10; color: var(--warn); }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-danger { background: #3a1414; color: #ffb3b3; border: 1px solid #5a1f1f; }
.alert-ok { background: #133620; color: #a8f0c0; border: 1px solid #1f5c34; }

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 360px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 32px; }
.login-card h1 { text-align: center; font-size: 18px; }
.login-banner { text-align: center; font-size: 11px; color: #ffb3b3; margin-bottom: 20px; }

code.mono { font-family: ui-monospace, Consolas, monospace; background: #0d0f14; padding: 2px 6px; border-radius: 4px; }
.backup-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 12px 0; }
.backup-codes code { text-align: center; padding: 6px; }
