/* ── Reset & base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-body:     #F0F4F8;
  --bg-card:     #FFFFFF;
  --bg-light:    #F8FAFC;
  --sidebar-bg:  #1B3A5C;
  --sidebar-hov: #243F5E;
  --sidebar-act: #1E6FD9;
  --accent:      #1E6FD9;
  --accent-lt:   #4A90E2;
  --accent-bg:   #EBF3FF;
  --teal:        #0F8A6A;
  --teal-bg:     #E6F7F3;
  --green:       #2E7D32;
  --green-bg:    #EAF3EA;
  --amber:       #B45309;
  --amber-bg:    #FEF3C7;
  --red:         #C23B3B;
  --red-bg:      #FEE2E2;
  --text-dark:   #1A2B42;
  --text-body:   #374151;
  --text-grey:   #6B7280;
  --text-dim:    #9CA3AF;
  --border:      #E2E8F0;
  --border-mid:  #CBD5E1;
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.05);
  --shadow:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:   0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --sidebar-w:   220px;
  --radius:      8px;
  --radius-lg:   12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg-body);
  color: var(--text-body);
  height: 100vh;
  overflow: hidden;
  font-size: 14px;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  width: 140px;
  height: auto;
  display: block;
  /* The webp has a transparent background — add a very subtle filter so it
     reads well on the dark navy sidebar */
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

.brand-sub {
  font-size: 10px;
  color: #7FA3C4;
  margin-top: 1px;
  letter-spacing: 0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 6px;
  color: #B0C8E0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: var(--sidebar-hov); color: #FFFFFF; }
.nav-item.active { background: var(--sidebar-act); color: #FFFFFF; }

.nav-icon { font-size: 14px; opacity: 0.85; }

.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: #E0EEF8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 10px;
  color: #7FA3C4;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.btn-generate {
  width: 100%;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
}

.btn-generate:hover { background: var(--accent-lt); }

.btn-import {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  color: #B0C8E0;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-import:hover { background: var(--sidebar-hov); color: #fff; }

.sidebar-hint {
  font-size: 10.5px;
  color: #7FA3C4;
  text-align: center;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px 12px;
  background: transparent;
  color: #7FA3C4;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn-logout:hover { background: rgba(255,255,255,0.07); color: #E0EEF8; }

/* ── Main content ─────────────────────────────────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--bg-body);
}

/* ── Page header ─────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}

.page-sub {
  font-size: 13px;
  color: var(--text-grey);
  margin-top: 3px;
}

.page-date {
  font-size: 12.5px;
  color: var(--text-grey);
  white-space: nowrap;
  padding-top: 4px;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

/* ── Stats grid ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.accent-bar { background: var(--accent); }
.blue-bar   { background: var(--teal); }
.red-bar    { background: var(--red); }
.amber-bar  { background: var(--amber); }

.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1;
  margin-top: 6px;
}

.stat-value.accent { color: var(--accent); }
.stat-value.teal   { color: var(--teal); }
.stat-value.red    { color: var(--red); }
.stat-value.amber  { color: var(--amber); }

.stat-label {
  font-size: 12px;
  color: var(--text-grey);
  margin-top: 6px;
  font-weight: 500;
}

/* ── Info bars ──────────────────────────────────────────────────────────── */
.last-fetch-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: var(--accent-bg);
  border: 1px solid #BFD9F5;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 500;
}

.dual-pass-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

.db-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 12px;
}

.db-dot { font-size: 10px; color: var(--text-dim); line-height: 1; }

/* ── Reports table ─────────────────────────────────────────────────────── */
.reports-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.reports-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-grey);
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  text-align: left;
}

.reports-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-body);
}

.reports-table tbody tr:hover { background: var(--bg-light); }

.reports-table.reports-table-full th,
.reports-table.reports-table-full td { padding: 10px 16px; }

.file-icon { color: var(--accent); font-weight: 500; }

.empty-row td {
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  padding: 24px !important;
}

.btn-open {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #BFD9F5;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-open:hover { background: var(--accent); color: #fff; }

.btn-delete {
  display: inline-block;
  margin-left: 6px;
  padding: 4px 12px;
  background: var(--red-bg);
  color: var(--red);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid #F3C4C4;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-delete:hover:not(:disabled) { background: var(--red); color: #fff; }
.btn-delete:disabled { opacity: 0.6; cursor: default; }

/* ── Quick actions ─────────────────────────────────────────────────────── */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qa-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-body);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-weight: 500;
}

