:root {
  --bg: #efe7d7;
  --panel: rgba(255, 251, 242, 0.94);
  --panel-soft: rgba(255, 248, 238, 0.86);
  --panel-strong: rgba(255, 245, 232, 0.94);
  --line: rgba(121, 93, 48, 0.16);
  --ink: #223026;
  --muted: #5b6a60;
  --accent: #1f4d39;
  --target: #ddb142;
  --executed: #4f9968;
  --balance: #4b7ca4;
  --shadow: 0 20px 60px rgba(35, 34, 26, 0.12);
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(242, 191, 73, 0.24), transparent 30%),
    linear-gradient(180deg, #f6f0e6 0%, #e9dfcc 100%);
}

body.modal-open {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(82, 69, 45, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 69, 45, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: 0.55;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 1440px);
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-copy,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
}
.hero-controls { padding: 26px; }

.hero-copy-main {
  display: grid;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: #9a7b42;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 4vw, 4.4rem);
  line-height: 0.95;
}

.hero-text {
  margin: 0;
  max-width: 40ch;
  color: var(--muted);
  font-size: 0.98rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.hero-badges[hidden] {
  display: none !important;
}

.hero-badge,
.ticket-pill,
.type-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 10px 14px;
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 0.83rem;
  border: 1px solid rgba(69, 89, 77, 0.15);
  background: var(--panel-soft);
}

.hero-panel-heading strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.hero-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.hero-summary-card {
  min-width: 0;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(49, 64, 56, 0.12);
  background: var(--panel-soft);
}

.hero-summary-card span,
.hero-summary-card small {
  display: block;
  color: var(--muted);
}

.hero-summary-card span {
  margin-bottom: 10px;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-summary-card strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.05;
  margin-bottom: 8px;
}

.hero-summary-card small {
  font-size: 0.92rem;
  line-height: 1.35;
}

