@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables (Landing Theme) ──────────────────────────────── */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fb;
  --bg-sidebar: #f8fbff;
  --bg-input: #ffffff;
  --bg-hover: #eef4ff;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --border-focus: #2563eb;

  --text-primary: #1a1a2e;
  --text-secondary: #5a5f7a;
  --text-muted: #94a3b8;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.18);
  --accent-subtle: #dbeafe;
  --accent-soft: #eff6ff;

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --info: #3b82f6;

  --instagram: #e1306c;
  --twitter: #1da1f2;
  --facebook: #1877f2;
  --threads: #111827;
  --youtube: #ff0000;
  --tiktok: #00f2ea;
  --linkedin: #0a66c2;

  --sidebar-width: 288px;
  --sidebar-collapsed: 64px;
  --topbar-height: 56px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

/* ─── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 28%),
    linear-gradient(180deg, #f5f9ff 0%, var(--bg-primary) 220px);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ─── Layout ─────────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width 0.2s ease;
}

.sidebar-logo {
  padding: 16px 24px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-logo .app-icon { font-size: 24px; }
.sidebar-logo .logo-text { opacity: 1; transition: opacity 0.2s; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav .nav-group {
  margin-bottom: 0;
}

.sidebar-nav .nav-section {
  padding: 8px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-nav .nav-section-toggle {
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.sidebar-nav .nav-section-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav .nav-section-chevron {
  display: flex;
  align-items: center;
  transition: transform 0.25s ease;
}

.sidebar-nav .nav-section-chevron svg {
  width: 14px;
  height: 14px;
}

.sidebar-nav .nav-group.collapsed .nav-section-chevron {
  transform: rotate(-90deg);
}

/* Accordion expand/collapse */
.sidebar-nav .nav-items {
  max-height: 600px;
  overflow: hidden;
  opacity: 1;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.2s ease;
  margin-top: 2px;
}

.sidebar-nav .nav-group.collapsed .nav-items {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

/* Phase 68: highlight the section that contains the current page so the user
   always knows which section they're in. Replaces the old menu-mode switcher. */
.sidebar-nav .nav-group.active-section {
  position: relative;
  background: var(--accent-muted, rgba(99,102,241,0.08));
  border-radius: var(--radius-sm, 8px);
  padding-left: 4px;
  border-left: 3px solid var(--accent, #6366f1);
}
.sidebar-nav .nav-group.active-section .nav-section {
  color: var(--accent, #6366f1);
  font-weight: 700;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 12px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  border-radius: 10px;
  white-space: nowrap;
}

.sidebar-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav a.active {
  color: white;
  background: var(--accent);
}

.sidebar-nav a.active .nav-icon {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.sidebar-nav a .nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-subtle);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.sidebar-nav a .nav-icon svg {
  width: 18px;
  height: 18px;
}

.sidebar-nav a:hover .nav-icon {
  background: var(--accent);
  color: white;
}

.sidebar-nav a .nav-label { transition: opacity 0.2s; }

.sidebar-nav a .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* Phase 68: menu-mode switcher removed. Old .menu-mode-switch rules deleted. */

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
}

.sidebar-footer .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-footer .user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ─── Sidebar Backdrop (mobile overlay) ──────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 89;
  backdrop-filter: blur(2px);
  transition: opacity 0.2s ease;
  opacity: 0;
}
.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* ─── Main Content ───────────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  transition: margin-left 0.2s ease;
}

/* ─── Top Bar ────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
}

/* Phase 68: breadcrumb in topbar — Section › Page so the user always knows
   where they are in the menu hierarchy. */
.topbar-title .topbar-crumb-section {
  color: var(--accent, #6366f1);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.6px;
  margin-right: 8px;
}
.topbar-title .topbar-crumb-sep {
  color: var(--text-muted);
  margin: 0 8px;
  font-weight: 400;
}
.topbar-title .topbar-crumb-page {
  color: var(--text-primary);
  font-weight: 600;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* AI Usage Meter */
.ai-meter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.ai-meter:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(124,58,237,0.15);
}
.ai-meter-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}
.ai-meter-label {
  white-space: nowrap;
}
.ai-meter.ai-meter-limited {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}
.ai-meter.ai-meter-limited .ai-meter-dot {
  animation: ai-pulse 0.8s ease-in-out infinite;
  background: #ef4444;
}
.ai-meter.ai-meter-approaching {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}
.ai-meter.ai-meter-approaching .ai-meter-dot {
  animation: ai-pulse-amber 1.2s ease-in-out infinite;
  background: #f59e0b;
}
@keyframes ai-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50% { opacity: 0.5; box-shadow: 0 0 6px 2px rgba(239,68,68,0.4); }
}
@keyframes ai-pulse-amber {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(245,158,11,0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 5px 2px rgba(245,158,11,0.3); }
}

