/* ─── ADMIN PANEL STYLES ─── */
:root {
  --crimson: #B50E22;
  --crimson-dark: #8B0A1A;
  --white: #FFFFFF;
  --black: #1A1A1A;
  --bg: #F5F5F5;
  --sidebar-width: 240px;
  --border: #E0E0E0;
  --text: #333;
  --text-light: #888;
  --success: #2E7D32;
  --warning: #E65100;
  --radius: 10px;
  --gray-light: #ccc;
  --gray-bg: #FAFAFA;
  --crimson-light: #FFF5F5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

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

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ─── LOGIN SCREEN ─── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-card {
  background: var(--crimson);
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  max-width: 400px;
  width: 100%;
}

.login-logo {
  width: 160px;
  margin-bottom: 24px;
}

.login-card h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 28px;
}

.login-card p {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 32px;
}

.login-google-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-google-btn:hover {
  border-color: var(--gray-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.login-error {
  margin-top: 16px;
  font-size: 13px;
  color: var(--white);
  min-height: 20px;
}

/* ─── ADMIN SHELL ─── */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--crimson);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-logo {
  width: 120px;
  height: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  color: rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.05);
}

.sidebar-link.active {
  color: var(--white);
  background: rgba(255,255,255,0.08);
  border-left-color: var(--white);
}

.sidebar-link.hidden {
  display: none;
}

.sidebar-divider-label {
  margin-top: auto;
  padding: 12px 18px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.35);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-link-ext {
  font-size: 13px;
  padding: 8px 18px;
}

.sidebar-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active svg {
  opacity: 1;
}

.sidebar-badge {
  background: var(--crimson);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: auto;
}

.sidebar-footer {
  padding: 0 16px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-link-settings {
  margin: 0 -16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-footer .sidebar-user {
  padding: 14px 4px 0;
}

.sidebar-footer .sidebar-signout {
  margin: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}

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

.sidebar-user-role {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.4);
}

.sidebar-signout {
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: var(--radius);
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.15s ease;
}

.sidebar-signout:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
}

/* ─── MAIN CONTENT ─── */
.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.admin-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 40px;
}

/* ─── PAGE HEADER ─── */
.page-builder-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  text-decoration: none;
  cursor: pointer;
  margin-bottom: 16px;
  transition: color 0.2s;
}
.page-builder-back:hover { color: var(--crimson); }
.page-builder-back svg {
  width: 16px;
  height: 16px;
}

.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.admin-page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--black);
}

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

.page-builder-hint {
  font-size: 12px;
  color: var(--text-light);
}

/* ─── DASHBOARD TOGGLE ─── */
.dash-toggle {
  display: flex;
  gap: 2px;
  background: #E5E7EB;
  border-radius: 12px;
  padding: 4px;
  position: relative;
}

.dash-toggle::before {
  content: '';
  position: absolute;
  top: 4px;
  left: var(--slider-left, 4px);
  width: var(--slider-width, 0);
  height: calc(100% - 8px);
  background: var(--white);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: left 0.3s ease, width 0.3s ease;
  z-index: 0;
}

.dash-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border: none;
  border-radius: 10px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  background: transparent;
  cursor: pointer;
  transition: color 0.25s ease;
  position: relative;
  z-index: 1;
}

.dash-toggle-btn:hover:not(.active) {
  color: var(--text);
}

.dash-toggle-btn.active {
  color: var(--black);
}

.dash-toggle-btn svg {
  flex-shrink: 0;
}

.dash-last-updated-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-last-updated {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 500;
}

.dash-refresh-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px;
  cursor: pointer;
  color: var(--text-light);
  display: flex;
  align-items: center;
  transition: color 0.15s, border-color 0.15s;
}

.dash-refresh-btn:hover {
  color: var(--text);
  border-color: var(--text-light);
}

/* ─── GA DASHBOARD WIDGETS ─── */
.ga-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.source-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}

.source-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 130px;
  font-size: 13px;
  color: var(--text);
}

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

.source-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}

.source-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.source-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 80px;
  justify-content: flex-end;
}

.source-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.source-pct {
  font-size: 11px;
  color: var(--text-light);
}

.device-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.device-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius);
}

.device-icon {
  color: var(--text-light);
  flex-shrink: 0;
}

.device-info {
  flex: 1;
}

.device-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-transform: capitalize;
}

.device-sessions {
  font-size: 12px;
  color: var(--text);
  margin-top: 2px;
}

.device-pct {
  color: var(--text-light);
}

.device-bounce {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 1px;
}

.user-ratio-bar {
  height: 4px;
  background: #E5E7EB;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.user-ratio-fill {
  height: 100%;
  background: var(--crimson);
  border-radius: 2px;
  transition: width 0.3s ease;
}

