/* ===== Base =============================================================== */
:root { color-scheme: light; }
:root.dark { color-scheme: dark; }

html,body { height:100%; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  margin:0; padding:0; color:#111827; background:#fff;
}
:root.dark body { color:#e5e7eb; background:#0b0f14; }

/* ===== Toolbar ============================================================ */
.toolbar{
  display:flex; justify-content:space-between; align-items:center;
  padding:8px 12px; border-bottom:1px solid #e5e7eb; background:#fff;
  position:sticky; top:0; z-index:10;
}
:root.dark .toolbar{ background:#0b0f14; border-color:#1f2937; }
.toolbar .toolbar-divider {
  margin: 0 0.625rem;
  color: #d1d5db;
  user-select: none;
  font-weight: 300;
  opacity: 0.6;
}
:root.dark .toolbar .toolbar-divider {
  color: #6b7280;
  opacity: 0.5;
}

/* Toolbar layout */
.toolbar .left,
.toolbar .right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Logo theme switching */
.logo-img {
  height: 28px;
  vertical-align: middle;
  margin-right: 8px;
}
.logo-partner {
  height: 18px;
}
.logo-light { display: inline !important; }
.logo-dark { display: none !important; }
:root.dark .logo-light { display: none !important; }
:root.dark .logo-dark { display: inline !important; }

/* ===== Container ========================================================== */
.container{ max-width:1180px; margin:0 auto; padding:16px; }
h1{ font-size:1.9rem; margin:8px 0 16px; }

/* ===== Content Pages (Imprint, Privacy) ================================== */
.content-page {
  max-width: 820px;
  line-height: 1.7;
}
.content-page h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: #111827;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0.5rem;
}
:root.dark .content-page h2 {
  color: #e5e7eb;
  border-bottom-color: #374151;
}
.content-page h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: #374151;
}
:root.dark .content-page h3 {
  color: #d1d5db;
}
.content-page p {
  margin-bottom: 1rem;
}
.content-page p:last-child {
  margin-bottom: 0;
}
.content-page ul, .content-page ol {
  margin: 0.75rem 0 1rem 1.5rem;
  padding-left: 0.5rem;
}
.content-page li {
  margin-bottom: 0.5rem;
}
.content-page a {
  color: #2563eb;
  text-decoration: none;
}
.content-page a:hover {
  text-decoration: underline;
}
:root.dark .content-page a {
  color: #60a5fa;
}
.content-page strong {
  font-weight: 600;
  color: #111827;
}
:root.dark .content-page strong {
  color: #e5e7eb;
}
.content-page em {
  color: #6b7280;
  font-style: italic;
}
:root.dark .content-page em {
  color: #9ca3af;
}

/* Prevent layout shifts */
.toolbar .right {
  min-height: 36px;
}
#vatTools {
  min-height: 40px;
  transition: opacity 0.2s ease;
}
#copyDuplicatesBtn,
#duplicateWarning {
  transition: visibility 0s linear 0.2s, opacity 0.2s ease;
}
#copyDuplicatesBtn[style*="visibility: visible"],
#duplicateWarning[style*="visibility: visible"] {
  transition-delay: 0s;
}

