/* ================================================
   BALANCE — K-ERI SaaS Design System
   Korea Emotional Risk Intelligence Platform
   ================================================ */

:root {
  /* === Brand Colors === */
  --primary:       #5B5BD6;
  --primary-dark:  #4747C2;
  --primary-light: #7C7CDE;
  --primary-glow:  rgba(91,91,214,0.18);

  /* === Risk Spectrum === */
  --risk-low:      #10B981;
  --risk-low-bg:   rgba(16,185,129,0.1);
  --risk-med:      #F59E0B;
  --risk-med-bg:   rgba(245,158,11,0.1);
  --risk-high:     #EF4444;
  --risk-high-bg:  rgba(239,68,68,0.1);
  --risk-crit:     #7F1D1D;
  --risk-crit-bg:  rgba(127,29,29,0.15);

  /* === K-ERI Score Colors === */
  --keri-excellent: #10B981;  /* 80-100 */
  --keri-good:      #3B82F6;  /* 60-79  */
  --keri-caution:   #F59E0B;  /* 40-59  */
  --keri-danger:    #EF4444;  /* 20-39  */
  --keri-critical:  #991B1B;  /* 0-19   */

  /* === Metric Colors === */
  --c-energy:    #F97316;
  --c-stress:    #EF4444;
  --c-focus:     #3B82F6;
  --c-belonging: #8B5CF6;
  --c-pressure:  #EC4899;

  /* === Neutrals === */
  --bg:          #F4F5F9;
  --surface:     #FFFFFF;
  --surface-2:   #F9FAFB;
  --border:      #E5E7EB;
  --border-dark: #D1D5DB;

  /* === Text === */
  --text-1: #111827;
  --text-2: #374151;
  --text-3: #6B7280;
  --text-4: #9CA3AF;

  /* === Sidebar === */
  --sidebar-bg:   #0F172A;
  --sidebar-text: rgba(255,255,255,0.7);
  --sidebar-act:  #FFFFFF;
  --sidebar-w:    240px;

  /* === Shadows === */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);

  /* === Radius === */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-full: 9999px;

  /* === Transitions === */
  --t-fast:   all 0.15s ease;
  --t-normal: all 0.25s ease;
  --t-slow:   all 0.4s ease;

  /* === Typography === */
  --font: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ===========================
   RESET
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; outline: none; }
img { max-width: 100%; display: block; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 99px; }

/* ===========================
   LAYOUT
   =========================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.page-body {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
}

/* ===========================
   SIDEBAR
   =========================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}
.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.logo-icon-box {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), #818CF8);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: white;
  flex-shrink: 0;
}
.logo-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.logo-sub {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.35);
  font-weight: 400;
  padding-left: 42px;
  letter-spacing: 0.03em;
}

.sidebar-org-select {
  margin: 14px 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-md);
}
.org-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.org-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
}
.nav-section-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.25);
  padding: 14px 8px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--sidebar-text);
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--t-fast);
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: white;
}
.nav-item.active {
  background: rgba(91,91,214,0.25);
  color: white;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--primary-light);
  border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  background: var(--risk-high);
  color: white;
  border-radius: var(--r-full);
  font-size: 0.65rem;
  font-weight: 700;
}
.nav-badge.yellow { background: var(--risk-med); }
.nav-badge.green  { background: var(--risk-low); }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #818CF8);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.35);
}

/* ===========================
   TOPBAR
   =========================== */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}
.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  flex: 1;
}
.topbar-subtitle {
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 400;
  margin-left: 8px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-week {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 0.78rem;
  color: var(--text-2);
  font-weight: 600;
}
.icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  font-size: 0.9rem;
  transition: var(--t-fast);
  cursor: pointer;
  position: relative;
}
.icon-btn:hover { background: var(--border); color: var(--text-1); }
.notif-dot {
  position: absolute;
  top: 6px; right: 7px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--risk-high);
  border: 1px solid white;
}

/* ===========================
   CARDS
   =========================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  transition: var(--t-fast);
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title i { font-size: 0.8rem; }
.card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-1);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.card-value.risk-low  { color: var(--risk-low); }
.card-value.risk-med  { color: var(--risk-med); }
.card-value.risk-high { color: var(--risk-high); }
.card-value.risk-crit { color: var(--risk-crit); }
.card-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--r-full);
  margin-top: 6px;
}
.delta-up   { background: var(--risk-low-bg);  color: var(--risk-low); }
.delta-down { background: var(--risk-high-bg); color: var(--risk-high); }
.delta-neutral { background: var(--risk-med-bg); color: var(--risk-med); }

/* ===========================
   RISK BADGES
   =========================== */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.risk-badge.low      { background: var(--risk-low-bg);  color: var(--risk-low);  border: 1px solid rgba(16,185,129,0.2); }