@media (max-width: 768px) {
  .ga-two-col {
    grid-template-columns: 1fr;
  }
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
  background: var(--crimson);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--crimson-dark);
}

.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--gray-light);
}

.btn-success {
  background: var(--success);
  color: var(--white);
}

.btn-danger {
  background: var(--crimson);
  color: var(--white);
}

.btn-danger:hover {
  background: var(--crimson-dark);
  color: var(--white);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  height: 32px;
}

/* ─── CARDS / PANELS ─── */
.admin-card {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}

.admin-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

/* ─── STATS ROW ─── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--black);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 4px;
}

/* ─── DASHBOARD YOUTUBE ─── */
.setup-prompt {
  text-align: center;
  padding: 48px 24px;
}

.setup-prompt-icon {
  color: var(--text-light);
  margin-bottom: 16px;
}

.setup-prompt-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.setup-prompt-text {
  color: var(--text-light);
  font-size: 14px;
  max-width: 420px;
  margin: 0 auto 20px;
  line-height: 1.5;
}

.channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 20px;
}

.channel-row-border {
  border-bottom: 1px solid var(--border);
}

.channel-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.channel-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}
.channel-thumb-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--crimson);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.channel-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--black);
}

.channel-row-stats {
  display: flex;
  gap: 32px;
  flex-shrink: 0;
}

.channel-stat {
  text-align: right;
}

.channel-stat-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--black);
}

.channel-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-light);
  margin-top: 2px;
}

.ga-card {
  padding: 0;
}

.ga-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}

.ga-link:hover {
  background: var(--bg);
}

.ga-link svg:last-child {
  margin-left: auto;
  color: var(--text-light);
}

/* ─── GROWTH CHART ─── */
.chart-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-header-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.chart-growth-value {
  font-size: 14px;
  font-weight: 700;
}

.chart-growth-value.positive {
  color: var(--success);
}

.chart-growth-value.negative {
  color: var(--crimson);
}

.chart-growth-period {
  font-size: 12px;
  color: var(--text-light);
  font-weight: 600;
}

.chart-container {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
  padding: 0 4px;
}

.chart-bar-wrap {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  cursor: default;
}

.chart-bar {
  width: 100%;
  background: var(--crimson);
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: opacity 0.15s;
  opacity: 0.7;
}

.chart-bar-wrap:hover .chart-bar {
  opacity: 1;
}

/* ─── CHART CONTROLS (below chart) ─── */
.chart-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.chart-range-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: 10px;
  padding: 3px;
}

.chart-range-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-range-btn:hover {
  color: var(--text);
}

.chart-range-btn.active {
  background: var(--crimson);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.chart-metric-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: 10px;
  padding: 3px;
}

.chart-metric-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-metric-btn:hover {
  color: var(--text);
}

.chart-metric-btn.active {
  background: var(--white);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.channel-handle {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 1px;
}

/* ─── VIDEO GRID ─── */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.video-card {
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.video-card:hover {
  border-color: var(--gray-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.video-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: #eee;
}

.video-info {
  padding: 12px;
}

.video-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--black);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-meta {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-light);
}

/* ─── TOP VIDEOS LIST ─── */
.top-videos-list {
  display: flex;
  flex-direction: column;
}

.top-video-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.top-video-row:last-child {
  border-bottom: none;
}

.top-video-row:hover {
  background: var(--bg);
}

.top-video-rank {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-light);
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.top-video-thumb {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  background: #eee;
  flex-shrink: 0;
}

.top-video-info {
  flex: 1;
  min-width: 0;
}

.top-video-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.top-video-channel {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

.top-video-stats {
  text-align: right;
  flex-shrink: 0;
}

.top-video-views {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.top-video-engagement {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* ─── TABLES ─── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
}

.admin-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(0,0,0,0.015);
}

.actions-dropdown {
  position: relative;
  display: inline-block;
}

.actions-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  height: 32px;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s;
}

.actions-dropdown-btn:hover {
  border-color: #aaa;
}

.actions-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  min-width: 120px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 50;
  overflow: hidden;
}

.actions-dropdown-menu.open {
  display: block;
}

.actions-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
}

.actions-dropdown-item:hover {
  background: var(--bg);
}

.actions-dropdown-danger {
  color: var(--crimson);
}

.actions-dropdown-danger:hover {
  background: var(--crimson-light);
}

.admin-table .table-title {
  font-weight: 600;
  color: var(--black);
}
.admin-table .table-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}
.admin-table .table-title a:hover {
  color: var(--crimson);
}