.company-switcher {
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.company-switcher:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(239, 68, 68, 0.04);
}

/* ─── Page Content ───────────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 24px;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.page-header .page-help {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 720px;
}
.page-header .page-help a { font-weight: 500; }
.page-header .page-help strong { color: var(--text-primary); font-weight: 600; }

/* ─── Button Groups ──────────────────────────────────────────────── */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ─── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── KPI Cards ──────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.kpi-icon.purple { background: var(--accent-subtle); color: var(--accent); }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.amber { background: var(--warning-bg); color: var(--warning); }
.kpi-icon.blue { background: rgba(59,130,246,0.1); color: var(--info); }
.kpi-icon.red { background: var(--danger-bg); color: var(--danger); }

.kpi-data h3 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-data p {
  color: var(--text-secondary);
  font-size: 12px;
  margin-top: 2px;
}

/* ─── Buttons (aligned to @mba/ui Button component) ──────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.4375rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 150ms ease;
  font-family: inherit;
  white-space: nowrap;
  outline: none;
}
.btn:disabled { cursor: not-allowed; opacity: 0.5; }

.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #16a34a; border-color: #16a34a; }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.btn-sm { padding: 0.3rem 0.625rem; font-size: 0.75rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.9375rem; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-filters .form-control {
  min-width: 160px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

/* ─── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.form-control { min-height: 100px; resize: vertical; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ─── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-draft { background: #e2e8f0; color: #64748b; }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-approved, .badge-sent { background: var(--success-bg); color: var(--success); }
.badge-scheduled { background: rgba(37,99,235,0.12); color: var(--accent); }
.badge-posted { background: var(--accent-subtle); color: var(--accent); }
.badge-failed, .badge-bounced { background: var(--danger-bg); color: var(--danger); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }
.badge-running { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-complete { background: var(--success-bg); color: var(--success); }
.badge-cancelled { background: #e2e8f0; color: #64748b; }
.badge-info { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-high { background: var(--danger-bg); color: var(--danger); }
.badge-medium { background: var(--warning-bg); color: var(--warning); }
.badge-low { background: var(--accent-subtle); color: var(--accent); }
.badge-open { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-acknowledged { background: rgba(34,197,94,0.1); color: var(--success); }
.badge-snoozed { background: rgba(37,99,235,0.15); color: var(--accent); }

.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-size: 12px;
}

.tiny-note {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ─── Platform Colors ────────────────────────────────────────────── */
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.platform-INSTAGRAM { background: rgba(225,48,108,0.15); color: var(--instagram); }
.platform-TWITTER { background: rgba(29,161,242,0.15); color: var(--twitter); }
.platform-FACEBOOK { background: rgba(24,119,242,0.15); color: var(--facebook); }
.platform-THREADS { background: rgba(17,24,39,0.12); color: var(--threads); }
.platform-YOUTUBE { background: rgba(255,0,0,0.15); color: var(--youtube); }
.platform-TIKTOK { background: rgba(0,242,234,0.15); color: var(--tiktok); }
.platform-LINKEDIN { background: rgba(10,102,194,0.15); color: var(--linkedin); }

/* ─── Tables ─────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

tr:hover td { background: #f8fbff; }

/* ─── Empty State ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state .icon-big { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* ─── Grids ──────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }

/* ─── Approval Cards ─────────────────────────────────────────────── */
.approval-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}
.approval-card:hover { border-color: var(--accent); }
.approval-card .post-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.approval-card .post-body { color: var(--text-secondary); font-size: 13px; margin-bottom: 12px; line-height: 1.6; white-space: pre-wrap; }
.approval-card .post-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.approval-actions { display: flex; gap: 10px; align-items: center; }
.approval-actions .btn-success, .approval-actions .btn-danger { min-width: 120px; font-size: 14px; padding: 10px 20px; }