.risk-badge.medium   { background: var(--risk-med-bg);  color: var(--risk-med);  border: 1px solid rgba(245,158,11,0.2); }
.risk-badge.high     { background: var(--risk-high-bg); color: var(--risk-high); border: 1px solid rgba(239,68,68,0.2); }
.risk-badge.critical { background: var(--risk-crit-bg); color: #ef4444; border: 1px solid rgba(127,29,29,0.3); }
.risk-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.risk-badge.critical::before { animation: critPulse 1s infinite; }
@keyframes critPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(1.3); }
}

/* ===========================
   KERI SCORE GAUGE
   =========================== */
.keri-gauge {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.keri-num {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
}
.keri-label {
  font-size: 0.7rem;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.keri-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: 8px;
}
.keri-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

/* ===========================
   PROGRESS BARS
   =========================== */
.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.progress-label {
  font-size: 0.75rem;
  color: var(--text-2);
  font-weight: 600;
  width: 64px;
  flex-shrink: 0;
}
.progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 0.8s ease;
}
.progress-val {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 0.82rem;
  font-weight: 600;
  transition: var(--t-fast);
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(91,91,214,0.35);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(91,91,214,0.4); }
.btn-secondary {
  background: var(--bg);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-danger {
  background: var(--risk-high-bg);
  color: var(--risk-high);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-sm { padding: 5px 11px; font-size: 0.75rem; }
.btn-lg { padding: 11px 22px; font-size: 0.9rem; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* ===========================
   FORM ELEMENTS
   =========================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
}
.form-label span { color: var(--risk-high); }
.form-input {
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border-dark);
  border-radius: var(--r-md);
  font-size: 0.85rem;
  color: var(--text-1);
  transition: var(--t-fast);
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input::placeholder { color: var(--text-4); }

/* ===========================
   SLIDER (Checkin)
   =========================== */
.slider-wrap {
  padding: 8px 0 4px;
}
.slider-row {
  margin-bottom: 20px;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.slider-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
}
.slider-name .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.slider-val {
  font-size: 1.1rem;
  font-weight: 800;
  min-width: 28px;
  text-align: right;
}
.range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--r-full);
  outline: none;
  cursor: pointer;
  transition: var(--t-fast);
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  border: 3px solid var(--primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: var(--t-fast);
}
.range-input::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider-ticks {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}
.slider-ticks span {
  font-size: 0.62rem;
  color: var(--text-4);
  font-weight: 500;
}

/* ===========================
   HEATMAP
   =========================== */
.heatmap-grid {
  display: grid;
  gap: 4px;
}
.heatmap-cell {
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: var(--t-fast);
  aspect-ratio: 1;
}
.heatmap-cell:hover { transform: scale(1.1); z-index: 2; box-shadow: var(--shadow-md); }
.heat-90 { background: #10B981; }
.heat-75 { background: #34D399; }
.heat-60 { background: #F59E0B; }
.heat-45 { background: #FB923C; }
.heat-30 { background: #EF4444; }
.heat-15 { background: #DC2626; }

/* ===========================
   TABLE
   =========================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  font-size: 0.82rem;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: var(--bg); }
.data-table tr:last-child td { border-bottom: none; }

/* ===========================
   TAGS / CHIPS
   =========================== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-3);
  border: 1px solid var(--border);
}
.tag.red    { background: var(--risk-high-bg); color: var(--risk-high); border-color: rgba(239,68,68,0.2); }
.tag.yellow { background: var(--risk-med-bg);  color: var(--risk-med);  border-color: rgba(245,158,11,0.2); }
.tag.green  { background: var(--risk-low-bg);  color: var(--risk-low);  border-color: rgba(16,185,129,0.2); }
.tag.purple { background: rgba(139,92,246,0.1); color: #7C3AED; border-color: rgba(139,92,246,0.2); }

/* ===========================
   MODAL
   =========================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--t-normal);
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal-box {
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 28px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: var(--t-normal);
}
.modal-backdrop.open .modal-box { transform: scale(1); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--t-fast);
}
.modal-close:hover { background: var(--border); color: var(--text-1); }

/* ===========================
   TOAST
   =========================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 16px;
  background: var(--text-1);
  color: white;
  border-radius: var(--r-lg);
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  transform: translateX(100px);
  opacity: 0;
  transition: var(--t-normal);
  max-width: 320px;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.success .toast-icon { color: var(--risk-low); }
.toast.warning .toast-icon { color: var(--risk-med); }
.toast.error   .toast-icon { color: var(--risk-high); }

/* ===========================
   EMPTY STATES
   =========================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-4);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-title { font-size: 0.9rem; font-weight: 600; color: var(--text-3); margin-bottom: 6px; }
.empty-desc  { font-size: 0.8rem; line-height: 1.5; }

/* ===========================
   PAGE HEADER
   =========================== */
.page-header {
  margin-bottom: 24px;
}
.page-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.page-desc {
  font-size: 0.82rem;
  color: var(--text-3);
}

/* ===========================
   GRID UTILITIES
   =========================== */
.grid-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3  { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4  { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.grid-5  { display: grid; grid-template-columns: repeat(5,1fr); gap: 16px; }
.flex    { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; align-items: center; gap: 8px; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-24  { gap: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ===========================
   DIVIDER
   =========================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ===========================
   SECTION LABEL
   =========================== */
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===========================
   ALERT BOX
   =========================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.8rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.alert i { flex-shrink: 0; margin-top: 1px; }
.alert-content strong { display: block; font-size: 0.82rem; margin-bottom: 2px; }
.alert-content p { color: inherit; opacity: 0.8; }
.alert.critical { background: var(--risk-crit-bg); color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }
.alert.high { background: var(--risk-high-bg); color: var(--risk-high); border: 1px solid rgba(239,68,68,0.15); }
.alert.medium { background: var(--risk-med-bg); color: var(--risk-med); border: 1px solid rgba(245,158,11,0.2); }
.alert.low { background: var(--risk-low-bg); color: var(--risk-low); border: 1px solid rgba(16,185,129,0.2); }
.alert.info { background: rgba(91,91,214,0.08); color: var(--primary); border: 1px solid rgba(91,91,214,0.2); }

/* ===========================
   LOADING SKELETON
   =========================== */
.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, var(--border) 50%, var(--bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===========================
   CHART CONTAINERS
   =========================== */
.chart-wrap {
  position: relative;
  width: 100%;
}
.chart-wrap canvas { display: block; }

/* ===========================
   VIEW SWITCHING
   =========================== */
.page-view { display: none; }
.page-view.active { display: block; }

/* ===========================
   LOGIN / LANDING STYLES
   =========================== */
.auth-page {
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.auth-bg-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(91,91,214,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91,91,214,0.05) 1px, transparent 1px);
  background-size: 48px 48px;
}
.auth-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-xl);
  padding: 36px;
  width: 100%;
  max-width: 440px;
  backdrop-filter: blur(20px);
  position: relative;
  z-index: 1;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo .logo-mark { justify-content: center; }
.auth-logo .logo-name { font-size: 1.4rem; }
.auth-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
  text-align: center;
  margin-top: 4px;
}
.auth-form .form-label { color: rgba(255,255,255,0.7); }
.auth-form .form-input {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.15);
  color: white;
}
.auth-form .form-input::placeholder { color: rgba(255,255,255,0.25); }
.auth-form .form-input:focus {
  border-color: var(--primary-light);
  background: rgba(91,91,214,0.1);
  box-shadow: 0 0 0 3px rgba(91,91,214,0.15);
}
.auth-role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.auth-role-btn {
  padding: 14px 12px;
  border-radius: var(--r-lg);
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.65);
  text-align: center;
  cursor: pointer;
  transition: var(--t-normal);
}
.auth-role-btn.selected {
  border-color: var(--primary-light);
  background: rgba(91,91,214,0.2);
  color: white;
}
.auth-role-btn i { font-size: 1.4rem; display: block; margin-bottom: 6px; }
.auth-role-btn span { font-size: 0.78rem; font-weight: 600; display: block; }
.auth-role-btn small { font-size: 0.65rem; color: inherit; opacity: 0.7; }

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-5 { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: var(--t-normal); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .page-body { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
}
