/* ═══════════════════════════════════════════════════════════════════
   theme-pro-v2.css — v3
   • Dark-blue prominent scrollbars
   • Hyper-realistic depth (NO backdrop-filter → no tab-switch lag)
   • Title-Case headings (overrides uppercase)
   • Unified quota section styling across Phone/CNIC, MaxPro, Fuse
   Load LAST on every page.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Scrollbars ── */
:root,[data-theme="dark"]{
  --sb-track:#0b1220; --sb-thumb:#1d4ed8; --sb-thumb-hover:#3b82f6;
  --sb-thumb-active:#1e3a8a; --sb-border:#070c16;
}
[data-theme="light"]{
  --sb-track:#d4def0; --sb-thumb:#1d4ed8; --sb-thumb-hover:#2563eb;
  --sb-thumb-active:#1e3a8a; --sb-border:#bccbe6;
}
*{ scrollbar-width:thin; scrollbar-color:var(--sb-thumb) var(--sb-track); }
*::-webkit-scrollbar{ width:12px; height:12px; }
*::-webkit-scrollbar-track{ background:var(--sb-track); border-radius:10px; }
*::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg,#2563eb,#1d4ed8 60%,#1e40af);
  border-radius:10px; border:2px solid var(--sb-border);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.15);
}
*::-webkit-scrollbar-thumb:hover{ background:linear-gradient(180deg,#3b82f6,#2563eb); }
*::-webkit-scrollbar-thumb:active{ background:var(--sb-thumb-active); }
*::-webkit-scrollbar-corner{ background:var(--sb-track); }

/* ═══════════════════ HYPER-REALISTIC DEPTH (theme-scoped) ═══════════════════ */
:root,[data-theme="dark"]{
  --bg-app:#070A11; --bg-primary:#070A11; --bg-secondary:#11161F;
  --bg-surface:#181F2B; --bg-input:#0B0F18;
  --border:#283041; --border-subtle:#1c2330;
  --accent:#4f7cff; --accent-light:#82a4ff; --accent-2:#f25ca2;
}

/* ── DARK decorative layer ── */
[data-theme="dark"] .panel,
[data-theme="dark"] .results-section,
[data-theme="dark"] .modal-dialog,
[data-theme="dark"] .stats-modal-dialog,
[data-theme="dark"] .export-dialog,
[data-theme="dark"] .fb-group,
[data-theme="dark"] .card,
[data-theme="dark"] .kpi-card{
  background-image:linear-gradient(180deg,rgba(255,255,255,.035),rgba(255,255,255,0) 90px);
  box-shadow:0 1px 0 rgba(255,255,255,.05) inset,0 12px 30px rgba(0,0,0,.45),0 3px 8px rgba(0,0,0,.30);
}
[data-theme="dark"] .results-header,
[data-theme="dark"] .fuse-results-header,
[data-theme="dark"] .de-header,
[data-theme="dark"] .panel-header{
  background-image:linear-gradient(180deg,rgba(79,124,255,.07),rgba(255,255,255,0));
}
[data-theme="dark"] .btn-action-primary,
[data-theme="dark"] .fuse-search-btn,
[data-theme="dark"] .btn-export-unified{
  background-image:linear-gradient(180deg,rgba(255,255,255,.18),rgba(255,255,255,0));
  box-shadow:0 1px 0 rgba(255,255,255,.25) inset,0 4px 14px rgba(79,124,255,.4);
}
[data-theme="dark"] .btn-action-primary:hover,
[data-theme="dark"] .fuse-search-btn:hover:not(:disabled),
[data-theme="dark"] .btn-export-unified:hover{
  filter:brightness(1.08);
  box-shadow:0 1px 0 rgba(255,255,255,.35) inset,0 6px 20px rgba(79,124,255,.55);
}
[data-theme="dark"] .form-input,
[data-theme="dark"] .fuse-term-input,
[data-theme="dark"] .fuse-field-select,
[data-theme="dark"] #manualInput,
[data-theme="dark"] .search-box input,
[data-theme="dark"] .fuse-filter-input,
[data-theme="dark"] .col-filter,
[data-theme="dark"] select.server-select,
[data-theme="dark"] .addr-term-input{
  box-shadow:inset 0 2px 4px rgba(0,0,0,.32),inset 0 0 0 1px rgba(255,255,255,.02);
}
[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .fuse-term-input:focus,
[data-theme="dark"] #manualInput:focus,
[data-theme="dark"] .search-box input:focus,
[data-theme="dark"] .fuse-filter-input:focus{
  box-shadow:inset 0 2px 4px rgba(0,0,0,.28),0 0 0 3px rgba(79,124,255,.22);
}

/* Table headers — DARK */
[data-theme="dark"] #resultsTableMain thead th,
[data-theme="dark"] #fuseResultsTable thead th,
[data-theme="dark"] #addrResultsTable.maxpro-table thead th{
  background-image:linear-gradient(180deg,#1c2434,#121826);
}
[data-theme="dark"] #resultsTableMain thead th{
  box-shadow:inset 0 -2px 0 var(--accent),0 0 14px rgba(79,124,255,.22);
}

/* ── LIGHT decorative layer ── */
[data-theme="light"] .panel,
[data-theme="light"] .results-section,
[data-theme="light"] .modal-dialog,
[data-theme="light"] .stats-modal-dialog,
[data-theme="light"] .export-dialog,
[data-theme="light"] .fb-group,
[data-theme="light"] .card,
[data-theme="light"] .kpi-card{
  background-image:linear-gradient(180deg,rgba(16,23,42,.018),rgba(16,23,42,0) 90px);
  box-shadow:0 1px 0 rgba(255,255,255,.7) inset,0 10px 26px rgba(16,23,42,.10),0 2px 6px rgba(16,23,42,.06);
}
[data-theme="light"] .results-header,
[data-theme="light"] .fuse-results-header,
[data-theme="light"] .de-header,
[data-theme="light"] .panel-header{
  background-image:linear-gradient(180deg,rgba(37,99,235,.05),rgba(255,255,255,0));
}
[data-theme="light"] .form-input,
[data-theme="light"] .fuse-term-input,
[data-theme="light"] .fuse-field-select,
[data-theme="light"] #manualInput,
[data-theme="light"] .search-box input,
[data-theme="light"] .fuse-filter-input,
[data-theme="light"] .col-filter,
[data-theme="light"] select.server-select{
  box-shadow:inset 0 1px 2px rgba(16,23,42,.08);
}
[data-theme="light"] .form-input:focus,
[data-theme="light"] .fuse-term-input:focus,
[data-theme="light"] #manualInput:focus,
[data-theme="light"] .search-box input:focus,
[data-theme="light"] .fuse-filter-input:focus{
  box-shadow:inset 0 1px 2px rgba(16,23,42,.06),0 0 0 3px rgba(37,99,235,.18);
}

/* Table headers — LIGHT (readable dark text on light gradient) */
[data-theme="light"] #resultsTableMain thead th,
[data-theme="light"] #fuseResultsTable thead th,
[data-theme="light"] #addrResultsTable.maxpro-table thead th{
  background-image:linear-gradient(180deg,#eef2fb,#e2e8f4) !important;
  color:#1e293b !important;
}
[data-theme="light"] #resultsTableMain thead th{
  box-shadow:inset 0 -2px 0 var(--accent);
}

/* Tab switching hint */
.de-tab-panel,.results-mode{ will-change:opacity; }

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

/* ═══════════════════ TITLE-CASE HEADINGS (override UPPERCASE) ═══════════════════ */
.de-section-label,
.fuse-row-label .fuse-label-text,
.fuse-label-text,
.de-tab,
.stats-section-title,
.si-label,
.kpi-lbl,
.fuse-export-label,
.es-chip-lbl,
.de-mini-chip,
.fuse-results-title,
.frd-detail-label,
.quota-detail-note,
.qd-k,
.summary-stats-row .ss-pill .ss-lbl,
.fuse-field-cell,
.frd-field,
.section-title,
.usr-tab{
  text-transform:none !important;
  letter-spacing:.2px !important;
}
/* Keep small "uppercase-ish" labels readable but Title-Cased */
.de-section-label{ font-variant:normal; }

/* ═══════════════════ UNIFIED QUOTA SECTIONS (all 3 tabs identical) ═══════════════════ */
.quota-section{ border-top:none !important; }
.quota-toggle-btn,.fuse-quota-toggle{
  margin-left:auto; font-size:10px; font-weight:700; letter-spacing:.2px;
  padding:3px 10px; height:20px; border-radius:10px; cursor:pointer;
  border:1px solid var(--border); background:var(--bg-surface);
  color:var(--accent-light); transition:all .15s; text-transform:none;
  display:inline-flex; align-items:center; gap:4px;
}
.quota-toggle-btn:hover,.fuse-quota-toggle:hover{
  background:var(--accent); color:#fff; border-color:var(--accent);
}
.fuse-quota-toggle{ align-self:flex-start; margin:6px 0 2px; }

/* Make Fuse/MaxPro quota chips visually identical to Phone/CNIC chips */
.quota-chip-row{ display:flex; gap:6px; flex-wrap:wrap; margin:5px 0; }
.quota-chip,
.fuse-status-row .fuse-chip{
  display:inline-flex; align-items:center; gap:5px; padding:4px 10px;
  border-radius:9px; background:var(--bg-primary); border:1px solid var(--border);
  font-size:10.5px; font-weight:700; color:var(--text-subtle); line-height:1;
}
.quota-chip .qc-ico,.fuse-chip .fuse-chip-ico{ font-size:11px; }
.quota-chip .qc-txt{ color:var(--text-primary); font-variant-numeric:tabular-nums; }
.quota-chip .qc-lbl{ font-size:9px; text-transform:none; letter-spacing:.3px; opacity:.85; }
.quota-chip.warn,.fuse-chip.warn{ border-color:rgba(245,158,11,.45); background:rgba(245,158,11,.10); color:#fcd34d; }
.quota-chip.danger,.fuse-chip.danger{ border-color:rgba(239,68,68,.45); background:rgba(239,68,68,.10); color:#fca5a5; }

.quota-detail{
  margin-top:7px; padding:10px 12px; border-radius:9px;
  background:var(--bg-primary); border:1px solid var(--border);
  animation:qdIn .15s ease-out;
}
@keyframes qdIn{ from{opacity:0;transform:translateY(-3px);} to{opacity:1;transform:none;} }
.quota-detail-grid{ display:grid; grid-template-columns:1fr 1fr; gap:6px 14px; }
.qd-item{ display:flex; align-items:baseline; justify-content:space-between; gap:8px; min-width:0; }
.qd-item .qd-k{ font-size:10px; color:var(--text-subtle); white-space:nowrap; }
.qd-item .qd-v{ font-size:11.5px; font-weight:800; color:var(--text-primary); font-variant-numeric:tabular-nums; }
.quota-detail-note{
  margin-top:9px; padding-top:8px; border-top:1px dashed var(--border);
  font-size:10px; line-height:1.5; color:var(--text-subtle);
}
.quota-detail-note strong{ color:var(--accent-light); }
@media (max-width:360px){ .quota-detail-grid{ grid-template-columns:1fr; } }

/* ════════════════════════════════════════════════════════════════
   MaxPro search-term highlight — calm amber "find" style.
   Bold matched term, soft gold background, gentle border. No glow,
   no animation — easy on the eyes, instantly recognisable.
   ════════════════════════════════════════════════════════════════ */
#addrResultsTable .maxpro-term-hl,
.maxpro-term-hl {
  background: #fde68a;            /* soft amber */
  color: #422006;                /* deep brown text — high contrast */
  font-weight: 800;
  border-radius: 3px;
  padding: 1px 4px;
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.45);
  white-space: nowrap;
  text-decoration: none;
  animation: none;
}
[data-theme="light"] .maxpro-term-hl,
[data-theme="light"] #addrResultsTable .maxpro-term-hl {
  background: #fcd34d;
  color: #451a03;
  box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.55);
}

