*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #080b0f;
  --bg2:        #0d1117;
  --bg3:        #111820;
  --line:       #1a2535;
  --accent:     #c8441a;
  --accent2:    #e85d20;
  --amber:      #d4820a;
  --green:      #2aab5f;
  --blue:       #80c9ff;
  --muted:      #3a4a5c;
  --text:       #b8c8d8;
  --text2:      #7a92a8;
  --text3:      #e9e9e9;
  --white:      #e8f0f8;
  --font-mono:  'Share Tech Mono', monospace;
  --font-cond:  'Barlow Condensed', sans-serif;
  --font-body:  'Barlow', sans-serif;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scanline overlay ─────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 9999;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(0,0,0,.07) 2px, rgba(0,0,0,.07) 4px
  );
  pointer-events: none;
}

/* ── Scrollbars ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--muted); border-radius: 3px; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ══════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════════════════════════ */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(200,68,26,.08) 0%, transparent 70%);
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  width: 380px;
  padding: 40px 36px 36px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.login-title {
  font-family: var(--font-cond);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--text3);
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-family: var(--font-cond);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
}

.login-input {
  width: 100%;
  font-size: 13px;
  padding: 10px 14px;
}

.login-error {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent2);
  min-height: 16px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 13px;
  letter-spacing: 3px;
  margin-top: 4px;
}

.login-footer {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  text-align: center;
  letter-spacing: 1px;
}

/* ── Header ───────────────────────────────────────────────────────────── */
header {
  background: var(--bg2);
  border-bottom: 1px solid var(--accent);
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 20px rgba(200,68,26,.15);
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-cond); font-weight: 900; font-size: 18px;
  letter-spacing: 4px; color: var(--white); text-transform: uppercase;
}
.logo-sub {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--accent); letter-spacing: 2px;
}

.header-right { display: flex; align-items: center; gap: 16px; }

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.header-username {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text2);
  letter-spacing: 1px;
}

/* ── Auto-refresh indicator ───────────────────────────────────────────── */
.refresh-ring {
  position: relative; width: 20px; height: 20px;
  cursor: pointer; flex-shrink: 0;
}
.refresh-ring svg { width: 20px; height: 20px; transform: rotate(-90deg); }
.refresh-ring circle { fill: none; stroke: var(--line); stroke-width: 2; }
.refresh-ring .progress {
  stroke: var(--green); stroke-width: 2;
  stroke-dasharray: 50.27; stroke-dashoffset: 50.27;
  transition: stroke-dashoffset .4s linear;
}
.refresh-ring:hover .progress { stroke: var(--accent2); }
.refresh-label {
  font-family: var(--font-mono); font-size: 9px;
  color: var(--text3); letter-spacing: 1px;
  text-align: center; margin-top: 1px;
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.header-clock {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text2); letter-spacing: 1px;
}

/* ── New crash alert banner ───────────────────────────────────────────── */
.new-crash-banner {
  display: none;
  background: rgba(200,68,26,.15);
  border-bottom: 1px solid var(--accent);
  padding: 8px 24px;
  font-family: var(--font-cond); font-size: 13px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent2);
  cursor: pointer; text-align: center;
  animation: flashBorder 1s ease infinite;
}
.new-crash-banner.show { display: block; }
@keyframes flashBorder {
  0%,100% { border-bottom-color: var(--accent); }
  50%     { border-bottom-color: transparent; }
}

/* ── Navigation tabs ──────────────────────────────────────────────────── */
.nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
  display: flex; gap: 2px; padding: 0 24px;
}
.nav-btn {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-cond); font-size: 13px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--text2); padding: 12px 20px;
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active { color: var(--accent2); border-bottom-color: var(--accent); }

/* ── Main content ─────────────────────────────────────────────────────── */
main { flex: 1; padding: 24px; max-width: 1600px; margin: 0 auto; width: 100%; }

