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

:root {
  --bg: #09090b;
  --surface: #131316;
  --surface2: #1c1c22;
  --surface-hover: #23232b;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);
  --text: #f0f0f5;
  --text2: #7a7a8c;
  --accent: #fe2c55;
  --accent-hover: #ff1745;
  --accent-glow: rgba(254,44,85,.25);
  --teal: #25f4ee;
  --teal-glow: rgba(37,244,238,.2);
  --green: #34d399;
  --green-glow: rgba(52,211,153,.2);
  --yellow: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 24px rgba(0,0,0,.5);
  --shadow-glow: 0 0 20px rgba(254,44,85,.15);
}

[data-theme="light"] {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface2: #f0f0f2;
  --surface-hover: #e8e8ec;
  --border: rgba(0,0,0,.08);
  --border-strong: rgba(0,0,0,.14);
  --text: #1a1a2e;
  --text2: #6b6b80;
  --accent: #fe2c55;
  --accent-hover: #ff1745;
  --accent-glow: rgba(254,44,85,.15);
  --teal: #0ea5a5;
  --teal-glow: rgba(14,165,165,.12);
  --green: #16a34a;
  --green-glow: rgba(22,163,74,.12);
  --yellow: #ca8a04;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.1);
  --shadow-md: 0 4px 24px rgba(0,0,0,.1);
  --shadow-glow: 0 0 20px rgba(254,44,85,.08);
}
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.25); }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Smooth scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* ── Header ──────────────────────────────────────────── */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

header h1 {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -.3px;
}

header h1 span {
  background: linear-gradient(135deg, var(--accent), #ff6b8a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* ── Buttons ─────────────────────────────────────────── */

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -.1px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ff4d73, #ff6b8a);
  background-size: 200% 200%;
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 6px 24px var(--accent-glow); transform: translateY(-1px); background-position: right center; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--surface-hover); border-color: rgba(255,255,255,.2); }
.btn-ghost { background: none; color: var(--text2); padding: 6px 10px; }
.btn-ghost:hover { color: var(--text); background: var(--surface-hover); }
.btn-danger { background: linear-gradient(135deg, #dc2626, #f43f5e); color: #fff; }
.btn-danger:hover { box-shadow: 0 2px 12px rgba(220,38,38,.3); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-teal {
  background: linear-gradient(135deg, var(--teal), #5bfff8);
  background-size: 200% 200%;
  color: #000;
  box-shadow: 0 2px 12px var(--teal-glow);
}
.btn-teal:hover { box-shadow: 0 6px 24px var(--teal-glow); transform: translateY(-1px); background-position: right center; }

/* ── Layout ──────────────────────────────────────────── */

.app {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

.sidebar {
  width: 220px;
  background: rgba(19,19,22,.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
[data-theme="light"] .sidebar {
  background: rgba(255,255,255,.7);
  border-right-color: rgba(0,0,0,.06);
}

.sidebar-section {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text2);
  margin-bottom: 10px;
  font-weight: 700;
}

.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--bg);
  transition: opacity .2s ease, transform .2s ease;
}
.main.view-enter {
  opacity: 0;
  transform: translateY(6px);
}

/* ── Pull-to-refresh (mobile) ────────────────────────── */
.ptr-indicator {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-60px);
  transition: opacity .15s ease;
  z-index: 5;
}
.ptr-indicator .ptr-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--teal);
  border-radius: 50%;
  transition: transform .1s linear;
}
.ptr-indicator.ptr-ready .ptr-spinner {
  border-top-color: var(--accent);
}
.ptr-indicator.ptr-refreshing .ptr-spinner {
  animation: ptr-spin .8s linear infinite;
}
@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

/* ── Profile cards ───────────────────────────────────── */

.profile-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .2s ease;
  margin-bottom: 4px;
}

.profile-item:hover { background: var(--surface-hover); }
.profile-item.active {
  background: var(--surface-hover);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 12px var(--accent-glow);
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--surface-hover), var(--surface2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border);
}

.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-id { font-size: 11px; color: var(--text2); }

