/*
 * MARTAR Scrub — Excel Merger functionality ported from the standalone
 * `MARTAR Excel Merger.html` into the MARTAR Document System.
 *
 * Everything is scoped under `.scrub-scope` using native CSS nesting so the
 * merger's class names (.module, .nav-item, .upload-card, …) never collide
 * with MARTAR's own classes. The scope also redefines the merger's custom
 * properties in terms of MARTAR's theme variables, so the module inherits
 * light/dark-mode values automatically.
 */

.scrub-scope {
  /* Remap the Excel Merger palette onto MARTAR's theme tokens. These are
     the same names the merger's rules reference (var(--accent), etc.) so
     the imported CSS below works without rewriting a single selector. */
  --bg: var(--bg);
  --paper: var(--surface);
  --ink: var(--text);
  --ink-soft: var(--text-muted);
  --line: var(--border);
  --accent: var(--primary);
  --accent-soft: var(--primary-soft);
  --gold: var(--warning);
  --green: var(--success);
  --shadow: var(--shadow-sm);

  /* Drop the merger's editorial fonts (Inter Tight + Fraunces) — use
     MARTAR's Inter stack throughout. JetBrains Mono stays for the mono
     bits (stats, nav labels, etc.) since MARTAR already loads it. */
  font-family: var(--font);
  color: var(--text);

  .module { display: none; }
  .module.active { display: block; animation: fadeInUp 0.3s ease; }

  @keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .module-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 32px;
  }

  .module-title {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 34px;
    letter-spacing: -0.02em;
    line-height: 1;
  }

  .module-title em { font-style: italic; color: var(--accent); }

  .module-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-soft);
    margin-top: 10px;
  }

  .module-actions {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  /* ============ UPLOAD MODULE ============ */
  .upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
  }

  .upload-card {
    background: var(--paper);
    border: 1px dashed var(--line);
    border-radius: 4px;
    padding: 26px 22px;
    transition: all 0.25s ease;
    cursor: pointer;
  }

  .upload-card:hover {
    border-color: var(--accent);
    background: #fff;
    box-shadow: var(--shadow);
  }

  .upload-card.dragover {
    border-style: solid;
    border-color: var(--accent);
    background: var(--accent-soft);
  }

  .upload-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
  }

  .upload-card h3 {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 19px;
    letter-spacing: -0.01em;
  }

  .upload-card h3 em { font-style: italic; color: var(--accent); }

  .upload-card .icon {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    border: 1px solid var(--line);
    padding: 3px 8px;
    border-radius: 2px;
  }

  .upload-card p {
    color: var(--ink-soft);
    font-size: 13px;
    margin-bottom: 14px;
  }

  .upload-btn {
    font-family: 'Inter Tight', sans-serif;
    font-weight: 500;
    font-size: 13px;
    background: var(--ink);
    color: var(--paper);
    border: none;
    padding: 10px 18px;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.2s;
  }

  .upload-btn:hover { background: var(--accent); }

  /* Progress bar for file loading */
  .upload-progress {
    display: none;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 14px 18px;
    margin-bottom: 16px;
    position: relative;
  }

  .upload-progress-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
  }

  .upload-progress-label .label-left {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
  }

  .upload-progress-label .label-right {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--ink);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  .upload-progress-track {
    height: 4px;
    background: #efeadf;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
  }

  .upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    width: 0%;
    border-radius: 2px;
    transition: width 0.15s linear;
    position: relative;
    overflow: hidden;
  }

  .upload-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
      transparent 0%,
      rgba(255,255,255,0.4) 50%,
      transparent 100%);
    animation: shimmer 1.2s linear infinite;
  }

  @keyframes shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
  }

  /* Stage selector */
  .stage-selector {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 14px 18px;
    margin-bottom: 16px;
  }

  .stage-selector-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
  }

  .stage-selector-label .lbl {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
  }

  .stage-quick { display: flex; gap: 6px; }

  .stage-quick-btn {
    font-family: 'Inter Tight', sans-serif;
    font-size: 11px;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--line);
    padding: 4px 10px;
    border-radius: 2px;
    cursor: pointer;
    color: var(--ink-soft);
    transition: all 0.15s;
    letter-spacing: 0.02em;
  }

  .stage-quick-btn:hover { color: var(--ink); border-color: var(--ink); }

  .stage-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .stage-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--line);
    padding: 8px 14px 8px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    transition: all 0.15s;
    user-select: none;
    min-width: 140px;
  }

  .stage-chip:hover {
    border-color: var(--ink-soft);
    color: var(--ink);
  }

  .stage-chip.checked {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
  }

  .stage-chip input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
    width: 14px;
    height: 14px;
    margin: 0;
  }

  .stage-chip .stage-name {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 500;
    font-size: 14px;
    flex: 1;
  }

  .stage-chip .stage-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    background: #efeadf;
    color: var(--ink-soft);
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 600;
  }

  .stage-chip.checked .stage-count {
    background: #fff;
    color: var(--accent);
  }

  .file-list {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
  }

  .file-list-header {
    display: grid;
    grid-template-columns: 30px 1fr 120px 100px 40px;
    padding: 10px 20px;
    background: #efeadf;
    border-bottom: 1px solid var(--line);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
  }

  .file-row {
    display: grid;
    grid-template-columns: 30px 1fr 120px 100px 40px;
    padding: 12px 20px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    transition: background 0.15s;
  }

  .file-row:last-child { border-bottom: none; }
  .file-row:hover { background: #fff; }

  .file-row .idx { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--ink-soft); }

  .file-row .name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 16px;
  }

  .file-row .sheets, .file-row .size {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--ink-soft);
  }

  .file-row .remove {
    background: none;
    border: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 2px;
  }

  .file-row .remove:hover { color: var(--accent); background: var(--accent-soft); }

  .empty-state {
    padding: 48px 20px;
    text-align: center;
    color: var(--ink-soft);
    font-style: italic;
    font-family: 'Fraunces', serif;
    font-size: 16px;
  }

  .actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
  }

  .action-left {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--ink-soft);
  }

  .action-left strong { color: var(--ink); font-weight: 600; }

  .btn-primary {
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 13px;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 11px 22px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .btn-primary:hover:not(:disabled) {
    background: #a8341f;
    transform: translateY(-1px);
  }

  .btn-primary:disabled { background: #b8b2a4; cursor: not-allowed; }

  .btn-ghost {
    font-family: 'Inter Tight', sans-serif;
    font-weight: 500;
    font-size: 12px;
    background: transparent;
    color: var(--ink-soft);
    border: 1px solid var(--line);
    padding: 8px 14px;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
  }

  .btn-ghost:hover { color: var(--ink); border-color: var(--ink); }

  .btn-help {
    font-family: 'Inter Tight', sans-serif;
    font-weight: 600;
    font-size: 13px;
    width: 28px;
    height: 28px;
    line-height: 26px;
    text-align: center;
    background: transparent;
    color: var(--ink-soft);
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
  }

  .btn-help:hover { color: var(--ink); border-color: var(--ink); background: var(--paper); }

  .info-note {
    background: var(--paper);
    border-left: 3px solid var(--gold);
    padding: 14px 18px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--ink-soft);
    border-radius: 0 3px 3px 0;
  }

  .info-note strong {
    color: var(--ink);
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 500;
  }

  /* ============ INFERENCES MODULE ============ */
  .inferences-column-map {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 14px 18px;
    margin-bottom: 24px;
  }

  .inf-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
  }

  .inf-map-header h4 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
    font-weight: 500;
  }

  .inf-map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
  }

  .inf-map-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .inf-map-field label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
  }

  .inf-map-field select {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 2px;
    font-family: 'Inter Tight', sans-serif;
    font-size: 12px;
    background: #fff;
    cursor: pointer;
  }

  .inf-map-field select:focus { outline: none; border-color: var(--accent); }

  .inf-map-field.missing select {
    border-color: var(--accent);
    background: var(--accent-soft);
  }

  .inf-section {
    margin-bottom: 36px;
  }

  .inf-section-title {
    font-family: 'Fraunces', serif;
    font-weight: 400;
    font-size: 22px;
    letter-spacing: -0.01em;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
  }

  .inf-section-title em {
    font-style: italic;
    color: var(--accent);
  }

  .inf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
  }

  .inf-stat-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 14px 16px;
    transition: border-color 0.15s;
  }

  .inf-stat-card:hover { border-color: var(--ink-soft); }

  .inf-stat-card .stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    margin-bottom: 6px;
  }

  .inf-stat-card .stat-value {
    font-family: 'Fraunces', serif;
    font-size: 28px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.02em;
  }

  .inf-stat-card .stat-value em {
    font-style: italic;
    color: var(--accent);
  }

  .inf-stat-card .stat-sub {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--ink-soft);
    margin-top: 4px;
    letter-spacing: 0.04em;
  }

  .inf-pair-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }

  .inf-pair-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 18px 20px;
    transition: border-color 0.15s;
  }

  .inf-pair-card:hover { border-color: var(--ink-soft); }

  .inf-pair-title {
    font-family: 'Fraunces', serif;
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
  }

  .inf-pair-title em {
    font-style: italic;
    color: var(--accent);
  }

  .inf-pair-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 5px 0;
    font-size: 13px;
  }

  .inf-pair-row .label {
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .inf-pair-row .label .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
  }

  .inf-pair-row .label .dot.clean { background: var(--green); }
  .inf-pair-row .label .dot.dirty { background: var(--gold); }
  .inf-pair-row .label .dot.blank { background: var(--accent); }

  .inf-pair-row .value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
  }

  .inf-pair-row .pct {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--ink-soft);
    margin-left: 6px;
  }

  .inf-missing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
  }

  .inf-missing-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold);
    border-radius: 0 3px 3px 0;
    padding: 12px 14px;
    transition: all 0.15s ease;
  }

  .inf-missing-card.clickable {
    cursor: pointer;
    position: relative;
  }

  .inf-missing-card.clickable:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }

  .inf-missing-card.clickable:active {
    transform: translateY(0);
    box-shadow: none;
  }

  .inf-missing-card.empty {
    opacity: 0.55;
    border-left-color: var(--line);
  }

  .inf-missing-card.empty .miss-count em {
    color: var(--ink-soft);
  }

  .inf-missing-card .miss-download {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .inf-missing-card.clickable:hover .miss-download {
    color: var(--ink);
  }

  .inf-missing-card .miss-pair {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    margin-bottom: 4px;
  }

  .inf-missing-card .miss-count {
    font-family: 'Fraunces', serif;
    font-size: 22px;
    font-weight: 500;
    line-height: 1;
  }

  .inf-missing-card .miss-count em {
    font-style: italic;
    color: var(--gold);
  }

  .inf-missing-card .miss-sub {
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 6px;
  }

  /* Reconciliation sub-sections */
  .recon-subsection {
    margin-bottom: 28px;
  }

  .recon-subsection:last-child { margin-bottom: 0; }

  .recon-sub-title {
    font-family: 'Fraunces', serif;
    font-style: normal;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: -0.005em;
    margin-bottom: 4px;
    color: var(--ink);
  }

  .recon-sub-title em {
    font-style: italic;
    color: var(--accent);
  }

  .recon-sub-desc {
    font-size: 12px;
    color: var(--ink-soft);
    margin-bottom: 12px;
    font-family: 'Fraunces', serif;
    font-style: italic;
  }

  .recon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
  }

  .recon-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 13px 15px;
    transition: all 0.15s;
  }

  .recon-card.clickable {
    cursor: pointer;
  }

  .recon-card.clickable:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
  }

  .recon-card.clickable:active {
    transform: translateY(0);
  }

  .recon-card .r-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    margin-bottom: 6px;
  }

  .recon-card .r-value {
    font-family: 'Fraunces', serif;
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.01em;
  }

  .recon-card .r-value em {
    font-style: italic;
    color: var(--accent);
  }

  .recon-card.good .r-value em { color: var(--green); }
  .recon-card.warn .r-value em { color: var(--gold); }
  .recon-card.alert .r-value em { color: var(--accent); }

  .recon-card .r-sub {
    font-size: 11px;
    color: var(--ink-soft);
    margin-top: 6px;
    line-height: 1.35;
  }

  .recon-card .r-dollar {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--ink);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
  }

  .recon-card .r-download {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
    color: var(--accent);
    text-transform: uppercase;
    opacity: 0;
    margin-top: 8px;
    transition: opacity 0.15s;
  }

  .recon-card.clickable:hover .r-download { opacity: 1; }

  .recon-totals {
    margin-top: 14px;
    padding: 12px 16px;
    background: #fff;
    border-left: 3px solid var(--accent);
    border-radius: 0 3px 3px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
  }

  .recon-totals .rt-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .recon-totals .rt-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
  }

  .recon-totals .rt-value {
    font-family: 'Fraunces', serif;
    font-size: 17px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
  }

  /* Top variance table */
  .recon-variance-table {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 3px;
    overflow: hidden;
  }

  .recon-variance-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    padding: 8px 14px;
    border-bottom: 1px solid #f0ece2;
    font-size: 12px;
    align-items: center;
  }

  .recon-variance-row:last-child { border-bottom: none; }

  .recon-variance-row.head {
    background: #faf7ef;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    font-weight: 500;
  }

  .recon-variance-row .vr-claim {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .recon-variance-row .vr-num {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    text-align: right;
  }

  .recon-variance-row .vr-diff {
    color: var(--accent);
    font-weight: 600;
  }

  .recon-variance-empty {
    padding: 24px;
    text-align: center;
    font-style: italic;
    color: var(--ink-soft);
    font-family: 'Fraunces', serif;
  }

  /* ============ RESULTS MODULE ============ */
  .results-empty {
    background: var(--paper);
    border: 1px dashed var(--line);
    border-radius: 4px;
    padding: 80px 20px;
    text-align: center;
    margin-top: 40px;
  }

  .results-empty h3 {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 400;
    font-size: 26px;
    color: var(--ink-soft);
    margin-bottom: 12px;
  }

  .results-empty p {
    color: var(--ink-soft);
    font-size: 14px;
    margin-bottom: 20px;
  }

  .sheet-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 22px;
    flex-wrap: wrap;
  }

  .sheet-tab {
    font-family: 'Inter Tight', sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 11px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    color: var(--ink-soft);
    transition: all 0.2s;
    position: relative;
    margin-bottom: -1px;
  }

  .sheet-tab:hover { color: var(--ink); }
  .sheet-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

  .sheet-tab .count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--ink-soft);
    margin-left: 6px;
    background: #efeadf;
    padding: 2px 6px;
    border-radius: 2px;
  }

  .sheet-tab.active .count { background: var(--accent-soft); color: var(--accent); }

  .sheet-tab .filter-dot {
    display: none;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--gold);
    margin-left: 4px;
    vertical-align: middle;
  }

  .sheet-tab.has-filters .filter-dot { display: inline-block; }

  .sheet-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 18px;
    gap: 20px;
    flex-wrap: wrap;
  }

  .sheet-title {
    font-family: 'Fraunces', serif;
    font-size: 24px;
    font-weight: 400;
    letter-spacing: -0.015em;
  }

  .sheet-title em { font-style: italic; color: var(--accent); }

  .sheet-stats {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--ink-soft);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 5px;
  }

  .sheet-stats span { margin-right: 18px; }
  .sheet-stats strong { color: var(--ink); font-weight: 600; }
  .sheet-stats .filtered-badge { color: var(--gold); font-weight: 600; }

  .filter-bar {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 12px 16px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }

  .filter-bar-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-soft);
    flex-shrink: 0;
  }

  .filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid var(--gold);
    border-radius: 20px;
    padding: 5px 6px 5px 12px;
    font-size: 12px;
    color: var(--ink);
    font-weight: 500;
  }

  .filter-chip .chip-col {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-right: 2px;
  }

  .filter-chip .chip-vals {
    font-style: italic;
    font-family: 'Fraunces', serif;
    font-size: 13px;
  }

  .filter-chip .chip-close {
    background: var(--accent-soft);
    color: var(--accent);
    border: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-left: 4px;
  }

  .filter-chip .chip-close:hover { background: var(--accent); color: #fff; }

  .filter-bar-empty {
    color: var(--ink-soft);
    font-size: 13px;
    font-style: italic;
    font-family: 'Fraunces', serif;
  }

  .filter-bar .clear-all {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--accent);
    font-family: 'Inter Tight', sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .filter-bar .clear-all:hover { text-decoration: underline; }

  .table-wrapper {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: auto;
    max-height: 560px;
    box-shadow: var(--shadow);
  }

  table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
  }

  thead {
    position: sticky;
    top: 0;
    background: #efeadf;
    z-index: 2;
  }

  th {
    text-align: left;
    padding: 10px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    white-space: nowrap;
    font-weight: 500;
  }

  th:last-child { border-right: none; }

  th.source-col { background: var(--accent-soft); color: var(--accent); }

  th .th-inner { display: flex; align-items: center; gap: 6px; }

  th .filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 2px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--ink-soft);
    font-size: 10px;
    padding: 0;
    transition: all 0.15s;
  }

  th .filter-btn:hover {
    background: #fff;
    border-color: var(--line);
    color: var(--ink);
  }

  th .filter-btn.active {
    background: var(--gold);
    color: #fff;
    border-color: var(--gold);
  }

  td {
    padding: 8px 14px;
    border-bottom: 1px solid #ece7dc;
    border-right: 1px solid #ece7dc;
    white-space: nowrap;
    color: var(--ink);
  }

  td:last-child { border-right: none; }
  tr:hover td { background: #fff; }

  td.source-col {
    background: #f7f0ec;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    font-weight: 500;
    border-right: 1px solid var(--line);
  }

  tr:hover td.source-col { background: var(--accent-soft); }

  .table-footer {
    padding: 10px 20px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-top: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--ink-soft);
    text-align: center;
    border-radius: 0 0 4px 4px;
  }

  /* ============ FILTER POPOVER ============ */
  .filter-popover {
    position: fixed;
    background: var(--paper);
    border: 1px solid var(--ink);
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 14px;
    width: 280px;
    max-height: 420px;
    display: none;
    flex-direction: column;
    z-index: 1000;
    font-size: 13px;
  }

  .filter-popover-title {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 10px;
    color: var(--ink);
  }

  .filter-popover-title em { font-style: italic; color: var(--accent); }

  .filter-search {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 2px;
    font-family: 'Inter Tight', sans-serif;
    font-size: 12px;
    margin-bottom: 8px;
    background: #fff;
  }

  .filter-search:focus { outline: none; border-color: var(--accent); }

  .filter-mode {
    display: flex;
    gap: 2px;
    margin-bottom: 10px;
    background: #efeadf;
    border-radius: 3px;
    padding: 2px;
  }

  .filter-mode-btn {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: transparent;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: var(--ink-soft);
    border-radius: 2px;
    transition: all 0.15s;
  }

  .filter-mode-btn.active {
    background: var(--ink);
    color: var(--paper);
  }

  .filter-values {
    overflow-y: auto;
    flex: 1;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: #fff;
    margin-bottom: 10px;
    max-height: 220px;
  }

  .filter-value-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid #f0ece2;
    cursor: pointer;
    font-size: 12px;
    user-select: none;
  }

  .filter-value-row:hover { background: #faf7ef; }
  .filter-value-row:last-child { border-bottom: none; }

  .filter-value-row input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
  }

  .filter-value-row .val-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .filter-value-row .val-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--ink-soft);
    flex-shrink: 0;
  }

  .filter-value-row.empty-val .val-text {
    font-style: italic;
    color: var(--ink-soft);
  }

  .filter-value-row.select-all-row {
    font-weight: 600;
    background: #faf7ef;
    border-bottom: 1px solid var(--line);
  }

  .filter-text-panel { display: none; margin-bottom: 10px; }
  .filter-text-panel.active { display: block; }
  .filter-values-panel.hidden { display: none; }

  .filter-text-panel input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 2px;
    font-family: 'Inter Tight', sans-serif;
    font-size: 12px;
    background: #fff;
  }

  .filter-text-panel input:focus { outline: none; border-color: var(--accent); }

  .filter-text-panel select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 2px;
    font-family: 'Inter Tight', sans-serif;
    font-size: 12px;
    background: #fff;
    margin-bottom: 6px;
    cursor: pointer;
  }

  .filter-actions {
    display: flex;
    gap: 6px;
    justify-content: space-between;
  }

  .filter-actions-left { display: flex; gap: 6px; }

  .fpbtn {
    font-family: 'Inter Tight', sans-serif;
    font-size: 11px;
    padding: 6px 12px;
    border-radius: 2px;
    cursor: pointer;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  .fpbtn:hover { border-color: var(--ink); }
  .fpbtn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
  .fpbtn.primary:hover { background: #a8341f; }
  .fpbtn.danger { color: var(--accent); }
  .fpbtn.danger:hover { background: var(--accent-soft); }

  /* ============ TOASTS ============ */
  .toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .toast {
    background: var(--ink);
    color: var(--paper);
    padding: 12px 18px;
    border-radius: 3px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
    max-width: 340px;
    border-left: 3px solid var(--accent);
  }

  .toast.success { border-left-color: var(--green); }
  .toast.error { border-left-color: var(--accent); }

  @keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
  }

  .loader {
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: -2px;
  }

  @keyframes spin { to { transform: rotate(360deg); } }

  /* ============ MODAL ============ */
  .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(26, 24, 20, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    animation: fadeIn 0.2s ease;
  }

  .modal-backdrop.active { display: flex; }

  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .modal {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    width: 480px;
    max-width: calc(100vw - 40px);
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  }

  .modal h2 {
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 24px;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
  }

  .modal h2 em { font-style: italic; color: var(--accent); }

  .modal p {
    color: var(--ink-soft);
    font-size: 14px;
    margin-bottom: 20px;
  }

  .modal-filter-summary {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 3px solid var(--gold);
    padding: 12px 14px;
    margin-bottom: 20px;
    font-size: 12px;
    color: var(--ink);
    border-radius: 0 3px 3px 0;
    max-height: 160px;
    overflow-y: auto;
  }

  .modal-filter-summary .f-row {
    padding: 6px 0;
    border-bottom: 1px dashed #f0ece2;
    line-height: 1.6;
  }

  .modal-filter-summary .f-row:last-child { border-bottom: none; }

  .modal-filter-summary .f-col {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 4px;
  }

  .modal-filter-summary .f-val {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 13px;
    margin-right: 8px;
  }

  .modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .modal-actions .fpbtn { padding: 9px 16px; font-size: 12px; }

  /* Column summary row inside export modal */
  .modal-column-summary {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 3px solid var(--green);
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 12px;
    color: var(--ink);
    border-radius: 0 3px 3px 0;
  }

  .modal-column-summary .f-row { line-height: 1.5; }

  .modal-column-summary .f-col {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 6px;
  }

  .modal-column-summary .f-val {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 13px;
  }

  .modal-column-summary.has-exclusions {
    border-left-color: var(--gold);
  }

  .modal-column-summary.has-exclusions .f-col { color: var(--gold); }

  /* Column picker modal */
  .column-picker-modal {
    width: 560px;
    max-width: calc(100vw - 40px);
  }

  .column-picker-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    align-items: center;
  }

  .column-picker-body {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #fff;
    margin-bottom: 20px;
  }

  .cp-sheet-section {
    border-bottom: 1px solid var(--line);
  }

  .cp-sheet-section:last-child { border-bottom: none; }

  .cp-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #faf7ef;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .cp-sheet-header .cp-sheet-name {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 15px;
    font-weight: 500;
    color: var(--ink);
  }

  .cp-sheet-header .cp-sheet-name em {
    font-style: normal;
    color: var(--accent);
    font-weight: 600;
  }

  .cp-sheet-header .cp-sheet-count {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--ink-soft);
    letter-spacing: 0.05em;
  }

  .cp-sheet-actions {
    display: flex;
    gap: 4px;
  }

  .cp-sheet-actions button {
    font-family: 'Inter Tight', sans-serif;
    font-size: 10px;
    font-weight: 500;
    background: transparent;
    border: 1px solid var(--line);
    padding: 2px 8px;
    border-radius: 2px;
    cursor: pointer;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .cp-sheet-actions button:hover {
    color: var(--ink);
    border-color: var(--ink);
  }

  .cp-col-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    border-bottom: 1px solid #f0ece2;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
    transition: background 0.1s;
  }

  .cp-col-row:hover { background: #faf7ef; }
  .cp-col-row:last-child { border-bottom: none; }

  .cp-col-row input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }

  .cp-col-row .cp-col-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cp-col-row.required .cp-col-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 2px 6px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
  }

  .cp-col-row.hidden-by-search { display: none; }

  .cp-sheet-empty {
    padding: 14px;
    text-align: center;
    font-size: 12px;
    color: var(--ink-soft);
    font-style: italic;
    font-family: 'Fraunces', serif;
  }

  input[type="file"] { display: none; }

  /* Mobile */
}

