/* ═══════════════════════════════════════════════════════════════════
   Steinbeis Bank – IRBA Rating Suite  |  Design System
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --sb-navy:      #0D2F4F;
  --sb-navy-light:#1A4A6E;
  --sb-gold:      #C5A028;
  --sb-gold-light:#D4B843;
  --sb-blue:      #1B5E7E;
  --sb-bg:        #F0F4F8;
  --sb-white:     #FFFFFF;
  --sb-border:    #DDE3EC;
  --sb-text:      #1A2D42;
  --sb-muted:     #6B7B8D;
  --sb-sidebar-w: 260px;
  --radius:       10px;
  --shadow:       0 2px 12px rgba(13,47,79,0.10);
  --shadow-lg:    0 8px 32px rgba(13,47,79,0.14);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--sb-bg);
  color: var(--sb-text);
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sb-sidebar-w);
  min-height: 100vh;
  background: var(--sb-navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,0.18);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.brand-logo {
  width: 44px; height: 44px;
  background: var(--sb-gold);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 18px; font-weight: 600;
  color: var(--sb-navy);
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.brand-name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.2px;
}

.brand-sub {
  display: block;
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.35);
  padding: 16px 10px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.70);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
}

.nav-item svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(197,160,40,0.18);
  color: var(--sb-gold-light);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 10.5px;
  color: rgba(255,255,255,0.30);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sb-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--sb-white);
  border-bottom: 1px solid var(--sb-border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--sb-navy);
  letter-spacing: -0.2px;
}

.page-sub {
  font-size: 12px;
  color: var(--sb-muted);
  display: block;
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge-irba {
  background: var(--sb-navy);
  color: var(--sb-gold);
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.topbar-date {
  font-size: 12px;
  color: var(--sb-muted);
}

.content-body {
  padding: 28px 32px;
  flex: 1;
}

/* ═══════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════ */
.card {
  background: var(--sb-white);
  border-radius: var(--radius);
  border: 1px solid var(--sb-border);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--sb-border);
}

.card-header h3 {
  font-size: 14px;
  font-weight: 650;
  color: var(--sb-navy);
}

.card-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--sb-bg);
  color: var(--sb-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-badge--success {
  background: #E8F5EC;
  color: #2D7D46;
}

/* ═══════════════════════════════════════════════════════════════════
   KPI GRID (Dashboard)
   ═══════════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--sb-white);
  border: 1px solid var(--sb-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow);
}

.kpi-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 20px; height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kpi-blue  { background: #EBF5FC; color: var(--sb-blue); }
.kpi-amber { background: #FDF6E3; color: var(--sb-gold); }
.kpi-green { background: #E8F5EC; color: #2D7D46; }

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--sb-navy);
  line-height: 1.1;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--sb-text);
  margin-top: 3px;
}

.kpi-sub {
  font-size: 10.5px;
  color: var(--sb-muted);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════════════════════════ */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.chart-card .chart-container {
  padding: 16px 20px;
  height: 230px;
}

/* ═══════════════════════════════════════════════════════════════════
   MODEL OVERVIEW (Dashboard)
   ═══════════════════════════════════════════════════════════════════ */
.model-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0;
}

.model-card {
  padding: 22px 20px;
  text-decoration: none;
  border-right: 1px solid var(--sb-border);
  transition: background 0.15s;
  display: block;
}

.model-card:last-child { border-right: none; }
.model-card:hover { background: var(--sb-bg); }

.model-card--corporate .model-card-title { color: var(--sb-navy); }
.model-card--retail .model-card-title { color: var(--sb-blue); }

.model-card-icon { font-size: 26px; margin-bottom: 8px; }
.model-card-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.model-card-desc { font-size: 12px; color: var(--sb-muted); line-height: 1.5; margin-bottom: 12px; }

.model-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-card-meta span {
  font-size: 10.5px;
  background: var(--sb-bg);
  border: 1px solid var(--sb-border);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--sb-muted);
}

/* ═══════════════════════════════════════════════════════════════════
   RATING FORM LAYOUT
   ═══════════════════════════════════════════════════════════════════ */
.rating-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
}

.form-card { margin-bottom: 0; }
.results-panel { min-width: 0; }

/* ── Form Elements ── */
.form-section {
  padding: 16px 20px 4px;
  border-bottom: 1px solid var(--sb-border);
}