/* ─── Approval Media Preview ─────────────────────────────────────── */
.approval-media-preview {
  margin-bottom: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 8px;
  text-align: center;
}

/* ─── Post Preview Modal ─────────────────────────────────────────── */
.preview-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  overflow-y: auto;
}
.preview-overlay.active { display: flex; }
.preview-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 680px;
  width: 100%;
  animation: previewSlideIn 0.2s ease-out;
}
@keyframes previewSlideIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
.preview-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.preview-modal-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
.preview-modal-body { padding: 24px; }
.preview-modal-body .preview-media {
  margin-bottom: 20px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-primary);
  text-align: center;
}
.preview-modal-body .preview-media img,
.preview-modal-body .preview-media video {
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
  border-radius: 8px;
}
.preview-modal-body .preview-content {
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.preview-section { margin-bottom: 16px; }
.preview-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
.preview-modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ─── Platform Cards ─────────────────────────────────────────────── */
.platform-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition: all 0.15s;
}
.platform-card:hover { border-color: var(--accent); }
.platform-card .platform-icon { font-size: 36px; margin-bottom: 12px; }
.platform-card .platform-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.platform-card .platform-handle { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }
.platform-card.connected { border-color: var(--success); }
.platform-card.connected .status-dot { display: inline-block; width: 8px; height: 8px; background: var(--success); border-radius: 50%; margin-right: 6px; }

/* ─── Hashtag Chips ──────────────────────────────────────────────── */
.hashtag-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hashtag-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-subtle); color: var(--accent); padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.hashtag-chip .remove { cursor: pointer; font-size: 14px; opacity: 0.6; }
.hashtag-chip .remove:hover { opacity: 1; }

/* ─── Platform Checkboxes ────────────────────────────────────────── */
.platform-checks { display: flex; flex-wrap: wrap; gap: 10px; }
.platform-check { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; transition: all 0.15s; }
.platform-check:hover { border-color: var(--accent); }
.platform-check.checked { border-color: var(--accent); background: var(--accent-subtle); }
.platform-check input { display: none; }

/* ─── Calendar ───────────────────────────────────────────────────── */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.calendar-header { padding: 8px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.calendar-day { min-height: 100px; background: #fbfdff; border: 1px solid var(--border); border-radius: 4px; padding: 6px; }
.calendar-day .day-number { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.calendar-event { font-size: 10px; padding: 2px 6px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }

/* ─── Charts Container ───────────────────────────────────────────── */
.chart-container { position: relative; width: 100%; height: 300px; }

/* ─── Activity Feed ──────────────────────────────────────────────── */
.activity-feed { list-style: none; }
.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.activity-text { font-size: 13px; }
.activity-text .time { color: var(--text-muted); font-size: 11px; margin-top: 2px; display: block; }

/* ─── Dashboard List Compact ─────────────────────────────────────── */
.list-compact .list-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.list-compact .list-item:last-child { border-bottom: none; }
.list-compact .list-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-row { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: 13px; color: var(--text-secondary); }

/* ─── Responsive ─────────────────────────────────────────────────── */

/* Tablet & small desktop (≤768px) — sidebar collapses */
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed); transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); width: var(--sidebar-width); }
  .sidebar-logo .logo-text { display: none; }
  .sidebar.open .sidebar-logo .logo-text { display: inline; }
  .sidebar-nav a .nav-label { display: none; }
  .sidebar.open .sidebar-nav a .nav-label { display: inline; }
  .sidebar-nav a .nav-badge { display: none; }
  .sidebar.open .sidebar-nav a .nav-badge { display: inline; }
  .sidebar-nav .nav-section { display: none; }
  .sidebar.open .sidebar-nav .nav-section { display: block; }
  .sidebar-footer .user-info span { display: none; }
  .sidebar.open .sidebar-footer .user-info span { display: inline; }
  .sidebar-footer .menu-mode-switch .menu-mode-label { display: none; }
  .sidebar.open .sidebar-footer .menu-mode-switch .menu-mode-label { display: inline; }
  .sidebar-footer .menu-mode-switch { justify-content: center; padding: 8px; }
  .sidebar.open .sidebar-footer .menu-mode-switch { justify-content: flex-start; }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .page-content { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .approval-actions { flex-direction: column; }
  .approval-actions .btn { width: 100%; justify-content: center; }

  /* Topbar — reduce spacing */
  .topbar { padding: 0 12px; }
  .topbar-left { gap: 8px; }
  .topbar-right { gap: 8px; }
  .topbar-title { font-size: 14px; }

  /* Page header — allow wrapping */
  .page-header.flex-between,
  .page-header .flex-between {
    flex-wrap: wrap;
    gap: 12px;
  }
  .page-header h1 { font-size: 20px; }
  .page-help { font-size: 13px; }

  /* Button groups */
  .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Tables */
  th { padding: 8px 10px; }
  td { padding: 10px; }
}

