/* ============================================================================
   CSV Splitter Online — style.css
   Single source of truth for ALL visual design.
   Edit this file to change colors, spacing, typography across every page.
   ============================================================================ */

/* ─── THEME TOKENS ────────────────────────────────────────────────────────── */
/* Light is default.  Dark is applied via :root[data-theme="dark"] set BEFORE
   paint by theme.js — this is what prevents the flash of wrong theme.       */

:root {
  /* Surfaces — white-and-green family (was warm beige). Dark mode untouched. */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f8f5;
  --surface-3: #e8f0ea;

  /* Borders — green-neutral tints, NOT grey/beige */
  --border: #e4ece6;
  --border-2: #c9d6cd;

  /* Text */
  --text: #1a1917;
  --text-2: #6b6860;
  --text-3: #9e9b94;

  /* Primary accent — keep this single hue as the brand */
  --accent: #1a6b4a;
  --accent-bg: #eaf3ed;
  --accent-text: #145c3e;

  /* Secondary accents (used sparingly — badges, categories) */
  --blue: #1a4d8f;        --blue-bg: #e8f0fb;       --blue-text: #163f76;
  --purple: #6b3fa0;      --purple-bg: #f0eaf8;     --purple-text: #5a2e8f;
  --orange: #c45c00;      --orange-bg: #fff3e8;     --orange-text: #9e4800;
  --danger: #b32a2a;      --danger-bg: #fdeaea;

  /* Layout primitives */
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,.09);

  /* Type */
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --bg: #18181a;
  --surface: #242426;
  --surface-2: #2e2e31;
  --surface-3: #38383c;
  --border: #38383c;
  --border-2: #4a4a50;
  --text: #f0efe9;
  --text-2: #9e9b94;
  --text-3: #6b6860;
  --accent: #3db878;
  --accent-bg: #1a2e22;
  --accent-text: #5dd49a;
  --blue: #5a9af0;        --blue-bg: #142038;       --blue-text: #7ab0f5;
  --purple: #a07ed4;      --purple-bg: #1e1430;     --purple-text: #c0a0e8;
  --orange: #f09050;      --orange-bg: #2e1800;     --orange-text: #f0b070;
  --danger: #e06060;      --danger-bg: #2e1818;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
}

/* ─── RESET / BASE ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .2s, color .2s;
}
img, svg { max-width: 100%; display: block; }
button { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Focus rings — visible for keyboard users, invisible for mouse */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip-to-content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  z-index: 1000;
}
.skip-link:focus { top: 0; }

/* ─── LAYOUT ──────────────────────────────────────────────────────────────── */
.page-wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
.page-wrap--narrow { max-width: 720px; }
.page-wrap--wide { max-width: 1200px; }

/* ─── NAVIGATION ──────────────────────────────────────────────────────────── */
nav.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: saturate(180%) blur(8px);
}
.nav-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 0;
}
.nav-logo {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -.015em;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-logo:hover { text-decoration: none; color: var(--text); }
.nav-logo-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: .02em;
}

/* V3: nav-center is an empty spacer that pushes nav-right to the far right. */
.nav-center {
  flex: 1;
}

/* V3: nav-right holds Home | Tools | Blog | theme | hamburger */
.nav-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  padding: 7px 12px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav-link:hover, .nav-link.active {
  color: var(--accent);
  background: var(--accent-bg);
  text-decoration: none;
}

/* Tools dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}
.nav-dropdown-toggle:hover,
.nav-dropdown.open .nav-dropdown-toggle,
.nav-dropdown-toggle[aria-expanded="true"],
.nav-dropdown-toggle.active {
  color: var(--accent);
  background: var(--accent-bg);
}
.nav-dropdown-toggle .caret {
  width: 10px;
  height: 10px;
  transition: transform .18s;
}
.nav-dropdown.open .nav-dropdown-toggle .caret,
.nav-dropdown-toggle[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;          /* V3: anchor dropdown to right edge since nav is right-aligned */
  left: auto;
  transform: none;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 201;
}
.nav-dropdown.open .nav-dropdown-menu { display: flex; }
.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-2);
  border-radius: 7px;
  white-space: nowrap;
  font-weight: 500;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
  background: var(--accent-bg);
  color: var(--accent);
  text-decoration: none;
}
.nav-dropdown-menu .menu-icon {
  width: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, color .15s;
  flex-shrink: 0;
  margin-left: 4px;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 14px; height: 14px; }