.qa-btn:hover {
  background: var(--accent-bg);
  border-color: #BFD9F5;
  color: var(--accent);
}

.qa-btn.qa-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.qa-btn.qa-primary:hover { background: var(--accent-lt); border-color: var(--accent-lt); }

.qa-btn.qa-teal {
  background: var(--teal-bg);
  border-color: #9DD4C6;
  color: var(--teal);
  font-weight: 600;
}

.qa-btn.qa-teal:hover { background: var(--teal); color: #fff; border-color: var(--teal); }

.qa-icon { font-size: 15px; flex-shrink: 0; }

/* ── Info box ───────────────────────────────────────────────────────────── */
.info-box {
  background: var(--amber-bg);
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--amber);
  margin-top: 16px;
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-top: 12px;
  border: 1px solid transparent;
}

.alert.success {
  background: var(--green-bg);
  border-color: #86EFAC;
  color: var(--green);
}

.alert.error {
  background: var(--red-bg);
  border-color: #FCA5A5;
  color: var(--red);
}

.alert.info {
  background: var(--accent-bg);
  border-color: #BFD9F5;
  color: var(--accent);
}

/* ── Settings grid ──────────────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row   { display: flex; gap: 16px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 5px;
}

.form-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-light);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  color: var(--text-body);
  font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,111,217,0.12);
}

.form-input::placeholder { color: var(--text-dim); }

.form-hint {
  font-size: 11.5px;
  color: var(--text-grey);
  margin-top: 4px;
}

/* ── Info rows (settings detail) ────────────────────────────────────────── */
.info-rows { display: flex; flex-direction: column; gap: 0; }

.info-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.info-row:last-child { border-bottom: none; }

.info-label {
  min-width: 140px;
  font-weight: 600;
  color: var(--text-grey);
  font-size: 12px;
  flex-shrink: 0;
}

.info-val { color: var(--text-body); font-size: 13px; }

/* ── Tags ───────────────────────────────────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  padding: 4px 10px;
  background: var(--accent-bg);
  border: 1px solid #BFD9F5;
  border-radius: 20px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn-action {
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-action:hover { background: var(--accent-lt); }

.btn-action.btn-secondary {
  background: var(--bg-light);
  color: var(--text-dark);
  border: 1px solid var(--border-mid);
}

.btn-action.btn-secondary:hover {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: #BFD9F5;
}

.btn-action.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #FCA5A5;
}

.btn-action.btn-danger:hover { background: var(--red); color: #fff; }

.btn-sm {
  padding: 7px 14px;
  background: var(--bg-light);
  border: 1px solid var(--border-mid);
  color: var(--text-grey);
  border-radius: 6px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-weight: 500;
}

.btn-sm:hover { background: var(--accent-bg); color: var(--accent); border-color: #BFD9F5; }

.btn-danger-sm { border-color: #FCA5A5; color: var(--red); }
.btn-danger-sm:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ── Log page ───────────────────────────────────────────────────────────── */
.log-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 12.5px;
  max-height: 60vh;
  overflow-y: auto;
}

.log-line {
  display: flex;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}

.log-ts {
  color: var(--text-dim);
  white-space: nowrap;
  font-size: 11px;
  padding-top: 1px;
}

.log-msg { color: var(--text-body); flex: 1; }
.log-msg.error { color: var(--red); }

.log-empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 24px 0;
  text-align: center;
}

/* ── Progress overlay ───────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,25,40,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.overlay-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  width: 520px;
  max-width: 90vw;
  box-shadow: var(--shadow-md);
}

.overlay-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 20px;
}

.progress-bar-wrap {
  height: 6px;
  background: var(--bg-body);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.overlay-log {
  max-height: 200px;
  overflow-y: auto;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  color: var(--text-grey);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.overlay-log-line        { color: var(--text-grey); }
.overlay-log-line.done   { color: var(--green); }
.overlay-log-line.error  { color: var(--red); }

/* ── Badge ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-blue   { background: var(--accent-bg); color: var(--accent); }
.badge-grey   { background: var(--bg-light);  color: var(--text-dim); border: 1px solid var(--border); }

/* ── Date-range row (dashboard Quick Actions) ───────────────────────────── */
.date-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.date-range-field {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  background: var(--bg-light);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  padding: 7px 11px;
  transition: border-color 0.15s;
}

