:root {
  --bg: #020617;
  --bg-soft: #0f172a;
  --panel: rgba(15, 23, 42, 0.75);
  --panel-2: #1e293b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f8fafc;
  --muted: #94a3b8;
  --brand: #eab308; /* Dynamic Gold */
  --brand-2: #a855f7; /* Modern Purple */
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --cyan: #0ea5e9;
  --shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.5);
  --radius: 24px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body[data-theme="light"] {
  --bg: #f8fafc;
  --bg-soft: #ffffff;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-2: #f1f5f9;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.15);
  --text: #0f172a;
  --muted: #64748b;
  --brand: #ca8a04;
  --brand-2: #9333ea;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --cyan: #0284c7;
  --shadow: 0 20px 50px -12px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, color-mix(in srgb, var(--brand) 15%, transparent) 0px, transparent 50%),
    radial-gradient(at 100% 0%, color-mix(in srgb, var(--brand-2) 15%, transparent) 0px, transparent 50%);
  background-attachment: fixed;
  transition: var(--transition);
  line-height: 1.5;
}

.wrap { max-width: 1440px; margin: 0 auto; padding: 40px 24px; }

.hero {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px;
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.hero-top { display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; }

.brand-box { display: flex; gap: 20px; align-items: center; margin-bottom: 24px; }
.brand-box img.iso { width: 64px; height: 64px; object-fit: contain; }
.brand-box img.logo { height: 32px; width: auto; }

body[data-theme="light"] .brand-box img.logo, 
body[data-theme="light"] .brand-box img.iso { filter: brightness(0); }

.hero h1 { 
  margin: 0 0 16px; 
  font-family: 'Outfit', sans-serif;
  font-size: clamp(32px, 5vw, 48px); 
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1; 
  background: linear-gradient(to bottom right, #fff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
body[data-theme="light"] .hero h1 {
  background: linear-gradient(to bottom right, var(--text), var(--muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p { 
  margin: 0 0 24px; 
  color: var(--muted); 
  max-width: 720px; 
  font-size: 18px; 
  line-height: 1.6;
}

.hero-tags { display: flex; flex-wrap: wrap; gap: 12px; }
.tag {
  background: var(--line);
  border: 1px solid var(--line-strong);
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

button, .btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 20px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

button:hover {
  background: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

button:active { transform: translateY(0); }

.primary { 
  background: var(--brand); 
  color: #000; 
  border: none;
}
.primary:hover {
  background: color-mix(in srgb, var(--brand) 80%, white);
}

.danger { 
  background: rgba(239, 68, 68, 0.1); 
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}
.danger:hover {
  background: var(--danger);
  color: white;
}
.layout { display: grid; grid-template-columns: 1fr 480px; gap: 32px; align-items: start; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
}

.panel-head { 
  padding: 24px 32px; 
  border-bottom: 1px solid var(--line); 
  display: flex; 
  justify-content: space-between; 
  gap: 16px; 
  align-items: center; 
  background: rgba(255,255,255,0.02);
}

.panel-head h2, .panel-head h3 { 
  margin: 0; 
  font-family: 'Outfit', sans-serif;
  font-size: 20px; 
  font-weight: 700;
  color: var(--text);
}

.panel-body { padding: 32px; }

.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 24px; }
.subgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 24px; }

label { 
  display: block; 
  margin-bottom: 8px; 
  color: var(--muted); 
  font-size: 13px; 
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"], input[type="date"], textarea, select {
  width: 100%; 
  background: var(--bg-soft); 
  border: 1px solid var(--line); 
  color: var(--text); 
  border-radius: 12px; 
  padding: 12px 16px; 
  font-family: inherit;
  font-size: 15px;
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent);
  background: var(--panel-2);
}

.section-title { 
  margin: 40px 0 20px; 
  font-family: 'Outfit', sans-serif;
  font-size: 18px; 
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.question-card {
  border: 1px solid var(--line); 
  border-radius: 20px; 
  background: var(--panel-2); 
  padding: 24px; 
  margin-bottom: 20px;
  transition: var(--transition);
}

.question-card:hover {
  border-color: var(--line-strong);
  transform: translateX(4px);
  box-shadow: var(--shadow);
}

.q-top strong { 
  display: block; 
  font-size: 17px; 
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.q-top small { 
  display: block; 
  color: var(--muted); 
  font-size: 14px;
  line-height: 1.5;
}

.badge {
  display: inline-flex; 
  padding: 6px 12px;
  border-radius: 8px; 
  border: 1px solid var(--line); 
  background: var(--bg-soft); 
  font-size: 12px; 
  font-weight: 700;
  color: var(--text);
}

.score-box { 
  display: grid; 
  grid-template-columns: auto 1fr auto; 
  gap: 20px; 
  align-items: center; 
  margin-top: 16px;
}

.score-number {
  width: 48px; 
  height: 48px; 
  border-radius: 12px; 
  background: var(--brand);
  color: #000;
  display: grid; 
  place-items: center; 
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent);
}

input[type="range"] { 
  width: 100%; 
  height: 6px;
  background: var(--line-strong);
  border-radius: 100px;
  outline: none;
  accent-color: var(--brand);
}

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

.metric {
  background: var(--panel-2); 
  border: 1px solid var(--line); 
  border-radius: 16px; 
  padding: 20px;
  text-align: center;
}

.metric .k { 
  color: var(--muted); 
  font-size: 12px; 
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.metric .v { 
  font-family: 'Outfit', sans-serif;
  font-size: 24px; 
  font-weight: 800; 
  color: var(--text);
  line-height: 1.2;
}

.canvas-wrap {
  background: var(--panel-2);
  border: 1px solid var(--line); 
  border-radius: 20px; 
  padding: 24px; 
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-wrap canvas {
  max-width: 100%;
  height: auto !important;
  aspect-ratio: 1 / 1;
}

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

.class-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}

.class-card .name {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.class-card .value {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.pill {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: var(--transition);
}

.score-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.score-scale span {
  font-size: 11px;
  color: var(--muted);
}

.legend {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
  width: 100%;
}

.logic-box {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
}

.logic-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.logic-chip {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.signature {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 16px;
}

.box {
  background: var(--panel-2); 
  border: 1px solid var(--line); 
  border-radius: 16px; 
  padding: 20px;
  margin-bottom: 12px;
}

.box h4 { 
  margin: 0 0 12px; 
  font-family: 'Outfit', sans-serif;
  font-size: 16px; 
  font-weight: 700;
  color: var(--text);
}

.sig-pad {
  border: 2px dashed var(--line-strong); 
  border-radius: 16px; 
  min-height: 120px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  text-align: center; 
  color: var(--muted); 
  padding: 20px; 
  background: rgba(255,255,255,0.01);
}
.footer-note { color: var(--muted); font-size: 12px; line-height: 1.45; margin-top: 10px; }
.logic-box h4 { margin: 0 0 8px; }
.logic-box p { margin: 0 0 10px; color: var(--muted); line-height: 1.5; }
.logic-chip strong { color: var(--text); }
.report-cover, .report-page {
  width: 1123px; min-height: 794px; background: linear-gradient(180deg, #070b14 0%, #121a2c 100%); color: #f8fafc;
  padding: 46px; position: absolute; left: -99999px; top: 0; overflow: hidden;
}
.report-page.light { background: #ffffff; color: #111827; }
.report-title { font-size: 34px; font-weight: 800; line-height: 1.08; margin: 16px 0 10px; }
.report-sub { color: #cbd5e1; max-width: 820px; line-height: 1.5; }
.report-page.light .report-sub { color: #475569; }
.report-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; margin-top: 28px; }
.report-card {
  border: 1px solid rgba(255,255,255,.12); border-radius: 22px; padding: 22px; background: rgba(255,255,255,.04);
}
.report-page.light .report-card { border-color: rgba(15,23,42,.10); background: #f8fafc; }
.report-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.report-kpi { border-radius: 18px; padding: 18px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); }
.report-page.light .report-kpi { background: #fff; border-color: rgba(15,23,42,.08); }
.report-kpi .k { font-size: 12px; opacity: .75; margin-bottom: 8px; }
.report-kpi .v { font-size: 28px; font-weight: 800; }
.report-list { padding-left: 18px; line-height: 1.6; }
.report-footer { position: absolute; bottom: 30px; left: 46px; right: 46px; display: flex; justify-content: space-between; align-items: center; color: #cbd5e1; font-size: 13px; }
.report-page.light .report-footer { color: #475569; }

@media (max-width: 1280px) { .layout { grid-template-columns: 1fr; } .sticky { position: static; } }
@media (max-width: 900px) {
  .meta-grid, .subgrid, .metrics, .classification-grid, .signature, .diag-grid { grid-template-columns: 1fr; }
  .legend { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  body { background: #fff; color: #111827; }
  .actions, .no-print { display: none !important; }
  .hero, .panel, .box, .metric, .question-card, .class-card, .logic-box { box-shadow: none; background: #fff !important; color: #111827 !important; }
  input, textarea, select, .sig-pad, .canvas-wrap, .pill, .badge { background: #fff !important; color: #111827 !important; }
  .layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .brand-box img.logo, .brand-box img.iso { filter: invert(1); }
}