/* ─── BADGES ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-draft {
  background: #E65100;
  color: #fff;
}

.badge-published {
  background: #2E7D32;
  color: #fff;
}

.badge-admin {
  background: #FCE4EC;
  color: var(--crimson);
}

.badge-editor {
  background: #E3F2FD;
  color: #1565C0;
}

.badge-contributor {
  background: #F3E5F5;
  color: #7B1FA2;
}

.badge-recipe {
  background: #555;
  color: #fff;
}

.badge-technique {
  background: #555;
  color: #fff;
}

.badge-product-review {
  background: #555;
  color: #fff;
}

.badge-beginner {
  background: #2E7D32;
  color: #fff;
}

.badge-intermediate {
  background: #1565C0;
  color: #fff;
}

.badge-advanced {
  background: #333;
  color: #fff;
}

.badge-expert {
  background: #333;
  color: #fff;
}

/* ─── TAG SELECTOR ─── */
.tag-selector {
  display: flex;
  gap: 8px;
}

.tag-option {
  flex: 1;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--white);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-light);
  text-align: center;
}

.tag-option:hover {
  border-color: var(--gray-light);
}

.tag-option.active {
  border-color: transparent;
  background: #555;
  color: #fff;
}

/* Ski-trail difficulty symbols */
.diff-icon { width: 1.1em; height: 1.1em; vertical-align: middle; flex-shrink: 0; }

/* ─── YOUTUBE CHANNEL ROWS ─── */
.yt-channel-header {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}
.yt-channel-header span:nth-child(1) { flex: 1; }
.yt-channel-header span:nth-child(2) { flex: 1.5; }
.yt-channel-header span:nth-child(3) { width: 110px; flex-shrink: 0; }
.yt-channel-header span:nth-child(4) { width: 32px; flex-shrink: 0; }
.yt-channel-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.yt-channel-row .yt-ch-name { flex: 1; }
.yt-channel-row .yt-ch-id { flex: 1.5; }
.yt-channel-row .yt-ch-lang,
.yt-channel-row .custom-select-wrap:has(.yt-ch-lang) { width: 110px; flex-shrink: 0; }
.yt-channel-row .yt-ch-remove {
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
}

.badge-lang {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #E3F2FD;
  color: #1565C0;
  margin-left: 6px;
}

/* ─── FORMS ─── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--crimson);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  height: 44px;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-select-sm {
  height: 32px;
  width: auto;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
}

/* ─── CUSTOM SELECT WRAPPER ─── */
.custom-select-wrap {
  position: relative;
}

.form-group .custom-select-wrap {
  width: 100%;
}

