:root {
  color-scheme: light;
  --orange: #ee6420;
  --orange-dark: #d95313;
  --orange-soft: #ffe9dc;
  --magenta: #e91e63;
  --magenta-soft: #fce4ec;
  --purple: #7b2d8e;
  --purple-soft: #f1e4f5;
  --green: #1f8a52;
  --green-soft: #e0f1e7;
  --blue: #2563a8;
  --blue-soft: #ddebf7;
  --warning: #b7791f;
  --warning-soft: #fbf1d6;
  --danger: #c7321b;
  --danger-soft: #fbe2dc;
  --bg: #fafaf7;
  --panel: #ffffff;
  --sunk: #f4f3ee;
  --line: #e8e6df;
  --line-strong: #d8d5cb;
  --ink: #0f1115;
  --ink-2: #2c2e33;
  --muted: #6b6e75;
  --faint: #9b9da3;
  --solid: #0f1115;
  --solid-hover: #24262b;
  --solid-ink: #ffffff;
  --topbar: rgba(250, 250, 247, 0.92);
  --backdrop: rgba(15, 17, 21, 0.42);
  --shadow-sm: 0 1px 2px rgba(15, 17, 21, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 17, 21, 0.06), 0 1px 3px rgba(15, 17, 21, 0.04);
  --shadow-lg: 0 18px 40px rgba(15, 17, 21, 0.12), 0 4px 10px rgba(15, 17, 21, 0.06);
  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --orange-soft: rgba(238, 100, 32, 0.18);
  --magenta-soft: rgba(233, 30, 99, 0.18);
  --purple-soft: rgba(180, 114, 205, 0.18);
  --green: #63d08f;
  --green-soft: rgba(99, 208, 143, 0.18);
  --blue: #7cb7ff;
  --blue-soft: rgba(124, 183, 255, 0.18);
  --warning: #f4c766;
  --warning-soft: rgba(244, 199, 102, 0.18);
  --danger: #ff816e;
  --danger-soft: rgba(255, 129, 110, 0.18);
  --bg: #101114;
  --panel: #17191e;
  --sunk: #20232a;
  --line: #2a2d34;
  --line-strong: #3a3e47;
  --ink: #f4f5f7;
  --ink-2: #dde1e7;
  --muted: #a8afba;
  --faint: #7e8794;
  --solid: #ee6420;
  --solid-hover: #d85617;
  --solid-ink: #ffffff;
  --topbar: rgba(16, 17, 20, 0.92);
  --backdrop: rgba(0, 0, 0, 0.64);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.34);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.32), 0 1px 3px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.46), 0 4px 12px rgba(0, 0, 0, 0.34);
}

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

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--orange) 26%, transparent);
  outline-offset: 2px;
}

code {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--sunk);
  color: var(--ink-2);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.88em;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

[hidden] {
  display: none !important;
}

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--magenta));
  box-shadow: var(--shadow-sm);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.18;
}

.brand-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-subtitle,
.file-sequence,
.eyebrow,
.section-kicker,
.nav-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 9.5px;
}

.nav {
  flex: 1;
  padding: 14px 10px;
}

.nav-label {
  margin: 4px 10px 7px;
  color: var(--faint);
}

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 550;
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}

.nav-item + .nav-item {
  margin-top: 3px;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  opacity: 0.76;
}

.nav-item:hover {
  background: var(--sunk);
  color: var(--ink);
}

.nav-item.active {
  background: var(--solid);
  color: var(--solid-ink);
}

.nav-item.active svg {
  opacity: 1;
}

.sidebar-note {
  display: flex;
  gap: 10px;
  margin: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--sunk);
}

.sidebar-note > svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--green);
}

.sidebar-note div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.sidebar-note strong {
  font-size: 11.5px;
}

.sidebar-note span {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 17px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
}

.sidebar-footer .version {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--sunk);
  color: var(--muted);
}

.sidebar-backdrop {
  display: none;
}

main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 67px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.topbar-left > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.topbar h1 {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button,
.theme-toggle {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink-2);
  cursor: pointer;
}

.menu-button {
  display: none;
  width: 35px;
  height: 35px;
  place-items: center;
}

.menu-button svg {
  width: 18px;
  height: 18px;
}

.theme-toggle {
  display: inline-flex;
  height: 35px;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 650;
}

.theme-toggle:hover,
.icon-button:hover {
  background: var(--sunk);
}

.theme-icon {
  width: 15px;
  height: 15px;
}

:root[data-theme="light"] .theme-icon-sun,
:root[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-heading,
.results-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 19px;
}

.page-heading.compact {
  margin-bottom: 24px;
}

.page-heading > div:first-child,
.results-heading > div {
  max-width: 730px;
}

.page-heading h2,
.results-heading h2 {
  margin: 4px 0 6px;
  color: var(--ink);
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 730;
  letter-spacing: -0.032em;
  line-height: 1.17;
}

