/* ============================================================
   Gemini Jio Scanner — Admin UI (dark theme, Tabler icons)
   Design system matched from Screenshot_4.png:
     bg        #1d1d1f   surface  #26262a / #313033
     accent    #6663FC   text     #e8e8ea / #9b9ba3
   Responsive breakpoints per Responsive.md:
     xs 0-575 | sm 576-767 | md 768-991 | lg 992-1199 | xl 1200-1399 | xxl 1400+
   ============================================================ */

:root {
  --accent: #6663fc;
  --accent-soft: rgba(102, 99, 252, .14);
  --accent-dark: #5755e0;
  --bg: #1d1d1f;
  --bg-elev: #242427;
  --card: #26262a;
  --card-2: #2e2e33;
  --card-3: #313033;
  --hover: #34343a;
  --text: #e8e8ea;
  --text-soft: #9b9ba3;
  --text-dim: #6f6f77;
  --border: #35353b;
  --border-soft: #2e2e34;
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, .13);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, .13);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, .13);
  --teal: #2dd4bf;
  --teal-soft: rgba(45, 212, 191, .13);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 20px rgba(0, 0, 0, .28);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, .4), 0 14px 36px rgba(0, 0, 0, .42);
  --trans: all .22s cubic-bezier(.4, 0, .2, 1);
  /* spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;
  /* container widths (Responsive.md) */
  --container-sm: 640px; --container-md: 768px; --container-lg: 1024px;
  --container-xl: 1280px; --container-2xl: 1536px;
  --sidebar-w: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Tabler icons ---------- */
.ti { font-size: 18px; line-height: 1; vertical-align: -2px; }
.btn .ti, .nav-link .ti, .copy-mini .ti { font-size: 16px; }