/* Collapsible input card */
#inputCard {
  contain: layout;
}
#inputCard .card-header {
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}
:root.dark #inputCard .card-header {
  background: #374151;
  border-bottom-color: #4b5563;
}
#inputCard.collapsed .card-header {
  border-bottom: none;
}
#inputCard.collapsed .card-body {
  display: none;
}
/* Use Bootstrap's accordion-button for arrow */
#inputCard .accordion-button {
  background: #f8f9fa;
  color: inherit;
  font-size: 1.25rem;
  font-weight: 500;
  box-shadow: none;
  padding: 0.75rem 1rem;
}
/* Hide arrow when not collapsible */
#inputCard .accordion-button.no-arrow::after {
  display: none !important;
}
/* Ensure arrow shows when collapsible - use Bootstrap's chevron styles */
#inputCard .accordion-button:not(.no-arrow)::after {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: auto;
  content: "";
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23212529'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-size: 1.25rem;
  transition: transform .2s ease-in-out;
}
:root.dark #inputCard .accordion-button:not(.no-arrow)::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23e5e7eb'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}
#inputCard .accordion-button:not(.no-arrow):not(.collapsed)::after {
  transform: rotate(-180deg);
}
:root.dark #inputCard .accordion-button {
  background: #374151;
  color: #e5e7eb;
}
#inputCard .accordion-button:not(.collapsed) {
  background: #f8f9fa;
  color: inherit;
  box-shadow: none;
}
:root.dark #inputCard .accordion-button:not(.collapsed) {
  background: #374151;
  color: #e5e7eb;
}
#inputCard .accordion-button.collapsed {
  background: #f8f9fa;
  color: inherit;
  box-shadow: none;
}
:root.dark #inputCard .accordion-button.collapsed {
  background: #374151;
  color: #e5e7eb;
}
#inputCard .accordion-button:focus {
  border-color: #dee2e6;
  box-shadow: none;
}
:root.dark #inputCard .accordion-button:focus {
  border-color: #4b5563;
}

/* ===== Notice (old blue pill) ============================================ */
.notice.info{
  background:#e7f1ff; border:1px solid #cfe0ff; color:#0b3b8f;
  padding:10px 12px; border-radius:6px; margin:8px 0 14px;
  contain: layout;
}
:root.dark .notice.info{
  background:#102a43; border-color:#1e3a5f; color:#cfe0ff;
}

.notice.warning{
  background:#fef3c7; border:1px solid #fde047; color:#854d0e;
  padding:10px 12px; border-radius:6px; margin:8px 0 14px;
  contain: layout;
}
:root.dark .notice.warning{
  background:#422006; border-color:#78350f; color:#fde047;
}

/* ===== CSV Import Section ================================================ */
.csv-import-section {
  background: #f9fafb;
  border-color: #e5e7eb;
}
:root.dark .csv-import-section {
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}
:root.dark .csv-import-section .text-muted {
  color: #9ca3af !important;
}

/* ===== Buttons (Bootstrap-ish) =========================================== */
.btn{
  display:inline-block; font-weight:500; line-height:1.5; text-align:center;
  vertical-align:middle; user-select:none; border:1px solid transparent;
  padding:.375rem .75rem; font-size:.9375rem; border-radius:.375rem;
  transition:color .15s ease-in-out, background-color .15s, border-color .15s, box-shadow .15s;
  background:#e5e7eb; color:#111827; cursor:pointer;
}
.btn:hover{ filter:brightness(.97); }
.btn:disabled{ opacity:.65; cursor:not-allowed; }