.custom-select-native {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.custom-select-trigger {
  width: 100%;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  text-align: left;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.custom-select-wrap-sm .custom-select-trigger {
  height: 32px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
}

.custom-select-wrap.open .custom-select-trigger {
  border-color: var(--crimson);
}

.custom-select-chevron {
  color: var(--text-light);
  margin-left: 8px;
  flex-shrink: 0;
}

.custom-select-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 900;
  max-height: 260px;
  overflow-y: auto;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.custom-select-menu.open {
  display: block;
}

.custom-select-option {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.custom-select-option:hover,
.custom-select-option.active {
  background: #f7f7f7;
}

.custom-select-option.disabled {
  color: var(--text-light);
  cursor: default;
}

.form-input {
  height: 44px;
}

/* Required field indicator */
.req-field {
  position: relative;
  display: flex;
  align-items: stretch;
}

.req-field .form-input,
.req-field .form-select {
  width: 100%;
}

.req-star {
  position: absolute;
  top: 6px;
  right: 6px;
  color: var(--crimson);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

/* Input with unit suffix */
.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit .form-input {
  padding-right: 40px;
}

.input-unit {
  position: absolute;
  right: 12px;
  color: var(--text-light);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}


.video-card-divider {
  border: none;
  border-top: 1.5px solid var(--border);
  margin: 20px 0;
}

/* ─── TOGGLE SWITCH ─── */
.toggle-section {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}

.toggle-section:not(.open) {
  overflow: hidden;
}

.toggle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--gray-bg);
}

.toggle-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: #CCC;
  border-radius: 11px;
  transition: background 0.2s ease;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch.on {
  background: var(--crimson);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--white);
  border-radius: 50%;
  transition: left 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.on::after {
  left: 20px;
}

.toggle-body {
  padding: 18px;
  border-top: 1px solid var(--border);
  display: none;
}

.toggle-section.open .toggle-body {
  display: block;
}

/* ─── REPEATABLE ROWS ─── */
.repeatable-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.repeatable-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.repeatable-row .form-input {
  flex: 1;
}
.repeatable-row .req-field {
  flex: 1;
}

.repeatable-remove {
  width: 32px;
  height: 32px;
  margin-top: 6px;
  border: none;
  background: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.repeatable-remove:hover {
  background: #FEE;
  color: var(--crimson);
}

.repeatable-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 8px;
}

.repeatable-add:hover {
  border-color: var(--crimson);
  color: var(--crimson);
}

/* ─── PAGE TYPE SELECTOR ─── */
.type-selector {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.type-option {
  flex: 1;
  padding: 16px;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.type-option:hover {
  border-color: var(--gray-light);
}

.type-option.active {
  border-color: var(--crimson);
  background: var(--crimson-light);
}

.type-option-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
}

.type-option.active .type-option-label {
  color: var(--crimson);
}

/* ─── YOUTUBE PREVIEW ─── */
.yt-preview {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 16px;
  background: var(--gray-bg);
  border-radius: var(--radius);
  margin-top: 12px;
}

.yt-preview-thumb {
  width: 120px;
  height: 68px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--border);
}

.yt-preview-info {
  flex: 1;
}

.yt-preview-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.yt-preview-meta {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ─── FILTER BAR ─── */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.filter-bar .form-select {
  width: auto;
  min-width: 140px;
  height: 38px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
}

/* ─── PAGES TOOLBAR ─── */
.pages-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.pages-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.pages-toolbar-right { flex-shrink: 0; }
.pages-search-wrap {
  position: relative;
  flex: 1;
  max-width: 260px;
  min-width: 160px;
}
.pages-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}
.pages-search-input {
  height: 38px;
  padding-left: 36px !important;
  font-size: 13px;
  font-weight: 600;
}
.pages-toolbar .form-select {
  width: auto;
  min-width: 130px;
  height: 38px;
  padding: 8px 34px 8px 14px;
  font-size: 13px;
  font-weight: 700;
}
.pages-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
}

/* ─── SORTABLE TABLE HEADERS ─── */
.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.sortable-th:hover { color: var(--text); }
.sort-icon { vertical-align: middle; margin-left: 4px; opacity: 0.9; }
.sort-icon-inactive { opacity: 0.3; }
.table-date { color: var(--text-light); font-size: 13px; white-space: nowrap; }

/* ─── ACTIONS DROPDOWN VARIANTS ─── */
.actions-dropdown-success { color: var(--success); font-weight: 600; }
.actions-dropdown-success:hover { background: #E8F5E9; }
.actions-dropdown-item:disabled,
.actions-dropdown-item[disabled] { opacity: 0.4; cursor: not-allowed; }
.actions-dropdown-item:disabled:hover,
.actions-dropdown-item[disabled]:hover { background: transparent; }

@media (max-width: 768px) {
  .pages-toolbar { flex-wrap: wrap; }
  .pages-toolbar-left { flex-wrap: wrap; }
  .pages-search-wrap { max-width: none; width: 100%; flex-basis: 100%; }
}

/* ─── TOAST NOTIFICATIONS ─── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  background: var(--black);
  color: var(--white);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: toastIn 0.3s ease;
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--crimson);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state-text {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.empty-state-sub {
  font-size: 13px;
}

/* ─── CONFIRM DIALOG ─── */
.confirm-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.confirm-dialog {
  background: var(--white);
  border-radius: 12px;
  padding: 28px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.confirm-dialog h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.confirm-dialog p {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 20px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ─── PRESETS GRID ─── */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.preset-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: background 0.15s ease;
}

.preset-checkbox:hover {
  background: #F5F5F5;
}

.preset-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--crimson);
  cursor: pointer;
}

/* ─── ADD USER FORM ─── */
.add-user-header {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}
.add-user-header span:nth-child(1) { width: 130px; flex: 0 0 130px; }
.add-user-header span:nth-child(2) { width: 130px; flex: 0 0 130px; }
.add-user-header span:nth-child(3) { flex: 1; }
.add-user-header span:nth-child(4) { width: 140px; flex: 0 0 140px; }
.add-user-header span:nth-child(5) { width: 52px; flex: 0 0 52px; }
.add-user-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}

.add-user-form .form-input {
  height: 32px;
  padding: 6px 12px;
  font-size: 12px;
}

.add-user-form .form-select-sm,
.add-user-form .custom-select-wrap:has(.form-select-sm) {
  height: 32px;
  width: 140px;
  flex: 0 0 140px;
}

.add-user-form .btn {
  height: 32px;
  white-space: nowrap;
}

.add-user-form .req-field:has(.form-input[type="text"]) {
  width: 130px;
  flex: 0 0 130px;
}

.add-user-form .req-field:has(.form-input[type="email"]) {
  flex: 1;
}

.action-btns {
  display: flex;
  gap: 6px;
}

.badge-active {
  background: #E8F5E9;
  color: var(--success);
}

.badge-suspended {
  background: #FFF3E0;
  color: var(--warning);
}