.date-range-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,111,217,0.1);
}

.date-range-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
}

.date-range-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-dark);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  padding: 0;
}

.date-range-sep {
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #EBF2FA 0%, #F0F4F8 60%, #E8F0FA 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  margin-bottom: 28px;
}

.login-logo {
  width: 160px;
  height: auto;
  display: block;
}

.login-brand-sub {
  font-size: 11.5px;
  color: var(--text-grey);
  margin-top: 2px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13.5px;
  color: var(--text-grey);
  margin-bottom: 28px;
}

.login-btn {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}

.login-btn:hover { background: var(--accent-lt); }

.login-error {
  background: var(--red-bg);
  border: 1px solid #FCA5A5;
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--red);
  font-size: 13px;
  margin-bottom: 16px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ── Reports: viewer badge ──────────────────────────────────────────────── */
.viewer-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--teal-bg);
  border: 1px solid #9DD4C6;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--teal);
  font-weight: 500;
}

/* ── Table scroll wrapper (mobile horizontal scroll) ────────────────────── */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1px;
}

.table-scroll .reports-table { min-width: 520px; }

/* ── Mobile top bar (hidden on desktop) ─────────────────────────────────── */
.mobile-header {
  display: none;
}

.hamburger-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #B0C8E0;
  font-size: 20px;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.15s;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.08); }

.mobile-logo {
  height: 28px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}

/* ── Sidebar overlay backdrop ───────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 190;
}
.sidebar-overlay.active { display: block; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .settings-grid  { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 20px 18px; }
}

@media (max-width: 768px) {
  /* ── Layout becomes single column, sidebar slides in ── */
  body { overflow: auto; height: auto; }

  .layout {
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  /* Sticky mobile top bar */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--sidebar-bg);
    position: sticky;
    top: 0;
    z-index: 200;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
  }

  /* Sidebar becomes a fixed slide-in panel */
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    bottom: 0;
    width: 260px;
    min-width: 260px;
    z-index: 210;
    transition: left 0.26s ease;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }

  .sidebar.sidebar-open { left: 0; }

  /* Main area fills viewport below sticky header */
  .main {
    flex: none;
    width: 100%;
    overflow-y: visible;
    padding: 16px;
    min-height: calc(100dvh - 56px);
  }

  /* Grids collapse to single column */
  .stats-grid     { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid  { grid-template-columns: 1fr; }

  /* Cards get less padding */
  .card { padding: 14px 16px; }

  /* Page header wraps on mobile */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }
  .page-date { display: none; }

  /* Date range stacks vertically */
  .date-range-row { flex-direction: column; gap: 8px; }
  .date-range-sep { display: none; }
  .date-range-field { width: 100%; }

  /* Forms stack vertically */
  .form-row { flex-direction: column; gap: 0; }

  /* Info bars wrap */
  .last-fetch-bar { flex-wrap: wrap; gap: 8px; }
  .db-status-bar  { flex-wrap: wrap; gap: 6px; }

  /* Stat values slightly smaller */
  .stat-value { font-size: 24px; }

  /* Login card */
  .login-card { padding: 28px 20px 24px; }

  /* Overlay card */
  .overlay-card { padding: 24px 20px; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-value { font-size: 22px; }
  .page-title { font-size: 18px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   SEARCH PAGE
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Layout ─────────────────────────────────────────────────────────────── */
.search-layout {
  display: flex;
  gap: 16px;
  height: calc(100vh - 120px);
  min-height: 0;
  position: relative;
}

/* ── Filter panel ───────────────────────────────────────────────────────── */
.search-filters {
  width: 272px;
  min-width: 272px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  padding: 14px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: width 0.22s ease, min-width 0.22s ease, padding 0.22s ease,
              opacity 0.18s ease, border-color 0.18s ease;
}

/* Desktop collapsed state */
.search-layout.filters-collapsed .search-filters {
  width: 0;
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
  border-color: transparent;
  opacity: 0;
  pointer-events: none;
}

/* Toggle button — visible on all screen sizes */
.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text-body);
  cursor: pointer;
  white-space: nowrap;
  transition: background .14s, border-color .14s, color .14s;
}
.filter-toggle-btn:hover  { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.filter-toggle-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.filter-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-dark);
}
.filter-reset-btn {
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text-grey);
  cursor: pointer;
  transition: background .15s;
}
.filter-reset-btn:hover { background: var(--bg-light); }

