/* ─────────────────────────────────────────
   CITATION TOLL AGENT — Premium Design System
   Font: Inter (Google Fonts)
   Mode: Light, glassmorphic, polished
───────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&display=swap');

/* ── Tokens ── */
:root {
  --blue-50:  hsl(213, 100%, 97%);
  --blue-100: hsl(214, 95%, 93%);
  --blue-500: hsl(217, 91%, 60%);
  --blue-600: hsl(221, 83%, 53%);
  --blue-700: hsl(224, 76%, 48%);

  --purple-400: hsl(262, 83%, 68%);
  --purple-600: hsl(265, 89%, 58%);

  --green-500: hsl(160, 84%, 39%);
  --green-50:  hsl(152, 76%, 96%);

  --amber-500: hsl(38, 92%, 50%);
  --red-500:   hsl(4, 86%, 58%);

  --gray-50:  hsl(210, 40%, 98%);
  --gray-100: hsl(210, 40%, 96%);
  --gray-200: hsl(214, 32%, 91%);
  --gray-300: hsl(213, 27%, 84%);
  --gray-400: hsl(215, 20%, 65%);
  --gray-500: hsl(215, 16%, 47%);
  --gray-600: hsl(215, 19%, 35%);
  --gray-700: hsl(215, 25%, 27%);
  --gray-900: hsl(222, 47%, 11%);

  --bg:        var(--gray-50);
  --surface:   #ffffff;
  --border:    var(--gray-200);
  --text:      var(--gray-900);
  --muted:     var(--gray-500);
  --accent:    var(--blue-600);
  --accent-2:  var(--purple-600);
  --success:   var(--green-500);
  --danger:    var(--red-500);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'Menlo', 'Consolas', monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  --sidebar-w: 272px;
  --topbar-h:  72px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 16px 40px rgba(0,0,0,.06);
  --shadow-accent: 0 8px 24px hsla(221,83%,53%,.22);
}

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

html { font-size: 16px; }

body {
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 20% 0%, hsla(217,91%,80%,.18) 0%, transparent 60%),
    radial-gradient(circle at 80% 100%, hsla(265,89%,80%,.12) 0%, transparent 60%);
}

/* ── Layout ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  overflow-y: auto;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--blue-600), var(--purple-600));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.logo-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--blue-50);
  padding: 1px 7px;
  border-radius: var(--r-sm);
  letter-spacing: 0.02em;
  width: fit-content;
}

/* ── Nav ── */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 140ms ease;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--gray-100);
  color: var(--text);
}

.nav-item.active {
  background: var(--blue-50);
  color: var(--accent);
  font-weight: 600;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

/* ── Publisher Card ── */
.publisher-card {
  margin-top: auto;
  background: linear-gradient(145deg, var(--blue-50), hsl(265,100%,98%));
  border: 1px solid var(--blue-100);
  border-radius: var(--r-lg);
  padding: 16px;
}

.publisher-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}

.publisher-icon {
  font-size: 1.25rem;
  margin-top: 1px;
}

.publisher-card-header h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.publisher-card-header p {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.input-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: 0.01em;
}

.input-field {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.input-field::placeholder { color: var(--gray-400); }

.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsla(221,83%,53%,.12);
}

.btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: linear-gradient(135deg, var(--blue-600), var(--purple-600));
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 160ms ease;
  box-shadow: var(--shadow-accent);
  margin-top: 4px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px hsla(221,83%,53%,.32);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

#signup-status {
  font-size: 0.775rem;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  display: none;
  font-weight: 500;
}

#signup-status.success {
  background: var(--green-50);
  color: var(--green-500);
  display: block;
}

#signup-status.error {
  background: hsl(4,86%,97%);
  color: var(--red-500);
  display: block;
}

/* ✨ Main Content ✨ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: var(--bg);
}

/* ✨ Top Bar ✨ */
.topbar {
  height: var(--topbar-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 250, 250, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
  gap: 16px;
}

.topbar h1 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 1px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  background: var(--green-50);
  border: 1px solid hsla(160,84%,39%,.2);
  padding: 5px 11px;
  border-radius: var(--r-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.live-dot.small {
  width: 6px;
  height: 6px;
  display: inline-block;
  margin-right: 5px;
  vertical-align: middle;
}

.btn-outline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 140ms ease;
}

.btn-outline:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

.btn-primary-sm {
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--blue-50);
  border: 1px solid hsla(221,83%,53%,.2);
  padding: 7px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 140ms ease;
}

