/* ========================================
   CRUDE DISTILL — Industrial Theme
   ======================================== */

/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Surface layers — LIGHT MODE DEFAULT */
  --surface-base: #f2f2f2;
  --surface-raised: #ffffff;
  --surface-overlay: #f7f7f7;
  --surface-card: #ffffff;

  /* Text */
  --text-primary: #1a1d2e;
  --text-secondary: #475569;
  --text-muted: #667085;
  --text-headline: #000000;

  /* Accents */
  --accent-amber: #B45309;
  --accent-cyan: #0E7490;
  --accent-green: #047857;
  --accent-red: #B91C1C;

  /* Semantic */
  --danger: #DC2626;
  --success: #059669;
  --warning: #D97706;
  --info: #0891B2;

  /* Borders */
  --border-subtle: #e5e5e5;
  --border-light: #d4d4d4;
  --border-focus: #D97706;

  /* Shadows */
  --shadow-subtle: 0 1px 2px rgba(0,0,0,0.05), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-medium: 0 4px 12px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);

  /* Typography */
  --font-sans: "Segoe UI", Arial, sans-serif;
  --font-display: "Bahnschrift SemiCondensed", "Arial Narrow", "Segoe UI", sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "Courier New", monospace;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-standard: 250ms ease-out;
}

/* DARK MODE OVERRIDE */
.dark-mode {
  --surface-base: #0a0a0a;
  --surface-raised: #141414;
  --surface-overlay: #1e1e1e;
  --surface-card: #161616;

  --text-primary: #e0e0e0;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-headline: #ffffff;

  --accent-amber: #F59E0B;
  --accent-cyan: #22D3EE;
  --accent-green: #10B981;
  --accent-red: #EF4444;

  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --info: #22D3EE;

  --border-subtle: #1a1a1a;
  --border-light: #2a2a2a;
  --border-focus: #F59E0B;

  --shadow-subtle: 0 1px 2px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-medium: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
}

.dark-mode img {
  filter: brightness(0.9);
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: linear-gradient(180deg, var(--surface-overlay), var(--surface-base) 34rem);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  transition: background-color 300ms ease, color 300ms ease;
}

body * {
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 400;
  transform: translateY(-150%);
  padding: 10px 14px;
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 2px solid var(--border-focus);
  border-radius: 6px;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--border-focus);
  outline-offset: 2px;
}

/* App Container */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  padding: var(--space-md) var(--space-xl);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 10px rgba(15, 23, 42, 0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.logo-icon {
  font-size: 28px;
}

.logo h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-headline);
}

.logo-accent {
  color: var(--accent-amber);
}

.subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  padding: 8px 14px;
  background: var(--surface-overlay);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
}

.theme-toggle:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}

/* Main Grid */
.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(320px, 480px) minmax(320px, 560px);
  gap: 16px;
  padding: 16px;
  margin: 0 auto;
  width: 100%;
  max-width: 1388px;
  justify-content: center;
}

/* Panels */
.left-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-self: start;
  min-width: 0;
}

.panel-section {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: var(--space-md);
  box-shadow: var(--shadow-subtle);
  min-width: 0;
}

.panel-section h2 {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.section-num {
  color: var(--accent-amber);
  font-size: 10px;
}

/* Form Elements */
.select-group {
  margin-bottom: var(--space-md);
}

.select-group label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

select,
input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-base);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  min-height: 44px;
}

select:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

input[aria-invalid="true"] {
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

select:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Input Row */
.input-row {
  display: flex;
  gap: var(--space-sm);
}

.input-row input {
  flex: 1;
}

.input-row select {
  width: 140px;
  flex-shrink: 0;
}

.balance-controls {
  margin-top: var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--surface-overlay);
}

.balance-controls summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 700;
}

.balance-controls[open] summary {
  border-bottom: 1px solid var(--border-subtle);
}

.balance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
  padding: 0 12px 12px;
}

.balance-grid[hidden] {
  display: none;
}

.balance-scenario-field {
  padding: 0 12px 12px;
}

.balance-scenario-field select {
  width: 100%;
}

.balance-source-link {
  display: inline-block;
  margin-top: 2px;
  color: var(--accent-cyan);
  font-size: 10px;
}

.balance-source-link[hidden] {
  display: none;
}

.field-group {
  min-width: 0;
}

.field-group label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.field-help {
  display: block;
  padding: 0 12px 10px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
}

.field-group .field-help {
  padding: 6px 0 0;
}

/* Specs Display */
.spec-empty {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--text-muted);
}

.spec-icon {
  font-size: 40px;
  margin-bottom: var(--space-sm);
  opacity: 0.5;
}

.spec-card h3 {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--accent-amber);
  margin-bottom: var(--space-md);
  text-align: center;
}

.spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.spec-item {
  background: var(--surface-base);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: var(--space-sm);
}

.spec-wide {
  grid-column: 1 / -1;
}