.hidden { display: none !important; }
.muted { color: var(--text-soft); font-weight: 400; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border: none; border-radius: 9px;
  font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  color: #fff; background: var(--accent);
  transition: var(--trans);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  white-space: nowrap;
}
.btn:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-success { background: #2f9e5f; }
.btn-success:hover { background: #278951; }
.btn-warn { background: #b8860b; }
.btn-warn:hover { background: #a3760a; }
.btn-danger { background: #c4443c; }
.btn-danger:hover { background: #ab3a33; }
.btn-ghost {
  background: transparent; color: var(--text-soft); border: 1px solid var(--border);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--card-3); color: var(--text); transform: none; }
.btn-ghost-dark {
  background: var(--card-2); color: var(--text); border: 1px solid var(--border); box-shadow: none;
}
.btn-ghost-dark:hover { background: var(--hover); transform: translateY(-1px); }
.btn-block { width: 100%; }
.btn-xs { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-xs .ti { font-size: 14px; }

/* ---------- inputs ---------- */
.input-wrap {
  position: relative; display: flex; align-items: center;
}
.input-wrap .ti {
  position: absolute; left: 12px; color: var(--text-dim); font-size: 16px;
  pointer-events: none;
}
.input-wrap input {
  width: 100%; padding: 10px 13px 10px 36px;
  border: 1.5px solid var(--border); border-radius: 9px;
  font-size: 13.5px; font-family: inherit; outline: none; transition: var(--trans);
  background: var(--bg-elev); color: var(--text);
}
.input-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(102, 99, 252, .16), transparent 60%),
              var(--bg);
  padding: var(--sp-6);
}
.login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: var(--sp-8) var(--sp-7) var(--sp-6);
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-hover);
  animation: rise .45s cubic-bezier(.4, 0, .2, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo { text-align: center; margin-bottom: var(--sp-7); }
.login-logo h1 { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-top: var(--sp-3); }
.login-logo p { color: var(--text-soft); font-size: 13px; margin-top: var(--sp-1); }
.logo-badge {
  width: 52px; height: 52px; margin: 0 auto; border-radius: 14px;
  background: linear-gradient(135deg, #8b89ff, #6663fc);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(102, 99, 252, .4);
}
.logo-badge .ti { font-size: 26px; vertical-align: 0; }
.logo-badge.small { width: 38px; height: 38px; border-radius: 10px; margin: 0; }
.logo-badge.small .ti { font-size: 19px; }
.login-form .login-field { margin-bottom: var(--sp-4); }
.login-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: var(--sp-2); }
.form-error {
  margin-top: var(--sp-3); padding: 9px 12px; border-radius: 8px; background: var(--red-soft);
  color: var(--red); font-size: 13px; font-weight: 500;
}

/* ---------- app layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  flex-shrink: 0;
}
.sidebar-head {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.sidebar-title strong { display: block; font-size: 15px; font-weight: 700; }
.sidebar-title span { font-size: 11.5px; color: var(--text-soft); }
.nav { flex: 1; padding: var(--sp-4) var(--sp-3); display: flex; flex-direction: column; gap: 3px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 11px var(--sp-3);
  border-radius: 9px; color: var(--text-soft); text-decoration: none;
  font-weight: 600; font-size: 13.5px; transition: var(--trans);
  position: relative;
}
.nav-link .ti { font-size: 18px; width: 20px; text-align: center; }
.nav-link:hover { background: var(--card-3); color: var(--text); transform: translateX(2px); }
.nav-link.active { background: var(--accent-soft); color: #c9c8ff; }
.nav-link.active::before {
  content: ''; position: absolute; left: -12px; top: 18%; bottom: 18%; width: 3px;
  border-radius: 3px; background: var(--accent);
}
.nav-badge {
  margin-left: auto; background: var(--card-3); color: var(--text-soft);
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
  transition: var(--trans);
}
.nav-badge.accent { background: var(--accent); color: #fff; }
.sidebar-foot { padding: var(--sp-4); border-top: 1px solid var(--border); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px var(--sp-3); border-radius: 9px; background: transparent;
  border: 1px solid var(--border); color: var(--text-soft);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--trans);
}
.btn-ghost:hover { background: var(--card-3); color: var(--text); }

/* ---------- main container ---------- */
.main {
  flex: 1; padding: var(--sp-7) var(--sp-6) var(--sp-8);
  width: 100%;
  max-width: var(--container-2xl);
}
/* xxl: keep readable width */
@media (min-width: 1536px) { .main { max-width: var(--container-2xl); } }
@media (min-width: 1280px) and (max-width: 1535px) { .main { max-width: var(--container-xl); } }

/* ---------- views ---------- */
.view { display: none; animation: fadein .3s ease; }
.view.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-6); flex-wrap: wrap;
}
.page-title h2 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.page-title .sub { color: var(--text-soft); margin-top: 2px; font-size: 13.5px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.scan-status-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-radius: 99px; background: var(--card-3); font-size: 13px; font-weight: 700;
  color: var(--text-soft); text-transform: capitalize;
  transition: var(--trans);
}
.scan-status-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #6f6f77;
  transition: var(--trans);
}
.scan-status-pill.running { background: var(--green-soft); color: #86efac; }
.scan-status-pill.running .dot { background: var(--green); animation: pulse 1.4s infinite; }
.scan-status-pill.paused { background: var(--amber-soft); color: #fcd34d; }
.scan-status-pill.paused .dot { background: var(--amber); }
.scan-status-pill.stopped { background: var(--red-soft); color: #fca5a5; }
.scan-status-pill.stopped .dot { background: var(--red); }
.scan-status-pill.done { background: var(--teal-soft); color: #5eead4; }
.scan-status-pill.done .dot { background: var(--teal); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: var(--sp-5);
  margin-bottom: var(--sp-5);
  transition: var(--trans);
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.card-head h3 {
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.card-head h3 .ti { color: var(--accent); }

/* ---------- control card ---------- */
.control-card { border-left: 3px solid var(--accent); }
.control-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.control-info h3 {
  font-size: 15.5px; font-weight: 700; margin-bottom: var(--sp-1);
  display: flex; align-items: center; gap: 8px;
}
.control-info h3 .ti { color: var(--accent); }
.control-info p { color: var(--text-soft); font-size: 13px; }
.control-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4); margin-bottom: var(--sp-5);
}
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-5); display: flex; align-items: center; gap: var(--sp-4);
  box-shadow: var(--shadow); transition: var(--trans);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--accent-soft); }
.stat-ico {
  width: 44px; height: 44px; border-radius: 11px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-ico .ti { font-size: 21px; vertical-align: 0; }
.stat-ico.blue { background: var(--accent-soft); color: #a5a3ff; }
.stat-ico.teal { background: var(--teal-soft); color: var(--teal); }
.stat-ico.green { background: var(--green-soft); color: var(--green); }
.stat-ico.orange { background: var(--amber-soft); color: var(--amber); }
.stat-ico.gray { background: var(--card-3); color: var(--text-soft); }
.stat-num { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.stat-label { color: var(--text-soft); font-size: 12.5px; margin-top: 2px; }

/* ---------- progress ---------- */
.progress-track {
  height: 10px; background: var(--card-3); border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #8b89ff, #6663fc);
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}
.progress-meta {
  display: flex; justify-content: space-between; margin-top: 10px;
  font-size: 13px; color: var(--text-soft); gap: var(--sp-3); flex-wrap: wrap;
}
.progress-meta #progressCurrent { color: var(--text); font-weight: 600; }

/* ---------- log ---------- */
.log-box {
  background: #131316; color: #b6b6bd; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px;
  font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Code', monospace;
  font-size: 12px; line-height: 1.7; max-height: 320px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.log-box .log-ok { color: #6ee7a0; }
.log-box .log-err { color: #fca5a5; }
.log-box .log-info { color: #a5b4fc; }

/* ---------- forms ---------- */
.panel-form { margin-top: var(--sp-1); }
.form-grid { display: grid; grid-template-columns: 1fr 2fr; gap: var(--sp-4); }
.form-field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 9px;
  font-size: 13.5px; font-family: inherit; outline: none; transition: var(--trans);
  background: var(--bg-elev); color: var(--text);
}
.form-field textarea { resize: vertical; min-height: 120px; font-family: ui-monospace, monospace; font-size: 12.5px; line-height: 1.6; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.form-field.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; margin-top: var(--sp-4); }
.bulk-hint { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; }

/* segmented control */
.seg {
  display: inline-flex; background: var(--card-3); border: 1px solid var(--border);
  border-radius: 9px; padding: 3px; gap: 2px;
}
.seg-btn {
  border: none; background: transparent; color: var(--text-soft);
  font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  padding: 5px 12px; border-radius: 7px; transition: var(--trans);
  display: inline-flex; align-items: center; gap: 5px;
}
.seg-btn .ti { font-size: 14px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent); color: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-soft); padding: 11px var(--sp-3);
  border-bottom: 1px solid var(--border); background: var(--card-2); white-space: nowrap;
}
.table td {
  padding: 12px var(--sp-3); border-bottom: 1px solid var(--border-soft); font-size: 13px;
  vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis;
}
.table tbody tr { transition: var(--trans); }
.table tbody tr:hover { background: var(--bg-elev); }
.table tbody tr:last-child td { border-bottom: none; }
.ta-right { text-align: right; }
.col-check { width: 40px; }
.col-status { width: 100px; }
.col-num { width: 90px; }
.col-date { width: 160px; }
.col-actions { width: 150px; }
/* name/source cell: fixed layout with ellipsis */
.cell-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cell-name .p-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-name .p-src { display: block; color: var(--text-dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-cell {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; color: #a5b4fc; text-decoration: none; font-size: 12.5px;
}
a.link-cell:hover { text-decoration: underline; color: #c7d2fe; }
.copy-mini {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; font-size: 11.5px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--card-2); color: var(--text-soft); cursor: pointer; font-weight: 600;
  transition: var(--trans);
}
.copy-mini .ti { font-size: 14px; }
.copy-mini:hover { background: var(--accent-soft); color: #c9c8ff; border-color: var(--accent); }
.copy-mini.danger:hover { background: var(--red-soft); color: #fca5a5; border-color: var(--red); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* status badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.badge .ti { font-size: 13px; }
.badge.fresh { background: var(--green-soft); color: #86efac; }
.badge.stale { background: var(--amber-soft); color: #fcd34d; }
.badge.unknown { background: var(--card-3); color: var(--text-soft); }
.badge.online { background: var(--green-soft); color: #86efac; }
.badge.offline { background: var(--card-3); color: var(--text-dim); }
.badge.enabled { background: var(--accent-soft); color: #c9c8ff; }
.badge.disabled { background: var(--card-3); color: var(--text-dim); }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: #4b4b52; border-radius: 99px;
  cursor: pointer; transition: var(--trans);
}
.switch .slider::before {
  content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: var(--trans);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---------- filters ---------- */
.filter-card { border-left: 3px solid var(--teal); }
.filter-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
  gap: var(--sp-3); align-items: end;
}
.filter-field.grow { min-width: 0; }
.filter-field label { display: block; font-size: 11.5px; font-weight: 600; margin-bottom: 5px; color: var(--text-soft); }
.filter-field input, .filter-field select {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; outline: none; transition: var(--trans);
  background: var(--bg-elev); color: var(--text);
}
.filter-field input:focus, .filter-field select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.filter-actions { display: flex; gap: 8px; }
.panel-filterbar {
  display: flex; gap: 10px; align-items: center; margin-bottom: var(--sp-3); flex-wrap: wrap;
}
.panel-filterbar .filter-field { min-width: 140px; flex: 1; }
.panel-filterbar .filter-field.grow { flex: 2; }
.panel-filterbar input, .panel-filterbar select {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; outline: none; transition: var(--trans);
  background: var(--bg-elev); color: var(--text);
}
.panel-filterbar input:focus, .panel-filterbar select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: var(--sp-3); }
.chip {
  padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--card-3); color: var(--text-soft); transition: var(--trans);
  display: inline-flex; align-items: center; gap: 5px;
}
.chip .ti { font-size: 13px; }
.chip:hover { background: var(--hover); }

/* ---------- pagination ---------- */
.pagination { display: flex; gap: 6px; margin-top: var(--sp-4); justify-content: flex-end; flex-wrap: wrap; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card-2); font-size: 12.5px; font-weight: 600; color: var(--text-soft); cursor: pointer;
  transition: var(--trans);
}
.page-btn:hover { background: var(--hover); color: var(--text); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: var(--sp-6); left: 50%; transform: translateX(-50%) translateY(8px);
  background: #2e2e33; border: 1px solid var(--border); color: var(--text);
  padding: 11px 22px; border-radius: 11px;
  font-size: 13.5px; font-weight: 600; z-index: 1000; opacity: 0;
  transition: var(--trans); pointer-events: none; max-width: 90vw; text-align: center;
  box-shadow: var(--shadow-hover);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: rgba(74, 222, 128, .4); color: #86efac; }
.toast.error { border-color: rgba(248, 113, 113, .4); color: #fca5a5; }

/* empty state */
.empty-row td { text-align: center; padding: 34px 12px; color: var(--text-soft); font-size: 13px; }

/* ============================================================
   RESPONSIVE — Responsive.md breakpoints
   ============================================================ */

/* ---------- lg (992-1199) ---------- */
@media (max-width: 1199px) {
  .filter-grid { grid-template-columns: 1fr 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.span-2 { grid-column: span 1; }
  .col-date { width: 140px; }
}

/* ---------- md (768-991) ---------- */
@media (max-width: 991px) {
  .sidebar { width: 72px; }
  .sidebar-title, .nav-link span:not(.ti), .nav-badge, .sidebar-foot .btn-ghost span { display: none; }
  .sidebar-head { justify-content: center; padding: var(--sp-4) var(--sp-2); }
  .nav-link { justify-content: center; padding: 12px; }
  .nav-link .ti { width: auto; }
  .nav-link.active::before { left: -12px; }
  .main { padding: var(--sp-5) var(--sp-4) var(--sp-7); }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

/* ---------- sm (576-767) ---------- */
@media (max-width: 767px) {
  .page-head { flex-direction: column; align-items: stretch; gap: var(--sp-3); }
  .page-head .scan-status-pill { align-self: flex-start; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .control-row { flex-direction: column; align-items: stretch; }
  .control-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .control-btns .btn { width: 100%; }
  .panel-filterbar { flex-direction: column; align-items: stretch; }
  .panel-filterbar .filter-field { min-width: 0; }
  .panel-filterbar .btn { flex: 1; }
  .card { padding: var(--sp-4); }
  .table th, .table td { padding: 10px 10px; }
  .col-date { display: none; }
  .col-status { width: 84px; }
}

/* ---------- xs (0-575) ---------- */
@media (max-width: 575px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 50;
    flex-direction: row; align-items: center; padding: 0 var(--sp-3);
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .sidebar-head { border-bottom: none; padding: var(--sp-2) 0; }
  .sidebar-title { display: none; }
  .nav { flex-direction: row; padding: 0; margin-left: auto; gap: 4px; }
  .nav-link { padding: 10px; }
  .nav-link.active::before { display: none; }
  .nav-link.active { border-radius: 9px; }
  .sidebar-foot { display: none; }
  .main { padding: var(--sp-4) var(--sp-3) var(--sp-7); }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  .stat-card { padding: var(--sp-3); gap: var(--sp-3); }
  .stat-ico { width: 38px; height: 38px; }
  .stat-ico .ti { font-size: 18px; }
  .stat-num { font-size: 20px; }
  .filter-grid { grid-template-columns: 1fr; }
  .filter-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-actions .btn { width: 100%; }
  .head-actions { flex-direction: column; }
  .head-actions .btn { width: 100%; }
  .control-btns { grid-template-columns: 1fr 1fr; }
  .toast { width: calc(100vw - 32px); }
  .cell-name .p-src { display: none; }
}
