/* =============================================
   Account Manager - Cutting-edge Dark Theme
   ============================================= */

:root {
  --bg-base: #0a0a0f;
  --bg-surface: #12121a;
  --bg-elevated: #1a1a26;
  --bg-hover: #22222e;
  --border: #2a2a3a;
  --border-light: #33334a;
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b5;
  --text-muted: #606075;
  --accent: #1DB954;
  --accent-hover: #1ed760;
  --accent-dim: rgba(29, 185, 84, 0.15);
  --danger: #e74c3c;
  --danger-dim: rgba(231, 76, 60, 0.15);
  --warning: #f39c12;
  --warning-dim: rgba(243, 156, 18, 0.15);
  --info: #3498db;
  --info-dim: rgba(52, 152, 219, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Glassmorphism */
.glass {
  background: rgba(26, 26, 38, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* =============================================
   Auth Page
   ============================================= */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #1a1a2e 0%, var(--bg-base) 50%);
  padding: 20px;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  padding: 48px 40px;
  box-shadow: var(--shadow);
}

.auth-logo {
  text-align: center;
  margin-bottom: 36px;
}

.auth-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border-radius: 16px;
  color: var(--accent);
}

.auth-logo h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.auth-form .form-group {
  margin-bottom: 20px;
}

.auth-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.auth-form input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

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

/* =============================================
   Buttons
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-dim);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* =============================================
   Alerts
   ============================================= */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
}

.alert-error {
  background: var(--danger-dim);
  color: var(--danger);
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.alert-success {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(29, 185, 84, 0.3);
}

.alert-info {
  background: var(--info-dim);
  color: var(--info);
  border: 1px solid rgba(52, 152, 219, 0.3);
}

.hidden {
  display: none !important;
}

/* =============================================
   Dashboard Layout
   ============================================= */
.app-body {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo span {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

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

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  min-width: 0;
}

/* =============================================
   Stats Bar
   ============================================= */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.stat-success .stat-value { color: var(--accent); }
.stat-failed .stat-value { color: var(--danger); }
.stat-pending .stat-value { color: var(--warning); }

/* =============================================
   Views
   ============================================= */
.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view-active {
  display: block;
}

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

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.view-header h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* =============================================
   Tables
   ============================================= */
.table-container {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: var(--transition);
}

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

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

.data-table td.actions-cell { display: flex; gap: 4px; align-items: center; }

/* Links inside tables (track/artist/album/playlist names) default to the dim
   browser link colour, which is hard to read on the dark surface. Use the bright
   primary text and reveal the green accent + underline on hover so they're
   clearly readable AND obviously clickable. */
.data-table td a { color: var(--text-primary); text-decoration: none; }
.data-table td a:hover { color: var(--accent); text-decoration: underline; }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* =============================================
   Status Badges
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-success {
  background: var(--accent-dim);
  color: var(--accent);
}
.badge-success::before { background: var(--accent); }

.badge-failed {
  background: var(--danger-dim);
  color: var(--danger);
}
.badge-failed::before { background: var(--danger); }

.badge-pending {
  background: var(--warning-dim);
  color: var(--warning);
}
.badge-pending::before {
  background: var(--warning);
  animation: pulse 1.5s infinite;
}

.badge-running {
  background: var(--info-dim);
  color: var(--info);
}
.badge-running::before {
  background: var(--info);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-error {
  margin-top: 4px;
  max-width: 220px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--danger);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: help;
}

/* =============================================
   Forms
   ============================================= */
.form-container {
  padding: 32px;
  max-width: 640px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: var(--transition);
  box-sizing: border-box;
}
.form-group textarea, .form-grid textarea { min-height: 70px; resize: vertical; line-height: 1.5; }

/* Custom dropdown chevron — the native select arrow looks off in a dark theme */
.form-group select,
.form-grid select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0aa' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  cursor: pointer;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover,
.form-grid input:hover,
.form-grid select:hover,
.form-grid textarea:hover { border-color: var(--text-muted); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--bg-elevated, var(--bg-surface));
}

.form-group input::placeholder,
.form-grid input::placeholder,
.form-grid textarea::placeholder { color: var(--text-muted); }

/* Small helper text under a field */
.form-hint { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 6px; font-weight: 400; }

/* Responsive auto-fit form grid (e.g. the Promote campaign form) */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px 18px;
  align-items: start;
}
.form-grid .form-group { margin-bottom: 0; }
.form-grid .fg-wide { grid-column: 1 / -1; }
.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 22px;
}
.form-card-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
}