.permissions-table {
  margin-bottom: 0;
}

.permissions-table td,
.permissions-table th {
  text-align: center;
}

.permissions-table td:first-child,
.permissions-table th:first-child {
  text-align: left;
}

.perm-yes {
  color: var(--success);
  font-weight: 600;
}

.perm-no {
  color: var(--gray-light);
}

/* ─── SETTINGS TABS ─── */
.settings-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}

.settings-tab {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s ease;
}

.settings-tab:hover {
  color: var(--text);
}

.settings-tab.active {
  color: var(--crimson);
  border-bottom-color: var(--crimson);
}

/* ─── IMAGE UPLOAD ─── */
.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.image-upload-area:hover {
  border-color: var(--crimson);
  background: var(--crimson-light);
}

.image-upload-area.has-image {
  border-style: solid;
  padding: 12px;
}

.image-upload-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: 6px;
  object-fit: contain;
}

/* ─── INGREDIENT ROW ─── */
.ingredient-header {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
}
.ingredient-header span:nth-child(1) { width: 24px; flex: 0 0 24px; }
.ingredient-header span:nth-child(2) { width: 70px; flex: 0 0 70px; }
.ingredient-header span:nth-child(3) { width: 100px; flex: 0 0 100px; }
.ingredient-header span:nth-child(4) { flex: 1; min-width: 120px; }
.ingredient-header span:nth-child(5) { width: 110px; flex: 0 0 110px; }
.ingredient-header span:nth-child(6) { width: 100px; flex: 0 0 100px; }
.ingredient-header span:nth-child(7) { width: 32px; flex: 0 0 32px; }
.ingredient-fields {
  display: flex;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

.ingredient-fields .form-input,
.ingredient-fields .form-select {
  min-width: 0;
}

.ingredient-fields .form-select {
  font-size: 13px;
  padding: 8px 10px;
}

.ingredient-qty { width: 100%; }
.req-field:has(.ingredient-qty) { width: 70px; flex: 0 0 70px; }
.ingredient-unit-wrap { width: 100px; flex: 0 0 100px; }
.ingredient-unit-select { width: 100%; }
.ingredient-unit-custom { width: 90px; flex: 0 0 90px; }
.ingredient-unit-custom.hidden { display: none; }
.ingredient-name { width: 100%; }
.ingredient-name-wrap { flex: 1; min-width: 120px; }
.ingredient-condition { width: 110px; flex: 0 0 110px; }

.ingredient-dept,
.custom-select-wrap:has(.ingredient-dept) {
  width: 100px;
  flex: 0 0 100px;
}

/* ─── INGREDIENT HEADINGS ─── */
.ingredient-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.ingredient-heading-line {
  flex: 1;
  height: 0;
  border-bottom: 1.5px solid var(--border);
}

.ingredient-heading-input {
  flex: 0 1 auto;
  width: auto;
  min-width: 120px;
  max-width: 260px;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 4px 8px;
}

.ingredient-heading-input:focus {
  outline: none;
  border-bottom: 1.5px solid var(--crimson);
  border-radius: 0;
}

.ingredient-heading-input::placeholder {
  color: var(--text-light);
  font-weight: 600;
}

/* ─── INGREDIENT ACTIONS ─── */
.ingredient-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* ─── DRAG HANDLE ─── */
.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 32px;
  margin-top: 6px;
  cursor: grab;
  color: var(--text-light);
  font-size: 16px;
  flex-shrink: 0;
  user-select: none;
  opacity: 0.5;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.drag-handle:hover {
  opacity: 1;
  color: var(--text);
}

.drag-handle:active {
  cursor: grabbing;
}

.repeatable-row.dragging {
  opacity: 0.4;
}

/* ─── TOOL ROW ─── */
.tool-row-fields {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.tool-input {
  flex: 1;
  min-width: 0;
}

.tool-input.hidden {
  display: none;
}

.tool-or {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-light);
  flex-shrink: 0;
}

.tool-or.hidden {
  display: none;
}

.tool-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.tool-action-btn {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--text-light);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.tool-action-btn:hover {
  border-color: var(--crimson);
  color: var(--crimson);
}

.tool-action-btn.hidden {
  display: none;
}

/* ─── STEP ROWS ─── */
.step-number {
  font-weight: 700;
  color: var(--crimson);
  min-width: 24px;
  font-size: 14px;
  flex-shrink: 0;
}

.step-heading-letter {
  font-weight: 800;
  color: var(--crimson);
  min-width: 24px;
  font-size: 14px;
  flex-shrink: 0;
}

.step-textarea {
  min-height: 60px;
  flex: 1;
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

/* ─── TIMING GRID ─── */
.timing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.timing-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.timing-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.timing-hr,
.timing-min {
  width: 52px;
  flex: 0 0 52px;
  text-align: center;
  -moz-appearance: textfield;
}

.timing-hr::-webkit-outer-spin-button,
.timing-hr::-webkit-inner-spin-button,
.timing-min::-webkit-outer-spin-button,
.timing-min::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.timing-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  margin-right: 4px;
}

/* ─── TIMING READONLY (auto-calculated total) ─── */
.timing-readonly {
  background: var(--bg) !important;
  color: var(--text-light);
  cursor: default;
  pointer-events: none;
}

/* ─── FILTER PILLS (reusable tab-filter buttons) ─── */
.filter-pills {
  display: flex;
  gap: 4px;
}

.filter-pill {
  padding: 10px 18px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--white);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill:hover:not(.active) {
  border-color: var(--crimson);
  color: var(--crimson);
}

.filter-pill.active {
  background: var(--crimson);
  border-color: var(--crimson);
  color: var(--white);
}

/* ─── PLAYLIST MANAGER ─── */
.playlist-tab-filters {
  display: flex;
  gap: 4px;
}

.playlist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  transition: background 0.15s;
}