.profile-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.profile-status.active { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }
.profile-status.expiring { background: var(--yellow); box-shadow: 0 0 8px rgba(251,191,36,.3); }
.profile-status.expired { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }

/* ── Nav tabs ────────────────────────────────────────── */

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text2);
  transition: all .15s ease;
  font-weight: 500;
  margin-bottom: 1px;
}

.nav-item svg { opacity: .5; flex-shrink: 0; transition: opacity .2s; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item:hover svg { opacity: .8; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(37,244,238,.08), transparent);
  color: var(--teal);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--teal);
}
.nav-item.active svg { opacity: 1; stroke: var(--teal); }
.job-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--teal);
  color: #000;
  border-radius: 9px;
  padding: 0 5px;
  animation: pulse 2s infinite;
}

/* ── Hover lift for surface cards ──────────────────────── */

.admin-user-card,
[style*="background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:14px 16px"] {
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.admin-user-card:hover,
[style*="background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:14px 16px"]:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  transform: translateY(-1px);
}

/* ── Video grid ──────────────────────────────────────── */

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.video-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all .25s ease;
  border: 1px solid var(--border);
}

.video-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.video-thumb {
  width: 100%;
  aspect-ratio: 9/16;
  background: var(--surface2);
  object-fit: cover;
}

.video-info { padding: 12px; }
.video-desc { font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; }

.video-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text2);
}

/* ── Comments ────────────────────────────────────────── */

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

.comment-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  transition: border-color .2s;
}

.comment-item:hover { border-color: var(--border-strong); }

.comment-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text2);
}

.comment-user { font-weight: 600; color: var(--text); }
.comment-text { font-size: 14px; line-height: 1.5; margin-bottom: 10px; }

.comment-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.reply-box {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.reply-box input {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.reply-box input:focus { border-color: var(--accent); }

.replies-container {
  margin-top: 10px;
  padding-left: 20px;
  border-left: 2px solid var(--border);
}

.reply-item {
  padding: 10px;
  margin-bottom: 6px;
  background: var(--surface-hover);
  border-radius: 8px;
}

/* ── New comment box ─────────────────────────────────── */

.new-comment-box {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.new-comment-box textarea {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  resize: vertical;
  min-height: 44px;
  font-family: inherit;
  outline: none;
}

.new-comment-box textarea:focus { border-color: var(--accent); }

/* ── Rules & Templates ───────────────────────────────── */

.rule-card, .template-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.rule-card:hover, .template-card:hover { border-color: var(--border-strong); box-shadow: 0 4px 16px rgba(0,0,0,.3); transform: translateY(-1px); }

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

.rule-name { font-weight: 600; font-size: 15px; }

.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
}

.badge-green { background: var(--green-glow); color: var(--green); border: 1px solid rgba(52,211,153,.2); }
.badge-red { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(254,44,85,.2); }
.badge-teal { background: var(--teal-glow); color: var(--teal); border: 1px solid rgba(37,244,238,.2); }

.rule-keywords {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.keyword-tag {
  padding: 3px 8px;
  background: var(--surface-hover);
  border-radius: 4px;
  font-size: 12px;
  color: var(--teal);
}

.rule-reply {
  padding: 10px;
  background: var(--bg);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text2);
  border-left: 3px solid var(--accent);
}

/* ── Form styles ─────────────────────────────────────── */

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text2);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-glow);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select option { background: var(--surface); }

/* ── Date Range Picker ─────────────────────────────────── */
.date-range-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 4px 10px;
  flex-wrap: wrap;
}
.date-range-picker .dr-preset {
  background: none;
  border: none;
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  padding: 4px 18px 4px 2px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%2325f4ee' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-position: right 2px center;
  background-size: 10px 10px;
  background-repeat: no-repeat;
}
.date-range-picker .dr-preset option { background: var(--surface); color: var(--text); }
.date-range-picker .dr-divider {
  width: 1px; height: 18px; background: var(--border); margin: 0 2px;
}
.date-range-picker .dr-sep {
  color: var(--text2); font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
}
.date-range-picker .dr-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  font-family: inherit;
  padding: 4px 6px;
  outline: none;
  width: 122px;
  transition: border-color .15s;
  color-scheme: dark;
}
[data-theme="light"] .date-range-picker .dr-input { color-scheme: light; }
.date-range-picker .dr-input:focus { border-color: var(--teal); }
@media (max-width: 640px) {
  .date-range-picker { padding: 3px 8px; gap: 5px; }
  .date-range-picker .dr-preset { font-size: 11px; padding-right: 14px; }
  .date-range-picker .dr-input { width: 104px; font-size: 10px; padding: 3px 5px; }
}