/* ════════════════════════════════════════════════════════════════
   Result rows — balanced compact (readable but space-efficient)
   ════════════════════════════════════════════════════════════════ */

/* Phone/CNIC table */
#resultsTableMain { font-size: 12px; }
#resultsTableMain thead th {
  padding: 6px 11px !important;
  font-size: 9.5px !important;
  line-height: 1.25 !important;
}
#resultsTableMain tbody td {
  padding: 5px 11px !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}
#resultsTableMain td[data-col="address"],
#resultsTableMain td:nth-child(9) {
  padding: 5px 11px !important;
  line-height: 1.4 !important;
  font-size: 11.5px !important;
}
#resultsTableMain .mobile-found,
#resultsTableMain .cnic-found,
#resultsTableMain .mobile-not-found,
#resultsTableMain .cnic-not-found,
#resultsTableMain .gender-m,
#resultsTableMain .gender-f,
#resultsTableMain [class^="network-"],
#resultsTableMain [class^="province-"] {
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  line-height: 1.3 !important;
}

/* MaxPro table */
#addrResultsTable.maxpro-table { font-size: 12px; }
#addrResultsTable.maxpro-table thead th {
  padding: 6px 11px !important;
  font-size: 9.5px !important;
  line-height: 1.25 !important;
}
#addrResultsTable.maxpro-table tbody td {
  padding: 5px 11px !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}