/* Mobile hamburger (hidden on desktop) */
.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 4px;
}
.nav-hamburger:hover { border-color: var(--accent); color: var(--accent); }
.nav-hamburger svg { width: 16px; height: 16px; }

/* Mobile: at ≤720px, collapse Home / Tools / Blog into a drawer triggered by hamburger */
@media (max-width: 720px) {
  .nav-inner { padding: 0 16px; }
  .nav-logo-badge { display: none; }
  .nav-link, .nav-dropdown { display: none; }
  .nav-hamburger { display: inline-flex; }

  /* When the mobile drawer is open, nav-right becomes a vertical drawer */
  .nav-right.mobile-open {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px 16px 14px;
    box-shadow: var(--shadow-md);
  }
  .nav-right.mobile-open .nav-link {
    display: block;
    padding: 11px 14px;
    font-size: 14px;
    border-radius: 8px;
  }
  .nav-right.mobile-open .nav-dropdown {
    display: block;
  }
  .nav-right.mobile-open .nav-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 11px 14px;
    font-size: 14px;
    border-radius: 8px;
  }
  .nav-right.mobile-open .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: 0;
    border-top: 1px solid var(--border);
    border-radius: 0;
    padding: 4px 0 4px 16px;
    margin-top: 4px;
  }
  .nav-right.mobile-open .nav-dropdown-menu a {
    padding: 9px 12px;
    font-size: 13px;
  }
  .nav-right.mobile-open .theme-toggle { align-self: flex-start; margin: 6px 0 0; }
}

/* ─── HERO (V3 — center aligned, product-first) ───────────────────────────── */
.hero {
  padding: 48px 0 24px;
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
}
.hero-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 14px;
}
.hero-breadcrumb a, .hero-breadcrumb a:hover {
  color: var(--text-3);
  text-decoration: none;
}
.hero-breadcrumb .sep { color: var(--border-2); }
.hero-breadcrumb .current { color: var(--text); }
.hero-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-text);
  background: var(--accent-bg);
  padding: 5px 12px;
  border-radius: 99px;
  margin-bottom: 14px;
  letter-spacing: .01em;
}
.hero h1 {
  font-size: clamp(28px, 4.6vw, 40px);
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.15;
  margin: 0 auto 12px;
  color: var(--text);
  max-width: 720px;
}
.hero h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
  position: relative;
}
.hero-sub {
  font-size: 15px;
  color: var(--text-2);
  max-width: 620px;
  margin: 0 auto 16px;
  line-height: 1.55;
}
.trust-pills {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
  margin: 0 auto;
}
.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
}
.trust-pill .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.hero-counter-wrap {
  text-align: center;
  margin-top: 18px;
}

/* Mobile hero */
@media (max-width: 640px) {
  .hero { padding: 24px 0 16px; }
  .hero h1 { font-size: clamp(22px, 7vw, 28px); }
  .hero-sub { font-size: 14px; }
  .trust-pills { gap: 12px; }
}

/* ─── MAIN TOOL CARD (V3 — 2-col grid with symmetric side panel) ─────────── */
.main-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  margin: 20px 0 36px;
}

/* V3: the tool "shell" — 2-column layout.
   Default/empty state: align-items: stretch → both columns match the drop-zone
     min-height (280px), and the two side-panel cards divide that height 50/50.
   File-loaded state: .tool-shell gets .has-file → side panel becomes align-self:
     start so it doesn't stretch to match a tall post-load left column. */