/* Filter section headers */
.filter-section-hdr {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 14px 7px;
  margin: 0 -14px 10px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.filter-section-hdr:first-child { margin-top: -14px; border-top: none; }
.filter-section-hdr > span:first-child {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .7px;
  text-transform: uppercase;
}
.filter-section-sub {
  font-size: 10px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
}
.fetch-hdr  { background: #EBF3FF; border-color: #C7DEFF; }
.fetch-hdr  > span:first-child { color: var(--accent); }
.fetch-hdr  .filter-section-sub { color: #4A72A8; }
.result-hdr { background: #F0FBF7; border-color: #B6E8D8; }
.result-hdr > span:first-child { color: var(--teal); }
.result-hdr .filter-section-sub { color: #2E7A62; }

/* Source toggle */
.source-toggle-row {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.source-btn {
  flex: 1;
  padding: 7px 8px;
  background: var(--bg-light);
  border: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-grey);
  cursor: pointer;
  transition: background .14s, color .14s;
  white-space: nowrap;
}
.source-btn + .source-btn { border-left: 1px solid var(--border); }
.source-btn.active {
  background: var(--accent);
  color: #fff;
}
.source-btn:not(.active):hover { background: var(--accent-bg); color: var(--accent); }

/* Filter divider */
.filter-divider {
  height: 1px;
  background: var(--border);
  margin: 8px -14px 12px;
}

/* Filter hint text */
.filter-hint {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
}

/* Live spinner */
.live-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.filter-group {
  margin-bottom: 12px;
}
.filter-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-grey);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 5px;
}
.filter-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text-body);
  background: var(--bg-light);
  outline: none;
  transition: border-color .15s;
}
.filter-input:focus { border-color: var(--accent); background: #fff; }

/* OEG category checkboxes */
.cat-check-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 190px;
  overflow-y: auto;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-light);
}
.cat-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-body);
  cursor: pointer;
  padding: 2px 0;
  white-space: nowrap;
}
.cat-check-item input[type="checkbox"] { accent-color: var(--accent); }

/* Multi-select dropdown (Exclude Category) */
.multi-dd { position: relative; }
.multi-dd-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  text-align: left;
}
.multi-dd-caret { font-size: 10px; color: #64748B; flex: none; }
.multi-dd-panel {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .12);
}
.multi-dd.open .multi-dd-panel { display: block; }
.multi-dd-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-body);
  cursor: pointer;
  padding: 3px 2px;
  white-space: nowrap;
}
.multi-dd-opt input[type="checkbox"] { accent-color: var(--accent); flex: none; }
.multi-dd-empty { font-size: 11.5px; color: #94A3B8; padding: 4px 2px; }

/* Status radio */
.radio-row { display: flex; gap: 12px; }
.radio-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
}
.radio-item input[type="radio"] { accent-color: var(--accent); }

/* Date pair */
.date-pair { display: flex; gap: 6px; }
.date-pair .filter-input { flex: 1; min-width: 0; padding: 6px 6px; font-size: 11.5px; }

/* Sort row */
.sort-row { display: flex; gap: 6px; }