/* ── Views ────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Stats grid ───────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg2); border: 1px solid var(--line);
  padding: 16px 20px; position: relative; overflow: hidden;
  transition: border-color .2s;
}
.stat-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent);
}
.stat-card:hover { border-color: var(--muted); }
.stat-label {
  font-family: var(--font-cond); font-size: 11px; font-weight: 600;
  letter-spacing: 3px; text-transform: uppercase;
  color: var(--text3); margin-bottom: 6px;
}
.stat-value { font-family: var(--font-mono); font-size: 28px; color: var(--white); line-height: 1; }

/* ── Section header ───────────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-cond); font-size: 14px; font-weight: 700;
  letter-spacing: 3px; text-transform: uppercase; color: var(--text2);
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ''; display: inline-block;
  width: 12px; height: 2px; background: var(--accent);
}

/* ── Controls bar ─────────────────────────────────────────────────────── */
.controls {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px; align-items: center;
}
.input, .select {
  background: var(--bg3); border: 1px solid var(--line);
  color: var(--text); font-family: var(--font-mono); font-size: 12px;
  padding: 7px 12px; outline: none; transition: border-color .2s;
}
.input:focus, .select:focus { border-color: var(--accent); }
.input { min-width: 220px; }
.select option { background: var(--bg3); }

.btn {
  background: transparent; border: 1px solid var(--muted);
  color: var(--text2); font-family: var(--font-cond); font-size: 12px;
  font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  padding: 7px 16px; cursor: pointer; transition: all .2s;
}
.btn:hover { border-color: var(--accent); color: var(--accent2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--white); }
.btn-accent:hover { background: var(--accent2); border-color: var(--accent2); color: var(--white); }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* ── Crash table ──────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--bg2); border: 1px solid var(--line); overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg3); font-family: var(--font-cond);
  font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text3); padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s;
}
tbody tr:hover { background: rgba(200,68,26,.07); }
tbody tr:last-child { border-bottom: none; }
tbody tr.row-new { border-left: 2px solid var(--accent); animation: rowFlash .8s ease; }
@keyframes rowFlash {
  0%   { background: rgba(200,68,26,.2); }
  100% { background: transparent; }
}
td {
  padding: 10px 14px; font-family: var(--font-mono);
  font-size: 12px; white-space: nowrap; vertical-align: top;
}
.td-main { white-space: normal; max-width: 340px; }
.td-error { color: var(--white); font-size: 12px; line-height: 1.4; }
.td-stack-preview {
  font-size: 10px; color: var(--text3); margin-top: 4px;
  white-space: pre; overflow: hidden; max-height: 42px;
  border-left: 2px solid var(--line); padding-left: 6px; line-height: 1.5;
}
.td-stack-preview .sf-ue  { color: var(--accent2); }
.td-stack-preview .sf-sys { color: var(--muted); }

/* ══════════════════════════════════════════════════════════════════════════
   CRASH DETAIL OVERLAY (fullscreen modal)
   ══════════════════════════════════════════════════════════════════════════ */
.crash-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 7, 11, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.crash-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.crash-overlay-dialog {
  background: var(--bg2);
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 1px rgba(200,68,26,.15), 0 40px 120px rgba(0,0,0,.8);
  width: 100%;
  max-width: 1100px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  transform: translateY(12px);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.crash-overlay.open .crash-overlay-dialog {
  transform: translateY(0);
}

.crash-overlay-header {
  background: var(--bg3);
  border-bottom: 1px solid var(--accent);
  padding: 18px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}
.crash-overlay-header-left { flex: 1; min-width: 0; }

.overlay-title {
  font-family: var(--font-cond); font-size: 20px; font-weight: 700;
  letter-spacing: 2px; color: var(--white); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.overlay-id {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--accent); letter-spacing: 1px; margin-top: 5px;
}

.crash-overlay-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Wider meta grid inside overlay */
.crash-overlay-body .meta-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* ── Status badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-block; font-family: var(--font-cond);
  font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  padding: 2px 8px; border: 1px solid currentColor;
}
.badge-new           { color: var(--accent);  }
.badge-investigating { color: var(--amber);   }
.badge-fixed         { color: var(--green);   }
.badge-wontfix       { color: var(--text3);   }
.badge-duplicate     { color: var(--blue);    }