.btn-primary{ color:#fff; background-color:#0d6efd; border-color:#0d6efd; }
.btn-primary:hover{ background-color:#0b5ed7; border-color:#0a58ca; }

.btn-secondary{ color:#fff; background-color:#6c757d; border-color:#6c757d; }
.btn-secondary:hover{ background-color:#5c636a; border-color:#565e64; }

.btn-outline-secondary{
  color:#6c757d; background:transparent; border-color:#6c757d;
}
.btn-outline-secondary:hover{
  color:#fff; background-color:#6c757d; border-color:#6c757d;
}

/* Map vanilla buttons to bootstrap-ish classes */
button#checkBtn{ composes: btn btn-primary; }
button#copyButton{ composes: btn btn-outline-secondary; }
button#resetBtn{ composes: btn btn-secondary; }

/* Fallback for browsers without CSS Modules 'composes' */
button#checkBtn{ color:#fff; background:#0d6efd; border:1px solid #0d6efd; }
button#checkBtn:hover{ background:#0b5ed7; border-color:#0a58ca; }
button#copyButton{ color:#6c757d; background:transparent; border:1px solid #6c757d; }
button#copyButton:hover{ color:#fff; background:#6c757d; }
button#resetBtn{ color:#fff; background:#6c757d; border:1px solid #6c757d; }
button#resetBtn:hover{ background:#5c636a; border-color:#565e64; }

/* Desktop Toolbar Buttons - Modern Style */
.toolbar .right button {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid #d1d5db;
  background: transparent;
  color: #6b7280;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}
:root.dark .toolbar .right button {
  border-color: #374151;
  color: #9ca3af;
}

.toolbar .right button:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}
:root.dark .toolbar .right button:hover {
  background: #1f2937;
  color: #e5e7eb;
  border-color: #6b7280;
}

/* Language buttons (both desktop and mobile) */
button[data-lang] {
  padding: 0.375rem 0.625rem;
  font-size: 0.875rem;
  border: 1px solid #d1d5db;
  background: transparent;
  color: #6b7280;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
  min-width: 2.5rem;
}
:root.dark button[data-lang] {
  border-color: #374151;
  color: #9ca3af;
}

button[data-lang]:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}
:root.dark button[data-lang]:hover {
  background: #1f2937;
  color: #e5e7eb;
  border-color: #6b7280;
}

button[data-lang].active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
:root.dark button[data-lang].active {
  background: #2563eb;
  border-color: #2563eb;
}

/* Theme toggle button - special styling */
#themeToggle {
  font-size: 1rem;
  padding: 0.375rem 0.5rem;
}

/* Import/Export buttons */
#exportConfigBtn,
#importConfigBtn {
  font-size: 1rem;
}

/* Inputs */
textarea#vat_list{
  width:100%; min-height:180px; padding:8px 10px; border:1px solid #cdd4da; border-radius:6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size:14px; line-height:1.35; resize:vertical;
}
input[type="file"]{ font-size:.9rem; }
label{ cursor:pointer; }

