* { margin: 0; padding: 0; box-sizing: border-box; }

/* Hide header title row when embedded in portal iframe, but keep nav tabs */
html.in-iframe .header-row { display: none !important; }
html.in-iframe header { padding-top: 0; }

:root {
  /* Dark mode (default) — teal cockpit aesthetic */
  --bg: #080a0f;
  --bg-raised: #0e1118;
  --card: #0c1015;
  --card-alt: #0a0e14;
  --primary: #14b8a6;
  --primary-dim: #0d9488;
  --primary-light: #2dd4bf;
  --text: #cbd5e1;
  --text-light: #64748b;
  --text-bright: #e2e8f0;
  --border: #1e293b;
  --border-light: #334155;
  --highlight: #0f172a;
  --danger: #ff3b30;
  --success: #7A9E7E;
  --blue: #4a9eff;
  --amber: #ffb800;
  --warning: #ff6e40;
  --purple: #b388ff;
  --profit-pos: #0a1520;
  --profit-neg: #1f0a0a;
  --transition-fast: 0.15s ease;
  --glow: 0 0 6px rgba(20, 184, 166, 0.3);
  --glow-amber: 0 0 6px rgba(255, 184, 0, 0.2);
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Light mode palette */
body.light {
  --bg: #f8fafc;
  --bg-raised: #ffffff;
  --card: #f1f5f9;
  --card-alt: #e2e8f0;
  --primary: #0d9488;
  --primary-dim: #0f766e;
  --primary-light: #14b8a6;
  --text: #1e293b;
  --text-light: #64748b;
  --text-bright: #0f172a;
  --border: #cbd5e1;
  --border-light: #e2e8f0;
  --highlight: #f0fdfa;
  --danger: #c0392b;
  --success: #0d9488;
  --amber: #b8860b;
  --glow: 0 0 6px rgba(13, 148, 136, 0.2);
  --glow-amber: 0 0 6px rgba(184, 134, 11, 0.15);
}

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ─── Header ────────────────────────────────── */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 2rem;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

header h1 {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-light);
  letter-spacing: 0.03em;
}

header h1 .prompt { color: var(--primary-dim); }
header h1 .title { color: var(--primary); font-weight: 600; }

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  color: var(--text-light);
  transition: color var(--transition-fast);
}
.theme-toggle:hover { color: var(--primary); }

nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  background: none;
  color: var(--text-light);
  border: none;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color var(--transition-fast);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text-bright); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ─── Main ──────────────────────────────────── */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

h2 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

/* ─── Settings bar ──────────────────────────── */
.settings-bar {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.settings-bar label {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─── Stat Grid (Dashboard) ─────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem;
  text-align: center;
}

.stat-card.warn { border-left: 3px solid var(--danger); }

.stat-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-light);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--amber);
}

/* ─── Toolbar ───────────────────────────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.toolbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ─── Type Toggle ───────────────────────────── */
.type-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.toggle-btn {
  background: var(--card);
  border: none;
  border-right: 1px solid var(--border);
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-light);
  transition: all var(--transition-fast);
}

.toggle-btn:last-child { border-right: none; }
.toggle-btn:hover { background: var(--highlight); color: var(--text-bright); }
.toggle-btn.active { background: var(--primary-dim); color: #fff; }

/* ─── Forms ─────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.form-group { display: flex; flex-direction: column; }
.form-group.full-width { grid-column: 1 / -1; }

label {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.9rem;
  background: var(--card);
  color: var(--text);
  font-family: var(--font-sans);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-dim);
  box-shadow: var(--glow);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* ─── Buttons ───────────────────────────────── */
.btn-primary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary-dim);
  padding: 0.5rem 1.5rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: var(--primary-dim);
  color: #fff;
  box-shadow: var(--glow);
}
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.btn-secondary {
  background: transparent;
  color: var(--amber);
  border: 1px solid rgba(255, 184, 0, 0.3);
  padding: 0.5rem 1.5rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: all var(--transition-fast);
}
.btn-secondary:hover {
  background: rgba(255, 184, 0, 0.12);
  box-shadow: var(--glow-amber);
}
.btn-secondary:disabled { opacity: 0.5; cursor: default; }

.btn-sm {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 0.3rem 0.8rem;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-light);
  transition: color var(--transition-fast);
}

.btn-sm:hover { color: var(--primary); border-color: var(--primary-dim); }
.btn-sm:disabled { opacity: 0.4; cursor: default; }

.btn-danger {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
}
.btn-danger:hover { text-decoration: underline; }

.btn-edit {
  background: none;
  border: none;
  color: var(--blue);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
}
.btn-edit:hover { text-decoration: underline; }

.full-width { width: 100%; }

/* ─── Toast ─────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--primary-dim);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.65rem 1.25rem;
  border-radius: 3px;
  box-shadow: var(--glow);
  transition: opacity 0.3s;
  z-index: 200;
}

.toast.hidden { opacity: 0; pointer-events: none; }
.toast.error { background: var(--danger); box-shadow: 0 0 6px rgba(255, 59, 48, 0.3); }

/* ─── Filters ───────────────────────────────── */
.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.filters input, .filters select {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}