/* ── Platform badges ──────────────────────────────────────────────────── */
.plat {
  font-family: var(--font-cond); font-size: 11px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 2px 8px; background: var(--bg3);
  border-left: 2px solid var(--muted); color: var(--text2);
}
.plat-win   { border-color: #4a9fd4; color: #4a9fd4; }
.plat-linux { border-color: #e8a040; color: #e8a040; }
.plat-mac   { border-color: #8080c0; color: #8080c0; }
.plat-quest { border-color: #44cc88; color: #44cc88; }
.plat-ps    { border-color: #0088cc; color: #0088cc; }

/* ── Pagination ───────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text2);
}

/* ── Panel tabs (inside overlay) ─────────────────────────────────────── */
.panel-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--line);
  margin-bottom: 20px; margin-top: 4px;
}
.panel-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text3); font-family: var(--font-cond); font-size: 12px;
  font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  padding: 10px 18px; cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 6px;
}
.panel-tab:hover { color: var(--text); border-bottom-color: var(--muted); }
.panel-tab.active { color: var(--accent2); border-bottom-color: var(--accent); }
.panel-tab-count {
  background: var(--bg3); border: 1px solid var(--line);
  color: var(--text2); font-size: 10px; padding: 0 5px;
  border-radius: 2px; min-width: 18px; text-align: center;
}
.panel-tab.active .panel-tab-count { border-color: var(--accent); color: var(--accent2); }

/* ── Detail sections ──────────────────────────────────────────────────── */
.detail-section { margin-bottom: 24px; }
.detail-section-title {
  font-family: var(--font-cond); font-size: 11px; font-weight: 700;
  letter-spacing: 3px; text-transform: uppercase; color: var(--text3);
  padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.meta-item {}
.meta-key {
  font-family: var(--font-mono); font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px;
}
.meta-val { font-family: var(--font-mono); font-size: 13px; color: var(--text); }

/* ── Stack Trace ──────────────────────────────────────────────────────── */
.st-empty {
  padding: 40px 0; text-align: center; font-family: var(--font-mono);
  font-size: 12px; color: var(--text3);
}
.st-thread-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; padding: 6px 10px;
  background: var(--bg3); border: 1px solid var(--line);
}
.st-thread-tag {
  font-family: var(--font-cond); font-size: 10px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent2); background: rgba(232,93,32,.12);
  border: 1px solid rgba(232,93,32,.3); padding: 2px 8px;
}
.st-frame-count { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-left: auto; }
.st-frames { font-family: var(--font-mono); font-size: 11px; }
.st-frame {
  display: flex; align-items: flex-start; gap: 0;
  border-bottom: 1px solid rgba(26,37,53,.7);
  padding: 5px 8px; transition: background .15s; min-height: 30px;
}
.st-frame:hover { background: rgba(255,255,255,.02); }
.st-frame-num { color: var(--text3); min-width: 26px; flex-shrink: 0; font-size: 10px; padding-top: 2px; user-select: none; }
.st-frame-indicator { width: 3px; flex-shrink: 0; align-self: stretch; margin-right: 10px; border-radius: 1px; }
.st-frame-body { flex: 1; min-width: 0; }
.st-frame-func { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.st-frame-file { display: block; font-size: 10px; color: var(--text3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-frame-app  .st-frame-indicator { background: var(--accent2); }
.st-frame-app  .st-frame-func      { color: var(--accent2); }
.st-frame-app                       { background: rgba(232,93,32,.04); }
.st-frame-engine .st-frame-indicator { background: var(--blue); }
.st-frame-engine .st-frame-func      { color: var(--blue); }
.st-frame-sys  .st-frame-indicator { background: var(--muted); }
.st-frame-sys  .st-frame-func      { color: var(--text3); }
.st-frame-other .st-frame-indicator { background: var(--line); }
.st-group-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; cursor: pointer;
  background: var(--bg); border: 1px dashed var(--line);
  border-left: 3px solid var(--muted);
  margin: 4px 0; transition: all .2s;
}
.st-group-toggle:hover { border-color: var(--muted); background: rgba(255,255,255,.02); }
.st-group-icon   { color: var(--text3); font-size: 10px; width: 12px; flex-shrink: 0; }
.st-group-label  { font-family: var(--font-mono); font-size: 11px; color: var(--text3); }
.st-group-hint   { font-size: 10px; color: var(--text3); margin-left: auto; font-style: italic; }
.st-group-frames { border-left: 3px solid var(--line); }

/* ── Log viewer ───────────────────────────────────────────────────────── */
.log-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.log-pills { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.log-file-pill {
  background: var(--bg3); border: 1px solid var(--line);
  color: var(--text2); font-family: var(--font-mono); font-size: 10px;
  padding: 4px 10px; cursor: pointer; transition: all .2s;
}
.log-file-pill:hover  { border-color: var(--muted); color: var(--text); }
.log-file-pill.active { border-color: var(--accent); color: var(--accent2); background: rgba(200,68,26,.08); }
.log-file-size { color: var(--text3); margin-left: 4px; }
.log-search-wrap { display: flex; align-items: center; gap: 8px; }
.log-search-input { min-width: 180px; max-width: 260px; padding: 5px 10px; }
.log-match-count { font-family: var(--font-mono); font-size: 10px; color: var(--text3); white-space: nowrap; min-width: 70px; }
.log-viewer-wrap {
  background: var(--bg); border: 1px solid var(--line);
  max-height: 420px; overflow-y: auto; overflow-x: auto;
}
.log-omit-banner {
  font-family: var(--font-mono); font-size: 10px; color: var(--text3);
  background: var(--bg2); border-bottom: 1px solid var(--line);
  padding: 6px 12px; letter-spacing: 1px;
}
.log-lines { display: table; width: 100%; }
.log-row {
  display: table-row; font-family: var(--font-mono); font-size: 11px; line-height: 1.5; transition: background .1s;
}
.log-row:hover { background: rgba(255,255,255,.03); }
.log-row-error-bg { background: rgba(200,68,26,.06); }
.log-linenum {
  display: table-cell; color: var(--text3); font-size: 10px;
  padding: 2px 12px 2px 8px; text-align: right; user-select: none;
  border-right: 1px solid var(--line); width: 48px; white-space: nowrap; vertical-align: top;
}
.log-line-text { display: table-cell; padding: 2px 14px; white-space: pre-wrap; word-break: break-all; vertical-align: top; }
.log-error   .log-line-text { color: #e87060; }
.log-warning .log-line-text { color: var(--amber); }
.log-verbose .log-line-text { color: var(--text3); }
.log-info    .log-line-text { color: var(--text2); }
.log-ts       { color: var(--text3); }
.log-cat      { color: var(--blue); font-weight: 600; }
.log-highlight { background: rgba(212,130,10,.35); color: var(--white); border-radius: 2px; }
.log-loading  { padding: 30px; text-align: center; font-family: var(--font-mono); font-size: 12px; color: var(--text3); }

/* ── Files tab ────────────────────────────────────────────────────────── */
.files-list { display: flex; flex-direction: column; gap: 6px; }
.files-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg3); border: 1px solid var(--line);
  padding: 8px 12px; transition: border-color .2s;
}
.files-row:hover { border-color: var(--muted); }
.files-name { font-family: var(--font-mono); font-size: 12px; color: var(--text); flex: 1; }
.files-size { font-family: var(--font-mono); font-size: 10px; color: var(--text3); white-space: nowrap; }
.files-actions { display: flex; gap: 6px; }

.file-ext {
  background: var(--accent); color: var(--white);
  font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  padding: 1px 5px;
}
.file-ext-log { background: var(--amber); }
.file-ext-dmp { background: var(--blue); }

.error-box {
  background: rgba(200,68,26,.08); border: 1px solid rgba(200,68,26,.3);
  border-left: 3px solid var(--accent); padding: 12px 16px;
  font-family: var(--font-mono); font-size: 13px; color: var(--white); line-height: 1.5;
}
.error-type {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  background: var(--accent); color: var(--white); padding: 1px 6px;
  margin-right: 8px; vertical-align: middle;
}

.status-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.status-select {
  background: var(--bg3); border: 1px solid var(--line); color: var(--text);
  font-family: var(--font-mono); font-size: 12px; padding: 5px 10px; outline: none; cursor: pointer;
}
.status-select:focus { border-color: var(--accent); }

/* Close button (overlay) */
.close-btn {
  background: none; border: 1px solid var(--muted); color: var(--text2);
  padding: 6px 14px; cursor: pointer; font-family: var(--font-cond);
  font-size: 12px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  display: flex; align-items: center; gap: 6px; transition: all .2s; flex-shrink: 0;
}
.close-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Empty / loading ──────────────────────────────────────────────────── */
.empty-state {
  padding: 60px; text-align: center; font-family: var(--font-cond);
  font-size: 14px; color: var(--text3); letter-spacing: 2px; text-transform: uppercase;
}
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 400;
  background: var(--bg3); border: 1px solid var(--line);
  border-left: 3px solid var(--green); padding: 12px 20px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text);
  transform: translateY(80px); opacity: 0; transition: all .3s; max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-left-color: var(--accent); }