.playlist-row:last-child {
  border-bottom: none;
}

.playlist-row:hover {
  background: none;
}

.playlist-row.dragging {
  opacity: 0.4;
}

.playlist-row.drag-over {
  border-top: 2px solid var(--crimson);
}

.playlist-drag-handle {
  color: var(--text-light);
  cursor: grab;
  flex-shrink: 0;
}

.playlist-row-info {
  flex: 1;
  min-width: 0;
}

.playlist-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.playlist-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-light);
}

.playlist-tab-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.playlist-tab-techniques {
  background: #EEF2FF;
  color: #4F46E5;
}

.playlist-tab-recipes {
  background: #FEF3C7;
  color: #B45309;
}

.playlist-tab-tools {
  background: #ECFDF5;
  color: #059669;
}

.playlist-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.playlist-page-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: grab;
}

.playlist-page-row:last-child {
  border-bottom: none;
}

.playlist-page-row.dragging {
  opacity: 0.4;
}

.playlist-page-row.drag-over {
  border-top: 2px solid var(--crimson);
}

.playlist-page-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.playlist-page-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-page-remove {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.playlist-page-remove:hover {
  color: var(--crimson);
  background: var(--crimson-light);
}

/* ─── MULTI-SELECT PAGE PICKER ─── */
.playlist-picker-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.playlist-picker-wrap {
  position: relative;
}

.playlist-picker-trigger {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  color: var(--text-light);
}

.playlist-picker-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 100;
  overflow: hidden;
}

.playlist-picker-dropdown.open {
  display: block;
}

.playlist-picker-search-wrap {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.playlist-picker-search {
  margin: 0;
}

.playlist-picker-options {
  max-height: 320px;
  overflow-y: auto;
}

.playlist-picker-toolbar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.playlist-picker-filter {
  width: 160px;
  flex-shrink: 0;
}

.playlist-picker-option {
  display: block;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 13px;
}

.playlist-picker-option:hover {
  background: var(--bg);
}

.playlist-picker-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.playlist-picker-option-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--crimson);
  flex-shrink: 0;
  cursor: pointer;
}

.playlist-picker-option-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 500;
}

.playlist-picker-option-meta {
  display: flex;
  gap: 6px;
  padding-left: 26px;
  margin-top: 3px;
}

.playlist-picker-option-meta .badge {
  font-size: 9px;
}

.playlist-page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
}

.playlist-page-meta .badge {
  font-size: 9px;
}

.playlist-picker-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* Tier chart in editor */
.ranking-tier-row {
  display: flex;
  margin-bottom: 8px;
  border-radius: 10px;
  overflow: visible;
  border: 1px solid var(--border);
  background: var(--white);
}

.ranking-tier-label {
  width: 80px;
  min-width: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: white;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-radius: 10px 0 0 10px;
}

.ranking-tier-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  flex: 1;
  min-height: 80px;
  align-items: center;
  transition: background 0.15s;
}

.ranking-tier-items.drag-over {
  background: rgba(181,14,34,0.04);
  outline: 2px dashed var(--crimson);
  outline-offset: -2px;
  border-radius: 0 10px 10px 0;
}

.ranking-product-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: grab;
  transition: all 0.15s;
}

.ranking-product-card:hover {
  border-color: var(--gray-light);
}

.ranking-product-card.dragging {
  opacity: 0.4;
}

.ranking-product-drag {
  color: var(--text-light);
  cursor: grab;
  flex-shrink: 0;
  display: flex;
}

.ranking-product-info {
  flex: 1;
  min-width: 0;
}

