:root {
  --bg: #08100f;
  --panel: #101b1b;
  --panel-2: #142223;
  --line: #244040;
  --text: #edf7f3;
  --muted: #93aaa4;
  --green: #24d18c;
  --blue: #4da3ff;
  --gold: #e8bc5f;
  --red: #ff6b6b;
  --shadow: 0 20px 60px rgba(0, 0, 0, .32);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(36, 209, 140, .12), transparent 34%), var(--bg);
  font: 15px/1.45 "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.auth-screen {
  min-height: calc(100vh - 44px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-panel {
  width: min(440px, 100%);
  padding: 30px;
  background: linear-gradient(180deg, rgba(20,34,35,.96), rgba(11,20,20,.98));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 8px;
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #06100e;
  background: linear-gradient(135deg, var(--green), var(--gold));
  font-weight: 900;
}
.auth-panel h1 { margin: 16px 0 8px; font-size: 28px; }
.auth-panel p, small { color: var(--muted); }
.form-grid { display: grid; gap: 14px; margin-top: 18px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%;
  color: var(--text);
  background: #0a1515;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(36,209,140,.12); }
.primary, .secondary, .ghost, .logout, .icon-btn {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 10px 14px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary { background: linear-gradient(135deg, #19b978, #2477d1); font-weight: 700; }
.secondary { background: #142a2a; border: 1px solid var(--line); }
.ghost { background: transparent; border: 1px solid var(--line); }
.logout { width: 100%; background: rgba(255,107,107,.12); color: #ffc7c7; border: 1px solid rgba(255,107,107,.25); }
.icon-btn { width: 42px; padding: 0; background: #142a2a; border: 1px solid var(--line); }
.app-shell { min-height: calc(100vh - 44px); display: grid; grid-template-columns: 270px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: calc(100vh - 44px);
  padding: 18px;
  background: rgba(8, 16, 15, .96);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.sidebar-brand span { display: block; color: var(--muted); font-size: 12px; }
nav { display: grid; gap: 6px; margin-bottom: 18px; }
.nav-btn {
  justify-content: flex-start;
  width: 100%;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
}
.nav-btn.active, .nav-btn:hover { color: var(--text); background: #132323; border-color: var(--line); }
.main { min-width: 0; padding: 22px; padding-bottom: 70px; }
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
}
.topbar h2 { margin: 0; font-size: 26px; }
.topbar p { margin: 3px 0 0; color: var(--muted); }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.page { display: none; }
.page.active { display: block; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: linear-gradient(180deg, rgba(20,34,35,.95), rgba(12,22,22,.96));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.16);
}
.metric { min-height: 112px; display: grid; align-content: space-between; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { font-size: clamp(21px, 2.5vw, 31px); line-height: 1.1; overflow-wrap: anywhere; }
.metric small { color: var(--green); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0 12px; }
.section-title h3 { margin: 0; font-size: 19px; }
.section-title p { margin: 0; color: var(--muted); }
.chart-box { height: 330px; position: relative; }
.chart-box.small { height: 250px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid rgba(36,64,64,.75); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
td { color: #dcebe7; }
.table-wrap { overflow-x: auto; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.pill.good { color: #9ff4ce; border-color: rgba(36,209,140,.35); background: rgba(36,209,140,.08); }
.pill.warn { color: #ffe2a4; border-color: rgba(232,188,95,.35); background: rgba(232,188,95,.08); }
.pill.bad { color: #ffc7c7; border-color: rgba(255,107,107,.35); background: rgba(255,107,107,.08); }
.notice {
  padding: 12px;
  border: 1px solid rgba(232,188,95,.35);
  background: rgba(232,188,95,.08);
  border-radius: 8px;
  color: #ffe6b2;
}
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters > * { max-width: 230px; }
.risk-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 44px;
  padding: 10px 18px;
  color: #bdd0ca;
  background: rgba(5, 10, 10, .94);
  border-top: 1px solid var(--line);
  font-size: 12px;
  z-index: 20;
}
.mobile-open .sidebar { transform: translateX(0); }
@media (max-width: 1080px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    z-index: 30;
    width: 280px;
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .main { padding: 16px; }
  .topbar { align-items: flex-start; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .top-actions { width: 100%; justify-content: stretch; }
  .top-actions button { flex: 1; }
}
@media print {
  .sidebar, .top-actions, .icon-btn, .risk-footer { display: none !important; }
  .app-shell { display: block; }
  body { background: #fff; color: #111; }
  .card { box-shadow: none; border-color: #ddd; background: #fff; color: #111; }
  th, td, .topbar p, .metric span { color: #222; }
}