/* ── Modal ────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,.6);
}

.modal h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ── Log table ───────────────────────────────────────── */

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

.log-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text2);
  border-bottom: 1px solid var(--border-strong);
  font-weight: 700;
}

.log-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.log-table tr { transition: background .15s; }
.log-table tbody tr:hover { background: var(--surface); }

/* ── Empty state ─────────────────────────────────────── */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text2);
  text-align: center;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .3; }
.empty h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); font-weight: 700; }
.empty p { font-size: 14px; max-width: 380px; line-height: 1.6; color: var(--text2); }

/* ── Toast ────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  animation: slideIn .3s ease;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
}

.toast-success { background: rgba(6,95,70,.9); color: #6ee7b7; border: 1px solid rgba(52,211,153,.2); }
.toast-error { background: rgba(127,29,29,.9); color: #fca5a5; border: 1px solid rgba(254,44,85,.2); }
.toast-warning { background: rgba(120,75,10,.9); color: #fcd34d; border: 1px solid rgba(252,211,77,.3); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ── Misc ─────────────────────────────────────────────── */

.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text2); }

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(254,44,85,.65);
  border-radius: 11px;
  transition: .25s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .25s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.toggle input:checked + .toggle-slider { background: var(--green); box-shadow: 0 0 10px var(--green-glow); }
.toggle input:checked + .toggle-slider::before { left: 21px; }

.template-selector {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.template-tag {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: .15s;
}

.template-tag:hover { border-color: var(--accent); color: var(--accent); }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text2);
}

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skel {
  background: linear-gradient(90deg, rgba(255,255,255,.03) 25%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.03) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 6px;
}
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-title { height: 20px; width: 40%; margin-bottom: 14px; }
.skel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
[data-theme="light"] .skel {
  background: linear-gradient(90deg, rgba(0,0,0,.04) 25%, rgba(0,0,0,.08) 50%, rgba(0,0,0,.04) 75%);
  background-size: 800px 100%;
}

/* Smooth heading styles */
h2 { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }

/* ── Burger menu & sidebar toggle ─────────────────── */

.burger-btn {
  padding: 4px 6px !important;
}
.burger-btn .burger-line {
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .2s ease;
}
.burger-btn.active .burger-line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger-btn.active .burger-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger-btn.active .burger-line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.sidebar {
  transition: margin .3s cubic-bezier(.4,0,.2,1);
}

.sidebar.collapsed {
  margin-left: -220px;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 49;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s cubic-bezier(.4,0,.2,1);
}
.sidebar-overlay.active { opacity: 1; pointer-events: auto; }

