html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
* { margin: 0; padding: 0; box-sizing: border-box; }
svg { display: block; }
button, input, select, textarea { font-family: inherit; }

:root {
  color-scheme: light;
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Height of the fixed mobile top bar (<=900px only; unused on desktop). */
  --topbar-h: 56px;

  --sidebar-bg-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active-bg: rgba(99, 102, 241, 0.18);
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-border: rgba(255, 255, 255, 0.08);

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: #eef2ff;
  --accent-ring: rgba(79, 70, 229, 0.16);

  --content-bg: #f6f7fb;
  --card-bg: #ffffff;
  --border: #e6e9f0;
  --border-strong: #d8dce6;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --success: #16a34a;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 24px 55px rgba(2, 6, 23, 0.16);
}

body {
  font-family: var(--font-sans);
  background: var(--content-bg);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* Custom scrollbars are a pointing-device affordance only — touch devices keep
   their native overlay scrollbars, which never steal layout width. */
@media (hover: hover) and (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; border: 2px solid var(--content-bg); background-clip: padding-box; }
  ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
  * { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
}

.icon { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; flex-shrink: 0; }
.icon svg { width: 100%; height: 100%; }

.icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  color: var(--accent);
  flex-shrink: 0;
}
.icon-badge svg { width: 18px; height: 18px; }