/* ===== Progress (with external Cancel) =================================== */
.progress-wrap{
  display:none; align-items:center; gap:12px; margin:16px 0; padding:8px 0;
}
/* Hidden state MUST come before .show to allow .show to override */
.progress-wrap[hidden]{ display:none !important; }
.progress-wrap.show{ display:flex !important; }
.progress{
  flex:1;
  position:relative;
  height:24px;
  min-width:200px;
  background:#e5e7eb;
  border:1px solid #d1d5db;
  border-radius:8px;
  overflow:hidden;
}
#progressBar{
  position:absolute;
  top:0; left:0; bottom:0;
  width:0;
  background:#2563eb;
  transition:width .25s ease;
  border-radius:7px;
}
#progressText{
  position:absolute;
  left:50%; top:50%;
  transform:translate(-50%, -50%);
  font-size:13px;
  color:#fff;
  font-weight:600;
  white-space:nowrap;
  z-index:1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.progress-cancel{
  display:inline-flex; align-items:center; justify-content:center;
  width:32px; height:32px; border-radius:50%; border:2px solid #d1d5db; background:#fff; color:#111; cursor:pointer;
  font-size:20px;
  flex-shrink:0;
}
.progress-cancel[hidden]{ display:none !important; }
:root.dark .progress{ background:#1f2937; border-color:#374151; }
:root.dark #progressText{ color:#e5e7eb; }
:root.dark .progress-cancel{ background:#1f2937; color:#fff; border-color:#374151; }

/* Progress time counter */
.progress-time-wrap{
  display:none; margin:4px 0 12px; text-align:center; font-size:13px; color:#6b7280;
}
.progress-time-wrap[hidden]{ display:none !important; }
.progress-time-wrap.show{ display:block !important; }
:root.dark .progress-time-text{ color:#9ca3af; }

/* ===== Layout columns (simple) =========================================== */
.row{ display:flex; gap:24px; flex-wrap:wrap; }
.col-12{ flex:1 1 100%; }
.col-lg-4{ flex:1 1 360px; max-width:420px; }
.col-lg-8{ flex:2 1 560px; }

/* ===== Results table ====================================================== */
#resultsSection{ display: block !important; }
#resultsSection[hidden]{ display: none !important; }
.table-wrap{ overflow:auto; }
#resultsTable{ width:100%; border-collapse:collapse; table-layout:fixed; }
#resultsTable th, #resultsTable td{
  padding:8px 10px; border-bottom:1px solid #e5e7eb; vertical-align:top; font-size:14px;
}
#resultsTable th{ text-align:left; font-weight:600; color:#374151; }
#resultsTable td:nth-child(1),
#resultsTable td:nth-child(2),
#resultsTable td:nth-child(7){ white-space:nowrap; }
.ok{ color:#15803d; font-weight:600; }
.fail{ color:#b91c1c; font-weight:600; }

/* ===== Export accordion (collapsed by default) =========================== */
.export-accordion[hidden]{ display:none !important; }
.export-accordion {
  contain: layout;
}
.export-accordion .accordion-item {
  border: 2px solid #d1d5db !important;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
:root.dark .export-accordion .accordion-item {
  border: 2px solid #4b5563 !important;
  background: #1f2937;
}
.export-accordion .accordion-button {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.75rem 1rem;
  background: #f9fafb;
  border-bottom: 1px solid #d1d5db;
}
:root.dark .export-accordion .accordion-button {
  background: #374151;
  border-bottom-color: #4b5563;
  color: #e5e7eb;
}
.export-accordion .accordion-button:not(.collapsed) {
  background: #fff;
}
:root.dark .export-accordion .accordion-button:not(.collapsed) {
  background: #1f2937;
}
.export-accordion .accordion-body {
  padding: 1rem;
}

/* Bootstrap card dark mode (used by export-box) */
:root.dark .card {
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}
:root.dark .card-header {
  background: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}
:root.dark .card-body {
  background: #1f2937;
  color: #d1d5db;
}
:root.dark .form-check-label {
  color: #d1d5db;
}
:root.dark .text-muted {
  color: #9ca3af !important;
}

/* Compact Statistics Bar */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 10px 16px;
  background: #f9fafb;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.4;
}
:root.dark .stats-bar {
  background: #1f2937;
}

.stat-item {
  white-space: nowrap;
}
.stat-value {
  font-weight: 600;
  font-size: 1.1em;
}
.stat-label {
  color: #6b7280;
  margin-left: 4px;
}
:root.dark .stat-label {
  color: #9ca3af;
}
.stat-percent {
  color: #9ca3af;
  font-size: 0.9em;
}
.stat-divider {
  color: #d1d5db;
  font-weight: 300;
  user-select: none;
}
:root.dark .stat-divider {
  color: #4b5563;
}

.stat-success .stat-value { color: #15803d; }
.stat-primary .stat-value { color: #2563eb; }
.stat-danger .stat-value { color: #b91c1c; }
.export-row{ display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin:6px 0; }
.export-row .vies-modes label{ margin-right:10px; }
.export-row .muted{ color:#6b7280; margin-right:6px; }
.export-actions{ display:flex; gap:8px; margin-top:8px; }

/* ===== Footer ============================================================= */
footer.legal{ margin:60px 0 10px; color:#6b7280; font-size:.9rem; }
footer.legal .tools-links{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
footer.legal .tools-links a{
  display:inline-block; padding:6px 14px; background:#e5e7eb; color:#374151;
  text-decoration:none; border-radius:16px; font-size:.85rem;
  transition:background .2s ease, color .2s ease;
}
footer.legal .tools-links a:hover{ background:#2563eb; color:#fff; }
:root.dark footer.legal .tools-links a{ background:#1f2937; color:#d1d5db; }
:root.dark footer.legal .tools-links a:hover{ background:#3b82f6; color:#fff; }
footer.legal .disclaimer{ margin-bottom:8px; }
footer.legal .copyright{ margin-bottom:8px; font-size:.85rem; }
footer.legal .legal-links{ margin-left:8px; }
footer.legal .legal-links a{ color:inherit; text-decoration:none; }
footer.legal .legal-links a:hover{ text-decoration:underline; }
footer.legal .links a{ color:inherit; text-decoration:none; }
footer.legal .links a:hover{ text-decoration:underline; }

/* ===== Accessibility helpers ============================================= */
.sr-only{
  position:absolute !important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}
.export-actions .btn.copied {
  background:#198754 !important; /* bootstrap success */
  border-color:#198754 !important;
  color:#fff !important;
}
/* options inline above textarea */
.search-options { display:flex; gap:12px; align-items:center; margin-bottom:6px; }

/* narrower textarea on wide screens */
#vat_list { max-width: 520px; width: 100%; }

/* copy button feedback */
.export-actions .btn.copied,
#copyTableBtn.copied {
  background:#198754 !important; border-color:#198754 !important; color:#fff !important;
}
#resultsTable th.sorted-asc::after  { content: " ▲"; font-size: .8em; }
#resultsTable th.sorted-desc::after { content: " ▼"; font-size: .8em; }

/* Sticky table header inside scrollable wrap */
.table-wrap {
  position: relative;
  overflow: auto;
  max-height: 70vh;
  border: 1px solid #e5e7eb;
  border-radius: .25rem;
  background: #fff;
}
.table-wrap thead th {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  z-index: 2;
  box-shadow: 0 2px 3px rgba(0,0,0,0.05);
  border-bottom: 2px solid #d1d5db !important;
}

/* Dark mode for table */
:root.dark .table-wrap {
  background: #1f2937 !important;
  border-color: #374151 !important;
}
:root.dark .table-wrap thead th {
  background: #374151 !important;
  box-shadow: 0 2px 3px rgba(0,0,0,0.2);
  border-bottom: 2px solid #4b5563 !important;
}
:root.dark #resultsTable {
  background: #1f2937 !important;
  color: #d1d5db;
  --bs-table-bg: #1f2937;
  --bs-table-color: #d1d5db;
}
:root.dark #resultsTable th {
  color: #e5e7eb !important;
  background: #1f2937 !important;
  border-bottom-color: #374151 !important;
}
:root.dark #resultsTable td {
  border-bottom-color: #374151 !important;
  color: #d1d5db !important;
  background: #1f2937 !important;
}
:root.dark #resultsTable tbody tr:hover {
  --bs-table-hover-bg: #374151;
  --bs-table-hover-color: #e5e7eb;
}

/* ===== Mobile Card Layout (< 768px) ====================================== */
@media (max-width: 767px) {
  /* Make stats bar stack on mobile */
  .stats-bar {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .stat-item {
    flex: 1 1 45%;
    text-align: center;
  }

  .stat-divider {
    display: none;
  }

  /* Remove table borders on mobile */
  .table-wrap {
    border: none;
    max-height: none;
    overflow: visible;
    background: transparent;
  }

  /* Hide table header */
  #resultsTable thead {
    display: none;
  }

  /* Make table display as block */
  #resultsTable,
  #resultsTable tbody {
    display: block;
    width: 100%;
  }

  /* Each row becomes a card */
  #resultsTable tbody tr {
    display: block;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }
  :root.dark #resultsTable tbody tr {
    background: #1f2937;
    border-color: #374151;
  }

  /* Each cell becomes a row within the card */
  #resultsTable tbody tr td {
    display: block;
    width: 100%;
    padding: 0.5rem 0;
    border: none;
    text-align: left;
    font-size: 0.9375rem;
  }

  /* Country + VAT header row */
  #resultsTable tbody tr td:nth-child(1),
  #resultsTable tbody tr td:nth-child(2) {
    display: inline-block;
    width: auto;
    padding: 0;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
  }

  #resultsTable tbody tr td:nth-child(1) {
    margin-right: 0.5rem;
  }

  #resultsTable tbody tr td:nth-child(2) {
    color: #3b82f6;
  }
  :root.dark #resultsTable tbody tr td:nth-child(2) {
    color: #60a5fa;
  }

  /* Status badges (VIES + PEPPOL) - show inline */
  #resultsTable tbody tr td:nth-child(3),
  #resultsTable tbody tr td:nth-child(6) {
    display: inline-block;
    width: auto;
    padding: 0.25rem 0.75rem;
    margin-right: 0.5rem;
    margin-bottom: 0.75rem;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 0.875rem;
  }
  :root.dark #resultsTable tbody tr td:nth-child(3),
  :root.dark #resultsTable tbody tr td:nth-child(6) {
    background: #374151;
  }

  /* Hide data labels for status badges */
  #resultsTable tbody tr td:nth-child(3)::before,
  #resultsTable tbody tr td:nth-child(6)::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    margin-right: 0.25rem;
  }

  /* Name, Address - show with labels */
  #resultsTable tbody tr td:nth-child(4),
  #resultsTable tbody tr td:nth-child(5) {
    padding: 0.375rem 0;
    line-height: 1.5;
  }

  #resultsTable tbody tr td:nth-child(4) {
    font-weight: 600;
    color: #111827;
    margin-top: 0.5rem;
    padding-bottom: 0.25rem;
  }
  :root.dark #resultsTable tbody tr td:nth-child(4) {
    color: #e5e7eb;
  }

  #resultsTable tbody tr td:nth-child(5) {
    color: #6b7280;
    font-size: 0.875rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
  }
  :root.dark #resultsTable tbody tr td:nth-child(5) {
    color: #9ca3af;
    border-bottom-color: #374151;
  }

  /* PEPPOL ID - show with label */
  #resultsTable tbody tr td:nth-child(7) {
    display: block;
    padding: 0.5rem 0.75rem;
    background: #dbeafe;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #1e40af;
  }
  :root.dark #resultsTable tbody tr td:nth-child(7) {
    background: #1e3a5f;
    color: #93c5fd;
  }

  #resultsTable tbody tr td:nth-child(7)::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    font-family: system-ui, -apple-system, sans-serif;
  }

  /* Hide directory link on mobile */
  #resultsTable tbody tr td:nth-child(8) {
    display: none;
  }

  /* Error - show with red background */
  #resultsTable tbody tr td:nth-child(9) {
    display: block;
    padding: 0.5rem 0.75rem;
    background: #fee2e2;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #991b1b;
    margin-top: 0.5rem;
  }
  :root.dark #resultsTable tbody tr td:nth-child(9) {
    background: #4c1d1d;
    color: #fca5a5;
  }

  #resultsTable tbody tr td:nth-child(9)::before {
    content: attr(data-label) ": ";
    font-weight: 600;
  }

  /* Hide empty cells (marked with td-empty class) on mobile */
  #resultsTable tbody tr td.td-empty {
    display: none;
  }

  /* When PEPPOL ID is empty, don't show the divider before it */
  #resultsTable tbody tr td:nth-child(7).td-empty + td {
    margin-top: 0;
  }
}

