:root {
  color-scheme: light;
  --ink: #f7f2f4;
  --muted: #cbbec4;
  --line: #3b2029;
  --panel: #171013;
  --soft: #21161a;
  --page: #080708;
  --accent: #9b2f45;
  --accent-2: #c34a62;
  --warn: #d59a45;
  --danger: #d94b4b;
  --ok: #3fa66b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #050505;
  color: #f8fafc;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand p,
.overline {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: 29px;
  line-height: 1.1;
}

.dropzone {
  border: 1px dashed rgba(195, 74, 98, 0.65);
  border-radius: 8px;
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  background: rgba(155, 47, 69, 0.14);
}

.dropzone:hover {
  background: rgba(155, 47, 69, 0.24);
}

.dropzone input {
  display: none;
}

.dropzone-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.dropzone small,
.hint {
  color: #d9cdd2;
  font-size: 13px;
  line-height: 1.5;
}

.field {
  display: grid;
  gap: 8px;
  color: #dbe3ee;
  font-size: 14px;
}

input,
select,
button {
  width: 100%;
  border: 1px solid #6a2d3c;
  border-radius: 6px;
  min-height: 42px;
  padding: 9px 11px;
  font: inherit;
  background: #120d10;
  color: var(--ink);
}

button {
  border: 0;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.report {
  padding: 30px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.report-logo {
  width: 193px;
  max-width: 32vw;
  height: auto;
  flex: 0 0 auto;
  background: #ffffff;
  border-radius: 6px;
  padding: 8px 10px;
}

.report-header h2,
.assessment h3,
.chart-title h3,
.tables h3,
.empty-state h3 {
  margin: 0;
  line-height: 1.2;
}

.report-header h2 {
  font-size: 30px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  text-align: right;
  line-height: 1.45;
  max-width: 420px;
}

.empty-state {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.empty-state p {
  max-width: 740px;
  color: var(--muted);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.kpi small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.kpi strong {
  display: block;
  font-size: 26px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 7px;
}

.table-note {
  color: var(--muted);
  line-height: 1.45;
  margin: 10px 0 0;
}

.assessment,
.chart-card,
.tables article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.assessment {
  margin-top: 18px;
}

.findings {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.finding {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.badge {
  align-self: start;
  border-radius: 999px;
  padding: 6px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.badge.ok {
  background: var(--ok);
}

.badge.warn {
  background: var(--warn);
}

.badge.danger {
  background: var(--danger);
}

.finding h4,
.finding p {
  margin: 0;
}

.finding p {
  color: var(--muted);
  line-height: 1.45;
  margin-top: 4px;
}

.charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 18px;
}

.span-2 {
  grid-column: span 1;
}

.chart-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}

.chart-title span {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

svg {
  display: block;
  width: 100%;
  height: 430px;
}

.chart-card.span-2 svg {
  height: 500px;
}

.tables {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-top: 12px;
  font-size: 14px;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.axis {
  stroke: #94a3b8;
  stroke-width: 1;
}

.grid-line {
  stroke: #34232a;
  stroke-width: 1;
}

.line-power {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 3;
}

.line-a {
  fill: none;
  stroke: #0f766e;
  stroke-width: 2.8;
}

.line-b {
  fill: none;
  stroke: #b45309;
  stroke-width: 2.8;
}

.line-c {
  fill: none;
  stroke: #7c3aed;
  stroke-width: 2.8;
}

.bar {
  fill: #0f766e;
}

.area-fill {
  fill: rgba(37, 99, 235, 0.14);
}

.chart-label {
  fill: var(--muted);
  font-size: 13px;
}

.chart-unit {
  font-weight: 700;
}

.chart-callout {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.peak-marker {
  fill: #ffffff;
  stroke: var(--accent-2);
  stroke-width: 3;
}

@media (max-width: 940px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .kpis,
  .charts,
  .tables {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .report-header {
    display: block;
  }

  .header-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-logo {
    max-width: 220px;
  }

  .meta {
    text-align: left;
    margin-top: 12px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 11mm;
  }

  @page chartPage {
    size: A4 landscape;
    margin: 10mm;
  }

  :root {
    --ink: #1c2430;
    --muted: #667085;
    --line: #d8dde6;
    --panel: #ffffff;
    --soft: #f7f7f8;
    --page: #ffffff;
    --accent: #9b2f45;
    --accent-2: #9b2f45;
    --warn: #8a5a10;
    --danger: #9b2f45;
    --ok: #276749;
  }

  body {
    background: #fff;
    color: var(--ink);
    font-size: 10.5pt;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .report {
    padding: 0;
    max-width: none;
  }

  .report-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 12px 14px;
  }

  .header-brand {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
  }

  .report-logo {
    width: 150px;
    max-width: 150px;
    padding: 4px 6px;
  }

  .report-header h2 {
    font-size: 18pt;
  }

  .meta {
    max-width: none;
    text-align: left;
    font-size: 9pt;
  }

  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

  .kpi {
    padding: 9px 10px;
  }

  .kpi small,
  .kpi span {
    font-size: 8.5pt;
  }

  .kpi strong {
    font-size: 14pt;
  }

  .assessment,
  .chart-card,
  .tables article {
    padding: 11px 12px;
    margin-top: 10px;
  }

  .findings {
    gap: 7px;
    margin-top: 8px;
  }

  .finding {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 8px;
    padding-top: 8px;
  }

  .badge {
    border-radius: 5px;
    padding: 4px 5px;
    font-size: 7.5pt;
  }

  .finding h4 {
    font-size: 10pt;
  }

  .finding p,
  .table-note {
    font-size: 9pt;
    line-height: 1.32;
  }

  .charts,
  .tables {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
  }

  .span-2 {
    grid-column: span 1;
  }

  .chart-title {
    display: block;
    margin-bottom: 8px;
  }

  .chart-title h3,
  .tables h3,
  .assessment h3 {
    font-size: 13pt;
  }

  .chart-title span {
    display: block;
    text-align: left;
    font-size: 9.5pt;
    margin-top: 2px;
  }

  .chart-card {
    page: chartPage;
    break-before: page;
    min-height: 175mm;
  }

  svg {
    height: 140mm;
  }

  .chart-card.span-2 svg {
    height: 145mm;
  }

  .chart-label {
    font-size: 10pt;
  }

  .chart-callout {
    font-size: 10pt;
  }

  .line-power,
  .line-a,
  .line-b,
  .line-c {
    stroke-width: 2.5;
  }

  .tables {
    break-before: page;
  }

  table {
    font-size: 8.5pt;
    margin-top: 6px;
  }

  th,
  td {
    padding: 5px 5px;
    line-height: 1.25;
  }

  input,
  select,
  button {
    background: #fff;
    color: var(--ink);
  }

  .report-header,
  .assessment,
  .chart-card,
  .tables article,
  .kpi,
  .empty-state {
    background: #fff;
    border-color: #d8dde6;
  }

  .overline,
  .brand p {
    color: var(--accent);
  }

  .grid-line {
    stroke: #e2e8f0;
  }

  .report-header,
  .assessment,
  .chart-card,
  .tables article,
  .kpi {
    break-inside: avoid;
    box-shadow: none;
  }

  .chart-card {
    page-break-inside: avoid;
  }

  a::after {
    content: none !important;
  }
}