.theme-switcher {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.theme-switcher-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.theme-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.theme-segment {
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(49, 64, 56, 0.18);
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.theme-segment:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(28, 58, 44, 0.08);
}

.theme-segment.is-active {
  background: linear-gradient(135deg, #ffd364 0%, #dfa11a 100%);
  border-color: rgba(151, 104, 0, 0.24);
  color: #2a2413;
}

.hero-actions {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.print-button {
  min-height: 50px;
  border: 1px solid rgba(31, 77, 57, 0.18);
  border-radius: 18px;
  background: linear-gradient(135deg, #214f3b 0%, #153628 100%);
  color: #f5f2e9;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 14px 28px rgba(28, 58, 44, 0.16);
}

.print-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 32px rgba(28, 58, 44, 0.2);
}

.print-helper {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.print-report-header {
  display: none;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.field[hidden] {
  display: none !important;
}

.field span { font-weight: 600; }

select,
.segment {
  min-height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(49, 64, 56, 0.18);
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
}

select {
  width: 100%;
  padding: 0 16px;
  cursor: pointer;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segment {
  flex: 1 1 0;
  min-width: 0;
  font-weight: 700;
  cursor: pointer;
  padding: 0 14px;
  text-align: center;
}

.segment.is-active {
  background: linear-gradient(135deg, #ffd364 0%, #dfa11a 100%);
  border-color: rgba(151, 104, 0, 0.24);
}

.viewer-note {
  margin-top: 18px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(29, 72, 52, 0.96), rgba(19, 46, 35, 0.96));
  color: #eff7f0;
}

.viewer-note strong {
  display: block;
  margin-bottom: 6px;
}

.viewer-note p {
  margin: 0;
  color: rgba(239, 247, 240, 0.8);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}

.metrics-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.content-grid > *,
.metrics-grid > * {
  min-width: 0;
}

.metric-card,
.progress-panel,
.chart-panel,
.ranking-panel,
.history-panel {
  padding: 24px;
}

.mix-panel {
  padding: 18px 14px 16px;
}

.metric-card,
.mini-metric {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.history-panel {
  display: flex;
  flex-direction: column;
}

.metric-label {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.96rem;
}

.metric-value {
  display: block;
  font-size: 2.1rem;
  line-height: 1;
  margin-bottom: 12px;
}

.metric-helper {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.progress-panel { grid-column: span 7; }
.chart-panel { grid-column: span 5; }
.mix-panel { grid-column: 1 / -1; }
.ranking-panel { grid-column: 1 / -1; }
.history-panel { grid-column: 1 / -1; }

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.7rem;
}

.progress-stack {
  display: grid;
  gap: 18px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 7px;
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(97, 85, 56, 0.12);
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
}

.progress-track.is-target span { background: linear-gradient(90deg, #d6a63d, #f0cf7b); }
.progress-track.is-executed span { background: linear-gradient(90deg, #2f8f97, #79d8d8); }
.progress-track.is-balance span { background: linear-gradient(90deg, #7b5ac8, #b79cff); }

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

.mini-metric {
  padding: 16px;
  border-radius: 20px;
  background: var(--panel-soft);
  border: 1px solid rgba(49, 64, 56, 0.12);
}

.mini-metric span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

.mini-metric strong { font-size: 1.5rem; }

.daily-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.daily-bar {
  min-width: 70px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.daily-bar strong { font-size: 0.92rem; }

.daily-bar-rail {
  width: 56px;
  height: 182px;
  padding: 8px;
  display: flex;
  align-items: flex-end;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(226, 195, 122, 0.22), rgba(209, 178, 103, 0.06));
}

.daily-bar-fill {
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #e2b336 0%, #2e7248 100%);
  box-shadow: 0 12px 20px rgba(51, 102, 67, 0.2);
}

.daily-bar span {
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 0.83rem;
  color: var(--muted);
}

.ranking-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ranking-item {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 16px;
  align-items: center;
}

.ranking-label strong { display: block; }
.ranking-label span { color: var(--muted); font-size: 0.9rem; }

.ranking-track {
  height: 16px;
  border-radius: 999px;
  background: rgba(44, 72, 58, 0.12);
  overflow: hidden;
}

.ranking-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f6d4a 0%, #f0bf56 100%);
}

.ranking-value {
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-weight: 700;
}

.mix-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mix-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(49, 64, 56, 0.1);
  background: var(--panel-soft);
  position: relative;
  overflow: hidden;
}

.mix-card span,
.mix-card small {
  display: block;
  color: var(--muted);
}

.mix-card span {
  margin-bottom: 10px;
}

.mix-card strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1;
  margin-bottom: 10px;
}

.mix-card small {
  font-size: 0.9rem;
}

.mix-card-green {
  box-shadow: inset 0 0 0 1px rgba(80, 153, 104, 0.14);
}

.mix-card-gold {
  box-shadow: inset 0 0 0 1px rgba(20, 107, 255, 0.16);
}

.mix-card-green::before,
.mix-card-gold::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
}

.mix-card-green::before {
  background: linear-gradient(90deg, #4f9968 0%, #8ccf9f 100%);
}

.mix-card-gold::before {
  background: linear-gradient(90deg, #146bff 0%, #63b4ff 100%);
}

.mix-card-green strong {
  color: #2b7a49;
}

.mix-card-gold strong {
  color: #1459d6;
}

.mix-bars {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.mix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.mix-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.mix-legend-item::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.mix-legend-item-green::before {
  background: linear-gradient(135deg, #4f9968 0%, #8ccf9f 100%);
}

.mix-legend-item-blue::before {
  background: linear-gradient(135deg, #146bff 0%, #63b4ff 100%);
}

.mix-bar-copy {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 600;
}

.mix-bar-track {
  display: flex;
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(97, 85, 56, 0.12);
}

.mix-bar-fill {
  height: 100%;
}

.mix-bar-fill-green {
  background: linear-gradient(90deg, #4f9968 0%, #8ccf9f 100%);
}

.mix-bar-fill-gold {
  background: linear-gradient(90deg, #146bff 0%, #63b4ff 100%);
}

.history-heading { align-items: end; }

.history-helper {
  max-width: 32ch;
  margin: 0;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 20px;
  border: 1px solid rgba(49, 64, 56, 0.12);
  background: rgba(255, 247, 236, 0.82);
}

.history-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(49, 64, 56, 0.1);
  text-align: left;
  vertical-align: top;
}

.history-table th {
  position: sticky;
  top: 0;
  background: rgba(247, 243, 234, 0.98);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.mono {
  font-family: "IBM Plex Mono", "Consolas", monospace;
}

.history-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.report-trigger {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(49, 64, 56, 0.14);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.report-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(19, 30, 24, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.report-modal {
  width: min(720px, 100%);
  max-height: min(78vh, 820px);
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(49, 64, 56, 0.14);
  background: rgba(255, 251, 242, 0.98);
  box-shadow: 0 28px 80px rgba(25, 27, 20, 0.18);
}

.report-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.report-modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.report-modal-close {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(49, 64, 56, 0.14);
  border-radius: 14px;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.report-modal-close:hover,
.report-trigger:hover {
  filter: brightness(0.98);
}

.report-modal-body {
  display: grid;
  gap: 16px;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.report-meta span {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--panel-soft);
  border: 1px solid rgba(49, 64, 56, 0.12);
  font-family: "IBM Plex Mono", "Consolas", monospace;
  font-size: 0.8rem;
}

.report-modal-body p {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
  white-space: pre-wrap;
}

.type-badge {
  font-size: 0.74rem;
  padding: 7px 10px;
}

.type-badge.is-preventive {
  background: rgba(80, 147, 109, 0.1);
  color: #1e6143;
}

.type-badge.is-corrective {
  background: rgba(20, 107, 255, 0.12);
  color: #1459d6;
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
}

body[data-theme='matrix'] {
  color: #d9f7df;
  background:
    radial-gradient(circle at top left, rgba(59, 255, 126, 0.12), transparent 28%),
    linear-gradient(180deg, #06140d 0%, #0b1f16 100%);
}

body[data-theme='matrix']::before {
  background-image:
    linear-gradient(rgba(74, 255, 151, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 255, 151, 0.08) 1px, transparent 1px);
  opacity: 0.32;
}

body[data-theme='matrix'] .hero-copy,
body[data-theme='matrix'] .panel {
  border-color: rgba(85, 255, 150, 0.14);
  background: rgba(9, 23, 17, 0.88);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

body[data-theme='matrix'] .eyebrow,
body[data-theme='matrix'] .metric-label,
body[data-theme='matrix'] .theme-switcher-label,
body[data-theme='matrix'] .history-helper,
body[data-theme='matrix'] .hero-summary-card span,
body[data-theme='matrix'] .hero-summary-card small,
body[data-theme='matrix'] .metric-helper,
body[data-theme='matrix'] .mini-metric span,
body[data-theme='matrix'] .mix-card span,
body[data-theme='matrix'] .mix-card small,
body[data-theme='matrix'] .daily-bar span,
body[data-theme='matrix'] .ranking-label span,
body[data-theme='matrix'] .print-helper,
body[data-theme='matrix'] .viewer-note p,
body[data-theme='matrix'] .mix-legend-item {
  color: #8ccfa0;
}

body[data-theme='matrix'] .hero h1,
body[data-theme='matrix'] .panel-heading h2,
body[data-theme='matrix'] .metric-value,
body[data-theme='matrix'] .progress-copy,
body[data-theme='matrix'] .mini-metric strong,
body[data-theme='matrix'] .mix-card strong,
body[data-theme='matrix'] .ranking-label strong,
body[data-theme='matrix'] .ranking-value,
body[data-theme='matrix'] .hero-panel-heading strong,
body[data-theme='matrix'] .hero-summary-card strong,
body[data-theme='matrix'] .history-table td,
body[data-theme='matrix'] .report-modal-body p,
body[data-theme='matrix'] .report-modal-header h2,
body[data-theme='matrix'] .report-meta span {
  color: #dfffe5;
}

body[data-theme='matrix'] .hero-text,
body[data-theme='matrix'] .report-modal-close,
body[data-theme='matrix'] .report-trigger,
body[data-theme='matrix'] .field span {
  color: #bdecc8;
}

body[data-theme='matrix'] .hero-badge,
body[data-theme='matrix'] .ticket-pill,
body[data-theme='matrix'] .type-badge,
body[data-theme='matrix'] .hero-summary-card,
body[data-theme='matrix'] .mini-metric,
body[data-theme='matrix'] .mix-card,
body[data-theme='matrix'] .table-wrap,
body[data-theme='matrix'] .report-trigger,
body[data-theme='matrix'] .report-modal-close,
body[data-theme='matrix'] .report-meta span {
  border-color: rgba(85, 255, 150, 0.12);
  background: rgba(15, 32, 22, 0.92);
}

body[data-theme='matrix'] .type-badge.is-preventive {
  background: rgba(20, 201, 92, 0.14);
  border-color: rgba(91, 255, 158, 0.24);
  color: #a8ffbf;
}

body[data-theme='matrix'] .type-badge.is-corrective {
  background: rgba(10, 86, 255, 0.18);
  border-color: rgba(84, 163, 255, 0.24);
  color: #9ec9ff;
}

body[data-theme='matrix'] select,
body[data-theme='matrix'] .segment,
body[data-theme='matrix'] .theme-segment {
  border-color: rgba(85, 255, 150, 0.16);
  background: rgba(13, 28, 20, 0.94);
  color: #dcffe4;
}

body[data-theme='matrix'] .segment.is-active,
body[data-theme='matrix'] .theme-segment.is-active {
  background: linear-gradient(135deg, #1c8c54 0%, #55f58a 100%);
  border-color: rgba(98, 255, 149, 0.28);
  color: #04110a;
}

body[data-theme='matrix'] .print-button {
  border-color: rgba(92, 255, 146, 0.16);
  background: linear-gradient(135deg, #0d2b1a 0%, #164729 100%);
  color: #dbffe5;
  box-shadow: 0 14px 28px rgba(5, 16, 10, 0.28);
}

body[data-theme='matrix'] .progress-track,
body[data-theme='matrix'] .ranking-track,
body[data-theme='matrix'] .mix-bar-track,
body[data-theme='matrix'] .daily-bar-rail {
  background: rgba(221, 255, 228, 0.08);
}

body[data-theme='matrix'] .daily-bar-fill {
  background: linear-gradient(180deg, #3dff8f 0%, #0d6d38 100%);
  box-shadow: 0 12px 20px rgba(10, 84, 42, 0.34);
}

body[data-theme='matrix'] .ranking-track span {
  background: linear-gradient(90deg, #146bff 0%, #3dff8f 100%);
}

body[data-theme='matrix'] .mix-bar-fill-green {
  background: linear-gradient(90deg, #14c95c 0%, #5bff9e 100%);
}

body[data-theme='matrix'] .mix-bar-fill-gold {
  background: linear-gradient(90deg, #0a56ff 0%, #54a3ff 100%);
}

body[data-theme='matrix'] .progress-track.is-target span {
  background: linear-gradient(90deg, #d69c24 0%, #ffd773 100%);
}

body[data-theme='matrix'] .progress-track.is-executed span {
  background: linear-gradient(90deg, #00b8c7 0%, #7ef5f7 100%);
}

body[data-theme='matrix'] .progress-track.is-balance span {
  background: linear-gradient(90deg, #7b57ff 0%, #b79cff 100%);
}

body[data-theme='matrix'] .viewer-note {
  background: linear-gradient(180deg, rgba(15, 47, 27, 0.96), rgba(8, 28, 16, 0.96));
  border: 1px solid rgba(92, 255, 146, 0.12);
}

body[data-theme='matrix'] .history-table th {
  background: rgba(12, 25, 18, 0.98);
  color: #9be3ad;
  border-bottom-color: rgba(85, 255, 150, 0.14);
}

body[data-theme='matrix'] .history-table td {
  border-bottom-color: rgba(85, 255, 150, 0.08);
}

body[data-theme='matrix'] .report-modal {
  border-color: rgba(85, 255, 150, 0.16);
  background: rgba(7, 19, 13, 0.98);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

@media (max-width: 1180px) {
  .hero,
  .metrics-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .progress-panel,
  .chart-panel,
  .mix-panel,
  .ranking-panel,
  .history-panel {
    grid-column: auto;
  }

  .mini-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mix-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body::before {
    opacity: 0.3;
    background-size: 30px 30px;
  }

  .app-shell {
    padding: 14px;
  }

  .hero {
    gap: 16px;
    margin-bottom: 18px;
  }

  .hero-controls {
    order: -1;
    padding: 20px;
    border-radius: 24px;
  }

  .hero-copy,
  .panel,
  .metric-card {
    border-radius: 24px;
  }

  .hero-copy,
  .metric-card,
  .progress-panel,
  .chart-panel,
  .mix-panel,
  .ranking-panel,
  .history-panel {
    padding: 20px;
  }

  .hero h1 {
    font-size: clamp(2.3rem, 13vw, 3.3rem);
    line-height: 0.98;
    max-width: 10ch;
  }

  .hero-text {
    font-size: 0.96rem;
    line-height: 1.5;
  }

  .hero-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hero-summary-card {
    padding: 14px 16px;
    border-radius: 18px;
  }

  .hero-badges {
    gap: 8px;
    margin-top: 18px;
  }

  .hero-badge,
  .ticket-pill,
  .type-badge {
    padding: 8px 12px;
    font-size: 0.76rem;
  }

  .hero-panel-heading strong {
    font-size: 2.3rem;
    line-height: 0.95;
  }

  .field {
    margin-top: 14px;
  }

  .field span {
    font-size: 0.96rem;
  }

  select,
  .segment {
    min-height: 50px;
  }

  .segmented {
    flex-direction: column;
  }

  .segment {
    width: 100%;
  }

  .viewer-note {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 20px;
  }

  .hero-actions {
    margin-top: 16px;
  }

  .theme-segmented {
    grid-template-columns: 1fr;
  }

  .print-button {
    min-height: 48px;
  }

  .viewer-note p {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .content-grid {
    gap: 18px;
  }

  .metrics-grid,
  .mini-metrics {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .metric-value {
    font-size: 1.9rem;
  }

  .metric-helper {
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .panel-heading,
  .progress-copy,
  .history-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel-heading {
    gap: 10px;
    margin-bottom: 18px;
  }

  .panel-heading h2 {
    font-size: 1.35rem;
    line-height: 1.15;
  }

  .progress-copy {
    margin-bottom: 10px;
  }

  .daily-chart {
    gap: 10px;
    margin-inline: -4px;
    padding-inline: 4px;
  }

  .daily-bar {
    min-width: 58px;
    gap: 8px;
  }

  .daily-bar strong {
    font-size: 0.84rem;
  }

  .daily-bar-rail {
    width: 46px;
    height: 144px;
    padding: 6px;
  }

  .ranking-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .mix-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .mix-card {
    padding: 14px;
    border-radius: 18px;
  }

  .mix-card strong {
    font-size: 1.3rem;
  }

  .mix-bar-copy {
    flex-direction: column;
    align-items: flex-start;
  }

  .ranking-item {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 247, 236, 0.82);
    border: 1px solid rgba(49, 64, 56, 0.1);
  }

  .ranking-value {
    font-size: 0.95rem;
  }

  .history-helper {
    max-width: none;
    font-size: 0.92rem;
    line-height: 1.45;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    border-radius: 18px;
  }

  .history-table {
    min-width: 880px;
  }

  .history-table th,
  .history-table td {
    padding: 12px 14px;
  }

  .report-modal-backdrop {
    padding: 14px;
  }

  .report-modal {
    padding: 18px;
    border-radius: 20px;
  }

  .report-modal-header {
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .app-shell {
    padding: 12px;
  }

  .hero-copy,
  .hero-controls,
  .metric-card,
  .progress-panel,
  .chart-panel,
  .ranking-panel,
  .history-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .eyebrow {
    letter-spacing: 0.18em;
    font-size: 11px;
  }

  .hero h1 {
    font-size: clamp(2.1rem, 12vw, 2.9rem);
  }

  .hero-summary-card strong {
    font-size: 1.2rem;
  }

  .segmented {
    gap: 8px;
  }

  .segment {
    width: 100%;
    font-size: 0.95rem;
  }

  .hero-panel-heading strong {
    font-size: 2.05rem;
  }

  .metric-value {
    font-size: 1.75rem;
  }

  .mini-metric strong {
    font-size: 1.3rem;
  }

  .daily-bar {
    min-width: 54px;
  }

  .daily-bar-rail {
    width: 42px;
    height: 132px;
  }
}

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

  html,
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    min-height: auto;
    background: #fff;
    color: #1e2a21;
  }

  body::before {
    display: none;
  }

  .app-shell {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .hero {
    display: none !important;
  }

  .print-report-header {
    display: block;
    margin-bottom: 10mm;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .print-report-header h1 {
    margin: 0 0 8px;
    font-size: 22pt;
    line-height: 1.05;
  }

  .print-report-header p {
    margin: 0;
    color: #445248;
  }

  .hero-copy,
  .panel,
  .metric-card,
  .mini-metric {
    background: #f7f2e9;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 1px solid rgba(75, 64, 44, 0.18);
  }

  .metric-card {
    background: linear-gradient(180deg, #fff8ec 0%, #f3ead9 100%);
  }

  .mini-metric {
    background: linear-gradient(180deg, #fffaf1 0%, #efe5d3 100%);
  }

  .progress-panel,
  .chart-panel,
  .mix-panel,
  .ranking-panel {
    background: linear-gradient(180deg, #fff9ee 0%, #f2e8d7 100%);
  }

  .hero-copy,
  .hero-controls,
  .metric-card,
  .progress-panel,
  .chart-panel,
  .mix-panel,
  .ranking-panel,
  .history-panel {
    padding: 14px;
    border-radius: 14px;
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .hero-text,
  .metric-helper,
  .history-helper,
  .viewer-note p,
  .print-helper {
    color: #445248;
  }

  .hero-actions,
  .theme-switcher,
  .print-button,
  .print-helper {
    display: none !important;
  }

  .history-panel,
  .report-modal-backdrop {
    display: none !important;
  }

  .content-grid {
    gap: 10px;
  }

  .metrics-grid {
    gap: 10px;
  }

  .progress-panel,
  .chart-panel,
  .mix-panel,
  .ranking-panel {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .metric-value {
    font-size: 1.55rem;
    margin-bottom: 8px;
  }

  .panel-heading h2,
  .metric-value,
  .mix-card strong,
  .mini-metric strong {
    color: #1b2a22;
  }

  .mini-metrics {
    gap: 8px;
    margin-top: 14px;
  }

  .daily-bar {
    min-width: 52px;
  }

  .daily-bar-rail {
    width: 38px;
    height: 110px;
  }

  .ranking-item {
    gap: 10px;
  }

  .mix-panel {
    padding: 10px 12px;
  }

  .mix-grid {
    gap: 8px;
  }

  .mix-card {
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, #fffdf7 0%, #f0e8d9 100%);
    border: 1px solid rgba(75, 64, 44, 0.16);
  }

  .mix-card strong {
    font-size: 1.15rem;
    margin-bottom: 6px;
  }

  .mix-card small {
    font-size: 0.8rem;
  }

  .mix-bars {
    gap: 10px;
    margin-top: 10px;
  }

  .mix-legend {
    gap: 8px 12px;
  }

  .mix-legend-item {
    font-size: 0.74rem;
  }

  .mix-bar-copy {
    margin-bottom: 6px;
    font-size: 0.9rem;
  }

  .mix-bar-track {
    height: 12px;
    background: rgba(97, 85, 56, 0.16);
    border: 1px solid rgba(75, 64, 44, 0.08);
  }

  .daily-bar-rail,
  .ranking-track,
  .progress-track {
    background: rgba(97, 85, 56, 0.16);
    border: 1px solid rgba(75, 64, 44, 0.08);
  }

  .mix-card-green {
    background: linear-gradient(180deg, #f4fbf6 0%, #e3f0e6 100%);
  }

  .mix-card-gold {
    background: linear-gradient(180deg, #eef5ff 0%, #dce8ff 100%);
  }

  .table-wrap,
  .history-table,
  .history-table thead,
  .history-table tr,
  .history-table th,
  .history-table td {
    display: none !important;
  }

  body[data-theme='matrix'] {
    background: #07110b;
    color: #dfffe5;
  }

  body[data-theme='matrix'] .print-report-header p,
  body[data-theme='matrix'] .hero-text,
  body[data-theme='matrix'] .metric-helper,
  body[data-theme='matrix'] .history-helper,
  body[data-theme='matrix'] .print-helper {
    color: #a8d8b3;
  }

  body[data-theme='matrix'] .hero-copy,
  body[data-theme='matrix'] .panel,
  body[data-theme='matrix'] .metric-card,
  body[data-theme='matrix'] .mini-metric {
    background: #0d1e14;
    border-color: rgba(99, 201, 131, 0.24);
    color: #dcffe4;
  }

  body[data-theme='matrix'] .metric-card {
    background: linear-gradient(180deg, #0d2316 0%, #122d1e 100%);
  }

  body[data-theme='matrix'] .mini-metric {
    background: linear-gradient(180deg, #112619 0%, #153422 100%);
  }

  body[data-theme='matrix'] .progress-panel,
  body[data-theme='matrix'] .chart-panel,
  body[data-theme='matrix'] .mix-panel,
  body[data-theme='matrix'] .ranking-panel {
    background: linear-gradient(180deg, #0e2116 0%, #153624 100%);
  }

  body[data-theme='matrix'] .panel-heading h2,
  body[data-theme='matrix'] .metric-value,
  body[data-theme='matrix'] .mix-card strong,
  body[data-theme='matrix'] .mini-metric strong {
    color: #e1ffe8;
  }

  body[data-theme='matrix'] .mix-card {
    background: linear-gradient(180deg, #102819 0%, #173823 100%);
    border-color: rgba(99, 201, 131, 0.18);
  }

body[data-theme='matrix'] .mix-card-green {
  background: linear-gradient(180deg, #0d2717 0%, #12361f 100%);
}

body[data-theme='matrix'] .mix-card-gold {
  background: linear-gradient(180deg, #0d1f35 0%, #153459 100%);
}

body[data-theme='matrix'] .mix-card-green::before {
  background: linear-gradient(90deg, #14c95c 0%, #5bff9e 100%);
}

body[data-theme='matrix'] .mix-card-gold::before {
  background: linear-gradient(90deg, #0a56ff 0%, #54a3ff 100%);
}

body[data-theme='matrix'] .mix-card-green strong {
  color: #a8ffbf;
}

body[data-theme='matrix'] .mix-card-gold strong {
  color: #9ec9ff;
}

  body[data-theme='matrix'] .mix-bar-track,
  body[data-theme='matrix'] .daily-bar-rail,
  body[data-theme='matrix'] .ranking-track,
  body[data-theme='matrix'] .progress-track {
    background: rgba(217, 255, 226, 0.08);
    border-color: rgba(99, 201, 131, 0.14);
  }

  body[data-theme='matrix'] .daily-bar-fill {
    background: linear-gradient(180deg, #51ff9d 0%, #0d6d38 100%);
    box-shadow: 0 12px 20px rgba(10, 84, 42, 0.32);
  }

  body[data-theme='matrix'] .ranking-track span {
    background: linear-gradient(90deg, #146bff 0%, #3dff8f 100%);
  }

  body[data-theme='matrix'] .mix-bar-fill-green {
    background: linear-gradient(90deg, #14c95c 0%, #5bff9e 100%);
  }

body[data-theme='matrix'] .mix-bar-fill-gold {
  background: linear-gradient(90deg, #0a56ff 0%, #54a3ff 100%);
}

body[data-theme='matrix'] .mix-legend-item-green::before {
  background: linear-gradient(135deg, #14c95c 0%, #5bff9e 100%);
}

body[data-theme='matrix'] .mix-legend-item-blue::before {
  background: linear-gradient(135deg, #0a56ff 0%, #54a3ff 100%);
}

  body[data-theme='matrix'] .progress-track.is-target span {
    background: linear-gradient(90deg, #d69c24 0%, #ffd773 100%);
  }

  body[data-theme='matrix'] .progress-track.is-executed span {
    background: linear-gradient(90deg, #00b8c7 0%, #7ef5f7 100%);
  }

  body[data-theme='matrix'] .progress-track.is-balance span {
    background: linear-gradient(90deg, #7b57ff 0%, #b79cff 100%);
  }
}