/* =============================================
   Spinner
   ============================================= */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.3);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =============================================
   Delete button
   ============================================= */
.btn-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.btn-delete:hover {
  color: var(--danger);
  background: var(--danger-dim);
}

.btn-retry:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

/* Cookie (sp_dc) activation button — a 🍪 glyph, not an SVG, so it can't be
   mistaken for the copy-password clipboard sitting next to it. It only renders
   on rows that need a cookie, so it always carries the amber "act on me" ring. */
.btn-cookie {
  font-size: 15px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(230, 160, 40, 0.55);
  border-radius: 6px;
}

.btn-cookie:hover {
  background: var(--accent-dim);
}

/* =============================================
   Mass Action Bar
   ============================================= */
.mass-action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.mass-action-bar select,
.mass-action-bar input {
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}

.mass-action-bar input {
  flex: 1;
  min-width: 150px;
}

.mass-action-bar select {
  min-width: 160px;
}

/* =============================================
   Filter Bar (accounts search & filters)
   ============================================= */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.filter-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 220px;
  padding: 0 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.filter-search input {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
}

.filter-bar select {
  padding: 8px 12px;
  min-width: 150px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.filter-count {
  font-size: 12px;
  margin-left: auto;
  white-space: nowrap;
}

/* =============================================
   Modal
   ============================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-content {
  width: 90%;
  max-width: 500px;
  padding: 32px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 700;
}

/* =============================================
   Create-form listening pattern fieldset
   ============================================= */
.pattern-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  margin-bottom: 8px;
}
.pattern-fieldset > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  list-style: none;
  user-select: none;
}
.pattern-fieldset > summary > span:last-child { margin-left: auto; }
.pattern-fieldset > summary::-webkit-details-marker { display: none; }
.pattern-fieldset > summary::before {
  content: '▸';
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.pattern-fieldset[open] > summary::before { transform: rotate(90deg); }
.pattern-fieldset-body {
  padding: 4px 16px 16px;
  border-top: 1px solid var(--border);
}

/* =============================================
   Collapsible sidebar (more room for the table)
   ============================================= */
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-toggle {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; padding: 6px; border-radius: var(--radius-sm); flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--accent-dim); }

.app-body.sidebar-collapsed .sidebar { width: 64px; overflow: hidden; }
.app-body.sidebar-collapsed .main-content { margin-left: 64px; }
.app-body.sidebar-collapsed .sidebar-logo span,
.app-body.sidebar-collapsed .user-info { display: none; }
.app-body.sidebar-collapsed .nav-item { font-size: 0; justify-content: center; gap: 0; padding-left: 0; padding-right: 0; }
.app-body.sidebar-collapsed .nav-item svg { margin: 0; }
.app-body.sidebar-collapsed .user-badge { justify-content: center; }
.main-content { transition: margin-left .18s ease; }
.sidebar { transition: width .18s ease; }

/* =============================================
   Live per-profile activity indicator
   ============================================= */
.live-activity {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--accent);
  white-space: normal;       /* show the full 'now playing' (wraps) */
  word-break: break-word;
  line-height: 1.35;
}

/* Live transport controls (pause/play/next/prev) for a playing listen */
.transport { display: flex; gap: 4px; margin-top: 6px; }
.transport button {
  background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-secondary);
  border-radius: 6px; padding: 2px 9px; font-size: 12px; line-height: 1.5; cursor: pointer;
}
.transport button:hover { color: var(--text-primary); border-color: var(--border-light); }

/* Status tick / cross */
.status-tick, .status-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 13px; font-weight: 700;
}
.status-tick { background: var(--accent-dim); color: var(--accent); }
.status-x { background: var(--danger-dim); color: var(--danger); }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: live-pulse 1.4s infinite;
  flex-shrink: 0;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(29,185,84,0.6); }
  70%  { box-shadow: 0 0 0 6px rgba(29,185,84,0); }
  100% { box-shadow: 0 0 0 0 rgba(29,185,84,0); }
}
.live-badge {
  display: inline-block; margin-left: 6px;
  font-size: 10px; font-weight: 700; color: var(--accent);
  animation: pulse 1.4s infinite;
}
.signup-progress {
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px; font-size: 11px; color: var(--accent);
  white-space: normal; line-height: 1.3;
}
.signup-progress .live-dot { flex-shrink: 0; }