.tone-olx { background: #fff7ed; color: #ea580c; }
.tone-zameen { background: #ecfdf5; color: #059669; }
.tone-whatsapp { background: #ecfdf5; color: #16a34a; }
.tone-facebook { background: #eff6ff; color: #2563eb; }
.tone-users { background: #f5f3ff; color: #7c3aed; }

/* Login page */
.login-body {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 24px;
  background: linear-gradient(160deg, #0b1120 0%, #131b30 45%, #1b2340 100%);
}
.login-body::before,
.login-body::after {
  content: '';
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  z-index: 0;
}
.login-body::before { background: #4f46e5; top: -180px; left: -160px; }
.login-body::after { background: #0ea5e9; bottom: -200px; right: -160px; }

.login-card {
  position: relative;
  z-index: 1;
  background: var(--card-bg);
  padding: 44px 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 388px;
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.login-badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.35);
  margin-bottom: 20px;
}
.login-badge svg { width: 26px; height: 26px; color: #fff; }

.login-card h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 5px; }
.login-card .subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 26px; }
.login-card label {
  display: block; font-size: 12px; font-weight: 600; margin-bottom: 7px; margin-top: 18px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.login-card label:first-of-type { margin-top: 0; }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input-icon { position: absolute; left: 13px; display: flex; color: var(--text-faint); pointer-events: none; }
.input-wrap .input-icon svg { width: 17px; height: 17px; }
.login-card .input-wrap input { padding-left: 40px; }
.login-card .input-wrap input#password { padding-right: 40px; }

.toggle-password {
  position: absolute;
  right: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .toggle-password:hover { color: var(--text-main); background: var(--content-bg); }
}
.toggle-password svg { width: 17px; height: 17px; }
.toggle-password .icon-eye-off { display: none; }
.toggle-password.showing .icon-eye { display: none; }
.toggle-password.showing .icon-eye-off { display: block; }

.login-card input {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }

.login-card button[type="submit"] {
  width: 100%;
  margin-top: 28px;
  padding: 12px;
  background: linear-gradient(180deg, #6366f1, var(--accent));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(79, 70, 229, 0.35);
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .login-card button[type="submit"]:hover { background: linear-gradient(180deg, #5457ea, var(--accent-hover)); box-shadow: 0 14px 30px rgba(79, 70, 229, 0.42); transform: translateY(-1px); }
}
.login-card button[type="submit"]:active { transform: translateY(0); }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 14px; min-height: 16px; font-weight: 500; }
.login-hint { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-faint); text-align: center; }

/* Dashboard layout */
.layout { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: 264px;
  background: linear-gradient(180deg, #0f172a 0%, #0b1222 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header { padding: 22px 20px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--sidebar-border); }
.sidebar-logo-badge {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4); flex-shrink: 0;
}
.sidebar-logo-badge svg { width: 19px; height: 19px; color: #fff; }
.logo { font-size: 15.5px; font-weight: 700; color: #fff; letter-spacing: -0.01em; line-height: 1.3; display: block; }
.logo-sub { font-size: 11px; color: var(--sidebar-text); }

.sidebar-nav { flex: 1; padding: 16px 12px; }
.sidebar-nav ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item .nav-label { flex: 1; }
@media (hover: hover) and (pointer: fine) {
  .nav-item:hover { background: var(--sidebar-bg-hover); color: #fff; }
}
.nav-item.active { background: var(--sidebar-active-bg); color: #fff; }
.nav-item.active .nav-icon { color: #818cf8; }

.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex-shrink: 0; }
.nav-icon svg { width: 100%; height: 100%; }

.chevron { display: inline-flex; width: 14px; height: 14px; transition: transform 0.2s ease; color: var(--sidebar-text); flex-shrink: 0; }
.chevron svg { width: 100%; height: 100%; }
.chevron.rotated { transform: rotate(90deg); }

.submenu {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  margin-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.submenu.open { max-height: 260px; }

.submenu-item {
  width: calc(100% - 8px);
  margin: 2px 0 2px 8px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--sidebar-text);
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
}
.submenu-item .nav-icon { width: 15px; height: 15px; }
@media (hover: hover) and (pointer: fine) {
  .submenu-item:hover { background: var(--sidebar-bg-hover); color: #fff; }
}
.submenu-item.active { background: var(--sidebar-active-bg); color: #fff; font-weight: 600; }
.submenu-item.active .nav-icon { color: #818cf8; }

.sidebar-footer { padding: 14px; border-top: 1px solid var(--sidebar-border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; margin-bottom: 4px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--sidebar-text); }

.logout-link {
  display: flex; align-items: center; gap: 10px; color: var(--sidebar-text); text-decoration: none;
  font-size: 13px; font-weight: 500; padding: 9px 8px; border-radius: 8px;
  transition: background 0.12s ease, color 0.12s ease;
}
@media (hover: hover) and (pointer: fine) {
  .logout-link:hover { background: rgba(220, 38, 38, 0.14); color: #fca5a5; }
}
.logout-link svg { width: 16px; height: 16px; }

/* Content */
.content { flex: 1; margin-left: 264px; padding: 28px 40px 60px; min-width: 0; }
.content-header { margin-bottom: 22px; }
.content-header h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }

.panel { display: none; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.panel.active { display: block; }
.panel h3 { margin-bottom: 0; font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; }

/* min() floor: identical to minmax(220px, 1fr) above a 220px container, but
   stops the track forcing document overflow on a narrow phone. */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 18px; margin-bottom: 26px; }
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
}
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-body { display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text-main); letter-spacing: -0.02em; }

.welcome-text { color: var(--text-muted); font-size: 14px; line-height: 1.6; }

.panel-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-toolbar-title { display: flex; align-items: center; gap: 12px; }

.refresh-btn, .apply-filters-btn, .clear-filters-btn, .page-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease, border-color 0.15s ease, color 0.15s ease;
}

.refresh-btn {
  background: linear-gradient(180deg, #6366f1, var(--accent));
  color: #fff;
  border: none;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3), 0 4px 10px rgba(79, 70, 229, 0.18);
}
@media (hover: hover) and (pointer: fine) {
  .refresh-btn:hover:not(:disabled) { background: linear-gradient(180deg, #5457ea, var(--accent-hover)); box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); transform: translateY(-1px); }
}
.refresh-btn:active:not(:disabled) { transform: translateY(0); }
.refresh-btn:disabled { background: #c7d2fe; box-shadow: none; cursor: not-allowed; color: #eef2ff; }
.refresh-btn:disabled .icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-text { color: var(--text-muted); font-size: 13px; margin-bottom: 18px; }

.table-wrap { max-height: 65vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card-bg); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.empty-row { text-align: center; color: var(--text-muted); padding: 26px; }
.thumb { width: 76px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; cursor: zoom-in; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
@media (hover: hover) and (pointer: fine) {
  .thumb:hover { transform: scale(1.15); border-color: var(--accent); box-shadow: var(--shadow-md); }
}

td a { color: var(--accent); text-decoration: none; font-weight: 600; }
@media (hover: hover) and (pointer: fine) {
  td a:hover { text-decoration: underline; }
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 20, 0.88);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 90vh; max-height: 90dvh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .lightbox-close:hover { color: #cbd5e1; }
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .lightbox-nav:hover { background: rgba(255, 255, 255, 0.24); }
}
.lightbox-nav:disabled { opacity: 0.25; cursor: not-allowed; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.options-cell { min-width: 260px; max-width: 380px; white-space: normal; }
.desc-cell { min-width: 220px; max-width: 320px; white-space: normal; }
.muted { color: var(--text-faint); font-size: 12px; }

/* Sticky header so it stays visible while scrolling through a page of
   results. */
thead { position: sticky; top: 0; z-index: 5; }
thead tr { background: #fafbfd; }
thead th { border-bottom: 1px solid var(--border); }

/* Filters panel — a dedicated card above the table, applied on demand
   rather than live-per-keystroke. */
.filters-panel {
  background: linear-gradient(180deg, #fafbff, #f5f6fb);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.filters-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.filters-header h4 { font-size: 14.5px; font-weight: 700; margin-bottom: 3px; }
.filters-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 0; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; align-items: end; }
.filter-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filter-field label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.filter-hint { font-weight: 400; color: var(--text-faint); font-size: 11px; }

.filter-field input, .filter-field select {
  padding: 10px 12px;
  font-size: 13.5px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-main);
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filter-field input::placeholder { color: var(--text-faint); }
@media (hover: hover) and (pointer: fine) {
  .filter-field input:hover, .filter-field select:hover { border-color: var(--border-strong); }
}
.filter-field input:focus, .filter-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }

/* Native <select> kept for the filter dropdowns (JS keys off tagName ===
   'SELECT'); the arrow is a plain rotated-border chevron drawn with
   ::after, not an image, so it recolors instantly on hover/focus. */
.select-wrap { position: relative; }
.select-wrap select { appearance: none; -webkit-appearance: none; -moz-appearance: none; padding-right: 34px; cursor: pointer; }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-faint);
  border-bottom: 2px solid var(--text-faint);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
  transition: border-color 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .select-wrap:hover::after { border-color: var(--text-muted); }
}
.select-wrap:focus-within::after { border-color: var(--accent); }

.filter-actions { display: flex; align-items: center; gap: 10px; }
.apply-filters-btn { background: var(--text-main); color: #fff; border: none; }
@media (hover: hover) and (pointer: fine) {
  .apply-filters-btn:hover { background: #1e293b; transform: translateY(-1px); }
}

.import-panel {
  background: linear-gradient(180deg, #f0fdf4, #ecfdf5);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 22px;
}
.import-panel-header { display: flex; align-items: flex-start; gap: 12px; }
.import-panel h4 { font-size: 14px; font-weight: 700; margin-bottom: 3px; color: #14532d; }
.import-controls { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.import-controls input[type="file"] { font-size: 12.5px; max-width: 280px; color: var(--text-muted); }
.import-controls input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: var(--text-main);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .import-controls input[type="file"]::file-selector-button:hover { background: #1e293b; }
}
.import-panel .status-text { margin: 10px 0 0; font-size: 12.5px; }

tbody tr { transition: background 0.1s ease; }
tbody tr:nth-child(even) td { background: rgba(15, 23, 42, 0.014); }
@media (hover: hover) and (pointer: fine) {
  tbody tr:hover td { background: var(--accent-light); }
  tbody tr.row-removed:hover td { background: var(--danger-bg); }
}

.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.pagination-info { font-size: 12.5px; color: var(--text-muted); }
.pagination-controls { display: flex; align-items: center; gap: 10px; }
.page-indicator { font-size: 13px; font-weight: 700; min-width: 96px; text-align: center; color: var(--text-main); }
.page-btn { background: var(--card-bg); color: var(--text-main); border: 1.5px solid var(--border); }
@media (hover: hover) and (pointer: fine) {
  .page-btn:hover:not(:disabled) { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.clear-filters-btn { color: var(--accent); border: 1.5px solid var(--accent-light); background: var(--accent-light); }
@media (hover: hover) and (pointer: fine) {
  .clear-filters-btn:hover { background: #e0e7ff; border-color: #c7d2fe; }
}

.status-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; white-space: nowrap; padding: 4px 10px 4px 8px; border-radius: 999px; }
.status-live { color: var(--success); background: var(--success-bg); }
.status-removed { color: var(--danger); background: var(--danger-bg); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-live { background: #22c55e; animation: pulse-dot 1.6s ease-in-out infinite; }
.dot-removed { background: #dc2626; }
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); opacity: 1; }
  50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); opacity: 0.6; }
}
.row-removed { opacity: 0.7; }
.row-removed td { background: rgba(220, 38, 38, 0.04); }

/* ==========================================================================
   RESPONSIVE
   --------------------------------------------------------------------------
   Five bands and no others:
     >= 1025px  desktop — untouched, pixel-identical to the pre-change build
     <= 1024px  tablet nudges (16px inputs, narrower wide cells, sane scrollers)
     <=  900px  shell tier — off-canvas drawer, fixed top bar, touch targets
     <=  720px  phone tier — tables become cards, lightbox gets a bottom bar
     <=  400px  small-phone escape hatch

   Everything that assumes JS is running is scoped to `.js-ready`, a class
   dashboard.js puts on <html> on its first line. With scripting off, the
   sidebar simply stacks above the content and every filter grid stays open.

   z-index scale — do not collide:
     .mobile-topbar 70 < .nav-scrim 80 < .sidebar (drawer) 90 < .lightbox 100
   The sticky thead (z-index 5) lives in .table-wrap's own stacking context.
   ========================================================================== */

/* --- Touch feedback. Scoped so a mouse-driven desktop never matches. ------ */
@media (hover: none), (pointer: coarse) {
  button, a, input, select, textarea, .thumb { -webkit-tap-highlight-color: transparent; }
  button, a, label, .thumb { touch-action: manipulation; }
  .nav-item:active, .submenu-item:active, .logout-link:active { background: var(--sidebar-bg-hover); color: #fff; }
  .refresh-btn:active:not(:disabled), .apply-filters-btn:active, .clear-filters-btn:active, .page-btn:active:not(:disabled) { transform: scale(0.98); }
  .thumb:active { transform: scale(0.96); }
  .mobile-nav-toggle:active, .drawer-close:active { background: var(--sidebar-bg-hover); }
}

/* --- Mobile chrome is invisible above the shell breakpoint. --------------- */
.mobile-topbar,
.nav-scrim,
.drawer-close { display: none; }

/* --- .filters-toggle is a <button> that must render exactly like the old
       .filters-header <div> did on desktop. --------------------------------- */
.filters-toggle {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; margin-bottom: 16px; padding: 0;
  background: none; border: none; font: inherit; color: inherit;
  text-align: left; cursor: default;
}
/* `flex: 0 1 auto` reproduces the old .filters-header <div> box exactly; the
   <=900px block switches it to `1 1 auto` so the count pill and chevron get
   pushed to the right edge. */
.filters-toggle-text { flex: 0 1 auto; min-width: 0; }
.filters-toggle-title { display: block; font-size: 14.5px; font-weight: 700; margin-bottom: 3px; color: var(--text-main); }
.filters-toggle .filters-subtitle { display: block; }
.filters-count, .filters-chevron { display: none; }
/* The two .import-panel headers still use the .filters-header structure, so
   those rules stay where they are. */

/* --- Lightbox nav is class-driven now: dashboard.js no longer writes inline
       display, which would have beaten every media query below. ------------- */
.lightbox-nav, .lightbox-counter { display: none; }
.lightbox.is-multi .lightbox-nav { display: flex; }
.lightbox.is-multi .lightbox-counter { display: block; }
.lightbox { overscroll-behavior: contain; }

/* --- Shared body-scroll lock (drawer and lightbox take turns). ------------ */
body.body-locked { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }

/* ======================= TABLET  <= 1024px =============================== */
@media (max-width: 1024px) {
  body { overscroll-behavior-y: none; }

  /* iOS focus-zoom killer. 16px is the exact threshold — 15.9px still zooms.
     1024px covers iPad landscape. Never add maximum-scale/user-scalable=no. */
  .login-card input,
  .filter-field input,
  .filter-field select,
  .import-controls input[type="file"] { font-size: 16px; }
  .login-card input, .filter-field input { -webkit-appearance: none; }

  /* Drops the table's intrinsic minimum from ~1211px to ~1071px. */
  .options-cell { min-width: 180px; max-width: 240px; }
  .desc-cell    { min-width: 160px; max-width: 220px; }

  .table-wrap {
    max-height: 70vh;
    max-height: 70dvh;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .filters-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
  .filter-actions { grid-column: 1 / -1; }

  .refresh-btn:disabled { color: #312e81; }
  .refresh-btn:disabled .icon { color: #312e81; }
}

/* ==================== SHELL + TOUCH  <= 900px =========================== */
@media (max-width: 900px) {

  /* --- No-JS fallback: the sidebar just stacks above the content. --------
     .layout is display:flex, so without turning it into a column the
     full-width sidebar and .content{flex:1} stay side by side and the content
     collapses to a few pixels. */
  .sidebar { position: static; width: 100%; height: auto; overflow-y: visible; }
  html:not(.js-ready) .layout { flex-direction: column; }
  .content { margin-left: 0; padding: 16px 16px 48px; }

  /* --- JS present: fixed top bar. --------------------------------------- */
  .js-ready .mobile-topbar {
    display: flex; align-items: center; gap: 8px;
    position: fixed; inset: 0 0 auto 0;
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 70;
  }
  .mobile-nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; flex-shrink: 0;
    border: none; background: none; border-radius: 10px;
    color: var(--text-main); cursor: pointer;
  }
  .hamburger { display: block; width: 20px; height: 14px; position: relative; }
  .hamburger span {
    position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px;
    background: currentColor; transition: transform .25s ease, opacity .2s ease;
  }
  .hamburger span:nth-child(1) { top: 0; }
  .hamburger span:nth-child(2) { top: 6px; }
  .hamburger span:nth-child(3) { top: 12px; }
  .nav-open .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-open .hamburger span:nth-child(2) { opacity: 0; }
  .nav-open .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .mobile-topbar-title {
    font-size: 16px; font-weight: 800; letter-spacing: -0.02em; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  /* --- JS present: the sidebar becomes an off-canvas drawer. ------------- */
  .js-ready .sidebar {
    position: fixed; top: 0; left: 0;
    width: min(84vw, 300px);
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-100%);
    visibility: hidden;
    z-index: 90;
    transition: transform .28s cubic-bezier(.4, 0, .2, 1), visibility 0s linear .28s;
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
  }
  .js-ready.nav-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    box-shadow: var(--shadow-lg);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1), visibility 0s linear 0s;
  }
  .sidebar-footer { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .js-ready .drawer-close {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; flex-shrink: 0;
    width: 44px; height: 44px; border: none; background: none;
    color: var(--sidebar-text); font-size: 28px; line-height: 1;
    border-radius: 8px; cursor: pointer;
  }
  .js-ready .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 80;
    background: rgba(8, 11, 20, 0.45);
    opacity: 0; pointer-events: none;
    transition: opacity .28s ease;
  }
  .js-ready.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }

  /* A collapsed submenu must leave the tab order and the a11y tree — but only
     when JS is there to reopen it. */
  .js-ready .submenu { visibility: hidden; transition: max-height .25s ease, visibility 0s linear .25s; }
  .js-ready .submenu.open { max-height: 320px; visibility: visible; transition: max-height .25s ease, visibility 0s linear 0s; }
  /* No JS: the disclosure can never be opened, so all five destinations stay
     visible instead of four of them being permanently unreachable. */
  html:not(.js-ready) .submenu { max-height: none; overflow: visible; }
  html:not(.js-ready) .chevron.rotated,
  html:not(.js-ready) #dataMenuBtn .chevron { transform: rotate(90deg); }

  /* --- Touch targets. --------------------------------------------------- */
  .nav-item     { padding: 13px 14px; font-size: 15px; min-height: 48px; }
  .submenu-item { padding: 12px; font-size: 14.5px; min-height: 46px; margin: 4px 0 4px 8px; }
  .logout-link  { padding: 13px 10px; font-size: 14.5px; min-height: 46px; }
  .refresh-btn, .apply-filters-btn, .clear-filters-btn, .page-btn { min-height: 44px; padding: 12px 16px; font-size: 14.5px; }

  /* --- Content shell (JS present: clear the fixed bar). ------------------ */
  .js-ready .content {
    margin-left: 0;
    padding: calc(var(--topbar-h) + env(safe-area-inset-top) + 16px)
             max(16px, env(safe-area-inset-right))
             48px
             max(16px, env(safe-area-inset-left));
  }
  .js-ready .content-header { display: none; }
  .content { overflow-x: clip; }
  .panel, .filters-panel, .import-panel, .filters-grid, .filter-field, .panel-toolbar-title { min-width: 0; }

  /* JS scrolls .table-wrap into view on paging and on collapse-on-apply
     (dashboard.js J10d/J10h) — without this the fixed top bar covers the
     first ~56px of the freshly-scrolled-to content. */
  .js-ready .table-wrap { scroll-margin-top: calc(var(--topbar-h) + env(safe-area-inset-top) + 12px); }

  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

  /* --- Form legibility. -------------------------------------------------- */
  .filter-field input, .filter-field select { padding: 12px 14px; min-height: 46px; border-radius: 10px; }
  .filter-field input::placeholder { color: var(--text-muted); }
  .filter-field label { font-size: 13px; }
  .filter-hint { color: var(--text-muted); font-size: 12px; }
  .filter-field input[type="number"]::-webkit-outer-spin-button,
  .filter-field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .filter-field input[type="number"] { -moz-appearance: textfield; }
  .select-wrap select { padding-right: 40px; }
  .select-wrap::after { border-color: var(--text-muted); width: 9px; height: 9px; right: 16px; }

  /* --- Collapsible filter cards (JS present only). ----------------------- */
  .filters-toggle { align-items: center; margin-bottom: 0; min-height: 44px; cursor: pointer; }
  .filters-toggle-text { flex: 1 1 auto; }
  .filters-panel.filters-open .filters-toggle { margin-bottom: 14px; }
  .filters-panel .filters-subtitle { display: none; }
  .import-panel .filters-subtitle { display: block; font-size: 12.5px; line-height: 1.5; }
  .filters-count {
    display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
    border-radius: 999px; background: var(--accent-light); color: var(--accent);
    font-size: 11.5px; font-weight: 700; white-space: nowrap; flex-shrink: 0;
  }
  .filters-count[hidden] { display: none; }   /* must stay after the rule above */
  .filters-chevron {
    display: inline-flex; width: 16px; height: 16px; flex-shrink: 0;
    color: var(--text-muted); transform: rotate(90deg); transition: transform .2s ease;
  }
  .filters-panel.filters-open .filters-chevron { transform: rotate(-90deg); }
  .js-ready .filters-panel:not(.filters-open) .filters-grid { display: none; }

  /* --- Login. ------------------------------------------------------------ */
  .login-body::before, .login-body::after { display: none; }  /* the 520px blur(120px) blobs */
  .login-body {
    overflow: visible;                                        /* overflow:hidden killed scrolling */
    padding: 24px max(16px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background:
      radial-gradient(560px 560px at -40px -100px, rgba(79, 70, 229, .38), rgba(79, 70, 229, 0) 70%),
      radial-gradient(560px 560px at calc(100% + 40px) calc(100% + 120px), rgba(14, 165, 233, .38), rgba(14, 165, 233, 0) 70%),
      linear-gradient(160deg, #0b1120 0%, #131b30 45%, #1b2340 100%);
  }
  .login-card input { padding: 13px 14px; min-height: 48px; }
  .login-card .input-wrap input#password { padding-right: 52px; }
  .login-card button[type="submit"] { min-height: 48px; font-size: 16px; margin-top: 24px; }
  .login-card label { font-size: 12.5px; }
  .toggle-password { width: 44px; height: 44px; right: 2px; border-radius: 10px; }
}

/* ======================== PHONE  <= 720px =============================== */
@media (max-width: 720px) {
  .content-header h2 { font-size: 19px; }
  .login-card { padding: 34px 26px; }

  .js-ready .content { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); padding-bottom: 56px; }
  .content { padding-left: 14px; padding-right: 14px; }
  .panel { padding: 16px 14px; border-radius: 14px; }
  #panel-dashboard { background: transparent; border: 0; box-shadow: none; padding: 0; }
  .stats-grid { gap: 10px; }
  .stat-card { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .stat-icon { width: 38px; height: 38px; }
  .stat-icon svg { width: 19px; height: 19px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 10.5px; letter-spacing: .03em; }

  .panel-toolbar { align-items: flex-start; gap: 12px; margin-bottom: 12px; }
  .panel-toolbar-title { align-items: flex-start; gap: 10px; }
  .panel-toolbar-title h3 { font-size: 15px; line-height: 1.35; }
  .panel-toolbar .icon-badge { width: 32px; height: 32px; border-radius: 9px; }
  .refresh-btn { width: 100%; justify-content: center; }

  .filters-panel { padding: 14px; margin-bottom: 16px; }
  .filters-grid { grid-template-columns: 1fr; gap: 12px; }
  .filter-actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .filter-actions > button { flex: 1 1 auto; justify-content: center; }

  .import-panel { padding: 14px; margin-bottom: 16px; }
  .import-panel-header { gap: 10px; }
  .import-controls { gap: 10px; }
  .import-controls input[type="file"] { flex: 1 1 100%; width: 100%; max-width: 100%; min-width: 0; }
  .import-controls input[type="file"]::file-selector-button { min-height: 44px; padding: 12px 16px; font-size: 14px; margin-right: 10px; }
  .import-controls .apply-filters-btn { width: 100%; justify-content: center; }
  .import-panel .status-text { font-size: 13px; }

  /* --- The ten-column table becomes a list of cards. --------------------- */
  .table-wrap { max-height: none; overflow: visible; border: 0; border-radius: 0; background: transparent; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: auto; }
  .table-wrap thead { display: none; }   /* neutralises the sticky header */

  .table-wrap tbody { display: grid; gap: 12px; }
  .table-wrap tbody tr {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 12px; row-gap: 6px; align-items: start;
    position: relative; padding: 14px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--card-bg); box-shadow: var(--shadow-sm);
  }
  /* Zebra/hover paint the td, not the tr — undo them or the fill bleeds past
     the card's rounded corner. The .table-wrap prefix outranks the originals. */
  .table-wrap tbody tr:nth-child(even) td,
  .table-wrap tbody tr:hover td,
  .table-wrap tbody tr.row-removed:hover td { background: transparent; }
  .table-wrap tbody tr.row-removed { opacity: 1; background: var(--danger-bg); border-color: #fecaca; }

  /* (0,1,1) — beats `th, td` (0,0,1) and .options-cell/.desc-cell (0,1,0).
     Without it, min-width:180px survives display:block and overflows. */
  .table-wrap td {
    border: 0; padding: 0; min-width: 0; max-width: none;
    font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere;
  }
  .table-wrap td::before {
    content: attr(data-label);
    display: block; margin-bottom: 2px;
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em;
    text-transform: uppercase; color: var(--text-faint);
  }

  /* Every per-cell rule below is written as `.table-wrap td.cell-*` (0,2,1) so
     it outranks the `.table-wrap td` / `.table-wrap td::before` resets above,
     which would otherwise win on specificity and flatten font-size, padding
     and the ::before suppressions back to the generic card values. */
  .table-wrap td.cell-image    { grid-column: 1; grid-row: 1 / span 2; }
  .table-wrap td.cell-title    { grid-column: 2 / -1; grid-row: 1; }
  .table-wrap td.cell-price    { grid-column: 2 / -1; grid-row: 2; }
  .table-wrap td.cell-location { grid-column: 1 / span 2; grid-row: 3; }
  .table-wrap td.cell-posted   { grid-column: 3; grid-row: 3; }
  .table-wrap td.cell-options  { grid-column: 1 / -1; grid-row: 4; }
  .table-wrap td.cell-desc     { grid-column: 1 / -1; grid-row: 5; }
  .table-wrap td.cell-seller   { grid-column: 1 / -1; grid-row: 6; }
  .table-wrap td.cell-link     { grid-column: 1 / -1; grid-row: 7; }

  .table-wrap td.cell-image::before { content: none; }
  .table-wrap .cell-image .thumb { width: 76px; height: 76px; border-radius: 10px; }
  .table-wrap .cell-image .muted {
    display: flex; align-items: center; justify-content: center;
    width: 76px; height: 76px; border: 1px dashed var(--border);
    border-radius: 10px; font-size: 10.5px; text-align: center; line-height: 1.2;
  }

  .table-wrap td.cell-title {
    /* Reserves real space for the two-line status pill (badge + "Since ..."
       date), measured up to ~110px wide / 39px tall — 126px/118px below give
       it headroom so long dates/badge text can never run under the title. */
    padding-right: 126px;   /* clears the absolutely-placed status pill */
    font-size: 15px; font-weight: 700; line-height: 1.3; color: var(--text-main);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  .table-wrap td.cell-title::before { content: none; }
  .table-wrap td.cell-price { font-size: 15px; font-weight: 800; color: var(--accent); }
  .table-wrap td.cell-price::before { content: none; }
  /* No price to show: hide the placeholder entirely instead of a bare,
     unlabeled accent-coloured dash floating under the title. */
  .table-wrap td.cell-price .muted { display: none; }

  .table-wrap td.cell-status { position: absolute; top: 12px; right: 12px; max-width: 118px; text-align: right; font-size: 11px; }
  .table-wrap td.cell-status::before { content: none; }
  .table-wrap .cell-status .status-badge { font-size: 11px; padding: 3px 8px 3px 6px; }
  .table-wrap .cell-status .muted { display: block; margin-top: 2px; font-size: 10.5px; }

  .table-wrap td.cell-location,
  .table-wrap td.cell-posted { font-size: 12.5px; color: var(--text-muted); }
  .table-wrap td.cell-location::before,
  .table-wrap td.cell-posted::before { display: inline; margin: 0 4px 0 0; font-size: 10px; }

  .table-wrap td.cell-options,
  .table-wrap td.cell-desc {
    min-width: 0; max-width: none;
    font-size: 12.5px; color: var(--text-muted); cursor: pointer;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  .table-wrap td.cell-options::before,
  .table-wrap td.cell-desc::before { display: inline; margin: 0 4px 0 0; }
  .table-wrap td.cell-options.is-expanded,
  .table-wrap td.cell-desc.is-expanded { display: block; -webkit-line-clamp: unset; overflow: visible; }

  .table-wrap td.cell-seller { font-size: 12.5px; }
  .table-wrap .cell-seller a { display: inline-flex; align-items: center; min-height: 44px; padding: 12px 0; }

  .table-wrap td.cell-link::before { content: none; }
  .table-wrap .cell-link a {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 14px;
    border: 1.5px solid var(--accent-light); border-radius: var(--radius-sm);
    background: var(--accent-light); font-size: 13.5px;
  }
  .table-wrap .cell-link .muted { display: none; }

  /* The empty row is a single full-width <td>, so the card chrome applied to
     `.table-wrap tbody tr` (0,1,2) has to be undone at equal-or-higher weight
     — otherwise the dashed box would sit inside a second, solid card. */
  .table-wrap tbody tr.empty-state-row {
    display: block; padding: 0; border: 0; border-radius: 0;
    background: transparent; box-shadow: none;
  }
  .table-wrap .empty-state-row td.empty-row {
    display: block; border: 1px dashed var(--border); border-radius: var(--radius);
    background: var(--card-bg); padding: 28px 18px; text-align: center;
  }
  .table-wrap .empty-state-row td.empty-row::before { content: none; }

  /* --- Pagination. ------------------------------------------------------- */
  .pagination { gap: 10px; margin-top: 12px; padding-top: 12px; }
  .pagination-info { width: 100%; text-align: center; font-size: 13px; }
  .pagination-controls { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
  .page-btn { width: 100%; justify-content: center; padding: 12px 10px; }
  .page-indicator { min-width: 0; font-size: 13px; }

  /* --- Lightbox: nav moves off the photo into a bottom bar. -------------- */
  .lightbox { padding: 0; backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(8, 11, 20, .94); }
  .lightbox img {
    max-width: 100vw; width: 100%;
    max-height: none;
    height: calc(100vh - 176px);
    height: calc(100dvh - 176px);
    object-fit: contain; border-radius: 0; box-shadow: none;
  }
  .lightbox.is-multi .lightbox-nav {
    top: auto; transform: none;
    bottom: calc(20px + env(safe-area-inset-bottom));
    width: 56px; height: 56px; background: rgba(255, 255, 255, .20);
  }
  .lightbox-prev { left: 20px; }
  .lightbox-next { right: 20px; }
  .lightbox-counter { bottom: calc(40px + env(safe-area-inset-bottom)); }
  .lightbox-close {
    display: flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    top: calc(12px + env(safe-area-inset-top)); right: 12px;
    font-size: 32px; border-radius: 50%; background: rgba(255, 255, 255, .14);
  }
}

/* ===================== SMALL PHONE  <= 400px ============================ */
@media (max-width: 400px) {
  .filter-actions .icon { display: none; }
  .content { padding-left: 10px; padding-right: 10px; padding-bottom: 48px; }
  .js-ready .content { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  .panel { padding: 14px 12px; }
}

/* ============= SHORT VIEWPORT (login in phone landscape) ================ */
@media (max-height: 620px) {
  .login-body { align-items: flex-start; overflow-y: auto; }
  .login-card { padding: 24px 22px; }
  .login-card .subtitle { margin-bottom: 16px; }
  .login-card label { margin-top: 12px; }
  .login-card button[type="submit"] { margin-top: 18px; }
  .login-hint { margin-top: 16px; padding-top: 12px; }
}

/* ========================= REDUCED MOTION =============================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .sidebar, .nav-scrim, .hamburger span, .submenu { transition: none !important; }
  .dot-live { animation: none; }
}
@media (pointer: coarse) {
  .dot-live { animation: none; }               /* up to 100 box-shadow paints at once */
  .refresh-btn:disabled .icon { animation: none; }
}