#addrResultsTable.maxpro-table tbody td [class^="network-"],
#addrResultsTable.maxpro-table tbody td [class^="province-"],
#addrResultsTable.maxpro-table tbody td .gender-m,
#addrResultsTable.maxpro-table tbody td .gender-f {
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  line-height: 1.3 !important;
}

/* ── Admin "Edit User" modal: protect tab switching from global overrides ── */
.usr-panes { display: block !important; width: 100%; min-height: 0; }
.usr-pane { display: none !important; }
.usr-pane.active { display: block !important; }
.usr-tabbar { will-change: auto; }
.usr-pane .card,
.usr-pane .kpi-card {
  background-image: none !important;
  box-shadow: none !important;
}
.usr-pane .form-grid,
.usr-pane .toggle-row,
.usr-pane .section-title { visibility: visible !important; opacity: 1 !important; }
.modal-form { min-height: 0 !important; }
.modal-body { min-height: 0 !important; }

/* ════════════════════════════════════════════════════════════════
   LIGHT THEME — authoritative overrides (loaded last, wins all).
   Neutralizes every hardcoded-dark `!important` rule from user.css /
   user-overrides.css so light mode renders correctly everywhere.
   ════════════════════════════════════════════════════════════════ */

/* App background */
[data-theme="light"] body {
  background:
    radial-gradient(1100px 700px at 10% 0%, rgba(37,99,235,.06), transparent 60%),
    radial-gradient(900px 700px at 100% 10%, rgba(167,139,250,.06), transparent 55%),
    #eef1f7 !important;
  color: #101727 !important;
}