/* =============================================
   System metrics bar (CPU / RAM / activity)
   ============================================= */
.system-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr 1.2fr;
  gap: 20px;
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
}
.sched-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .03em;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.sched-pill.sched-on { color: var(--accent); background: var(--accent-dim); }
.sched-pill.sched-off { color: var(--text-muted); background: var(--bg-surface); }
.sched-pill.sched-warn { color: var(--warning); background: var(--warning-dim); }
.sched-pill.sched-full { color: var(--danger); background: var(--danger-dim); }

/* Logs console + Errors view (super admin) */
.log-console {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.5;
  color: #cfe3d6; background: #0c1410;
  padding: 14px 16px; border-radius: var(--radius-sm);
  max-height: calc(100vh - 230px); overflow: auto;
  white-space: pre-wrap; word-break: break-word; margin: 0;
}
.log-line { white-space: pre-wrap; word-break: break-word; padding: 0 2px; border-radius: 2px; }
.log-line.lvl-info   { color: #cfe3d6; }
.log-line.lvl-ok     { color: #5fd38d; }
.log-line.lvl-warn   { color: #e8c34a; background: rgba(232,195,74,.06); }
.log-line.lvl-err    { color: #ff7a7a; background: rgba(255,92,92,.10); font-weight: 600; }
.log-line.lvl-err-ctx{ color: #d98a8a; }
.log-line.lvl-meta   { color: #7c93a5; }
.log-line .log-tag   { color: #6fd0ff; font-weight: 700; }
.logs-controls { display: flex; align-items: center; gap: 12px; }
.logs-controls select { padding: 6px 10px; }
.logs-autoscroll { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.errors-section-title { margin: 22px 0 10px; font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.err-cell { color: var(--danger); font-size: 12px; max-width: 480px; }
#errors-log { max-height: 340px; }
.nav-badge {
  display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: auto;
  font-size: 11px; font-weight: 700; text-align: center;
  color: #fff; background: var(--danger); border-radius: 999px;
}

/* Bulk-create card */
.bulk-create-card { margin-bottom: 18px; border: 1px solid var(--accent-dim); }
.bulk-create-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.bulk-create-head h3 { margin: 0; font-size: 16px; }
.bulk-create-head .text-muted { font-size: 12px; }
.bulk-create-row { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.bulk-create-row .form-group { margin: 0; flex: 0 0 auto; }
.bulk-create-row #bulk-count { width: 90px; }
.bulk-create-row .btn { height: 40px; }
@media (max-width: 640px) { .bulk-create-row { gap: 10px; } .bulk-create-row .form-group, .bulk-create-row .btn { flex: 1 1 100%; } }
/* Personas-only toggle: mint the identities, skip the automated signup. */
.bulk-persona-toggle {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  font-size: 12.5px; color: var(--text-muted); cursor: pointer; user-select: none;
}
.bulk-persona-toggle input { cursor: pointer; accent-color: var(--accent); }
.bulk-persona-toggle:hover { color: var(--text-primary); }
.system-bar .metric { display: flex; flex-direction: column; gap: 5px; }
.metric-head { display: flex; align-items: baseline; justify-content: space-between; }
.metric-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.metric-value { font-size: 16px; font-weight: 700; }
.metric-bar { height: 7px; background: var(--bg-surface); border-radius: 4px; overflow: hidden; }
.metric-bar-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 4px; transition: width .6s ease, background .3s ease; }
.metric-bar-fill.metric-mid { background: #e8b339; }
.metric-bar-fill.metric-high { background: #ff5c5c; }
.metric-sub { font-size: 11px; color: var(--text-muted); }
.metric-activity { justify-content: center; }
@media (max-width: 768px) { .system-bar { grid-template-columns: 1fr 1fr; } .metric-activity { grid-column: auto; } }

/* Accounts table: fit the viewport (no left/right scroll) + vertical scroll */
#view-accounts .table-container { max-height: calc(100vh - 340px); overflow-y: auto; overflow-x: hidden; }
.data-table thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-surface); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 0; }

/* Fixed layout so columns share the width and long values truncate (tooltip
   shows the full value) instead of forcing horizontal scroll. */
#accounts-table { table-layout: fixed; width: 100%; }
#accounts-table th, #accounts-table td {
  padding: 10px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#accounts-table th:nth-child(1),  #accounts-table td:nth-child(1)  { width: 34px; padding-right: 0; }   /* checkbox */
#accounts-table th:nth-child(2)  { width: 15%; }   /* Email */
#accounts-table th:nth-child(3)  { width: 13%; }   /* Name (hidden — see below) */
/* Display name now lives only in the account-detail panel; hide it from the list
   to free horizontal space (the browser redistributes the freed width to the
   other columns). nth-child numbering of the rest is unchanged. */
#accounts-table th:nth-child(3), #accounts-table td:nth-child(3) { display: none; }
/* Email was the ONLY content column with no width, so when the fixed-width columns
   claimed the row the browser shrank it (its .email-copy is overflow:hidden, so it
   can collapse) and clipped the address to nothing — leaving just the #id badge.
   Pin a width + min-width so the email always has room. */
#accounts-table th:nth-child(2), #accounts-table td:nth-child(2) { width: 24%; min-width: 210px; }
#accounts-table th:nth-child(4)  { width: 6%;  }   /* Country (compact code, e.g. GR) */
#accounts-table th:nth-child(5)  { width: 12%; }   /* Plan (⭐ Premium + renewal date) */
#accounts-table th:nth-child(6)  { width: 10%; }   /* IP */
#accounts-table th:nth-child(7)  { width: 9%;  }   /* System */
#accounts-table th:nth-child(8)  { width: 11%; }   /* Status */
#accounts-table th:nth-child(9)  { width: 8%;  }   /* Created */
#accounts-table th:nth-child(10) { width: 11%; }   /* Listened (tracks/day · hours) */
#accounts-table th:nth-child(11) { width: 132px; } /* Actions */
/* Let the full email show: wrap to a 2nd line instead of clipping with an ellipsis
   (22/35 addresses are >28 chars and were being cut). The hidden Name column leaves
   the room. overflow-wrap:anywhere breaks the long local-part/domain cleanly. */
#accounts-table .email-copy { display: inline; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
#accounts-table td:nth-child(10) { white-space: normal; }   /* Listened: allow the sub-line */
#accounts-table td:nth-child(11) { white-space: normal; }   /* let action icons wrap if needed */
#accounts-table td:nth-child(11) > div { flex-wrap: wrap; }
.system-cell { max-width: 100%; }
.system-cell .system-os, .system-cell .system-browser { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Promote campaigns table: fit the viewport (no left/right scroll) — same fixed-layout
   approach as the accounts table. Without this the 9 nowrap columns are wider than the
   screen and the table scrolls horizontally inside its card. */
#view-promote .table-container { overflow-x: hidden; }
#promote-table { table-layout: fixed; width: 100%; }
#promote-table th, #promote-table td {
  padding: 10px 10px;
  white-space: normal;            /* wrap instead of forcing width */
  overflow-wrap: anywhere;
  vertical-align: top;
}
#promote-table th:nth-child(1), #promote-table td:nth-child(1) { width: 20%; }  /* Target */
#promote-table th:nth-child(2), #promote-table td:nth-child(2) { width: 8%;  }  /* Type */
#promote-table th:nth-child(3), #promote-table td:nth-child(3) { width: 8%;  }  /* Intensity */
#promote-table th:nth-child(4), #promote-table td:nth-child(4) { width: 7%;  }  /* Cap */
#promote-table th:nth-child(5), #promote-table td:nth-child(5) { width: 11%; }  /* Ramp / Fade */
#promote-table th:nth-child(6), #promote-table td:nth-child(6) { width: 16%; }  /* Delivered */
#promote-table th:nth-child(7), #promote-table td:nth-child(7) { width: 13%; }  /* Goal / ETA */
#promote-table th:nth-child(8), #promote-table td:nth-child(8) { width: 7%;  }  /* Status */
#promote-table th:nth-child(9), #promote-table td:nth-child(9) { width: 10%; }  /* Actions */
#promote-table td.actions-cell { flex-wrap: wrap; }
/* The expandable detail row spans all columns — never clip it, let it use full width. */
#promote-table tr.promo-detail td { overflow: visible; text-overflow: clip; white-space: normal; }
@media (max-width: 768px) {
  #promote-table th, #promote-table td { padding: 8px 6px; font-size: 12px; }
}

/* =============================================
   Full-page account detail
   ============================================= */
.account-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.account-detail-grid > * {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin: 0;
}
.account-detail-grid > * .detail-section { margin-bottom: 0; }
#account-insights-section { grid-column: 1 / -1; }
@media (max-width: 900px) {
  /* minmax(0,1fr) (not 1fr) lets the single column shrink below its content's
     intrinsic width — otherwise a long URL forces the card wider than the
     screen and the right edge gets clipped. */
  .account-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .account-detail-grid > * { min-width: 0; padding: 14px 16px; }
}
@media (max-width: 768px) {
  /* Detail view: keep everything inside the viewport + wrap long values/URLs. */
  #view-account-detail .view-header { flex-wrap: wrap; gap: 10px; }
  #account-detail-actions { flex-wrap: wrap; }
  .account-detail-grid, .account-detail-grid > * { max-width: 100%; }
  .account-detail-grid * { overflow-wrap: anywhere; }
  .detail-row, .activity-row, .activity-main { flex-wrap: wrap; }
  .detail-row code, .activity-row code, .account-detail-grid a { word-break: break-all; }
}
.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, var(--text-muted));
  margin-bottom: 8px;
}

/* Plan (premium/free) badges */
.badge-premium {
  background: linear-gradient(135deg, #f5d76e, #d4af37);
  color: #2a2208;
}
.badge-free {
  background: var(--border-light);
  color: var(--text-secondary, var(--text-muted));
}
.badge-unknown {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.plan-badge {
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
/* health dot carried on the plan badge */
.plan-badge .hdot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 1.5px rgba(0,0,0,.25) inset;
}
/* renewal/expiry date shown under the Premium badge in the accounts list */
.plan-exp {
  font-size: 9.5px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#accounts-table td:nth-child(5) { white-space: normal; }   /* Plan cell: allow the expiry line */

/* Diagnostics panel — capability health rows */
.diag-list { padding: 4px 0; border-radius: 12px; overflow: hidden; }
.diag-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light, rgba(255,255,255,0.06));
  border-left: 3px solid transparent;
}
.diag-row:last-child { border-bottom: none; }
.diag-row.diag-ok   { border-left-color: #34d399; }
.diag-row.diag-warn { border-left-color: #fbbf24; background: rgba(251,191,36,0.05); }
.diag-row.diag-fail { border-left-color: #f87171; background: rgba(248,113,113,0.07); }
.diag-dot { font-size: 13px; line-height: 1.4; }
.diag-text { flex: 1; min-width: 0; }
.diag-label { font-weight: 600; font-size: 14px; }
.diag-summary { font-size: 13px; color: var(--text-secondary, var(--text-muted)); margin-top: 2px; }
.diag-detail { font-size: 12px; color: var(--text-muted); margin-top: 3px; word-break: break-word; }

/* Registered-country ↔ proxy-country mismatch warning */
.cc-mismatch {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border-radius: 4px;
  padding: 1px 4px;
  white-space: nowrap;
}

/* Playback-history source tags */
.hist-src {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.hist-src-verified { background: var(--accent-dim); color: var(--accent); }
.hist-src-driven  { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); }

/* Per-account listen metrics in the accounts list */
.listen-metric { line-height: 1.3; }
.listen-metric .lm-main { font-size: 13px; }
.listen-metric .lm-main strong { color: var(--accent); }
.listen-metric .lm-sub { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }
.listen-metric .lm-today { font-size: 10px; color: var(--accent); white-space: nowrap; }

/* Now-playing board (top of Accounts view) */
.now-playing-board { margin-bottom: 18px; }
.now-playing-board:empty { display: none; }
.np-head { font-size: 12px; font-weight: 700; color: var(--text-secondary, var(--text-muted)); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; }
.np-count { display: inline-block; background: var(--accent-dim); color: var(--accent); border-radius: 10px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
.np-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.np-item { display: flex; align-items: center; gap: 8px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.np-item:hover { border-color: var(--accent); }
.np-acct { font-weight: 600; font-size: 12px; white-space: nowrap; max-width: 38%; overflow: hidden; text-overflow: ellipsis; }
.np-prem { color: #d4af37; }
.np-track { font-size: 12px; color: var(--text-secondary, var(--text-muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.np-detached { color: var(--warning); font-size: 12px; flex: 0 0 auto; }
/* tiny animated equalizer */
.np-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; flex: 0 0 auto; }
.np-eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: npbar 0.9s ease-in-out infinite; }
.np-eq i:nth-child(1) { height: 6px; animation-delay: 0s; }
.np-eq i:nth-child(2) { height: 12px; animation-delay: 0.3s; }
.np-eq i:nth-child(3) { height: 9px; animation-delay: 0.6s; }
@keyframes npbar { 0%,100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }

/* Economics ROI banner */
.econ-roi { border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; border: 1px solid var(--border); }
.econ-roi.pos { background: var(--accent-dim); }
.econ-roi.neg { background: var(--danger-dim); }
.econ-roi-val { font-size: 26px; font-weight: 800; }
.econ-roi.pos .econ-roi-val { color: var(--accent); }
.econ-roi.neg .econ-roi-val { color: var(--danger); }
.econ-roi-lbl { font-size: 12px; color: var(--text-secondary, var(--text-muted)); margin-top: 2px; }
.econ-rates { font-size: 10.5px; color: var(--text-muted); margin-top: 6px; }

/* Statistics trend charts (30-day activity + detection) */
.trend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .trend-grid { grid-template-columns: 1fr; } }
.trend-card { padding: 14px 16px; border-radius: 12px; }
.trend-title {
  font-size: 12px; font-weight: 600; color: var(--text-secondary, var(--text-muted));
  margin-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.trend-legend { font-size: 10px; font-weight: 400; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }
.trend-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.trend-ok { font-size: 11px; color: var(--accent); margin-top: 6px; }

/* =============================================
   Playlists (per account)
   ============================================= */
.playlist-block { padding: 8px 0; border-bottom: 1px solid var(--border); }
.playlist-block:last-child { border-bottom: none; }
.playlist-head { font-weight: 600; font-size: 14px; }
.playlist-head a { color: var(--accent); }
.playlist-tracks { margin: 6px 0 0 16px; padding: 0; list-style: disc; }
.playlist-tracks li { font-size: 13px; padding: 2px 0; color: var(--text-secondary, var(--text-muted)); }
.playlist-tracks a { color: var(--text-primary); }
.playlist-tracks a:hover { color: var(--accent); }

/* =============================================
   Recent activity + clickable email
   ============================================= */
.activity-list { display: flex; flex-direction: column; }
.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.activity-row:last-child { border-bottom: none; }
.activity-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.activity-target { color: var(--text-muted); font-size: 12px; }
.activity-when { white-space: nowrap; font-size: 12px; }

.acct-id { display: inline-block; font: 600 11px/1 ui-monospace, monospace; color: var(--text-muted, #8a8f98); background: var(--border-light, rgba(255,255,255,.06)); border-radius: 5px; padding: 2px 5px; margin-right: 6px; vertical-align: middle; }
.email-copy { cursor: pointer; border-bottom: 1px dashed var(--border-light); }
.email-copy:hover { color: var(--accent); border-bottom-color: var(--accent); }
.email-copy.copied { color: var(--accent); }
.email-copy.copy-failed { color: #ff5c5c; }

/* =============================================
   Copy-password buttons
   ============================================= */
.btn-copy-pw.copied,
.btn-copy-pw-inline.copied {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}
.btn-copy-pw.copy-failed,
.btn-copy-pw-inline.copy-failed {
  color: #ff5c5c !important;
  border-color: #ff5c5c !important;
}
.btn-copy-pw-inline {
  margin-left: 8px;
  padding: 2px 10px;
  font-size: 12px;
}
.btn-copy-pw-inline.copied::after { content: " ✓"; }
.pw-mask {
  letter-spacing: 2px;
  color: var(--text-muted);
}

/* =============================================
   Listening insights (chart + stat tiles)
   ============================================= */
.insights-chart {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 12px 6px;
  margin-bottom: 12px;
}
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.stat-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}
.stat-tile-value {
  font-size: 18px;
  font-weight: 700;
}
.stat-tile-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* =============================================
   Account details modal
   ============================================= */
.account-row { cursor: pointer; }
.modal-wide {
  max-width: 620px;
  max-height: 88vh;
  overflow-y: auto;
}
.detail-section { margin-bottom: 22px; }
.detail-section:last-child { margin-bottom: 0; }
.detail-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* =============================================
   System / profile characteristics
   ============================================= */
.system-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: transparent;
  border: none;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--text-primary);
  transition: background 0.15s ease;
}
.system-cell:hover {
  background: var(--accent-dim);
}
.system-os {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.system-browser {
  font-size: 11px;
  color: var(--text-muted);
}
.os-icon {
  font-size: 14px;
  line-height: 1;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.profile-row:last-of-type {
  border-bottom: none;
}
.profile-key {
  color: var(--text-muted);
  font-size: 13px;
}
.profile-val {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}
.profile-ua-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.profile-ua-block .profile-key {
  display: block;
  margin-bottom: 8px;
}
.profile-ua-val {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary, var(--text-muted));
  word-break: break-all;
}

/* =============================================
   Responsive
   ============================================= */
/* Mobile chrome (hidden on desktop): a top bar with a hamburger, and a dimming
   overlay for the off-canvas sidebar drawer. */
.mobile-topbar {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; height: 52px;
  align-items: center; gap: 12px; padding: 0 14px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  z-index: 95;
}
.menu-toggle {
  background: none; border: none; color: var(--text-primary);
  cursor: pointer; padding: 6px; display: inline-flex; align-items: center;
}
.mobile-topbar .mt-title { font-weight: 700; font-size: 16px; letter-spacing: -0.3px; }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 99; opacity: 0; pointer-events: none; transition: opacity .2s ease;
}

@media (max-width: 768px) {
  /* Sidebar becomes an off-canvas drawer (slides in on the hamburger / tap). */
  .sidebar {
    transform: translateX(-100%);
    width: 80vw; max-width: 300px; overflow-y: auto;
    transition: transform .25s ease;
    box-shadow: 2px 0 28px rgba(0,0,0,.45);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  /* Always show full labels inside the drawer (ignore the desktop collapse rules). */
  .sidebar-logo span, .nav-item span, .user-info { display: revert; }
  .app-body.sidebar-collapsed .sidebar { width: 80vw; max-width: 300px; }
  .app-body.sidebar-collapsed .main-content { margin-left: 0; }
  .app-body.sidebar-collapsed .nav-item {
    font-size: 14px; justify-content: flex-start; gap: 12px; padding: 12px 16px;
  }

  .mobile-topbar { display: flex; }
  body.sidebar-open .sidebar-overlay { display: block; opacity: 1; pointer-events: auto; }

  .main-content { margin-left: 0; padding: 16px; padding-top: 66px; }

  /* Content reflow */
  .view-header { flex-wrap: wrap; gap: 12px; }
  .view-header h2 { font-size: 20px; }
  .view-header > div { display: flex; flex-wrap: wrap; gap: 8px; }
  .stat-tiles { grid-template-columns: 1fr 1fr; }
  /* Overview counters (Total / Success / Failed / In progress) stay on ONE row. */
  .stats-bar { grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
  .stats-bar .stat-card { padding: 10px 6px; text-align: center; }
  .stats-bar .stat-value { font-size: 20px; letter-spacing: -0.5px; }
  .stats-bar .stat-label { font-size: 10px; margin-top: 2px; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  /* Wide tables scroll horizontally instead of breaking the layout. */
  .table-container, #view-accounts .table-container {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  #view-accounts .table-container { max-height: none; }
  /* Modals fill the screen with a small margin. */
  .modal-content { width: 94vw; max-width: 94vw; max-height: 88vh; margin: 0; }
  .btn { min-height: 40px; }   /* comfortable tap target */
}

@media (max-width: 480px) {
  .main-content { padding: 12px; padding-top: 62px; }
  .stat-tiles { grid-template-columns: 1fr; }
  .stats-bar { gap: 6px; }                        /* keep the overview 4-up, tighter */
  .stats-bar .stat-card { padding: 9px 4px; }
  .stats-bar .stat-value { font-size: 18px; }
  .view-header h2 { font-size: 18px; }
  .data-table th, .data-table td { padding: 11px 12px; font-size: 13px; }
}

/* Stop the whole page from scrolling sideways on phones — contain overflow at the
   document level and let only inner table-containers scroll horizontally. */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; max-width: 100%; }
  .main-content { overflow-x: hidden; max-width: 100%; }
  .table-container { max-width: 100%; }

  /* Accounts table → stacked cards (a 10-column table is unreadable on a phone). */
  #accounts-table thead { display: none; }
  #accounts-table, #accounts-table tbody { display: block; width: 100%; }
  #accounts-table tr {
    display: block; background: var(--bg-surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 4px 14px; margin-bottom: 10px;
  }
  #accounts-table td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 9px 0; border: none; border-bottom: 1px solid var(--border);
    white-space: normal; text-align: right; min-width: 0;
  }
  #accounts-table tr td:last-child { border-bottom: none; }
  #accounts-table td::before {
    content: attr(data-label); flex: 0 0 auto; text-align: left;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .4px; color: var(--text-muted);
  }
  #accounts-table td.cb-cell { display: none; }   /* per-row select isn't useful as a card */
  #accounts-table td.actions-cell { justify-content: flex-end; flex-wrap: wrap; }
  #accounts-table td.actions-cell::before { display: none; }
  #accounts-table .email-copy { word-break: break-all; text-align: right; }
  #accounts-table .empty-row td { justify-content: center; }
  #accounts-table .empty-row td::before { display: none; }
}
/* =============================================
   Toasts (non-blocking notifications) — replace native alert()
   ============================================= */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 10px;
  background: var(--bg-surface, #1e1e24); color: var(--text, #eee);
  border: 1px solid var(--border, #333); border-left-width: 3px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); font-size: 13.5px; line-height: 1.45;
  animation: toast-in 0.18s ease; word-break: break-word;
}
.toast.leaving { opacity: 0; transform: translateX(24px); transition: all 0.2s ease; }
.toast-success { border-left-color: #34d399; }
.toast-error   { border-left-color: #f87171; }
.toast-info    { border-left-color: var(--accent, #1db954); }
.toast-icon { font-size: 15px; line-height: 1.3; flex-shrink: 0; }
.toast-msg  { flex: 1; white-space: pre-wrap; }
.toast-close {
  background: none; border: none; color: var(--text-muted, #999);
  cursor: pointer; font-size: 17px; line-height: 1; padding: 0 2px; flex-shrink: 0;
}
.toast-close:hover { color: var(--text, #eee); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Daily proxy-GB budget tile (superadmin): clickable — opens the budget editor. */
.metric-budget { cursor: pointer; }
.metric-budget:hover .metric-label { color: var(--accent); }

/* Range slider (budget editor) — match the theme (default UA styling is jarring). */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 6px; background: var(--bg-surface); border-radius: 4px; outline: none; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px;
  border-radius: 50%; background: var(--accent); border: none; cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: none; cursor: pointer;
}

/* Bandwidth-by-vendor panel (admin): GB burned per proxy provider */
.vendor-usage-panel { padding: 16px 18px; margin: 0 0 18px; border-radius: 14px; }
.vendor-usage-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.vendor-usage-table th {
  text-align: left; font-weight: 600; opacity: .65; padding: 6px 10px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.1)); white-space: nowrap;
}
.vendor-usage-table td { padding: 8px 10px; border-bottom: 1px solid var(--border, rgba(255,255,255,.06)); }
.vendor-usage-table tr:last-child td { border-bottom: none; }
.vendor-usage-table .vendor-usage-total td { border-top: 2px solid var(--border, rgba(255,255,255,.14)); }

/* Proxy management page */
.proxy-panel { padding: 16px 18px; margin: 0 0 18px; border-radius: 14px; }
.proxy-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.proxy-table th {
  text-align: left; font-weight: 600; opacity: .65; padding: 6px 10px; white-space: nowrap;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.1));
}
.proxy-table td { padding: 8px 10px; border-bottom: 1px solid var(--border, rgba(255,255,255,.06)); }
.proxy-table tr:last-child td { border-bottom: none; }
.proxy-table .proxy-ip-over td { background: rgba(229,72,77,.08); }
.proxy-bar { height: 8px; border-radius: 4px; background: var(--border, rgba(255,255,255,.08)); overflow: hidden; }
.proxy-bar-fill { height: 100%; border-radius: 4px; transition: width .3s ease; }