.page-heading p,
.results-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.privacy-chip,
.success-badge,
.count-chip,
.file-state {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.privacy-chip {
  gap: 7px;
  margin-top: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.flow-card {
  display: grid;
  grid-template-columns: auto minmax(30px, 1fr) auto minmax(30px, 1fr) auto;
  align-items: center;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.flow-number {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 11px;
  font-weight: 750;
}

.flow-step div {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.flow-step strong {
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 650;
}

.flow-step div span {
  color: var(--muted);
  font-size: 10.5px;
}

.flow-line {
  height: 1px;
  margin: 0 18px;
  background: var(--line);
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.file-card,
.panel,
.export-card,
.guide-card,
.rules-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.file-card {
  overflow: hidden;
}

.file-card-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.file-brand {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  font-size: 13px;
  font-weight: 750;
}

.file-brand.headout {
  background: linear-gradient(135deg, var(--orange), #ff864b);
}

.file-brand.step {
  background: linear-gradient(135deg, var(--purple), var(--magenta));
}

.file-card-header > div:nth-child(2) {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.file-card h3,
.panel h3,
.export-card h3,
.guide-card h3,
.rules-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.file-state {
  margin-left: auto;
  padding: 4px 8px;
  background: var(--sunk);
  color: var(--muted);
}

.file-state.ready {
  background: var(--green-soft);
  color: var(--green);
}

.dropzone {
  display: flex;
  min-height: 224px;
  margin: 16px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--orange);
  background: var(--orange-soft);
}

.dropzone.dragging {
  transform: scale(0.995);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  width: 45px;
  height: 45px;
  margin-bottom: 13px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  color: var(--orange);
}

.upload-icon svg {
  width: 21px;
  height: 21px;
}

.dropzone strong {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}

.dropzone > span:not(.upload-icon) {
  margin-top: 3px;
  font-size: 11.5px;
}

.dropzone u {
  color: var(--orange);
  font-weight: 650;
  text-underline-offset: 2px;
}

.dropzone small {
  margin-top: 13px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.selected-file {
  display: flex;
  min-height: 224px;
  margin: 16px;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.excel-icon {
  display: grid;
  width: 44px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
}

.selected-file-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.selected-file-name {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-meta {
  color: var(--muted);
  font-size: 10.5px;
}

.remove-file {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.remove-file:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.remove-file svg {
  width: 14px;
  height: 14px;
}

.file-requirement {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10.5px;
}

.file-requirement > span {
  color: var(--orange);
  font-weight: 700;
}

.action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.action-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.action-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: var(--orange-soft);
  color: var(--orange);
}

.action-icon svg {
  width: 19px;
  height: 19px;
}

.action-copy > div {
  display: flex;
  flex-direction: column;
}

.action-copy strong {
  color: var(--ink-2);
  font-size: 12.5px;
}

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

.primary-button,
.download-button,
.secondary-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.primary-button {
  gap: 8px;
  min-width: 150px;
  padding: 0 16px;
  border: 0;
  background: var(--solid);
  color: var(--solid-ink);
}

.primary-button:hover:not(:disabled) {
  background: var(--solid-hover);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.primary-button svg,
.download-button svg {
  width: 16px;
  height: 16px;
}

.results {
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.results-heading {
  align-items: center;
  margin-bottom: 15px;
}

.results-heading h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.success-badge {
  gap: 6px;
  padding: 6px 9px;
  background: var(--green-soft);
  color: var(--green);
}

.success-badge svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.success-badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.zero-match-panel {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--line));
  border-radius: var(--radius-md);
  background: var(--warning-soft);
  color: var(--warning);
}

.zero-match-panel > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.zero-match-panel > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.zero-match-panel strong {
  color: var(--ink-2);
  font-size: 12px;
}

.zero-match-panel span {
  color: var(--muted);
  font-size: 10.5px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  position: relative;
  display: flex;
  min-height: 126px;
  overflow: hidden;
  flex-direction: column;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.stat-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--stat-color);
  content: "";
}

.stat-matched {
  --stat-color: var(--green);
}

.stat-difference {
  --stat-color: var(--orange);
}

.stat-step {
  --stat-color: var(--magenta);
}

.stat-headout {
  --stat-color: var(--purple);
}

.stat-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.stat-card strong {
  margin: 7px 0 6px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-card > span:last-child {
  margin-top: auto;
  color: var(--muted);
  font-size: 10.5px;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 14px;
  margin-top: 14px;
  align-items: stretch;
}

.panel,
.export-card {
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-header p,
.export-card p,
.guide-card p,
.rules-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.count-chip {
  padding: 4px 8px;
  background: var(--orange-soft);
  color: var(--orange);
}

.table-wrap {
  position: relative;
  min-height: 260px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 10.5px;
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--sunk);
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

th.numeric,
td.numeric {
  text-align: right;
}

td.reference {
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 650;
}

.value-pair {
  color: var(--danger);
  font-weight: 700;
}

.empty-table {
  position: absolute;
  inset: 36px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--muted);
  text-align: center;
}

.empty-check {
  display: grid;
  width: 40px;
  height: 40px;
  margin-bottom: 9px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
}

.empty-check svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.empty-table strong {
  color: var(--ink-2);
  font-size: 12px;
}

.empty-table > span:last-child {
  margin-top: 3px;
  font-size: 10.5px;
}

.table-footnote {
  min-height: 38px;
  margin: 0;
  padding: 10px 14px;
  background: var(--sunk);
  color: var(--muted);
  font-size: 9.5px;
}

.export-card {
  display: flex;
  flex-direction: column;
  padding: 17px;
}

.export-icon {
  display: grid;
  width: 43px;
  height: 43px;
  margin-bottom: 13px;
  place-items: center;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
}

.export-icon svg {
  width: 22px;
  height: 22px;
}

.export-card h3 {
  overflow-wrap: anywhere;
  margin-top: 3px;
  font-size: 13px;
}

.sheet-list {
  display: grid;
  gap: 7px;
  margin: 17px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.sheet-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 10.5px;
}

.sheet-color {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.sheet-color.orange {
  background: var(--orange);
}

.sheet-color.purple {
  background: var(--purple);
}

.sheet-color.magenta {
  background: var(--magenta);
}

.sheet-color.gray {
  background: var(--faint);
}

.download-button {
  gap: 8px;
  margin-top: auto;
  padding: 0 14px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
}

.download-button:hover {
  filter: brightness(0.94);
}

.secondary-button {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink-2);
}

.secondary-button:hover {
  background: var(--sunk);
}

.warning-panel {
  display: flex;
  gap: 11px;
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--line));
  border-radius: var(--radius-md);
  background: var(--warning-soft);
  color: var(--warning);
}

.warning-panel > svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.warning-panel strong {
  font-size: 11.5px;
}

.warning-panel ul {
  margin: 4px 0 0;
  padding-left: 16px;
  color: var(--ink-2);
  font-size: 10.5px;
}

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

.guide-card {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  padding: 20px;
}

.guide-number {
  position: absolute;
  top: 14px;
  right: 16px;
  color: var(--line-strong);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.guide-icon,
.rules-icon {
  display: grid;
  width: 39px;
  height: 39px;
  margin-bottom: 20px;
  place-items: center;
  border-radius: 11px;
}

.guide-icon svg,
.rules-icon svg {
  width: 19px;
  height: 19px;
}

.guide-icon.orange {
  background: var(--orange-soft);
  color: var(--orange);
}

.guide-icon.purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.guide-icon.magenta {
  background: var(--magenta-soft);
  color: var(--magenta);
}

.guide-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

.guide-card h3 {
  font-size: 15px;
}

.guide-card p {
  max-width: 92%;
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.6;
}

.rules-card {
  margin-top: 14px;
  padding: 18px 20px;
}

.rules-header {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.rules-icon {
  margin: 0;
  flex: 0 0 auto;
  background: var(--blue-soft);
  color: var(--blue);
}

.rules-card p {
  max-width: 900px;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.55;
}

.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 22px;
  place-items: center;
  background: var(--backdrop);
  backdrop-filter: blur(3px);
}

.processing-card {
  display: flex;
  width: min(390px, 100%);
  align-items: center;
  flex-direction: column;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.spinner {
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  border: 3px solid var(--orange-soft);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.processing-card h2 {
  margin: 5px 0 4px;
  font-size: 17px;
  letter-spacing: -0.015em;
}

.processing-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.progress-track {
  width: 100%;
  height: 5px;
  overflow: hidden;
  margin-top: 20px;
  border-radius: 999px;
  background: var(--sunk);
}

.progress-track span {
  display: block;
  width: 12%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--magenta));
  transition: width 300ms ease;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 110;
  display: flex;
  width: min(430px, calc(100vw - 40px));
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  border-radius: var(--radius-md);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  color: var(--danger);
}

.toast > svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.toast > span {
  flex: 1;
  color: var(--ink-2);
  font-size: 11.5px;
}

.toast button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
}

@media (max-width: 1080px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .export-card {
    min-height: 330px;
  }
}

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

  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-102%);
    width: 248px;
    box-shadow: var(--shadow-lg);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 15;
    border: 0;
    background: var(--backdrop);
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .menu-button {
    display: grid;
  }

  .topbar {
    padding: 11px 18px;
  }

  .page {
    padding: 24px 18px 42px;
  }

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

@media (max-width: 620px) {
  .theme-toggle span {
    display: none;
  }

  .theme-toggle {
    width: 35px;
    justify-content: center;
    padding: 0;
  }

  .page-heading,
  .results-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .privacy-chip {
    margin-top: 0;
  }

  .flow-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .flow-line {
    width: 1px;
    height: 15px;
    margin: -2px 0 -2px 14px;
  }

  .action-card {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .stat-grid,
  .guide-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-card {
    min-height: 112px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