/* Sorting affordance */
th.sortable { cursor: pointer; user-select: none; }
th.sortable .sort-ind {
  margin-left: .25rem;
  font-size: .75rem;
  opacity: .6;
}
th.sort-asc .sort-ind::after  { content: "▲"; }
th.sort-desc .sort-ind::after { content: "▼"; }
th.sortable:not(.sort-asc):not(.sort-desc) .sort-ind::after { content: "↕"; opacity: .4; }

/* Green/Red status */
.ok   { color:#15803d; font-weight:600; }
.fail { color:#b91c1c; font-weight:600; }

/* ===== Mobile Menu (Offcanvas) =========================================== */
.navbar-toggler-icon-custom {
  font-size: 1.5rem;
  line-height: 1;
}

.offcanvas {
  background: #fff;
  color: #111827;
}
:root.dark .offcanvas {
  background: #0b0f14;
  color: #e5e7eb;
  border-left: 1px solid #1f2937;
}

.offcanvas-header {
  border-bottom: 1px solid #e5e7eb;
}
:root.dark .offcanvas-header {
  border-bottom: 1px solid #1f2937;
}

.offcanvas-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.btn-close {
  filter: none;
}
:root.dark .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.mobile-menu-section {
  margin-bottom: 1.5rem;
}

.mobile-menu-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}
:root.dark .mobile-menu-heading {
  color: #9ca3af;
}

.mobile-menu-divider {
  margin: 1.5rem 0;
  border-color: #e5e7eb;
}
:root.dark .mobile-menu-divider {
  border-color: #1f2937;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 0.25rem;
  border: none;
  background: transparent;
  color: #111827;
  text-decoration: none;
  border-radius: 6px;
  transition: background-color 0.15s ease;
  cursor: pointer;
  font-size: 1rem;
}
:root.dark .mobile-menu-item {
  color: #e5e7eb;
}

.mobile-menu-item:hover {
  background: #f3f4f6;
  color: #111827;
}
:root.dark .mobile-menu-item:hover {
  background: #1f2937;
  color: #e5e7eb;
}

.mobile-menu-item.active {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 600;
}
:root.dark .mobile-menu-item.active {
  background: #1e3a5f;
  color: #93c5fd;
}

.mobile-menu-icon {
  margin-right: 0.75rem;
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
}

/* Language buttons in mobile menu */
.mobile-menu-lang-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.mobile-lang-btn {
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  background: transparent;
  color: #6b7280;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s ease;
}
:root.dark .mobile-lang-btn {
  border-color: #374151;
  color: #9ca3af;
}

.mobile-lang-btn:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #9ca3af;
}
:root.dark .mobile-lang-btn:hover {
  background: #1f2937;
  color: #e5e7eb;
  border-color: #6b7280;
}

