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

:root {
  --surface-0: #f5f4f0;
  --surface-1: #f0efeb;
  --surface-2: #ffffff;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --border: rgba(11,11,11,0.10);
  --border-strong: rgba(11,11,11,0.18);
  --radius: 8px;
  --bg-accent: #e6f1fb;
  --text-accent: #185fa5;
  --border-accent: #b5d4f4;
  --bg-danger: #fcebeb;
  --text-danger: #a32d2d;
  --border-danger: #f7c1c1;
  --bg-success: #eaf3de;
  --text-success: #3b6d11;
  --border-success: #c0dd97;
  --bg-warning: #faeeda;
  --text-warning: #854f0b;
  --border-warning: #fac775;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --surface-2: #232322;
    --text-primary: #f5f4f0;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --border: rgba(255,255,255,0.10);
    --border-strong: rgba(255,255,255,0.18);
    --bg-accent: #0c447c;
    --text-accent: #85b7eb;
    --border-accent: #185fa5;
    --bg-danger: #501313;
    --text-danger: #f09595;
    --border-danger: #791f1f;
    --bg-success: #173404;
    --text-success: #97c459;
    --border-success: #3b6d11;
    --bg-warning: #412402;
    --text-warning: #ef9f27;
    --border-warning: #854f0b;
  }
}

body {
  font-family: var(--font-sans);
  background: var(--surface-0);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.app-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 0.5px solid var(--border-strong);
}
.app-header h1 { font-size: 22px; font-weight: 500; color: var(--text-primary); }
.app-header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.nav { display: flex; gap: 8px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.nav-btn {
  padding: 8px 16px;
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 6px;
}
.nav-btn.active { background: var(--bg-accent); color: var(--text-accent); border-color: var(--border-accent); }
.nav-btn:hover:not(.active) { background: var(--surface-1); color: var(--text-primary); }

.section { display: none; }
.section.visible { display: block; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 1rem; }

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface-2);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  padding: 1rem 1.25rem;
}
.card-accent { border-left: 3px solid #2a78d6; border-radius: 0 12px 12px 0; }
.card-warn { border-left: 3px solid #eda100; border-radius: 0 12px 12px 0; }
.card-danger { border-left: 3px solid #e34948; border-radius: 0 12px 12px 0; }
.card-success { border-left: 3px solid #1baf7a; border-radius: 0 12px 12px 0; }

.metric-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.metric-value { font-size: 22px; font-weight: 500; color: var(--text-primary); }
.metric-delta { font-size: 12px; margin-top: 2px; }
.delta-up { color: #e34948; }
.delta-down { color: #1baf7a; }

.section-title { font-size: 16px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.section-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 1rem; }

.range-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.range-val { font-size: 13px; font-weight: 500; min-width: 60px; text-align: right; }
input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #2a78d6;
  border: 2px solid var(--surface-2);
  box-shadow: 0 0 0 1px #2a78d6;
  cursor: pointer;
}

.result-box {
  background: var(--surface-1);
  border-radius: 12px;
  border: 0.5px solid var(--border);
  padding: 1.25rem;
  margin-top: 1rem;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 13px;
}
.result-row:last-child { border-bottom: none; font-weight: 500; font-size: 14px; }
.result-row.total { color: var(--text-primary); }

.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.badge-blue { background: var(--bg-accent); color: var(--text-accent); }
.badge-red { background: var(--bg-danger); color: var(--text-danger); }
.badge-green { background: var(--bg-success); color: var(--text-success); }
.badge-warn { background: var(--bg-warning); color: var(--text-warning); }

.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.tl-item { position: relative; margin-bottom: 1.25rem; }
.tl-dot { position: absolute; left: -24px; top: 3px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface-0); }
.tl-dot.blue { background: #2a78d6; }
.tl-dot.amber { background: #eda100; }
.tl-dot.green { background: #1baf7a; }
.tl-dot.red { background: #e34948; }
.tl-year { font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; }
.tl-title { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 2px; }
.tl-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

.tab-row { display: flex; gap: 4px; margin-bottom: 1rem; border-bottom: 0.5px solid var(--border); flex-wrap: wrap; }
.tab { padding: 8px 14px; font-size: 13px; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text-accent); border-bottom-color: #2a78d6; font-weight: 500; }
.sub-section { display: none; }
.sub-section.visible { display: block; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 10px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 0.5px solid var(--border-strong); font-weight: 500; }
td { padding: 9px 10px; border-bottom: 0.5px solid var(--border); color: var(--text-secondary); }
td:first-child { color: var(--text-primary); font-weight: 500; }
tr:last-child td { border-bottom: none; }

.progress-bar { height: 6px; border-radius: 3px; background: var(--surface-1); overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 3px; }

.opp-card { background: var(--surface-2); border-radius: 12px; border: 0.5px solid var(--border); padding: 1rem 1.25rem; margin-bottom: 12px; }
.opp-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.opp-title { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.opp-body { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

.icon-circle { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px; }
.ic-blue { background: var(--bg-accent); color: var(--text-accent); }
.ic-green { background: var(--bg-success); color: var(--text-success); }
.ic-warn { background: var(--bg-warning); color: var(--text-warning); }
.ic-red { background: var(--bg-danger); color: var(--text-danger); }

.row-flex { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 1rem; }
.highlight-box { background: var(--bg-accent); border: 0.5px solid var(--border-accent); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 1rem; font-size: 13px; color: var(--text-accent); line-height: 1.6; }
.warn-box { background: var(--bg-warning); border: 0.5px solid var(--border-warning); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 1rem; font-size: 13px; color: var(--text-warning); line-height: 1.6; }

input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: #2a78d6; }
label { cursor: pointer; }