.tool-shell {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 4px;
  align-items: stretch;
}
.tool-shell.has-file {
  align-items: start;
}
.tool-shell.has-file .tool-side {
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
@media (max-width: 720px) {
  .tool-shell {
    grid-template-columns: 1fr;
  }
  .tool-shell.has-file .tool-side {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

/* Left column — contains the drop zone AND the expanded tool UI (tool-specific).
   min-width: 0 prevents content from overflowing the grid column. */
.tool-content {
  min-width: 0;
  padding: 8px 4px 8px 8px;
}
@media (max-width: 720px) {
  .tool-content { padding: 4px; }
}

/* Side panel cards stack and fill the height of the drop zone in default state.
   When the tool is loaded (left column grows), panel stretches along — users
   are focused on results below anyway, so asymmetry doesn't matter then. */
.tool-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 8px 8px 4px;
}
@media (max-width: 720px) {
  .tool-side { padding: 0 4px 4px; }
}
.tool-side-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px;
  flex: 1;  /* symmetric fill */
  min-height: 0;
}
.tool-side-card.accent {
  background: var(--accent-bg);
  border-color: transparent;
  color: var(--accent-text);
  flex: 0 0 auto;
  min-height: 78px;
}
.tool-side-card.accent .side-title { color: var(--accent); }
.tool-side-card .side-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tool-side-card .side-title svg { width: 11px; height: 11px; }
.tool-side-card .side-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: var(--text);
}
.tool-side-card .side-list > div {
  display: flex;
  align-items: center;
  gap: 7px;
}
.tool-side-card .side-list .tick { color: var(--accent); font-weight: 600; }
.tool-side-card .side-body {
  font-size: 11px;
  color: var(--accent-text);
  line-height: 1.55;
}

/* V3 section label — mono caps used for "Other tools", "FAQ · 10 questions", etc. */
.section-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 36px 0 14px;
}

.tool-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin: 0 0 14px;
  padding: 0;
  scrollbar-width: none;
}
.tool-tabs::-webkit-scrollbar { display: none; }
.tool-tab {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}
.tool-tab:hover { color: var(--text); text-decoration: none; }
.tool-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Drop zone — inner dashed panel of the tool shell */
.drop-zone {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
  background: var(--bg);
  margin: 4px 4px 4px 8px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
@media (max-width: 720px) {
  .drop-zone { margin: 4px; min-height: 240px; }
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.drop-zone input[type="file"] { display: none; }
.dz-icon svg {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  fill: none;
  stroke: var(--text-3);
  stroke-width: 1.5;
}
.drop-zone.drag-over .dz-icon svg { stroke: var(--accent); }
.drop-zone h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.dz-formats {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 10px 0 14px;
}
.dz-fmt {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: .04em;
}
.dz-fmt-csv { background: var(--accent-bg); color: var(--accent-text); }
.dz-fmt-tsv { background: var(--blue-bg); color: var(--blue-text); }
.dz-fmt-xlsx { background: var(--purple-bg); color: var(--purple-text); }

.browse-btn, .demo-btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  margin: 6px 4px;
  min-width: 140px;
  transition: border-color .15s, color .15s, background .15s, transform .08s;
}
.browse-btn { margin-top: 4px; }
.demo-btn   { margin-bottom: 4px; }
.browse-btn:active, .demo-btn:active { transform: translateY(1px); }
.browse-btn:hover, .demo-btn:hover { border-color: var(--accent); color: var(--accent); }
.browse-btn { background: var(--accent); color: #fff; border-color: var(--accent); }
.browse-btn:hover { background: var(--accent-text); color: #fff; border-color: var(--accent-text); }

.privacy-note {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.privacy-note svg { width: 12px; height: 12px; stroke: var(--text-3); fill: none; stroke-width: 2; }

.dz-spinner {
  display: none;
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── INFO BAR (file metadata) ────────────────────────────────────────────── */
.info-bar {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px 16px;
  gap: 24px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.info-cell { flex: 1; min-width: 100px; }
.info-cell .label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}
.info-cell .value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  font-family: var(--mono);
}

/* Section header */
.section-hdr {
  margin: 22px 0 10px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.section-hdr h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}

/* Mode tabs (sub-tabs within a tool) */
.mode-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow-x: auto;
}
.mode-tab {
  flex: 1;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: none;
  padding: 8px 10px;
  border-radius: calc(var(--radius) - 3px);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Preset buttons */
.presets-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}
.preset-btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.preset-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Form controls */
.form-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.form-field { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 6px; }
.form-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.form-field input[type="text"],
.form-field input[type="number"],
.form-field select,
input.cso-input, select.cso-select {
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 11px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  transition: border-color .15s;
  width: 100%;
}
input.cso-input:focus, select.cso-select:focus,
.form-field input:focus, .form-field select:focus {
  border-color: var(--accent);
}

/* Output format toggle group */
.out-fmt-row {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: var(--radius);
}
.out-fmt-btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  background: transparent;
  color: var(--text-2);
  border: none;
  border-radius: calc(var(--radius) - 3px);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.out-fmt-btn:hover { color: var(--text); }
.out-fmt-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Column-toggle chips */
.col-toggles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.col-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: border-color .15s;
}
.col-toggle.checked { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-text); }
.col-toggle input { margin: 0; accent-color: var(--accent); }

/* Preview table */
.preview-wrap {
  overflow-x: auto;
  max-height: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: var(--mono);
}
.preview-table thead th {
  background: var(--surface-2);
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
.preview-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-table tbody tr:last-child td { border-bottom: none; }

/* Primary / secondary buttons */
.primary-btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, transform .05s;
  width: 100%;
  margin-top: 16px;
}
.primary-btn:hover { background: var(--accent-text); text-decoration: none; }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  background: var(--text-3);
}