.spec-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.spec-value {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.spec-value.badge {
  display: inline-block;
  background: rgba(34, 211, 238, 0.1);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.spec-value.confidence-high {
  background: rgba(5, 150, 105, 0.12);
  color: var(--accent-green);
}

.spec-value.confidence-medium {
  background: rgba(180, 83, 9, 0.12);
  color: var(--accent-amber);
}

.spec-value.confidence-low {
  background: rgba(185, 28, 28, 0.1);
  color: var(--accent-red);
}

.data-evidence {
  margin-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-sm);
}

.evidence-summary,
.context-sources summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 700;
}

.evidence-note {
  margin-top: var(--space-sm);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
}

.evidence-heading {
  margin-top: var(--space-md);
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.evidence-list,
.context-sources ul {
  list-style: none;
  margin-top: var(--space-xs);
}

.evidence-list li,
.context-sources li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin-top: 6px;
  line-height: 1.45;
}

.source-link,
.context-sources a {
  color: var(--accent-cyan);
  overflow-wrap: anywhere;
  text-underline-offset: 2px;
}

.source-tier {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 20px;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
}

.tier-t1 {
  color: var(--accent-green);
  background: rgba(5, 150, 105, 0.12);
}

.tier-t2 {
  color: var(--accent-cyan);
  background: rgba(14, 116, 144, 0.12);
}

.tier-t3 {
  color: var(--accent-amber);
  background: rgba(180, 83, 9, 0.12);
}

/* Conversions */
.conversions {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-subtle);
}

.conv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs);
}

.conv-item {
  background: var(--surface-base);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.conv-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.conv-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.barrel-ref {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
}

.barrel-ref .ref-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-amber), #d97706);
  color: #000;
  margin-bottom: var(--space-sm);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface-base);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--surface-overlay);
  color: var(--text-primary);
}

.btn-icon {
  font-size: 14px;
}

.auto-note,
.simulation-message {
  margin-top: var(--space-sm);
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.45;
  text-align: center;
}

.simulation-message {
  min-height: 28px;
  padding: 7px 8px;
  border-radius: 6px;
  background: var(--surface-overlay);
}

.simulation-message.is-error {
  color: var(--accent-red);
  border: 1px solid rgba(185, 28, 28, 0.25);
}

/* Center Panel — Column */
.center-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
}

.column-container {
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: var(--space-lg);
  box-shadow: var(--shadow-medium);
  width: 100%;
  max-width: 500px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.column-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: 12px;
}

#column-svg {
  width: 100%;
  height: auto;
  max-height: 520px;
}

/* Column Animation States */
.column-container.running .status-dot {
  background: var(--accent-green);
  animation: pulse 1s ease-in-out infinite;
}

.column-container.running .status-text {
  color: var(--accent-green);
}

/* Bubbles */
@keyframes bubbleRise {
  0% {
    transform: translateY(0);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-360px);
    opacity: 0;
  }
}

/* Side Streams Flow */
.side-stream {
  stroke-dasharray: 8 4;
  transition: opacity var(--transition-standard);
}

.side-stream.flowing {
  animation: streamFlow 0.5s linear infinite;
  opacity: 0.8 !important;
}

@keyframes streamFlow {
  to {
    stroke-dashoffset: -12;
  }
}

/* Status */
.column-status {
  margin-top: var(--space-md);
  text-align: center;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-light);
  border-radius: 20px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-text {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.total-section {
  padding-bottom: var(--space-sm);
}

.total-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.total-item {
  background: var(--surface-base);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: var(--space-md);
  text-align: center;
}

.total-label {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.total-basis {
  display: block;
  min-height: 14px;
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.3;
}

.total-value {
  display: block;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-amber);
}

.total-value-muted {
  color: var(--text-secondary);
}

.total-value-info {
  color: var(--accent-cyan);
}

.total-sub {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.total-note {
  margin-top: var(--space-sm);
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
  text-align: center;
  font-style: italic;
}

.process-section {
  border-top: 3px solid var(--accent-cyan);
}

.process-details {
  border: 1px solid var(--border-interactive);
  border-radius: 8px;
  background: var(--surface-raised);
  overflow: clip;
}

.process-details summary {
  min-height: 44px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.process-details summary::marker {
  color: var(--accent-cyan);
}

.process-details summary:hover {
  background: var(--surface-overlay);
}

.process-details summary:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: -3px;
}

.process-details-summary-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.process-details-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

.process-details-hint {
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.35;
}

.process-details-toggle-label {
  flex: 0 0 auto;
  margin-inline-start: auto;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(8, 145, 178, 0.1);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
}

.process-details .details-open {
  display: none;
}

.process-details[open] .details-closed {
  display: none;
}

.process-details[open] .details-open {
  display: inline;
}

.process-details[open] summary {
  border-bottom: 1px solid var(--border-subtle);
}

.process-details-body {
  padding: 12px;
}

.process-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.process-fit {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text-primary);
}

.screen-badge {
  flex: 0 0 auto;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(180, 83, 9, 0.12);
  color: var(--accent-amber);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.process-rationale,
.process-note,
.process-caveat {
  margin-top: var(--space-sm);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.process-flow {
  display: grid;
  gap: 6px;
  margin-top: var(--space-md);
  padding: 0;
  list-style: none;
  counter-reset: process-step;
}

.process-flow li {
  counter-increment: process-step;
  position: relative;
  padding: 9px 10px 9px 36px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--surface-overlay);
  color: var(--text-primary);
  font-size: 11px;
  line-height: 1.35;
}

.process-flow li::before {
  content: counter(process-step);
  position: absolute;
  inset-inline-start: 10px;
  top: 8px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-cyan);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
}

.method-note {
  padding: 8px 10px;
  border-inline-start: 3px solid var(--accent-amber);
  background: var(--surface-overlay);
}

.process-caveat {
  font-weight: 700;
}

/* Right Panel — Chart & Results */
.chart-wrapper {
  height: 220px;
  position: relative;
  min-width: 0;
}

.chart-wrapper canvas {
  max-width: 100%;
}

.results-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
}