.form-section:last-of-type { border-bottom: none; }

.form-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sb-muted);
  margin-bottom: 12px;
}

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sb-text);
  margin-bottom: 6px;
}

.input-with-unit {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--sb-border);
  border-radius: 7px;
  overflow: hidden;
  transition: border-color 0.15s;
  background: var(--sb-white);
}

.input-with-unit:focus-within { border-color: var(--sb-blue); }

.input-with-unit input {
  flex: 1;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  color: var(--sb-text);
  background: transparent;
}

.unit {
  padding: 8px 10px;
  background: var(--sb-bg);
  color: var(--sb-muted);
  font-size: 12px;
  font-weight: 600;
  border-left: 1px solid var(--sb-border);
}

select {
  width: 100%;
  padding: 9px 10px;
  border: 1.5px solid var(--sb-border);
  border-radius: 7px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  color: var(--sb-text);
  background: var(--sb-white);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7B8D' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

select:focus { border-color: var(--sb-blue); }

.slider-row {
  margin-top: 6px;
}

.slider-row input[type=range] {
  width: 100%;
  height: 4px;
  accent-color: var(--sb-blue);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--sb-muted);
  margin-top: 3px;
}

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  background: var(--sb-muted);
  color: white;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
}

.btn-rate {
  display: block;
  width: calc(100% - 40px);
  margin: 16px 20px;
  padding: 12px;
  background: var(--sb-navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: background 0.15s, transform 0.1s;
}

.btn-rate:hover { background: var(--sb-navy-light); }
.btn-rate:active { transform: scale(0.99); }

/* ═══════════════════════════════════════════════════════════════════
   RATING RESULT COMPONENTS
   ═══════════════════════════════════════════════════════════════════ */
.result-card { margin-bottom: 20px; }

.rating-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border-left: 4px solid #ccc;
  margin: 16px 20px;
  background: var(--sb-bg);
  border-radius: 8px;
}

.rating-grade-badge {
  width: 58px; height: 58px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.20);
}

.rating-details { flex: 1; }

.rating-equiv {
  font-size: 12px;
  color: var(--sb-muted);
  margin-bottom: 3px;
}

.rating-equiv strong { color: var(--sb-text); font-weight: 700; }

.rating-desc {
  font-size: 14px;
  font-weight: 600;
  color: var(--sb-navy);
}

.rating-pd { text-align: right; }

.pd-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--sb-navy);
  font-variant-numeric: tabular-nums;
}

.pd-label {
  font-size: 10.5px;
  color: var(--sb-muted);
  white-space: nowrap;
}

/* ── Master-Scale Bar ── */
.master-scale-bar {
  padding: 0 20px 20px;
}

.scale-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--sb-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.scale-track {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: visible;
  gap: 2px;
  position: relative;
}

.scale-segment {
  flex: 1;
  height: 100%;
  position: relative;
  border-radius: 3px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.scale-segment.active {
  opacity: 1;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(0,0,0,0.3);
  z-index: 2;
}

.scale-pointer {
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--sb-navy);
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--sb-muted);
  margin-top: 20px;
}

/* ── PD Comparison ── */
.pd-comparison {
  margin: 0 20px 16px;
  border: 1px solid var(--sb-border);
  border-radius: 8px;
  overflow: hidden;
}

.pd-comp-title {
  padding: 8px 14px;
  background: var(--sb-bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--sb-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pd-comp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-top: 1px solid var(--sb-border);
  font-size: 13px;
  color: var(--sb-text);
}

.pd-comp-row.highlight {
  background: #F7F9FC;
  font-weight: 600;
}

.pd-comp-val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════════════
   DRIVER / TREIBER ANALYSIS
   ═══════════════════════════════════════════════════════════════════ */
.driver-chart-container {
  padding: 16px 20px;
  height: 250px;
}

.driver-table {
  padding: 0 20px 16px;
  overflow-x: auto;
}

.driver-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.driver-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--sb-bg);
  color: var(--sb-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--sb-border);
}

.driver-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #F0F4F8;
  vertical-align: middle;
}

.driver-bar-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.driver-bar {
  height: 10px;
  border-radius: 3px;
  min-width: 4px;
  transition: width 0.3s;
}