/* ── Config view ──────────────────────────────────────────────────────── */
.config-card {
  background: var(--bg2); border: 1px solid var(--line);
  padding: 24px; margin-bottom: 16px; max-width: 780px;
}
.config-label {
  font-family: var(--font-cond); font-size: 11px; font-weight: 700;
  letter-spacing: 3px; text-transform: uppercase; color: var(--text3); margin-bottom: 8px;
}
.code-block {
  background: var(--bg); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 12px; color: var(--text);
  padding: 14px 16px; line-height: 1.7; overflow-x: auto; white-space: pre; position: relative;
}
.copy-btn {
  position: absolute; top: 8px; right: 8px; background: var(--bg3);
  border: 1px solid var(--muted); color: var(--text2); font-family: var(--font-mono);
  font-size: 10px; padding: 3px 8px; cursor: pointer; transition: all .2s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.ini-key { color: var(--amber); }
.ini-val { color: var(--green); }
.ini-sec { color: var(--accent2); }
.ini-cmt { color: var(--text3); font-style: italic; }

/* ── Charts ───────────────────────────────────────────────────────────── */
.charts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.chart-card { background: var(--bg2); border: 1px solid var(--line); padding: 16px 20px; }
.chart-title {
  font-family: var(--font-cond); font-size: 11px; font-weight: 700;
  letter-spacing: 3px; text-transform: uppercase; color: var(--text3); margin-bottom: 14px;
}
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bar-label { font-family: var(--font-mono); font-size: 11px; color: var(--text2); width: 100px; flex-shrink: 0; text-overflow: ellipsis; overflow: hidden; }
.bar-bg { flex: 1; background: var(--bg3); height: 16px; position: relative; }
.bar-fill { height: 100%; background: var(--accent); transition: width .8s cubic-bezier(.4,0,.2,1); position: relative; }
.bar-fill::after {
  content: attr(data-n); position: absolute; right: -28px; top: 50%;
  transform: translateY(-50%); font-family: var(--font-mono); font-size: 10px; color: var(--text2);
}

/* ══════════════════════════════════════════════════════════════════════════
   MODALS (shared: change password, add user, reset password)
   ══════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(4,7,11,.88);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  width: 380px;
  padding: 32px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-title {
  font-family: var(--font-cond);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--white);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.modal-field .input,
.modal-field .select {
  width: 100%;
}

.modal-error {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent2);
  min-height: 14px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .meta-grid { grid-template-columns: 1fr; }
  .controls { flex-direction: column; }
  .input { min-width: 100%; }
  .crash-overlay { padding: 0; }
  .crash-overlay-dialog { max-height: 100vh; border: none; border-top: 2px solid var(--accent); }
  .login-card { width: 100%; margin: 16px; }
  .header-user { display: none; }
}