.mobile-lang-btn.active {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}
:root.dark .mobile-lang-btn.active {
  background: #2563eb;
  border-color: #2563eb;
}

/* ===== CSV Preview Modal ================================================== */
#csvPreviewModal .modal-content {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
:root.dark #csvPreviewModal .modal-content {
  background: #1f2937;
  border-color: #374151;
}

:root.dark #csvPreviewModal .modal-header {
  border-bottom-color: #374151;
}

:root.dark #csvPreviewModal .modal-footer {
  border-top-color: #374151;
}

#csvPreviewTable {
  font-size: 0.875rem;
}

#csvPreviewTable th {
  background: #f9fafb;
  font-weight: 600;
  padding: 8px;
  white-space: nowrap;
}
:root.dark #csvPreviewTable th {
  background: #111827;
  color: #e5e7eb;
}

#csvPreviewTable td {
  padding: 6px 8px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Highlight detected VAT column */
#csvPreviewTable th.vat-column,
#csvPreviewTable td.vat-column {
  background: #dbeafe;
  font-weight: 500;
}
:root.dark #csvPreviewTable th.vat-column,
:root.dark #csvPreviewTable td.vat-column {
  background: #1e3a5f;
  color: #93c5fd;
}

/* Valid VAT cell indicator */
#csvPreviewTable td.vat-valid::after {
  content: ' ✓';
  color: #22c55e;
  font-weight: bold;
}
:root.dark #csvPreviewTable td.vat-valid::after {
  color: #4ade80;
}

/* Invalid VAT cell indicator */
#csvPreviewTable td.vat-invalid::after {
  content: ' ✗';
  color: #ef4444;
  font-weight: bold;
}