.btn-primary-sm:hover {
  background: var(--blue-100);
  border-color: hsla(221,83%,53%,.4);
}

/* ✨ Content Sections ✨ */
.content-section {
  display: none;
  flex: 1;
  min-height: 0; /* Required to allow scrolling in flex column */
  padding: 24px 28px;
  flex-direction: column;
  gap: 20px;
}

.content-section.active {
  display: flex;
}


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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 160ms ease, transform 160ms ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-change {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.stat-change.positive { color: var(--success); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.badge {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--success);
  background: var(--green-50);
  border: 1px solid hsla(160,84%,39%,.2);
  padding: 3px 9px;
  border-radius: var(--r-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Activity Feed ── */
.activity-feed {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
  animation: fadeIn 0.35s ease forwards;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 7px;
  flex-shrink: 0;
}

.activity-dot.green { background: var(--success); }
.activity-dot.purple { background: var(--purple-600); }

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-body strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.activity-body span {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ── Data Table ── */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  padding: 11px 24px;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 24px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--gray-50); }

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 40px 24px !important;
  font-size: 0.875rem;
}

.price-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--success);
  background: var(--green-50);
  padding: 3px 10px;
  border-radius: var(--r-sm);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--success);
  background: var(--green-50);
  border: 1px solid hsla(160,84%,39%,.2);
  padding: 3px 9px;
  border-radius: var(--r-sm);
  letter-spacing: 0.03em;
}

.wallet-mono {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: var(--r-sm);
}

/* ── Agent Logs ── */
.logs-feed {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

.log-item {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  animation: fadeIn 0.35s ease forwards;
}

.log-item.increase { border-left: 3px solid var(--success); }
.log-item.decrease { border-left: 3px solid var(--red-500); }
.log-item.buyer    { border-left: 3px solid var(--purple-600); }

.log-icon {
  font-size: 1rem;
  margin-top: 1px;
  flex-shrink: 0;
}

.log-body strong {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 3px;
}

.log-body span {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
  width: 100%;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gray-900);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  transform: translateY(16px);
  opacity: 0;
  transition: all 220ms ease;
  z-index: 100;
  pointer-events: none;
  max-width: 360px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── Animations ── */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.9); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─────────────────────────────────────────
   MOBILE RESPONSIVENESS
   Breakpoints: 768px (tablet), 480px (phone)
───────────────────────────────────────── */

/* ── Hamburger Button (hidden on desktop) ── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  padding: 6px;
  transition: background 120ms ease;
}
.hamburger:hover { background: var(--gray-100); }
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--gray-600);
  border-radius: 2px;
  transition: all 200ms ease;
}

/* ── Sidebar Close Button (hidden on desktop) ── */
.sidebar-close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  line-height: 1;
  transition: color 120ms ease;
}
.sidebar-close:hover { color: var(--text); }

/* ── Sidebar Overlay (mobile backdrop) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
  opacity: 0;
  transition: opacity 220ms ease;
}
.sidebar-overlay.active {
  opacity: 1;
}

/* ── Topbar Left ── */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── btn-label-short (hidden on desktop, shown on mobile) ── */
.btn-label-short { display: none; }