/* ---------------------------------------------------------------------------
 * Scrub-specific tweaks to sit inside MARTAR's <section class="view">
 * instead of the merger's original <main class="main"> layout.
 * ------------------------------------------------------------------------- */
.scrub-scope {
  padding: 28px 40px 60px;
  background-image:
    radial-gradient(circle at 15% 10%, rgba(1, 104, 112, 0.035), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(150, 65, 24, 0.04), transparent 45%);
}
[data-theme="dark"] .scrub-scope {
  background-image:
    radial-gradient(circle at 15% 10%, rgba(79, 152, 163, 0.06), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(210, 130, 80, 0.05), transparent 45%);
}

/* MARTAR flips views in/out via .view.active — since each scrub sub-view is
 * its own MARTAR view (view-scrub-upload, view-scrub-results, etc.), the
 * merger's own .module display:none is redundant. Force .module always-on
 * inside the scoped wrapper so one module renders per MARTAR view. */
.scrub-scope .module { display: block !important; animation: none !important; }

/* Module sub-title flourish used Fraunces italic — now plain Inter italic. */
.scrub-scope .module-title { font-family: var(--font); font-weight: 600; }
.scrub-scope .module-title em,
.scrub-scope .upload-card h3 em,
.scrub-scope .sheet-title em,
.scrub-scope .inf-section-title em { font-style: italic; color: var(--primary); }