.results-table-wrapper:focus-visible {
  outline-offset: 3px;
}

.scroll-hint {
  display: none;
  margin-bottom: var(--space-sm);
  color: var(--text-muted);
  font-size: 10px;
}

.results-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 11px;
}

.results-table th {
  position: sticky;
  top: 0;
  background: var(--surface-raised);
  padding: 10px 6px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.results-table th:first-child,
.results-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface-raised);
}

.results-table th:first-child {
  z-index: 2;
}

.results-table th:nth-child(2),
.results-table th:nth-child(3),
.results-table th:nth-child(4),
.results-table th:nth-child(5) {
  text-align: right;
}

.results-table td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.results-table td.num {
  text-align: right;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.results-table .note-cell {
  min-width: 170px;
  max-width: 220px;
  line-height: 1.4;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.results-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.product-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.empty-results {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-xl) var(--space-md) !important;
}

/* Footer */
.app-footer {
  padding: var(--space-md) var(--space-xl);
  text-align: center;
  border-top: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.55;
}

.app-footer p + p {
  margin-top: 4px;
}

.context-sources {
  width: min(100%, 760px);
  margin: var(--space-sm) auto 0;
  text-align: left;
}

.context-sources summary {
  justify-content: center;
}

.context-sources ul {
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-raised);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--surface-base);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Responsive */
@media (min-width: 1700px) {
  .main-grid {
    max-width: 1680px;
    grid-template-columns: minmax(260px, 280px) minmax(400px, 440px) minmax(0, 1fr);
  }

  .right-panel {
    display: grid;
    grid-template-columns: minmax(440px, 1.15fr) minmax(360px, 0.85fr);
    grid-template-rows: auto auto 1fr;
    align-items: start;
  }

  .right-panel .chart-section {
    grid-column: 1;
    grid-row: 1;
  }

  .right-panel .total-section {
    grid-column: 1;
    grid-row: 2;
  }

  .right-panel .results-section {
    grid-column: 1;
    grid-row: 3;
  }

  .right-panel .process-section {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

}

@media (max-width: 1300px) {
  .main-grid {
    grid-template-columns: minmax(240px, 280px) minmax(300px, 1fr) minmax(320px, 460px);
    gap: 10px;
    padding: 10px;
  }
}

@media (max-width: 1100px) {
  .main-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }

  .left-panel,
  .right-panel {
    max-height: none;
    overflow-y: visible;
  }

  .column-container {
    max-width: 400px;
  }

  .right-panel,
  .left-panel {
    width: 100%;
  }
}

@media (max-width: 576px) {
  html {
    font-size: 13px;
  }

  .app-header {
    align-items: flex-start;
    gap: 2px;
    padding: var(--space-sm) var(--space-md);
    padding-right: 92px;
  }

  .logo h1 {
    font-size: 18px;
    letter-spacing: 1px;
  }

  .subtitle {
    font-size: 9px;
    letter-spacing: 0.5px;
  }

  .theme-toggle {
    top: 10px;
    right: 10px;
    padding: 7px 10px;
    font-size: 11px;
  }

  .scroll-hint {
    display: block;
  }

  .main-grid {
    padding: var(--space-sm);
    gap: var(--space-sm);
  }

  .panel-section {
    padding: 12px;
  }

  .panel-section h2 {
    font-size: 11px;
  }

  .input-row {
    flex-direction: column;
  }

  .input-row select {
    width: 100%;
  }

  .column-container {
    max-width: 100%;
    padding: 10px;
    border-radius: 8px;
  }

  #column-svg {
    max-height: 420px;
  }

  .chart-wrapper {
    height: 260px;
  }

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

  .conv-grid {
    grid-template-columns: 1fr;
  }

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

  .balance-grid {
    grid-template-columns: 1fr;
  }

  .process-heading-row {
    display: block;
  }

  .screen-badge {
    display: inline-flex;
    margin-top: 6px;
  }
}

@media (max-width: 400px) {
  .subtitle {
    display: none;
  }

  .logo-icon {
    font-size: 24px;
  }

  .app-header {
    align-items: center;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