/* ── Tablet (≤ 900px): shrink sidebar ── */
@media (max-width: 900px) {
  :root { --sidebar-w: 240px; }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Mobile (≤ 768px): slide-over sidebar ── */
@media (max-width: 768px) {
  /* Show hamburger & close button */
  .hamburger       { display: flex; }
  .sidebar-close   { display: block; }
  .sidebar-overlay { display: block; }

  /* Sidebar becomes fixed slide-over panel */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: min(var(--sidebar-w), 85vw);
    z-index: 100;
    transform: translateX(-110%);
    transition: transform 240ms cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-md);
  }

  /* Open state toggled by JS */
  .sidebar.open {
    transform: translateX(0);
  }

  /* App shell stops being flex side-by-side */
  .app-shell {
    flex-direction: column;
  }

  /* Main content: fills remaining space, content-section handles scrolling */
  .main-content {
    width: 100%;
    flex: 1;
    min-height: 0; 
  }

  /* Content sections inherit scrolling from desktop base styles */
  .content-section {
    padding: 14px;
    gap: 14px;
  }

  /* Topbar compact */
  .topbar {
    padding: 10px 14px;
    height: auto;
    min-height: 56px;
    flex-wrap: nowrap;
    justify-content: space-between;
    flex-shrink: 0;
  }

  /* Hide full-text button labels, show short versions */
  .btn-label       { display: none; }
  .btn-label-short { display: inline; }

  /* Stats: 2-column always on mobile */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Stat card: compact horizontal */
  .stat-card {
    padding: 12px;
    gap: 10px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .stat-value {
    font-size: 1.4rem;
  }

  /* Publisher card normal flow */
  .publisher-card {
    margin-top: 12px;
  }

  /* Table: hide wallet column, keep title + price + status */
  .data-table th:nth-child(3),
  .data-table td:nth-child(3) {
    display: none;
  }

  /* Table scrollable horizontally */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Small Phone (≤ 480px) ── */
@media (max-width: 480px) {
  /* Stats: stay 2-column (NOT 1-column — saves vertical space) */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* Stat card ultra compact */
  .stat-card {
    padding: 10px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .stat-label {
    font-size: 0.6875rem;
  }

  /* Content sections tighter padding */
  .content-section {
    padding: 10px;
    gap: 10px;
  }

  /* Input fields: 16px prevents iOS auto-zoom on focus */
  .input-field {
    font-size: 16px;
  }

  /* Card padding reduced */
  .card {
    padding: 14px;
    border-radius: var(--r-md);
  }

  /* Bigger touch targets for nav */
  .nav-item {
    padding: 12px 14px;
    font-size: 0.9375rem;
  }

  /* Table: hide status column on tiny screens, keep title + price */
  .data-table th:nth-child(4),
  .data-table td:nth-child(4) {
    display: none;
  }

  /* Topbar: title + actions on same row, compact */
  .topbar {
    padding: 8px 12px;
  }

  .topbar-left h1 {
    font-size: 1rem;
  }

  .page-subtitle {
    display: none; /* hide subtitle on very small screens to save space */
  }
}


/* ── Mobile (≤ 768px): slide-over sidebar ── */
@media (max-width: 768px) {
  /* Show hamburger & close button */
  .hamburger       { display: flex; }
  .sidebar-close   { display: block; }
  .sidebar-overlay { display: block; }

  /* Sidebar becomes fixed slide-over panel */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: min(var(--sidebar-w), 85vw);
    z-index: 100;
    transform: translateX(-110%);
    transition: transform 240ms cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-md);
  }

  /* Open state toggled by JS */
  .sidebar.open {
    transform: translateX(0);
  }

  /* Main content takes full width */
  .main-content {
    width: 100%;
    margin-left: 0;
  }

  /* App shell stops being flex side-by-side */
  .app-shell {
    flex-direction: column;
  }

  /* Topbar stacks nicely */
  .topbar {
    padding: 0 14px;
    height: auto;
    min-height: var(--topbar-h);
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  /* Hide full-text button labels, show short versions */
  .btn-label       { display: none; }
  .btn-label-short { display: inline; }

  /* Stats go 2-column on tablet-ish mobile */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Publisher card goes to bottom of sidebar (normal flow on mobile) */
  .publisher-card {
    margin-top: 16px;
  }

  /* Content padding reduced */
  .main-content {
    padding: 0;
  }

  .content-section {
    padding: 14px;
  }

  /* Table: hide less important columns */
  .data-table th:nth-child(3),
  .data-table td:nth-child(3) {
    display: none;
  }

  /* Make table scrollable horizontally */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Small Phone (≤ 480px) ── */
@media (max-width: 480px) {
  /* Single column stats */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  /* Topbar actions stack below title */
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Table: hide status column too, keep title + price */
  .data-table th:nth-child(4),
  .data-table td:nth-child(4) {
    display: none;
  }

  /* Bigger touch targets */
  .nav-item {
    padding: 12px 14px;
    font-size: 0.9375rem;
  }

  .btn-primary,
  .btn-outline,
  .btn-primary-sm {
    min-height: 42px;
  }

  /* Reduce page padding */
  .content-section {
    padding: 10px;
  }

  /* Input fields full width */
  .input-field {
    font-size: 16px; /* prevents iOS zoom on focus */
  }

  /* Card padding reduced */
  .card {
    padding: 14px;
    border-radius: var(--r-md);
  }

  /* Stat card layout tweak */
  .stat-card {
    padding: 14px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
}