/* Search button */
.btn-search {
  width: 100%;
  margin-top: 4px;
  padding: 9px 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.btn-search:hover { background: var(--accent-lt); }

/* CSV button */
.btn-csv {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-csv:hover { opacity: .85; }
.btn-csv:disabled { opacity: .5; cursor: wait; }

/* Count badge */
.search-count-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Results panel ──────────────────────────────────────────────────────── */
.search-results {
  flex: 1;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;        /* clips border-radius; children still scroll */
}

.search-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

#resultsWrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.results-table-wrap {
  flex: 1;
  min-height: 0;
  overflow-x: auto;        /* horizontal scroll */
  overflow-y: auto;        /* vertical scroll */
  -webkit-overflow-scrolling: touch;
}

/* ── Results table ──────────────────────────────────────────────────────── */
.results-table {
  width: 100%;
  min-width: 800px;         /* forces horizontal scroll below this width */
  border-collapse: collapse;
  font-size: 12.5px;
}
.results-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.results-table th {
  background: var(--sidebar-bg);
  color: #fff;
  padding: 9px 8px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  white-space: nowrap;
  border-bottom: 2px solid var(--accent);
  user-select: none;
}
.results-table th.sortable {
  cursor: pointer;
}
.results-table th.sortable:hover { background: #243F5E; }
.sort-arrow { color: var(--accent-lt); font-size: 11px; }

.results-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.results-table tr:hover td { background: var(--bg-light); }
.results-table tr.urg-urgent td { background: #FFF5F5; }
.results-table tr.urg-urgent:hover td { background: #FEE2E2; }
.results-table tr.urg-high td { background: #FFFBEB; }

/* Column widths */
.col-num     { width: 32px; text-align: center; }
.col-title   { min-width: 220px; }
.col-cat     { width: 140px; }
.col-country { width: 90px; }
.col-dist    { width: 70px; text-align: right; }
.col-close   { width: 90px; }
.col-days    { width: 52px; text-align: center; }
.col-val     { width: 90px; }
.col-act     { width: 60px; text-align: center; white-space: nowrap; }

.result-title {
  font-weight: 600;
  color: var(--text-dark);
  font-size: 12.5px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  flex-wrap: wrap;
}
.title-link {
  font-weight: 400;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.title-link:hover {
  color: var(--accent, #2563eb);
  text-decoration: underline;
}
.result-sub {
  font-size: 11px;
  color: var(--text-grey);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}
.result-note {
  font-size: 10.5px;
  color: var(--text-grey);
  margin-top: 3px;
  line-height: 1.3;
}

/* Status dot */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.status-dot.matched  { background: var(--teal); }
.status-dot.excluded { background: var(--text-dim); }

/* Category pill */
.cat-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.excl-pill { color: var(--text-grey); background: var(--bg-light); border-color: var(--border-mid); }

/* Days value */
.days-val { font-weight: 600; font-size: 12px; }
.days-urgent { color: var(--red); }
.days-high   { color: var(--amber); }

/* NEW badge */
.new-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .5px;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Row action buttons */
.row-act-btn {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-grey);
  transition: background .12s, color .12s;
  margin: 1px;
}
.row-act-btn:hover { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.row-pdf-btn:hover { background: var(--teal-bg); color: var(--teal); border-color: var(--teal); }

/* Empty row */
.empty-row { text-align: center; color: var(--text-grey); padding: 28px !important; font-style: italic; }

/* Results footer */
.results-footer {
  padding: 7px 14px;
  font-size: 11.5px;
  color: var(--text-grey);
  border-top: 1px solid var(--border);
  background: var(--bg-light);
  flex-shrink: 0;
}

/* ── Tender detail modal ────────────────────────────────────────────────── */
.tender-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.tender-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  max-width: 680px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px 26px 22px;
  position: relative;
}
.modal-close-btn {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none;
  font-size: 18px; cursor: pointer; color: var(--text-grey);
}
.modal-close-btn:hover { color: var(--text-dark); }
.modal-hdr {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-size: 16px; font-weight: 700;
  color: var(--text-dark); line-height: 1.4;
  margin-bottom: 4px;
}
.modal-company { font-size: 12.5px; color: var(--text-grey); }
.modal-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.modal-meta-cell {
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.modal-meta-label { font-size: 10px; font-weight: 700; color: var(--text-grey); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.modal-meta-val   { font-size: 13px; font-weight: 600; color: var(--text-dark); }
.modal-section { margin-bottom: 12px; }
.modal-section-title { font-size: 11.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.modal-section-body  { font-size: 13px; color: var(--text-body); line-height: 1.5; }
.modal-links { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.modal-link {
  display: inline-block;
  padding: 5px 12px;
  background: var(--accent-bg);
  color: var(--accent);
  border: none;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}
.modal-link:hover { background: var(--accent); color: #fff; }
.modal-urg {
  display: inline-block; padding: 2px 9px;
  border-radius: 10px; font-size: 11px; font-weight: 700;
}
.urgent-pill { background: var(--red-bg);   color: var(--red);   }
.high-pill   { background: var(--amber-bg); color: var(--amber); }

/* ── Pagination bar ─────────────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-light);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.pg-btn {
  min-width: 34px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-card);
  color: var(--text-body);
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.pg-btn:hover:not(.pg-disabled):not(.pg-active) {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.pg-btn.pg-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: default;
}
.pg-btn.pg-disabled {
  opacity: .4;
  cursor: default;
}
.pg-ellipsis {
  padding: 0 4px;
  color: var(--text-grey);
  font-size: 13px;
  user-select: none;
}
.pg-jump {
  margin-left: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-grey);
}
.pg-jump-input {
  width: 44px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
  outline: none;
}
.pg-jump-input:focus { border-color: var(--accent); }

/* ── Mobile filter drawer ────────────────────────────────────────────────── */
/* On mobile the filter panel becomes a fixed bottom/side drawer */
.filter-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 299;
}
.filter-drawer-backdrop.active { display: block; }

/* ── Search page responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  /* Layout: single column, full height */
  .search-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100dvh - 56px);
    gap: 10px;
  }

  /* Filter panel: hidden off-screen as a side drawer on mobile */
  .search-filters {
    position: fixed;
    top: 0;
    left: -290px;
    bottom: 0;
    width: 272px !important;
    min-width: 272px !important;
    height: 100%;
    border-radius: 0;
    z-index: 300;
    transition: left 0.24s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.2);
    opacity: 1 !important;
    pointer-events: auto !important;
    border: none;
  }
  /* Override desktop collapse — mobile uses left slide instead */
  .search-layout.filters-collapsed .search-filters {
    left: -290px;
    width: 272px !important;
    min-width: 272px !important;
    padding-left: 14px;
    padding-right: 14px;
    border-color: var(--border);
    opacity: 1;
    pointer-events: auto;
  }
  .search-filters.drawer-open {
    left: 0 !important;
  }

  /* Results panel: fill remaining space */
  .search-results {
    flex: none;
    width: 100%;
    height: calc(100dvh - 110px);
    min-height: 400px;
  }
}

@media (max-width: 540px) {
  .modal-meta-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FETCH BAR  — horizontal strip above the search layout
   ═══════════════════════════════════════════════════════════════════════════ */
.fetch-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.fetch-bar-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.fetch-bar-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-grey);
  text-transform: uppercase;
  letter-spacing: .6px;
}
.fetch-bar-sep {
  width: 1px;
  height: 36px;
  background: var(--border);
  align-self: flex-end;
  flex-shrink: 0;
}
.fetch-bar-spacer { flex: 1; min-width: 8px; }
.btn-fetch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 22px;
  height: 36px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, transform .1s;
  flex-shrink: 0;
}
.btn-fetch:hover  { background: #1557b0; }
.btn-fetch:active { transform: scale(.97); }

.sec-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER LOCK STATE  — sidebar locked until first search
   ═══════════════════════════════════════════════════════════════════════════ */
.filters-lock-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  border: 1.5px dashed var(--border-mid, #CBD5E1);
  border-radius: var(--radius);
  margin-bottom: 14px;
  background: #F8FAFC;
}
.filter-fields-locked {
  opacity: .3;
  pointer-events: none;
  user-select: none;
  transition: opacity .25s;
}
.filter-fields-unlocked {
  opacity: 1;
  pointer-events: auto;
  user-select: auto;
  transition: opacity .25s;
}

/* ═══════════════════════════════════════════════════════════════════════════
   APPLY FILTERS BUTTON ROW
   ═══════════════════════════════════════════════════════════════════════════ */
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.btn-apply-filters {
  flex: 1;
  padding: 8px 10px;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-apply-filters:hover  { background: #0a7259; }
.btn-apply-filters:active { transform: scale(.97); }

/* Fetch bar responsive — stack vertically on narrow screens */
@media (max-width: 860px) {
  .fetch-bar { gap: 10px; padding: 10px 12px; }
  .fetch-bar-sep { display: none !important; }
  .fetch-bar-spacer { display: none; }
  .btn-fetch { width: 100%; justify-content: center; }
  #liveOptions { flex-direction: column; gap: 10px !important; }
}