.filters input[type="text"] { min-width: 200px; }

/* ─── Tables ────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  font-size: 0.82rem;
}

th {
  background: var(--bg-raised);
  padding: 0.55rem 0.6rem;
  text-align: left;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--primary-dim);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

th:hover { color: var(--primary); }
th.sort-asc::after { content: ' \25B2'; font-size: 0.6rem; }
th.sort-desc::after { content: ' \25BC'; font-size: 0.6rem; }
th.number { text-align: right; }

td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td.number {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--amber);
}

tr:hover { background: var(--highlight); }

/* ─── Badges ────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.badge-seed { background: rgba(74, 246, 38, 0.1); color: var(--primary); border: 1px solid rgba(74, 246, 38, 0.2); }
.badge-input { background: rgba(74, 158, 255, 0.1); color: var(--blue); border: 1px solid rgba(74, 158, 255, 0.2); }
.badge-fertilizer { background: rgba(255, 184, 0, 0.1); color: var(--amber); border: 1px solid rgba(255, 184, 0, 0.2); }
.badge-chemical { background: rgba(255, 110, 64, 0.1); color: var(--warning); border: 1px solid rgba(255, 110, 64, 0.2); }
.badge-biological { background: rgba(179, 136, 255, 0.1); color: var(--purple); border: 1px solid rgba(179, 136, 255, 0.2); }
.badge-other { background: rgba(255, 255, 255, 0.05); color: var(--text-light); border: 1px solid rgba(255, 255, 255, 0.1); }
.badge-paid { background: rgba(74, 246, 38, 0.1); color: var(--primary); }
.badge-unpaid { background: rgba(255, 110, 64, 0.1); color: var(--warning); }
.badge-partial { background: rgba(255, 184, 0, 0.1); color: var(--amber); }
.badge-scan { background: rgba(74, 158, 255, 0.1); color: var(--blue); }
.badge-photo { background: rgba(179, 136, 255, 0.1); color: var(--purple); }
.badge-manual { background: rgba(255, 255, 255, 0.05); color: var(--text-light); }
.badge-discrepancy { background: rgba(255, 59, 48, 0.1); color: var(--danger); }

body.light .badge-seed { background: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; }
body.light .badge-input { background: #e3f2fd; color: #1565c0; border-color: #bbdefb; }
body.light .badge-fertilizer { background: #fff8e1; color: #f9a825; border-color: #fff3c4; }
body.light .badge-chemical { background: #fff3e0; color: #e65100; border-color: #ffe0b2; }
body.light .badge-biological { background: #f3e5f5; color: #7b1fa2; border-color: #e1bee7; }
body.light .badge-other { background: #f5f5f5; color: #757575; border-color: #e0e0e0; }
body.light .badge-paid { background: #e8f5e9; color: #2e7d32; }
body.light .badge-unpaid { background: #fff3e0; color: #e65100; }
body.light .badge-partial { background: #fffde7; color: #f9a825; }

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ─── Forecast Product Rows ─────────────────── */
.product-row {
  cursor: pointer;
  transition: background var(--transition-fast);
}
.product-row:hover { background: var(--highlight); }
.product-row.expanded { background: var(--highlight); }

.product-name {
  font-weight: 600;
  color: var(--text-bright);
}

.expand-icon {
  display: inline-block;
  font-size: 0.65rem;
  color: var(--text-light);
  margin-right: 0.3rem;
  transition: transform var(--transition-fast);
}

.product-row.expanded .expand-icon {
  color: var(--primary);
}

.field-details td {
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.sub-table {
  width: 100%;
  border: none;
  box-shadow: none;
  border-radius: 0;
  background: var(--card-alt);
  margin: 0;
}

.sub-table th {
  background: var(--card-alt);
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  padding: 0.35rem 0.6rem;
}

.sub-table td {
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}

.sub-table td.indent { padding-left: 1.5rem; }

.sub-table tr:last-child td { border-bottom: none; }
.sub-table tr:hover { background: var(--highlight); }

.detail-grid {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.6rem 1.5rem;
  color: var(--text);
  background: var(--card-alt);
  line-height: 1.8;
}

.detail-grid strong { color: var(--text-bright); }

.field-detail-row td { color: var(--text); }

.forecast-summary, .catalog-summary {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-light);
  padding: 0.5rem 0;
}

.source-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary);
  background: rgba(74, 246, 38, 0.08);
  border: 1px solid rgba(74, 246, 38, 0.2);
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  white-space: nowrap;
}

body.light .source-badge {
  color: #2e7d32;
  background: #e8f5e9;
  border-color: #c8e6c9;
}

.offline-banner {
  background: rgba(255, 59, 48, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 59, 48, 0.3);
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border-radius: 2px;
  margin-bottom: 0.5rem;
}