.driver-bar--pos { background: #2D7D46; }
.driver-bar--neg { background: #C0392B; }

.badge-positive {
  background: #E8F5EC;
  color: #2D7D46;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.badge-negative {
  background: #FDECEA;
  color: #C0392B;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.model-note {
  padding: 10px 20px 16px;
  font-size: 11.5px;
  color: var(--sb-muted);
  line-height: 1.6;
  border-top: 1px solid var(--sb-border);
}

/* ═══════════════════════════════════════════════════════════════════
   LGD COMPONENTS
   ═══════════════════════════════════════════════════════════════════ */
.lgd-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
  margin: 16px 20px;
  background: var(--sb-bg);
  border-radius: 8px;
}

.lgd-gauge-container {
  position: relative;
  width: 200px;
  height: 120px;
  flex-shrink: 0;
}

.lgd-gauge-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.lgd-val { font-size: 22px; font-weight: 800; }
.lgd-sub { font-size: 11px; color: var(--sb-muted); font-weight: 600; }

.lgd-metrics {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 24px;
}

.metric-item { text-align: center; flex: 1; }
.metric-val { font-size: 24px; font-weight: 800; }
.metric-label { font-size: 11px; color: var(--sb-muted); font-weight: 600; margin-top: 4px; }
.metric-divider { width: 1px; height: 50px; background: var(--sb-border); }

/* LGD Scale Bar */
.lgd-scale-bar { padding: 0 20px 20px; }

.lgd-track {
  position: relative;
  height: 20px;
  background: linear-gradient(to right, #006400, #DAA520, #DC143C, #8B0000);
  border-radius: 10px;
  margin-bottom: 6px;
  overflow: visible;
}

.lgd-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  border-radius: 10px 0 0 10px;
  opacity: 0.3;
}

.lgd-pointer {
  position: absolute;
  top: -28px;
  transform: translateX(-50%);
  text-align: center;
}

.lgd-pointer-label {
  background: var(--sb-navy);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.lgd-pointer-label::after {
  content: '';
  display: block;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--sb-navy);
  margin: 0 auto;
}

.lgd-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--sb-muted);
  margin-top: 8px;
}

.lgd-benchmarks {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.bench-item {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
}

.bench--green { background: #E8F5EC; color: #2D7D46; }
.bench--amber { background: #FDF6E3; color: #C5A028; }
.bench--red   { background: #FDECEA; color: #C0392B; }

/* ═══════════════════════════════════════════════════════════════════
   INFO CARD
   ═══════════════════════════════════════════════════════════════════ */
.info-card .info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.info-item {
  padding: 10px 20px;
  border-bottom: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.info-item:nth-child(odd) { border-right: 1px solid var(--sb-border); }

.info-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--sb-muted);
}

.info-val {
  font-size: 12.5px;
  color: var(--sb-text);
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════ */
.empty-result {
  padding: 48px 32px;
  text-align: center;
}

.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--sb-navy); margin-bottom: 8px; }
.empty-desc { font-size: 13px; color: var(--sb-muted); line-height: 1.6; max-width: 320px; margin: 0 auto; }

/* ═══════════════════════════════════════════════════════════════════
   PRODUCT SELECTOR (Retail LGD)
   ═══════════════════════════════════════════════════════════════════ */
.product-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--sb-border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.product-option input[type=radio] { display: none; }

.product-option.selected {
  border-color: var(--sb-blue);
  background: rgba(27, 94, 126, 0.05);
}

.product-option:hover { border-color: var(--sb-blue); }

.product-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.product-name { font-size: 13.5px; font-weight: 700; color: var(--sb-navy); }
.product-desc { font-size: 11.5px; color: var(--sb-muted); line-height: 1.4; margin-top: 2px; }

.product-lgd {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sb-blue);
  background: rgba(27,94,126,0.08);
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .model-overview-grid { grid-template-columns: 1fr 1fr; }
  .model-card { border-bottom: 1px solid var(--sb-border); }
}

@media (max-width: 900px) {
  .rating-layout { grid-template-columns: 1fr; }
  .chart-row { grid-template-columns: 1fr; }
  :root { --sb-sidebar-w: 0px; }
  .sidebar { display: none; }
  .content-body { padding: 16px; }
  .topbar { padding: 12px 16px; }
}