/* Panels — kill the dark gradients from FIX 6 */
[data-theme="light"] .panel,
[data-theme="light"] .user-status-panel,
[data-theme="light"] .data-entry-panel,
[data-theme="light"] .results-section {
  background: #ffffff !important;
  color: #101727 !important;
  box-shadow: 0 1px 3px rgba(16,23,42,.10), 0 1px 2px rgba(16,23,42,.06) !important;
}
[data-theme="light"] .user-status-panel { border-left: 4px solid #4f56e0 !important; }
[data-theme="light"] .data-entry-panel  { border-left: 4px solid #db2e84 !important; }

/* Panel headers + de-header */
[data-theme="light"] .panel-header,
[data-theme="light"] .user-status-panel .panel-header,
[data-theme="light"] .data-entry-panel .de-header {
  background: #f4f7fb !important;
  border-bottom: 1px solid #d5dee9 !important;
}

/* Status info items — light cards, coloured left border kept */
[data-theme="light"] .status-info-item {
  background: #f4f7fb !important;
  border: 1px solid #e2e8f0 !important;
  border-left-width: 2px !important;
}
[data-theme="light"] .status-info-item .si-label { color: #5a6a82 !important; }
[data-theme="light"] .status-info-item .si-value { color: #101727 !important; }

/* Data-entry sections (the blue/green/violet tinted ones from FIX 6) */
[data-theme="light"] .de-tab-panel[data-tab-panel="pak"] .de-section {
  background: transparent !important;
  border-top: 1px solid #e4eaf1 !important;
}

/* Tabs — inactive readable, active keeps its colour */
[data-theme="light"] .de-header-tabs { background: rgba(16,23,42,.05) !important; }
[data-theme="light"] .de-tab[data-tab="pak"]     { color: #1d4ed8 !important; }
[data-theme="light"] .de-tab[data-tab="address"] { color: #0d9488 !important; }
[data-theme="light"] .de-tab[data-tab="fuse"]    { color: #c2410c !important; }
[data-theme="light"] .de-tab[data-tab="pak"].active     { color: #fff !important; }
[data-theme="light"] .de-tab[data-tab="address"].active { color: #fff !important; }
[data-theme="light"] .de-tab[data-tab="fuse"].active    { color: #fff !important; }

/* Inputs / textarea / selects */
[data-theme="light"] #manualInput,
[data-theme="light"] .textarea-wrapper,
[data-theme="light"] .form-input,
[data-theme="light"] .fuse-term-input,
[data-theme="light"] .fuse-field-select,
[data-theme="light"] select.server-select,
[data-theme="light"] .search-box input,
[data-theme="light"] .fuse-filter-input,
[data-theme="light"] .col-filter {
  background: #ffffff !important;
  color: #101727 !important;
  border-color: #d5dee9 !important;
}
[data-theme="light"] #lineNumbers { background: rgba(16,23,42,.04) !important; }

/* Tables — light surfaces, dark text */
[data-theme="light"] .table-container,
[data-theme="light"] .fuse-table-container,
[data-theme="light"] #addrResultsScroll,
[data-theme="light"] .fuse-results-scroll { background: #ffffff !important; }
[data-theme="light"] #resultsTableMain td,
[data-theme="light"] #fuseResultsTable td,
[data-theme="light"] #addrResultsTable.maxpro-table tbody td { color: #101727 !important; }
[data-theme="light"] #resultsTableMain tbody tr:nth-child(even) td,
[data-theme="light"] #addrResultsTable.maxpro-table tbody tr:nth-child(even) td {
  background: rgba(16,23,42,.025) !important;
}

/* Export bars / fuse results header */
[data-theme="light"] .export-bar {
  background: linear-gradient(180deg, rgba(20,184,166,.06), #f4f7fb 60%) !important;
}
[data-theme="light"] .fuse-export-bar { background: #ffffff !important; }
[data-theme="light"] .fuse-results-header,
[data-theme="light"] #phoneModeWrap .results-header {
  background: #f4f7fb !important;
}

/* Quota chips / details */
[data-theme="light"] .quota-chip,
[data-theme="light"] .quota-detail,
[data-theme="light"] .de-mini-chip,
[data-theme="light"] .de-summary-chip,
[data-theme="light"] .file-chip {
  background: #f4f7fb !important;
  border-color: #d5dee9 !important;
}
[data-theme="light"] .quota-chip .qc-txt,
[data-theme="light"] .qd-item .qd-v { color: #101727 !important; }

/* Modals + stats modal */
[data-theme="light"] .stats-modal-dialog,
[data-theme="light"] .export-dialog,
[data-theme="light"] .modal-dialog,
[data-theme="light"] .fb-group,
[data-theme="light"] .fb-card { background: #ffffff !important; color: #101727 !important; }
[data-theme="light"] .kpi-card { background: #f4f7fb !important; }
[data-theme="light"] .kpi-val { color: #101727 !important; }

/* Remove the "panel hover lift→none" interfering shadows in light */
[data-theme="light"] .results-section:has(#phoneModeWrap:not([hidden])),
[data-theme="light"] .results-section:has(#fuseModeWrap:not([hidden])) {
  box-shadow: 0 1px 3px rgba(16,23,42,.10) !important;
}

/* ── Prominent username in user-status panel header ── */
#whoami {
  font-size: 14px !important;
  font-weight: 800 !important;
  color: var(--accent-light) !important;
  letter-spacing: .2px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-status-panel .panel-icon {
  width: 26px !important;
  height: 26px !important;
  font-size: 14px !important;
}
[data-theme="light"] #whoami { color: #4f56e0 !important; }

/* MaxPro inline "searching" spinner in the empty-state */
.maxpro-spin {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(13,148,136,.25);
  border-top-color: #0d9488;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════════════════════════════
   LAYOUT LOCK — sidebar LEFT, results RIGHT (desktop ≥1025px).
   Hardened with !important so no stray CSS error can collapse it.
   ════════════════════════════════════════════════════════════════ */
@media (min-width: 1025px) {
  .container {
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    padding: 10px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .main-grid:not(.results-fullpage) {
    display: grid !important;
    grid-template-columns: 340px minmax(0, 1fr) !important;
    gap: 10px !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  /* LEFT column — sidebar (user status + search/data-entry panel) */
  .main-grid:not(.results-fullpage) > .sidebar {
    grid-column: 1 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    max-height: 100% !important;
  }

  /* RIGHT column — results output panel */
  .main-grid:not(.results-fullpage) > .results-section {
    grid-column: 2 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }

  /* The active result mode fills the results section */
  .results-section .results-mode:not([hidden]) {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .results-section .results-mode[hidden] { display: none !important; }
}

@media (min-width: 1400px) {
  .main-grid:not(.results-fullpage) {
    grid-template-columns: 360px minmax(0, 1fr) !important;
  }
}

/* Mobile / tablet (<1025px): stack sidebar above results (intended) */
@media (max-width: 1024px) {
  .main-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  .container { height: auto !important; overflow: auto !important; }
  body { overflow: auto !important; height: auto !important; }
  .results-section { min-height: 60vh !important; }
}

/* ── MaxPro & Fuse panels: fill height, internal scroll, fully workable ── */
@media (min-width: 1025px) {
  /* Data-entry panel grows to fill remaining sidebar height */
  .data-entry-panel {
    flex: 1 1 auto !important;
    min-height: 280px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .data-entry-panel .panel-collapse-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .de-tab-panel.active {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .de-tab-panel.active .panel-body,
  .de-tab-panel.active .fuse-panel-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  /* MaxPro results: header fixed, table scrolls, export bar pinned */
  #addressModeWrap {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }
  #addressModeWrap .fuse-results-scroll {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: auto !important;
  }
  #addrResultsTableWrap:not([hidden]) {
    display: block !important;
    min-height: 0 !important;
  }

  /* Fuse results: same fill behaviour */
  #fuseModeWrap {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }
  #fuseModeWrap .fuse-results-scroll {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: auto !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   LAYOUT FIX — toggle button removed from grid flow so the
   sidebar (col 1) and results (col 2) align correctly.
   ════════════════════════════════════════════════════════════════ */
#layoutToggleBtn {
  position: fixed !important;
  z-index: 200;
}

/* Guarantee grid child ORDER regardless of source position:
   sidebar always left, results always right. */
@media (min-width: 1025px) {
  .main-grid:not(.results-fullpage) > .sidebar {
    order: 1 !important;
    grid-column: 1 !important;
  }
  .main-grid:not(.results-fullpage) > .results-section {
    order: 2 !important;
    grid-column: 2 !important;
  }
  /* The toggle button is fixed-position, so it never consumes a grid cell.
     Belt-and-braces: if it somehow stays in flow, force it span-0. */
  .main-grid > #layoutToggleBtn {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 0;
    height: 0;
    overflow: visible;
  }
}