.offline-banner.hidden { display: none; }

body.light .offline-banner {
  background: #ffebee;
  border-color: #ef9a9a;
}

.btn-cert {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  cursor: pointer;
}

.btn-cert:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.supplier-cell { min-width: 140px; }

.current-supplier {
  font-size: 0.75rem;
  color: var(--text-light);
  display: block;
  margin-bottom: 0.15rem;
}

.supplier-select {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.15rem 0.3rem;
  border-radius: 2px;
  max-width: 130px;
}

.supplier-select:focus {
  border-color: var(--primary);
  outline: none;
}

body.light .supplier-select {
  background: #fff;
  color: #333;
}

.sync-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  font-family: var(--font-mono);
}

.sync-badge.synced {
  color: var(--primary);
}

.sync-badge.not-synced {
  color: var(--text-light);
}

/* ─── Modal ─────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-header h3 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-light);
  padding: 0.25rem;
}

.modal-close:hover { color: var(--danger); }

.hidden { display: none !important; }

/* ─── Scan / Verify ─────────────────────────── */
.scan-section { margin-bottom: 1.5rem; }

.btn-scan {
  background: rgba(74, 158, 255, 0.1);
  border: 1px solid rgba(74, 158, 255, 0.3);
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.75rem 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-scan:hover { background: rgba(74, 158, 255, 0.2); box-shadow: 0 0 6px rgba(74, 158, 255, 0.2); }
.btn-scan:disabled { opacity: 0.5; cursor: wait; }

.scan-status {
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.scan-status.loading { background: rgba(74, 158, 255, 0.1); color: var(--blue); }
.scan-status.error { background: rgba(255, 59, 48, 0.1); color: var(--danger); }
.scan-status.success { background: rgba(74, 246, 38, 0.1); color: var(--primary); }

.help-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
  margin: 1rem 0 0.5rem;
}

/* ─── Verify Wizard ─────────────────────────── */
.verify-wizard {
  max-width: 500px;
  margin: 0 auto;
}

.verify-step { margin-bottom: 1.5rem; }

.verify-step h3 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.verify-step select { margin-bottom: 1rem; }

.scan-results {
  background: var(--highlight);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.scan-results .field {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.scan-results .field-label { color: var(--text-light); font-weight: 600; font-family: var(--font-mono); font-size: 0.78rem; }
.scan-results .field-value { font-weight: 500; }

.match-list { margin-top: 1rem; }

.match-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.match-card:hover { border-color: var(--primary); }
.match-card.match-good { border-color: var(--success); }
.match-card.match-partial { border-color: var(--amber); }
.match-card.match-none { border-color: var(--danger); }

.match-card .match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.match-card .match-score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
}

.match-card .match-details {
  font-size: 0.82rem;
  color: var(--text-light);
}

.verify-done {
  text-align: center;
  padding: 2rem 0;
}

.verify-done h3 {
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.verify-done p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

/* ─── Delivery line items ───────────────────── */
.delivery-shared,
.delivery-items {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.delivery-shared legend,
.delivery-items legend {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.line-item-row {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
}
.line-item-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.modal-wide { max-width: 850px; }

.delivery-group-header {
  background: var(--highlight);
  cursor: pointer;
  font-weight: 600;
}
.delivery-group-header:hover { background: var(--bg-raised); }
.delivery-group-item td:first-child { border-left: 3px solid var(--primary); }

/* ─── Verify multi-item ─────────────────────── */
.scanned-item-block {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.scanned-item-header {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.confirm-table { font-size: 0.82rem; width: 100%; }
.confirm-table th { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--primary-dim); }
.confirm-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); }
.confirm-table input { padding: 0.3rem 0.5rem; font-size: 0.82rem; }

.manual-item-row {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}
.manual-item-row:last-child { border-bottom: none; }

/* ─── Reconciliation colors ─────────────────── */
.recon-good { color: var(--success); }
.recon-warn { color: var(--amber); }
.recon-bad { color: var(--danger); }

/* ─── Responsive ────────────────────────────── */
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  header { padding: 0.5rem 1rem; }
  main { padding: 1rem; }

  nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }
  .tab-btn {
    flex-shrink: 0;
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem 0.8rem;
    font-size: 0.75rem;
  }

  input, select, button { min-height: 44px; font-size: 16px; }

  .btn-primary { width: 100%; padding: 0.75rem; font-size: 1rem; }
  .btn-scan { width: 100%; margin-bottom: 1rem; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .filters { flex-direction: column; }
  .filters input[type="text"] { min-width: unset; }

  .table-wrap { margin: 0 -1rem; padding: 0 1rem; }
  table { font-size: 0.72rem; }
  th, td { padding: 0.3rem 0.4rem; }

  .toast { left: 1rem; right: 1rem; bottom: 1rem; text-align: center; }

  .modal-content { padding: 1rem; max-height: 95vh; }
}