.secondary-btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  cursor: pointer;
}
.secondary-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Result items */
.result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  gap: 14px;
}
.result-info { flex: 1; min-width: 0; overflow: hidden; }
.result-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.dl-btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
}
.dl-btn:hover { background: var(--accent-text); }
.dl-all-btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 11px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
  margin-top: 6px;
}

/* Progress bar */
.progress {
  height: 6px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin: 10px 0;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width .2s ease-out;
  width: 0%;
}
.progress-label {
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
  font-family: var(--mono);
}

/* Error text */
.err-text {
  font-size: 12px;
  color: var(--danger);
  margin-top: 8px;
  min-height: 1em;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: transform .25s, opacity .25s;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }

/* ─── FILETYPE BADGE ──────────────────────────────────────────────────────── */
.filetype-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.filetype-badge.csv { background: var(--accent-bg); color: var(--accent-text); }
.filetype-badge.tsv { background: var(--blue-bg); color: var(--blue-text); }
.filetype-badge.xlsx { background: var(--purple-bg); color: var(--purple-text); }

/* ─── TOOL GRID (V3 — compact 4-col cards) ────────────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0 40px;
}
@media (max-width: 720px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
}
.tool-card {
  display: block;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
  color: var(--text);
  position: relative;
}
.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.tool-card .card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.tool-card .icon {
  width: 22px;
  height: 22px;
  background: var(--accent-bg);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
  margin-bottom: 0;
}
.tool-card .icon.mono { font-family: var(--mono); font-size: 10px; }
.tool-card h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin: 0;
  letter-spacing: -.005em;
}
.tool-card p {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0;
}

/* ─── COMMAND SEARCH (homepage) ───────────────────────────────────────────── */
.cso-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  max-width: 520px;
  margin: 24px auto 0;
  transition: border-color .15s, box-shadow .15s;
}
.cso-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.cso-search .cso-search-icon { color: var(--text-3); flex-shrink: 0; }
.cso-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  min-width: 0;
}
.cso-search input::placeholder { color: var(--text-3); }
.cso-search-kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--text-2);
}
.cso-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.08);
  padding: 6px;
  z-index: 30;
  max-height: 320px;
  overflow-y: auto;
}
.cso-search-results a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
}
.cso-search-results a:hover,
.cso-search-results a.active {
  background: var(--accent-bg);
  color: var(--accent-text);
  text-decoration: none;
}
.cso-search-results .sr-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 5px;
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
}
.cso-search-results .sr-label { font-weight: 500; }
.cso-search-results .sr-hint { color: var(--text-3); font-size: 11px; margin-left: auto; }
.cso-search-results .sr-empty {
  padding: 14px 10px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
}

/* ─── USE-CASE CARDS (homepage) ───────────────────────────────────────────── */
.usecase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-bottom: 32px;
}
.usecase-card {
  display: block;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.usecase-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}
.usecase-card h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}
.usecase-card p { font-size: 11px; color: var(--text-2); line-height: 1.55; }
.tool-card.is-current {
  background: var(--accent-bg);
  border-color: var(--accent);
  cursor: default;
}
.tool-card.is-current:hover { transform: none; }
.tool-card.is-current .icon { background: var(--accent); color: #fff; }
.tool-card.is-current::after {
  content: 'You are here';
  position: absolute;
  top: 6px;
  right: 6px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent);
  padding: 1px 6px;
  border-radius: 99px;
  letter-spacing: .02em;
}

