/* ===== RISIKO-DASHBOARD CSS ===== */
@import url('/shared/fonts/inter.css');
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: linear-gradient(145deg, #eef2f7 0%, #e4ecf4 25%, #dfe8f0 50%, #e8eef5 75%, #f0f4f8 100%);
  --nav-bg: rgba(255,255,255,0.55);
  --nav-border: rgba(255,255,255,0.5);
  --card-bg: rgba(255,255,255,0.45);
  --card-border: rgba(255,255,255,0.6);
  --card-hover-bg: rgba(255,255,255,0.65);
  --card-shadow: 0 2px 16px rgba(0,0,0,0.04);
  --card-hover-shadow: 0 12px 44px rgba(0,0,0,0.08);
  --text-primary: #1c1c1e;
  --text-secondary: #636366;
  --text-tertiary: #8e8e93;
  --badge-bg: rgba(4,179,214,0.1);
  --badge-color: #04b3d6;
  --toggle-bg: rgba(0,0,0,0.06);
  --toggle-knob: #fff;
  --input-bg: rgba(255,255,255,0.7);
  --modal-bg: rgba(255,255,255,0.92);
}

[data-theme="dark"] {
  --bg: linear-gradient(145deg, #0a0a1a 0%, #0f1528 20%, #151022 40%, #1a0f1e 60%, #12111a 80%, #0d1318 100%);
  --nav-bg: rgba(255,255,255,0.05);
  --nav-border: rgba(255,255,255,0.09);
  --card-bg: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.1);
  --card-hover-bg: rgba(255,255,255,0.1);
  --card-shadow: 0 2px 16px rgba(0,0,0,0.2);
  --card-hover-shadow: 0 12px 44px rgba(0,0,0,0.3);
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-tertiary: #636366;
  --badge-bg: rgba(4,179,214,0.15);
  --badge-color: #2cc5e4;
  --toggle-bg: rgba(255,255,255,0.1);
  --toggle-knob: #1c1c1e;
  --input-bg: rgba(255,255,255,0.07);
  --modal-bg: rgba(20,20,30,0.97);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  min-height: 100vh;
  background: var(--bg);
  background-size: 400% 400%;
  animation: gradientShift 20s ease infinite;
  -webkit-font-smoothing: antialiased;
  color: var(--text-primary);
}
@keyframes gradientShift { 0%{background-position:0% 50%} 50%{background-position:100% 50%} 100%{background-position:0% 50%} }

nav {
  position: sticky; top: 0; z-index: 200;
  background: var(--nav-bg);
  backdrop-filter: blur(44px) saturate(180%);
  -webkit-backdrop-filter: blur(44px) saturate(180%);
  border-bottom: 1px solid var(--nav-border);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex-shrink: 1; overflow: hidden; }