@media (max-width: 768px) {
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 640px) {
  /* ── Sidebar → slide-over overlay ─── */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    z-index: 50;
    transform: translateX(-100%);
    border-right: 1px solid var(--border);
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar.collapsed {
    transform: translateX(-100%);
  }

  .sidebar-section { padding: 12px; }
  #navItems { display: flex; flex-direction: column; gap: 0; }
  .nav-item { white-space: nowrap; padding: 11px 14px; font-size: 13px; }
  .nav-item.active { box-shadow: inset 3px 0 0 var(--teal); }
  .sidebar > div[style*="margin-top:auto"] { display: flex !important; }

  /* ── Header compact ─── */
  header { padding: 8px 12px; gap: 6px; }
  header h1 { font-size: 14px; gap: 4px; }
  .header-actions { gap: 4px; }
  .header-actions .btn { padding: 5px 8px; font-size: 11px; }
  #loggedInUser { display: none !important; }

  /* ── Main content ─── */
  .main { padding: 10px; padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); -webkit-overflow-scrolling: touch; overflow-x: hidden; }
  h2 { font-size: 16px; }

  /* ── Dashboard 2-col cards ─── */
  [style*="grid-template-columns:repeat(2,1fr);gap:10px"] { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  [style*="grid-template-columns:repeat(2,1fr);gap:10px"] [style*="font-size:22px"] { font-size: 16px !important; }
  [style*="grid-template-columns:repeat(2,1fr);gap:10px"] [style*="width:36px;height:36px"] { display: none !important; }

  /* ── Dashboard stats bar ─── */
  [style*="justify-content:space-around"] [style*="font-size:18px"] { font-size: 14px !important; }

  /* ── Profile stat cards — keep 4-col but compact ─── */
  [style*="grid-template-columns:repeat(4,1fr);gap:14px"] { gap: 6px !important; }
  [style*="grid-template-columns:repeat(4,1fr);gap:14px"] > div { padding: 10px 6px !important; }
  [style*="grid-template-columns:repeat(4,1fr);gap:14px"] [style*="font-size:32px"] { font-size: 20px !important; }
  [style*="grid-template-columns:repeat(4,1fr);gap:14px"] [style*="font-size:12px"] { font-size: 9px !important; letter-spacing: .5px !important; }

  /* ── Profile cards ─── */
  .rule-card { padding: 10px !important; }
  .rule-card [style*="display:flex;align-items:center;gap:12px"] { flex-wrap: wrap; gap: 8px !important; }
  .profile-avatar { width: 30px !important; height: 30px !important; font-size: 12px !important; }

  /* ── Flex-between — stack title & actions vertically ─── */
  .flex-between { flex-direction: column; align-items: flex-start !important; gap: 8px; }
  .flex-between > h2 { font-size: 16px; }
  .flex-between > div:last-child { display: flex; flex-wrap: wrap; gap: 4px; }
  .flex-between > .btn { align-self: flex-start; }

  /* ── Admin filter dropdown ─── */
  .flex-between .form-select { font-size: 11px !important; padding: 5px 8px !important; }

  /* ── Video grid ─── */
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important; gap: 8px; }

  /* ── Comment items ─── */
  .comment-item { padding: 10px; }
  .comment-actions { gap: 3px; }
  .comment-actions .btn { padding: 3px 6px; font-size: 10px; }
  .reply-box { flex-direction: column; }
  .reply-box input { width: 100%; }
  .new-comment-box { flex-direction: column; padding: 10px; }

  /* ── Log table ─── */
  .log-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .log-table th, .log-table td { padding: 8px 6px; font-size: 11px; }
  .log-table th:first-child, .log-table td:first-child { padding-left: 4px; }

  /* ── Modal ─── */
  .modal { padding: 14px; width: 96%; max-height: 92vh; border-radius: 12px; }
  .modal h2 { font-size: 15px; margin-bottom: 10px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1; justify-content: center; min-width: 80px; }

  /* ── Comment Bot submit button ─── */
  #jobActions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: var(--bg);
    padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 6px);
    border-top: 1px solid var(--border);
  }

  /* ── Comment Bot layout ─── */
  [style*="display:flex;gap:16px;flex-wrap:wrap"] { flex-direction: column !important; }
  [style*="display:flex;gap:16px;flex-wrap:wrap"] > div { min-width: 0 !important; width: 100% !important; flex: none !important; }
  [style*="display:flex;gap:20px"] { flex-direction: column !important; }
  [style*="display:flex;gap:20px"] > [style*="min-width:320px"],
  [style*="display:flex;gap:20px"] > [style*="min-width:280px"] { min-width: 0 !important; }
  .step-num { width: 20px !important; height: 20px !important; font-size: 10px !important; }

  /* ── Form inputs ─── */
  .form-input, .form-textarea, .form-select { font-size: 14px; padding: 10px 12px; max-width: 100%; box-sizing: border-box; }

  /* ── Campaign run modal delay input pairs ─── */
  .modal [style*="display:flex;gap:16px"] { flex-direction: column !important; gap: 0 !important; }

  /* ── Buttons full width on mobile ─── */
  .empty .btn { width: 100%; justify-content: center; }

  /* ── Campaign list cards ─── */
  .rule-card[style*="display:flex;align-items:center;gap:12px"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }
  .rule-card[style*="display:flex;align-items:center;gap:12px"] > div:last-child {
    width: 100%;
    justify-content: flex-start;
  }

  /* ── Rule / campaign cards ─── */
  .rule-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .rule-header > div { width: 100%; flex-wrap: wrap; gap: 4px; }
  .rule-header > div:last-child { justify-content: flex-start; }
  .rule-name { display: block; width: 100%; font-size: 13px; margin-bottom: 2px; }
  .rule-header .badge { margin-left: 0 !important; }

  /* ── Settings page ─── */
  .form-group { margin-bottom: 10px; }
  [style*="grid-template-columns:1fr 1fr"][style*="gap:16px"] { grid-template-columns: 1fr !important; }

  /* ── Admin user cards ─── */
  [style*="display:flex;gap:16px;font-size:12px"] { flex-wrap: wrap !important; gap: 8px !important; }
  [style*="display:flex;gap:6px;align-items:center"] { flex-wrap: wrap !important; gap: 4px !important; }

  /* ── Toast positioning ─── */
  .toast-container { left: 12px; right: 12px; top: 12px; }
  .toast { font-size: 12px; padding: 10px 14px; }

  /* ── Job log cards — stacked on mobile ─── */
  .job-card-row {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  .job-card-row .job-card-url { display: none !important; }
  .job-card-row .job-card-stats {
    order: 10;
    width: 100%;
    padding-top: 2px;
    justify-content: flex-start !important;
  }
  .job-card-row .job-card-time {
    order: 10;
  }
  .job-card-row .job-card-actions {
    position: absolute;
    right: 8px;
    top: 8px;
  }

  /* ── Job detail view meta ─── */
  [style*="display:flex;gap:16px;margin-bottom:16px;font-size:13px"] { flex-direction: row !important; flex-wrap: wrap !important; gap: 6px !important; font-size: 11px !important; }

  /* ── Total spend badge in logs ─── */
  [style*="border-radius:20px"][style*="padding:6px 14px"] { font-size: 11px !important; padding: 4px 10px !important; }

  /* ── Job log header actions ─── */
  .flex-between > div[style*="display:flex;gap:6px"] { flex-wrap: wrap; gap: 4px !important; }
  .flex-between > div[style*="display:flex;gap:6px"] input[style*="width:140px"] { width: 100px !important; }

  /* ── Toggle switches ─── */
  .toggle { transform: scale(0.9); }

  /* ── Empty states ─── */
  .empty { padding: 30px 14px; }
  .empty-icon { font-size: 32px; }
  .empty h3 { font-size: 15px; }
  .empty p { font-size: 12px; }

  /* ── Profiles header buttons ─── */
  .flex-between > div[style*="display:flex;gap:6px;align-items:center"] { flex-wrap: wrap; gap: 4px !important; width: 100%; }
  .flex-between > div[style*="display:flex;gap:6px;align-items:center"] .btn { font-size: 11px !important; padding: 5px 8px !important; }
  .flex-between > div[style*="display:flex;gap:6px;align-items:center"] .btn-primary { flex: 1; text-align: center; justify-content: center; }

  /* ── Profile 3-col grid → 1 col on mobile ─── */
  #profileGrid { grid-template-columns: 1fr !important; gap: 16px !important; }

  /* ── Profile cards — compact on mobile ─── */
  .rule-card .profile-avatar { width: 32px !important; height: 32px !important; font-size: 13px !important; }
  .rule-card [style*="gap:10px"] > .toggle { transform: scale(0.8) !important; }
  .rule-card [style*="gap:10px"] > button[style*="color:var(--accent)"] { padding: 2px 5px !important; font-size: 10px !important; }

  /* ── Profile name row — stack on mobile ─── */
  .profile-name-row { display: block !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .profile-name-row > span { font-size: 12px !important; }

  /* ── Profile stats — shorter labels on mobile ─── */
  .profile-stats-row span { font-size: 9px !important; }
  .profile-stats-row { gap: 6px !important; }

  /* ── Comment List cards — compact on mobile ─── */
  .rule-card[style*="display:flex;align-items:center;gap:12px"] {
    display: block !important;
    padding: 10px 12px !important;
  }
  .rule-card[style*="display:flex;align-items:center;gap:12px"] > div:first-child {
    margin-bottom: 4px;
  }
  .rule-card[style*="display:flex;align-items:center;gap:12px"] > .badge {
    margin-right: 4px;
  }
  .rule-card[style*="display:flex;align-items:center;gap:12px"] > div:last-child {
    margin-top: 4px;
    margin-left: 0 !important;
  }

  /* ── Comment List header +New button — don't stretch ─── */
  .flex-between .btn-primary { flex: none !important; }

  /* ── Comment list selector ─── */
  #listSelectField { min-height: 38px !important; }
  .list-chip { font-size: 10px !important; padding: 2px 6px !important; }
  #listDropdown { max-height: 180px !important; }

  /* ── Link validation preview ─── */
  #linkPreview { max-height: 70px !important; }

  /* ── Admin user cards ─── */
  [style*="display:grid;grid-template-columns:repeat(auto-fit,minmax(380px"] { grid-template-columns: 1fr !important; gap: 6px !important; }
  .admin-user-card { padding: 10px 12px !important; }
  .admin-user-card > div:first-child { margin-bottom: 6px !important; gap: 8px !important; }
  .admin-user-card > div:first-child > div:first-child { width: 28px !important; height: 28px !important; font-size: 12px !important; border-radius: 8px !important; }
  .admin-user-card [style*="font-weight:700;font-size:14px"] { font-size: 12px !important; }
  .admin-user-card [style*="font-size:10px;color:var(--text2);margin-top:2px"] { font-size: 9px !important; gap: 4px !important; }
  .admin-user-card [style*="display:flex;align-items:center;gap:0"] { padding: 5px 8px !important; font-size: 10px !important; }
  .admin-user-card [style*="display:flex;align-items:center;gap:0"] > span[style*="color:var(--border)"] { margin: 0 2px; }
  .admin-user-card [style*="display:flex;align-items:center;gap:0"] > span[style*="flex:1"] { font-size: 10px !important; }
  .admin-user-card [style*="display:flex;gap:4px;flex-shrink:0"] > button { font-size: 9px !important; padding: 3px 6px !important; }

  /* ── Job ETA pill — wrap on narrow screens ─── */
  .job-card-row + div[style*="display:flex"] { flex-wrap: wrap !important; }

  /* ── Activity feed entries — compact on mobile ─── */
  #activityFeed > div { padding: 5px 8px !important; }
  #activityFeed > div > span:first-child { font-size: 8px !important; min-width: 55px !important; }
  #activityFeed > div > span:last-child { font-size: 10px !important; }
  #activityFeed { max-height: 200px !important; }


  /* ── Job detail stat boxes — 2 cols on mobile ─── */
  [style*="grid-template-columns:repeat(auto-fit,minmax(80px"] { grid-template-columns: repeat(2, 1fr) !important; gap: 6px !important; }

  /* ── Settings password fields — stack vertically ─── */
  .rule-card [style*="flex-wrap:wrap"] { flex-direction: column !important; }
  .rule-card [style*="flex-wrap:wrap"] > div { width: 100% !important; flex: none !important; }
  .rule-card [style*="flex-wrap:wrap"] > button { width: 100% !important; }

  /* ── Search inputs — responsive width ─── */
  input[style*="width:140px"] { width: 100px !important; }

  /* ── Job detail meta row — wrap better ─── */
  [style*="display:flex;gap:12px;margin-top:10px"] { flex-wrap: wrap !important; gap: 4px 10px !important; }
  [style*="display:flex;gap:12px;margin-top:10px"] > span { font-size: 9px !important; }

  /* ── Job detail progress bar with ETA ─── */
  [style*="display:flex;align-items:center;gap:8px"] > span[style*="margin-left"] { margin-left: 0 !important; display: block; width: 100%; margin-top: 4px; }
}