/* ─── FEATURE GRID ────────────────────────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin: 24px 0 48px;
}
.feature-item h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: -.01em;
}
.feature-item p { font-size: 13px; color: var(--text-2); line-height: 1.65; }

/* ─── FAQ ─────────────────────────────────────────────────────────────────── */
.faq-section {
  max-width: 720px;
  margin: 56px auto;
  padding: 0 4px;
}
.faq-section > h2 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  letter-spacing: -.02em;
  margin-bottom: 28px;
  color: var(--text);
}
.faq {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.faq-q {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  list-style: none;
  line-height: 1.5;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::after {
  content: '';
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform .2s;
  flex-shrink: 0;
}
.faq[open] .faq-q::after { transform: rotate(-135deg); }
.faq-a {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
  padding-top: 12px;
}
.faq-a p + p { margin-top: 10px; }

/* ─── FOOTER ──────────────────────────────────────────────────────────────── */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 20px 24px;
  margin-top: 60px;
  background: var(--surface);
  text-align: center;
}
.footer-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 13px;
  max-width: 980px;
  margin: 0 auto;
}
.footer-nav a { color: var(--text-2); font-weight: 500; transition: color .15s; }
.footer-nav a:hover { color: var(--accent); text-decoration: none; }
.footer-legal {
  margin: 16px auto 0;
  max-width: 980px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}
@media (max-width: 560px) {
  .footer-nav { gap: 14px 18px; font-size: 12px; }
}

/* ─── AD SLOTS ────────────────────────────────────────────────────────────── */
/* Slots are INVISIBLE (display:none) until ads.js flips `.is-active` on them
   after a valid AdSense publisher ID is configured.  This keeps the page
   gap-free pre-activation.  When activated, layout space is reserved BEFORE
   the ad renders to prevent CLS.                                            */
.ad-slot {
  display: none;
  margin: 0;
  text-align: center;
  max-width: 980px;
  overflow: hidden;
}
.ad-slot.is-active {
  display: block;
  margin: 24px auto;
  min-height: 90px;   /* leaderboard default — reserved to prevent CLS */
}
.ad-slot.is-active.ad-inline { min-height: 250px; }
.ad-slot.is-active.ad-sidebar { min-height: 600px; max-width: 300px; }
.ad-slot ins.adsbygoogle {
  display: block;
}
/* Label required by AdSense when ads are placed adjacent to navigation */
.ad-label {
  display: block;
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}

/* ─── LIVE COUNTER PILL (hero — V3 left-aligned) ──────────────────────────── */
.cso-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 7px 13px 7px 11px;
  font-size: 11px;
  color: var(--text-2);
  line-height: 1;
}
.cso-counter .cnt-dot {
  position: relative;
  width: 8px;
  height: 8px;
  display: inline-block;
}
.cso-counter .cnt-dot::before,
.cso-counter .cnt-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--accent);
}
.cso-counter .cnt-dot::after {
  animation: cso-pulse 2.2s ease-out infinite;
  opacity: 0.55;
}
@keyframes cso-pulse {
  0%   { transform: scale(1);   opacity: 0.55; }
  70%  { transform: scale(2.6); opacity: 0;    }
  100% { transform: scale(2.6); opacity: 0;    }
}
.cso-counter .cnt-value {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  min-width: 3ch;
  display: inline-block;
  transition: color .2s;
}
.cso-counter .cnt-value.cnt-tick {
  animation: cso-tick 0.45s ease-out;
}
@keyframes cso-tick {
  0%   { transform: translateY(6px); opacity: 0; }
  100% { transform: translateY(0);   opacity: 1; }
}
/* Loading state — shown until the real number arrives from Cloudflare Worker */
.cso-counter .cnt-value.cnt-loading {
  color: var(--text-3);
  opacity: 0.6;
  animation: cso-loading-pulse 1.2s ease-in-out infinite;
}
@keyframes cso-loading-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.85; }
}
.cso-counter .cnt-suffix { color: var(--text-3); font-size: 11px; }

/* ─── FOOTER KEYBOARD-SHORTCUTS HINT ──────────────────────────────────────── */
.footer-shortcuts {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.footer-shortcuts kbd {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--text-2);
}