.nav-logo { height: 28px; width: auto; }
[data-theme="dark"] .nav-logo { filter: brightness(2.2) contrast(0.85); }
.nav-brand { font-size: 16px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.4px; }
.nav-divider { width: 1px; height: 18px; background: var(--nav-border); margin: 0 2px; }
.nav-subtitle { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.nav-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-back { font-size: 13px; font-weight: 500; color: var(--badge-color); text-decoration: none; padding: 5px 10px; border-radius: 8px; transition: all 0.2s; }
.nav-back:hover { background: var(--badge-bg); }
.theme-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.toggle-icon { font-size: 14px; }
.toggle-track { width: 44px; height: 26px; border-radius: 13px; background: var(--toggle-bg); border: 1px solid var(--card-border); position: relative; transition: all 0.3s; }
.toggle-knob { width: 20px; height: 20px; border-radius: 10px; background: var(--toggle-knob); position: absolute; top: 2px; left: 3px; transition: all 0.3s cubic-bezier(0.4,0,0.2,1); box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
[data-theme="dark"] .toggle-knob { left: 21px; background: #f5f5f7; }

.container { max-width: 1280px; margin: 0 auto; padding: 28px 24px 80px; }
.cursor-pointer { cursor: pointer; }

/* AMPEL */
.ampel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.ampel-card {
  border-radius: 18px; padding: 20px 22px;
  position: relative; overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: all 0.2s;
}
.ampel-card:hover { transform: translateY(-2px); box-shadow: var(--card-hover-shadow); }
.ampel-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 50%; background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%); border-radius: 18px 18px 0 0; pointer-events: none; }
.ampel-rot { background: linear-gradient(135deg, rgba(255,69,58,0.15), rgba(255,69,58,0.08)); border: 1.5px solid rgba(255,69,58,0.3); }
.ampel-gelb { background: linear-gradient(135deg, rgba(255,159,10,0.15), rgba(255,159,10,0.08)); border: 1.5px solid rgba(255,159,10,0.3); }
.ampel-gruen { background: linear-gradient(135deg, rgba(48,209,88,0.15), rgba(48,209,88,0.08)); border: 1.5px solid rgba(48,209,88,0.3); }
.ampel-zahl { font-size: 38px; font-weight: 700; letter-spacing: -2px; line-height: 1; margin-bottom: 4px; }
.ampel-rot .ampel-zahl { color: #ff453a; }
.ampel-gelb .ampel-zahl { color: #ff9f0a; }
.ampel-gruen .ampel-zahl { color: #30d158; }
.ampel-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.ampel-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.ampel-card.active-filter { box-shadow: 0 0 0 3px var(--badge-color), var(--card-hover-shadow); }

/* FILTER BAR */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.kat-btns { display: flex; gap: 4px; }
.kat-btn { padding: 6px 16px; border-radius: 20px; border: 1px solid var(--card-border); background: var(--card-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: var(--text-secondary); font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer; transition: all 0.2s; min-height: 34px; -webkit-tap-highlight-color: transparent; }
.kat-btn:hover { background: var(--card-hover-bg); color: var(--text-primary); }
.kat-btn.active { background: linear-gradient(135deg, #04b3d6, #0090b0); border-color: transparent; color: #fff; font-weight: 600; }
.kat-btn.rot.active { background: linear-gradient(135deg, #ff453a, #cc2e25); border-color: transparent; }
.kat-btn.gelb.active { background: linear-gradient(135deg, #ff9f0a, #cc7e08); border-color: transparent; }
.kat-btn.gruen.active { background: linear-gradient(135deg, #30d158, #25a845); border-color: transparent; }
.filter-note { font-size: 12.5px; color: var(--text-tertiary); margin-left: 4px; }

/* TABELLE */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 16px; width: 100%; max-width: 100%; }
.risiko-table { width: auto; min-width: 860px; border-collapse: collapse; background: var(--card-bg); backdrop-filter: blur(60px) saturate(180%); -webkit-backdrop-filter: blur(60px) saturate(180%); border: 1px solid var(--card-border); border-radius: 16px; overflow: hidden; box-shadow: var(--card-shadow); }
.risiko-table thead th {
  position: sticky; top: 0; z-index: 10;
  background: var(--card-bg);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}
[data-theme="dark"] .risiko-table thead th { background: rgba(20,20,30,0.97); }
.risiko-table tbody tr { border-bottom: 1px solid var(--card-border); transition: background 0.15s; }
.risiko-table tbody tr:last-child { border-bottom: none; }
.risiko-table tbody tr:hover { background: var(--card-hover-bg); }
.risiko-table td { padding: 12px 14px; font-size: 13px; color: var(--text-primary); vertical-align: middle; }
.col-name { font-weight: 600; min-width: 130px; }
.col-score { min-width: 70px; }
.col-kat { min-width: 90px; white-space: nowrap; }
.col-komp { min-width: 200px; }
.col-we { min-width: 70px; text-align: center; }
.col-rek { min-width: 70px; text-align: center; }
.col-trend { min-width: 60px; text-align: center; }
.col-akt { min-width: 90px; color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.col-detail { min-width: 80px; white-space: nowrap; }

/* SCORE BADGE */
.score-badge { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; font-size: 16px; font-weight: 700; }
.score-rot { background: rgba(255,69,58,0.12); color: #ff453a; }
.score-gelb { background: rgba(255,159,10,0.12); color: #ff9f0a; }
.score-gruen { background: rgba(48,209,88,0.12); color: #30d158; }

/* KATEGORIE BADGE */
.kat-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.kat-rot { background: rgba(255,69,58,0.12); color: #ff453a; border: 1px solid rgba(255,69,58,0.2); }
.kat-gelb { background: rgba(255,159,10,0.12); color: #ff9f0a; border: 1px solid rgba(255,159,10,0.2); }
.kat-gruen { background: rgba(48,209,88,0.12); color: #30d158; border: 1px solid rgba(48,209,88,0.2); }

/* KOMPONENTEN MINI-BARS */
.komp-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.komp-row { display: flex; align-items: center; gap: 6px; }
.komp-label { font-size: 10px; color: var(--text-tertiary); width: 68px; flex-shrink: 0; }
.komp-track { flex: 1; height: 5px; border-radius: 3px; background: var(--card-border); overflow: hidden; max-width: 80px; }
.komp-fill { height: 100%; border-radius: 3px; }
.komp-val { font-size: 10px; color: var(--text-secondary); font-weight: 600; width: 32px; text-align: right; }

/* TREND */
.trend-auf { color: #ff453a; font-size: 18px; font-weight: 700; }
.trend-ab { color: #30d158; font-size: 18px; font-weight: 700; }
.trend-gleich { color: var(--text-tertiary); font-size: 18px; }

/* BUTTONS */
.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 10px; border: none; background: linear-gradient(135deg, #04b3d6, #0090b0); color: #fff; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; transition: all 0.2s; text-decoration: none; min-height: 36px; -webkit-tap-highlight-color: transparent; }
.btn-primary:hover { opacity: 0.88; }
.btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 9px; border: 1px solid var(--card-border); background: var(--card-bg); color: var(--text-secondary); font-size: 13px; font-weight: 500; font-family: inherit; cursor: pointer; transition: all 0.2s; min-height: 36px; -webkit-tap-highlight-color: transparent; }
.btn-secondary:hover { background: var(--card-hover-bg); }
.btn-detail { padding: 5px 12px; border-radius: 8px; border: 1px solid rgba(4,179,214,0.3); background: rgba(4,179,214,0.07); color: var(--badge-color); font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer; transition: all 0.2s; min-height: 34px; -webkit-tap-highlight-color: transparent; white-space: nowrap; }
.btn-detail:hover { background: rgba(4,179,214,0.16); }

/* MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 500; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.show { display: flex; }
.modal { background: var(--modal-bg); backdrop-filter: blur(60px) saturate(180%); -webkit-backdrop-filter: blur(60px) saturate(180%); border: 1px solid var(--card-border); border-radius: 22px; width: 100%; max-width: 680px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 32px 80px rgba(0,0,0,0.22); overflow: hidden; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--card-border); flex-shrink: 0; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.modal-subtitle { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }
.modal-close { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--card-border); background: var(--toggle-bg); color: var(--text-tertiary); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; -webkit-tap-highlight-color: transparent; flex-shrink: 0; }
.modal-close:hover { background: var(--card-hover-bg); }
.modal-body { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 2px; }
.modal-footer { padding: 14px 24px 18px; border-top: 1px solid var(--card-border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0; }

/* DETAIL SECTIONS */
.detail-section { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 14px; padding: 14px 18px; }
.detail-section-title { font-size: 11px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.hist-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.hist-table th { text-align: left; padding: 5px 8px; font-size: 10.5px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; border-bottom: 1px solid var(--card-border); }
.hist-table td { padding: 7px 8px; border-bottom: 1px solid var(--card-border); color: var(--text-primary); }
.hist-table tr:last-child td { border-bottom: none; }

/* EMPTY + LOADING */
.empty-state { display: none; flex-direction: column; align-items: center; justify-content: center; padding: 60px 24px; text-align: center; gap: 14px; }
.empty-state.show { display: flex; }
.empty-icon { font-size: 48px; opacity: 0.4; }
.empty-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.empty-sub { font-size: 14px; color: var(--text-tertiary); }
.loading-state { display: flex; align-items: center; justify-content: center; padding: 60px; gap: 10px; color: var(--text-secondary); font-size: 14px; }
.loading-state.hidden { display: none; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--card-border); border-top-color: var(--badge-color); border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 18px; border-radius: 12px; background: #1c1c1e; color: #f5f5f7; font-size: 13.5px; font-weight: 500; box-shadow: 0 8px 32px rgba(0,0,0,0.25); max-width: 300px; animation: slideIn 0.25s ease; border: 1px solid rgba(255,255,255,0.1); }
.toast.error { background: #3a1a1a; color: #ff453a; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* MOBILE */
@media (max-width: 600px) {
  .container { padding: 16px 12px 80px; }
  .ampel-grid { grid-template-columns: 1fr; gap: 8px; }
  .kat-btns { flex-wrap: wrap; }
  .modal { max-height: 96vh; border-radius: 18px 18px 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: none; }
}