.ranking-product-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-product-remove {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 16px;
  flex-shrink: 0;
}

.ranking-product-remove:hover {
  color: var(--crimson);
  background: var(--crimson-light);
}

.ranking-tier-select {
  height: auto;
}

/* ─── MOBILE HEADER & HAMBURGER (hidden on desktop) ─── */
.mobile-header {
  display: none;
}

.hamburger-btn {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {

  /* ── 1. MOBILE HEADER BAR + SIDEBAR TOGGLE ── */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: var(--crimson);
    z-index: 110;
    padding: 0 16px;
  }

  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--white);
    cursor: pointer;
    flex-shrink: 0;
    margin-left: -8px;
  }

  .hamburger-btn .close-icon {
    display: none;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    width: 100%;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .sidebar-open .mobile-header {
    z-index: 300;
    background: transparent;
  }

  .sidebar-open .hamburger-btn .hamburger-icon {
    display: none;
  }

  .sidebar-open .hamburger-btn .close-icon {
    display: block;
  }

  .sidebar-open .sidebar .sidebar-header {
    padding-top: 64px;
  }

  .sidebar-open .sidebar .sidebar-nav {
    width: 100%;
    max-width: 300px;
  }

  .sidebar-open .sidebar .sidebar-link {
    justify-content: flex-start;
    font-size: 16px;
    padding: 14px 24px;
  }

  .sidebar-open .sidebar .sidebar-footer {
    width: 100%;
    max-width: 300px;
  }

  /* ── 2. MAIN CONTENT — FULL WIDTH ── */
  .admin-main {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }

  .admin-content {
    padding: 64px 24px 24px;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .admin-page-header {
    flex-wrap: wrap;
    gap: 12px;
  }

  .admin-card {
    max-width: 100%;
    min-width: 0;
  }

  .admin-page-title {
    font-size: 20px;
  }

  /* Prevent iOS input auto-zoom that can misplace popovers/dropdowns */
  .form-input,
  .form-select,
  .form-textarea,
  .form-select-sm {
    font-size: 16px;
  }

  .form-select option {
    font-size: 16px;
  }

  /* ── 3. DASHBOARD ── */
  .chart-range-tabs,
  .chart-metric-toggle {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
  }

  .dash-last-updated-wrap {
    flex-wrap: wrap;
  }

  /* ── 4. PAGES LIST ── */
  .admin-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    width: 100%;
    min-width: 0;
    position: relative;
  }

  .admin-table-wrap.actions-menu-open {
    overflow-y: visible;
    -webkit-overflow-scrolling: auto;
  }

  .admin-table {
    min-width: 560px;
  }

  /* ── 5. PAGE BUILDER ── */
  .page-builder-actions .btn {
    white-space: nowrap;
  }

  .ingredient-fields {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── 6. PRODUCTS & RANKINGS ── */
  .filter-pills {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .filter-pill {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* ── 7. PLAYLISTS ── */
  .playlist-tab-filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── 8. SETTINGS ── */
  .settings-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .settings-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* ── 9. MODALS & TOASTS ── */
  .confirm-dialog {
    max-width: 90vw;
    padding: 24px 20px;
    margin: 0 16px;
  }

  /* ── 10. GENERAL TOUCH TARGETS ── */
  .sidebar-link {
    min-height: 44px;
  }

  /* ── PHONE-ONLY OVERRIDES (not tablet) ── */
  @media (max-width: 768px) {

    .admin-content {
      padding: 64px 16px 24px;
    }

    /* Dashboard */
    .stats-row {
      grid-template-columns: 1fr;
    }

    .chart-controls-row {
      flex-wrap: wrap;
      gap: 8px;
    }

    .channel-row {
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
      padding: 14px 16px;
    }

    .channel-row-stats {
      gap: 20px;
      flex-shrink: 1;
    }

    .channel-stat {
      text-align: left;
    }

    .video-grid {
      grid-template-columns: 1fr;
    }

    .top-video-thumb {
      width: 64px;
      height: 36px;
    }

    .ga-two-col {
      grid-template-columns: 1fr;
    }

    .source-row {
      flex-wrap: wrap;
    }

    .dash-toggle-btn {
      padding: 8px 14px;
      font-size: 12px;
    }

    /* Pages list */
    .pages-toolbar {
      flex-wrap: wrap;
    }

    .pages-toolbar-left {
      flex-wrap: wrap;
      width: 100%;
    }

    .pages-search-wrap {
      max-width: none;
      width: 100%;
      flex-basis: 100%;
      min-width: 0;
    }

    .pages-toolbar .form-select {
      min-width: 0;
      flex: 1;
    }

    .pages-toolbar-right {
      width: 100%;
    }

    .pages-toolbar-right .btn {
      width: 100%;
      justify-content: center;
    }

    /* Page builder */
    .type-selector {
      flex-direction: column;
    }

    .form-row {
      flex-direction: column;
    }

    .page-builder-actions {
      flex-wrap: wrap;
      gap: 8px;
    }

    .page-builder-actions .btn {
      flex: 1;
      justify-content: center;
      min-width: 0;
    }

    .toggle-body {
      padding: 14px;
    }

    .yt-preview {
      flex-direction: column;
      align-items: flex-start;
    }

    .yt-preview-thumb {
      width: 100%;
      height: auto;
      aspect-ratio: 16/9;
    }

    .ingredient-header {
      display: none;
    }

    .ingredient-fields {
      flex-direction: column;
      overflow-x: visible;
    }

    .req-field:has(.ingredient-qty) {
      width: 100%;
      flex: 1;
    }

    .ingredient-unit-wrap {
      width: 100%;
      flex: 1;
    }

    .ingredient-name-wrap {
      min-width: 0;
      width: 100%;
    }

    .ingredient-condition {
      width: 100%;
      flex: 1;
    }

    .ingredient-dept {
      width: 100%;
      flex: 1;
    }

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

    .timing-hr,
    .timing-min {
      width: 44px;
      flex: 0 0 44px;
    }

    .tool-row-fields {
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
    }

    .tool-input {
      width: 100%;
      min-width: 0;
    }

    .tool-or {
      width: 100%;
      display: block;
      text-align: left;
      padding-left: 2px;
    }

    /* Rankings */
    .ranking-tier-label {
      width: 56px;
      min-width: 56px;
      font-size: 10px;
      letter-spacing: 0;
    }

    .ranking-tier-items {
      flex-direction: column;
      min-height: 80px;
      padding: 10px;
      gap: 6px;
    }

    .ranking-product-card {
      width: 100%;
    }

    .ranking-product-name {
      font-size: 12px;
    }

    .playlist-picker-filter {
      width: 100%;
    }

    .playlist-picker-toolbar {
      flex-direction: column;
      align-items: stretch;
    }

    /* Playlists */
    .playlist-row {
      padding: 14px 12px;
    }

    .playlist-drag-handle {
      min-width: 32px;
      min-height: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .playlist-page-row {
      padding: 12px 0;
      align-items: flex-start;
    }

    .drag-handle {
      width: 32px;
      height: 44px;
    }

    .filter-bar {
      flex-wrap: wrap;
    }

    .filter-bar .form-select {
      min-width: 0;
      flex: 1;
    }

    /* Settings */
    .add-user-header {
      display: none;
    }

    .add-user-form {
      flex-direction: column;
      align-items: stretch;
    }

    .add-user-form .req-field:has(.form-input[type="text"]) {
      width: 100%;
      flex: 1;
    }

    .add-user-form .form-select-sm {
      width: 100%;
      flex: 1;
    }

    .add-user-form .btn {
      width: 100%;
      justify-content: center;
    }

    .permissions-table {
      min-width: 420px;
    }

    .yt-channel-header {
      display: none;
    }

    .yt-channel-row {
      flex-wrap: wrap;
    }

    .yt-channel-row .yt-ch-name {
      flex-basis: 100%;
    }

    .yt-channel-row .yt-ch-id {
      flex: 1;
      min-width: 0;
    }

    .yt-channel-row .yt-ch-lang {
      width: auto;
      flex: 0 0 auto;
    }

    /* Modals */
    .confirm-actions {
      flex-direction: column-reverse;
    }

    .confirm-actions .btn {
      width: 100%;
      justify-content: center;
    }

    .toast-container {
      left: 16px;
      right: 16px;
      top: 16px;
    }

    .toast {
      width: 100%;
    }

    .actions-dropdown-menu {
      right: auto;
      left: 0;
    }

    /* Touch targets */
    .btn {
      min-height: 44px;
    }

    .btn-sm {
      min-height: 36px;
    }

    .admin-table td {
      padding: 14px 12px;
    }

    .admin-table th {
      padding: 12px;
    }

    .actions-dropdown-btn {
      min-height: 40px;
      padding: 8px 14px;
    }

    .actions-dropdown-item {
      padding: 12px 14px;
      min-height: 44px;
      display: flex;
      align-items: center;
    }

    .repeatable-remove {
      width: 44px;
      height: 44px;
    }

    .playlist-page-remove {
      width: 44px;
      height: 44px;
      align-self: flex-start;
      margin-top: 0;
    }

    .ranking-product-remove {
      width: 44px;
      height: 44px;
    }

    .form-select-sm {
      min-height: 38px;
    }

    .tag-option {
      padding: 10px 12px;
      font-size: 12px;
    }
  }
}