/* ─── COOKIE-CONSENT BANNER ───────────────────────────────────────────────── */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 520px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 18px 22px;
  z-index: 400;
  display: none;
  animation: slideUp .3s ease-out;
}
.cookie-banner.show { display: block; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.cookie-banner h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.cookie-banner p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 14px;
}
.cookie-banner p a { color: var(--accent); }
.cookie-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cookie-actions button {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, background .15s, color .15s;
}
.cookie-actions button:hover { border-color: var(--accent); color: var(--accent); }
.cookie-actions button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.cookie-actions button.primary:hover { background: var(--accent-text); border-color: var(--accent-text); color: #fff; }

/* ─── POLICY / TEXT PAGES (privacy, about, contact, terms) ────────────────── */
.policy-hero {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.policy-hero h1 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.2;
  margin-bottom: 8px;
}
.policy-hero .updated { font-size: 13px; color: var(--text-3); }

.policy-body { padding-bottom: 60px; }
.policy-body h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 32px 0 10px;
  color: var(--text);
  letter-spacing: -.015em;
}
.policy-body h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 22px 0 8px;
  color: var(--text);
}
.policy-body p { font-size: 15px; color: var(--text-2); line-height: 1.75; margin-bottom: 14px; }
.policy-body ul { margin: 0 0 14px 20px; }
.policy-body ul li { font-size: 15px; color: var(--text-2); line-height: 1.75; margin-bottom: 6px; }
.policy-body strong { color: var(--text); font-weight: 600; }
.policy-body a { color: var(--accent); }

.highlight-box {
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin: 24px 0;
}
.highlight-box p {
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 500;
  margin: 0;
  line-height: 1.6;
}

.contact-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-top: 36px;
}
.contact-box h2 { font-size: 16px; margin-bottom: 6px; }
.contact-box p { font-size: 14px; margin-bottom: 4px; }

/* ─── SETTINGS BAR (persisted preferences) ────────────────────────────────── */
.settings-bar {
  display: none;
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--accent-text);
  margin-bottom: 14px;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.settings-bar.show { display: flex; }
.settings-bar button {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 99px;
  color: var(--accent-text);
  cursor: pointer;
}
.settings-bar button:hover { background: var(--accent); color: #fff; }

/* ─── RADIO / CHECK UTILITY ───────────────────────────────────────────────── */
.radio-row, .check-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}
.radio-row label, .check-row label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}
.radio-row input, .check-row input { accent-color: var(--accent); }