@media (max-width: 900px) {
  .scrub-scope { padding: 22px 18px 40px; }
}

/* ================= MONGO PUSH UI ================= */
.scrub-scope .mongo-overwrite-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  user-select: none;
  cursor: pointer;
}
.scrub-scope .mongo-overwrite-label input { margin: 0; cursor: pointer; }

.scrub-scope .mongo-stats-widget {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}
.scrub-scope .mongo-stats-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.scrub-scope .mongo-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.scrub-scope .mongo-stat-card {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
}
.scrub-scope .mongo-stat-card .stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.scrub-scope .mongo-stat-card .stat-value {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.1;
}
.scrub-scope .mongo-stat-card .stat-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-soft);
  margin-top: 3px;
}

.mongo-preview-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}
.mongo-preview-table th,
.mongo-preview-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.mongo-preview-table th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 600;
}
.mongo-preview-table td { font-family: 'JetBrains Mono', monospace; }
.mongo-preview-table td strong { font-family: 'Fraunces', serif; font-size: 16px; }

/* ===== Push-plan modal: per-file metadata table ===== */
/* Big-screen layout so users can comfortably edit per-file metadata for
   many files at once. Fills ~95% of the viewport with the table area
   stretching to take all leftover vertical space. */
.modal-push-plan {
  width: 95vw !important;
  max-width: 1400px;
  max-height: 92vh;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-push-plan h2 { margin-bottom: 4px; }
.modal-push-plan > p { margin-bottom: 8px; }
.modal-push-plan > .push-plan-section { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.modal-push-plan > .push-plan-section .push-plan-table-wrap { flex: 1 1 auto; min-height: 0; max-height: none; }
/* When both sections are visible, give them a roughly even split. */
.modal-push-plan > .push-plan-section + .push-plan-section { margin-top: 12px; }
.push-plan-section { margin: 14px 0 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.push-plan-section.warn { border-color: #c46a3a; background: #fff7f0; }
.push-plan-section.ok   { border-color: var(--line); background: #fbfbf8; }
.push-plan-section-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-family: 'Fraunces', serif; font-size: 14px;
  border-bottom: 1px solid inherit;
}
.push-plan-section.warn .push-plan-section-head { background: #f7e6d6; color: #7a3a17; }
.push-plan-section.ok   .push-plan-section-head { background: #f1efe6; color: var(--ink); }
.push-plan-pin { font-size: 14px; line-height: 1; }
.push-plan-title { font-style: italic; font-weight: 500; }
.push-plan-title em { font-style: normal; color: var(--accent); }
.push-plan-sub { margin-left: auto; color: var(--ink-soft); font-family: 'JetBrains Mono', monospace; font-size: 11px; }

.push-plan-table-wrap { max-height: 280px; overflow: auto; }
.push-plan-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.push-plan-table th {
  position: sticky; top: 0; background: #f7f5ee;
  text-align: left; padding: 6px 8px; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft);
  font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.push-plan-table td { padding: 4px 6px; border-bottom: 1px solid #ece8db; vertical-align: middle; }
.push-plan-table tr:last-child td { border-bottom: none; }
.push-plan-table .col-file     { width: 32%; }
.push-plan-table .col-client   { width: 16%; }
.push-plan-table .col-facility { width: 22%; }
.push-plan-table .col-month    { width: 10%; }
.push-plan-table .col-year     { width: 10%; }
.push-plan-table .col-stages   { width: 6%;  text-align: center; }
.push-plan-table .col-rows     { width: 4%;  text-align: right; }

.push-plan-table td.file-cell {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--ink); overflow: hidden;
}
.push-plan-table .file-name {
  display: block; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.push-plan-table input[type="text"],
.push-plan-table select {
  width: 100%; box-sizing: border-box;
  padding: 4px 6px; border: 1px solid var(--line); border-radius: 3px;
  background: #fff; color: var(--ink); font-size: 12px; font-family: inherit;
}
.push-plan-table input[type="text"]:focus,
.push-plan-table select:focus { outline: none; border-color: var(--accent); }
.push-plan-table input.invalid,
.push-plan-table select.invalid { border-color: #c46a3a; background: #fff5ee; }

/* Push/export progress bar (file-level) */
.export-progress-bar {
  width: 100%; height: 8px;
  background: #ece8db; border-radius: 999px; overflow: hidden;
  margin-top: 4px;
}
.export-progress-bar-fill {
  height: 100%; width: 0%;
  background: var(--accent);
  transition: width 0.18s ease;
}
[data-theme="dark"] .export-progress-bar { background: #2a2720; }

.push-plan-table .cell-facility-hint {
  display: block; margin-top: 2px;
  font-size: 10px; color: #a0522d;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
[data-theme="dark"] .push-plan-table .cell-facility-hint { color: #d18b5b; }
.push-plan-table .stages-chip {
  display: inline-block; padding: 1px 6px; border-radius: 999px;
  background: #ece8db; color: var(--ink-soft);
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.04em;
}
.push-plan-table .row-count {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--ink-soft);
}

.push-plan-empty { padding: 24px; text-align: center; color: var(--ink-soft); }

.push-plan-actions-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--line);
}
.push-plan-overwrite { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 13px; }

[data-theme="dark"] .push-plan-section.warn { background: #2c1d10; border-color: #b07242; }
[data-theme="dark"] .push-plan-section.warn .push-plan-section-head { background: #3a2618; color: #ecb88b; }
[data-theme="dark"] .push-plan-section.ok   { background: #1f1d18; }
[data-theme="dark"] .push-plan-section.ok   .push-plan-section-head { background: #2a2720; }
[data-theme="dark"] .push-plan-table th { background: #26241d; }
[data-theme="dark"] .push-plan-table td { border-bottom-color: #2c2a23; }
[data-theme="dark"] .push-plan-table input[type="text"],
[data-theme="dark"] .push-plan-table select { background: #1d1c17; color: var(--ink); border-color: #3a382f; }
[data-theme="dark"] .push-plan-table .stages-chip { background: #2a2720; color: var(--ink-soft); }