/* Phone landscape & small tablets (≤600px) — content shrinks */
@media (max-width: 600px) {
  .topbar-title { font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .company-switcher { font-size: 11px; padding: 4px 6px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
  .ai-meter-label { display: none; }
  .btn-logout { padding: 5px 8px; font-size: 11px; }

  .page-header h1 { font-size: 18px; }
  .page-help { font-size: 12px; }
  .card { padding: 16px; }

  /* Forms full width */
  .form-row { grid-template-columns: 1fr; }
  .flex.gap-1, .flex.gap-2 { flex-wrap: wrap; }

  /* Search inputs */
  input[style*="min-width"] { min-width: 0 !important; width: 100% !important; }

  /* KPI grid single column */
  .kpi-grid { grid-template-columns: 1fr; }

  /* Modals */
  .preview-overlay { padding: 10px 8px; }
  .preview-modal { max-width: 100% !important; }
}

/* Phone portrait (≤480px) — aggressive mobile layout */
@media (max-width: 480px) {
  .topbar { padding: 0 8px; height: 48px; }
  .topbar-left { gap: 6px; }
  .topbar-right { gap: 4px; }
  .topbar-title { font-size: 12px; max-width: 80px; }
  .company-switcher { max-width: 90px; font-size: 10px; padding: 3px 5px; }
  .btn-logout { font-size: 10px; padding: 4px 6px; }
  .ai-meter { padding: 2px 6px; font-size: 10px; }
  .ai-meter-label { display: none; }
  .ai-meter-dot { animation: none; }

  /* Page header — full stack */
  .page-header.flex-between,
  .page-header .flex-between,
  .flex-between {
    flex-direction: column;
    align-items: flex-start;
  }
  .page-header h1 { font-size: 16px; }

  /* Button group — full width stack */
  .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
  .btn-group .btn {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    justify-content: center;
    font-size: 12px;
    padding: 8px 10px;
  }

  /* Cards */
  .card { padding: 12px; border-radius: 8px; }

  /* Tables — smaller text, tighter padding */
  th { font-size: 10px; padding: 6px 8px; }
  td { font-size: 12px; padding: 8px; }

  /* Toasts — centered */
  .toast-container { top: auto; bottom: 16px; right: 8px; left: 8px; align-items: center; }
  .toast { max-width: 100%; text-align: center; }

  /* Page content */
  .page-content { padding: 12px 8px; }

  /* Sidebar mobile overlay */
  .sidebar.open {
    width: 85vw;
    max-width: 320px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }

  /* Forms */
  .form-group label { font-size: 12px; }
  .form-control { font-size: 14px; padding: 10px; }
  .help-hint { font-size: 11px; }

  /* Hide page help text on very small screens */
  .page-help { display: none; }
}

/* ─── Auth Pages (full screen, no sidebar) ───────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--accent-subtle) 0%, var(--bg-primary) 100%);
}

.auth-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.auth-box .logo { text-align: center; margin-bottom: 32px; }
.auth-box .logo .app-icon { font-size: 48px; }
.auth-box .logo h1 { font-size: 22px; font-weight: 700; margin-top: 8px; }
.auth-box .logo p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.auth-box .btn-primary { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }
.auth-box .auth-link { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-secondary); }
.auth-box .error-msg { background: var(--danger-bg); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; display: none; }

/* ─── Loading / Toast ────────────────────────────────────────────── */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; animation: slideIn 0.2s ease; max-width: 360px; }
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--info); color: white; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Utilities ──────────────────────────────────────────────────── */
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none !important; }