/* ─── PRINT ──────────────────────────────────────────────────────────────── */
@media print {
  nav.site-nav, footer.site-footer, .ad-slot, .cookie-banner, .toast { display: none !important; }
  body { background: #fff; color: #000; }
}

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

/* ============================================================================
   APPEND this block to the END of /assets/css/style.css
   ----------------------------------------------------------------------------
   Validator v2 — summary banner, issue accordion, file chip, action row.
   All tokens use existing CSS variables so dark mode works automatically.
   ============================================================================ */

/* File header row (filename + Replace-file button) */
.val-file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.val-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.val-file-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Summary banner: OK (green) vs problems (yellow/red border) */
.val-summary {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
}
.val-summary .val-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.val-summary-ok {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--text);
}
.val-summary-ok .val-icon { color: var(--accent); }
.val-summary-bad {
  background: color-mix(in srgb, var(--danger, #c0392b) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger, #c0392b) 20%, transparent);
  color: var(--text);
}
.val-summary-bad .val-icon { color: var(--danger, #c0392b); }

/* Issue accordion rows */
.val-issue {
  border: 1px solid var(--border, rgba(0,0,0,.1));
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface);
  overflow: hidden;
  transition: border-color .15s ease;
}
.val-issue[open] {
  border-color: color-mix(in srgb, var(--text) 20%, transparent);
}
.val-issue-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.val-issue-summary::-webkit-details-marker { display: none; }
.val-issue-summary::marker { content: ''; }
.val-issue-summary::after {
  content: '⌄';
  margin-left: auto;
  font-size: 16px;
  color: var(--text-3, #888);
  transition: transform .15s ease;
  line-height: 1;
}
.val-issue[open] .val-issue-summary::after { transform: rotate(180deg); }
.val-issue-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.val-issue-error .val-issue-badge {
  background: color-mix(in srgb, var(--danger, #c0392b) 12%, transparent);
  color: var(--danger, #c0392b);
}
.val-issue-warn .val-issue-badge {
  background: color-mix(in srgb, var(--orange, #d97706) 12%, transparent);
  color: var(--orange, #d97706);
}
.val-issue-info .val-issue-badge {
  background: color-mix(in srgb, var(--blue, #2563eb) 12%, transparent);
  color: var(--blue, #2563eb);
}
.val-issue-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}
.val-issue-body {
  padding: 0 14px 14px 14px;
  border-top: 1px solid var(--border, rgba(0,0,0,.06));
}
.val-issue-body p {
  margin: 12px 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2, var(--text));
}
.val-issue-body .secondary-btn { margin-top: 4px; }

/* Action row: download + copy side-by-side, then the empty-rows checkbox */
.val-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.val-opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2, var(--text));
  cursor: pointer;
  user-select: none;
}
.val-opt input { margin: 0; }

/* Problem-cell highlight in preview table */
.preview-table td.val-cell-bad,
.preview-table th.val-cell-bad {
  background: color-mix(in srgb, var(--danger, #c0392b) 10%, transparent) !important;
  color: var(--danger, #c0392b);
}

/* Small screens — stack the file-head */
@media (max-width: 540px) {
  .val-file-head { flex-direction: column; align-items: stretch; }
  .val-file-head .secondary-btn { align-self: flex-start; }
  .val-actions .primary-btn,
  .val-actions .secondary-btn { width: 100%; }
}

/* ============================================================================
   V4 additions — loading overlay, file-info bar, preview enhancements
   ============================================================================ */

/* Loading overlay — full-screen centered spinner + message */
.tool-loading {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  backdrop-filter: blur(2px);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tool-loading-fade-in .18s ease-out;
}
@keyframes tool-loading-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.tool-loading-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .15);
  min-width: 240px;
  max-width: 360px;
  text-align: center;
}
.tool-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tool-spinner-rot 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes tool-spinner-rot {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.tool-loading-msg {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}
.tool-loading-bar {
  display: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 14px;
}
.tool-loading-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 120ms linear;
}

/* File-info bar — shown after successful file load */
#fileInfoBar {
  display: none;
  margin: 10px 0 16px;
}
.file-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--accent-bg);
  border: 1px solid var(--accent);
  border-radius: 99px;
  font-size: 13px;
  color: var(--accent-text);
  flex-wrap: wrap;
  max-width: 100%;
}
.file-info-ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--accent);
  color: #fff;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.file-info-name {
  font-weight: 600;
  color: var(--text);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-info-sep { opacity: .5; font-weight: 400; }
.file-info-meta { color: var(--text-2); font-family: var(--mono); font-size: 12px; }

/* Preview sampling note — subtle microcopy under preview tables */
.preview-note {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
  font-family: var(--mono);
  letter-spacing: .02em;
}

/* Muted cells (blank headers, etc.) in preview tables */
.preview-table .preview-cell-muted {
  color: var(--text-3);
  font-style: italic;
}

/* Mobile: file-info stacks + smaller loading dialog */
@media (max-width: 640px) {
  .file-info { font-size: 12px; padding: 7px 12px; }
  .file-info-name { max-width: 140px; }
  .tool-loading-inner { min-width: 200px; padding: 20px 24px; }
}

/* Changed cell highlight (used by find & replace preview) */
.preview-table .preview-cell-changed {
  background: var(--accent-bg);
  color: var(--accent-text);
  font-weight: 500;
}
/* Invalid cell highlight (used by validate email/phone/url preview) */
.preview-table .preview-cell-invalid {
  background: rgba(220, 53, 69, .12);
  color: #b02a37;
  font-weight: 500;
}
html[data-theme="dark"] .preview-table .preview-cell-invalid {
  background: rgba(220, 53, 69, .22);
  color: #ff8a94;
}

/* Validate: column content check result UI */
.val-check-msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 8px;
}
.val-check-msg.err {
  background: rgba(220, 53, 69, .12);
  color: #b02a37;
  border: 1px solid rgba(220, 53, 69, .3);
}
html[data-theme="dark"] .val-check-msg.err {
  color: #ff8a94;
  background: rgba(220, 53, 69, .2);
}
.val-check-summary {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 4px;
}
.val-check-summary.ok {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent-text);
}
.val-check-summary.warn {
  background: rgba(245, 158, 11, .1);
  border-color: rgba(245, 158, 11, .4);
}
.val-check-heading {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.5;
}
.val-check-stats {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
}
.val-check-details {
  margin-top: 12px;
  font-size: 13px;
}
.val-check-details > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  padding: 6px 0;
}
.val-check-details > summary:hover { text-decoration: underline; }
