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

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Colors */
  --bg:           #F8FAFC;
  --surface:      #FFFFFF;
  --surface-2:    #F1F5F9;
  --border:       #E2E8F0;
  --border-strong:#CBD5E1;

  --text-1:       #0F172A;
  --text-2:       #475569;
  --text-3:       #94A3B8;

  --accent:       #6366F1;
  --accent-hover: #4F46E5;
  --accent-light: #EEF2FF;
  --accent-dim:   rgba(99,102,241,.12);

  --success:      #10B981;
  --success-bg:   #D1FAE5;
  --success-text: #065F46;

  --warning:      #F59E0B;
  --warning-bg:   #FEF3C7;
  --warning-text: #92400E;

  --danger:       #EF4444;
  --danger-bg:    #FEE2E2;
  --danger-text:  #991B1B;

  --info-bg:      #DBEAFE;
  --info-text:    #1E40AF;

  /* Sidebar */
  --sidebar-bg:   #0F172A;
  --sidebar-w:    240px;
  --sidebar-text: #CBD5E1;
  --sidebar-muted:#475569;
  --sidebar-hover:#1E293B;
  --sidebar-active:#1E293B;

  /* Misc */
  --radius:       8px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:       0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-lg:    0 10px 25px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);

  --transition: 150ms ease;
}

/* ── Dark Mode ────────────────────────────────────── */
[data-theme="dark"] {
  --bg:           #0F172A;
  --surface:      #1E293B;
  --surface-2:    #263245;
  --border:       #334155;
  --border-strong:#475569;

  --text-1:       #F1F5F9;
  --text-2:       #CBD5E1;
  --text-3:       #64748B;

  --accent:       #818CF8;
  --accent-hover: #6366F1;
  --accent-light: #1E1B4B;
  --accent-dim:   rgba(129,140,248,.18);

  --success:      #34D399;
  --success-bg:   #064E3B;
  --success-text: #6EE7B7;

  --warning:      #FBBF24;
  --warning-bg:   #451A03;
  --warning-text: #FCD34D;

  --danger:       #F87171;
  --danger-bg:    #450A0A;
  --danger-text:  #FCA5A5;

  --info-bg:      #1E3A5F;
  --info-text:    #93C5FD;

  --sidebar-bg:   #080F1E;
  --sidebar-text: #94A3B8;
  --sidebar-muted:#334155;
  --sidebar-hover:#111827;
  --sidebar-active:#1E293B;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow:       0 4px 6px -1px rgba(0,0,0,.4), 0 2px 4px -1px rgba(0,0,0,.3);
  --shadow-lg:    0 10px 25px -3px rgba(0,0,0,.5), 0 4px 6px -2px rgba(0,0,0,.3);
}

/* Dark mode input/select overrides */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--surface-2);
  color: var(--text-1);
  border-color: var(--border);
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--text-3); }

[data-theme="dark"] .modal-box { background: var(--surface); }
[data-theme="dark"] .toast     { background: var(--surface-2); color: var(--text-1); border: 1px solid var(--border); }

/* Dark mode theme toggle button */
.btn-theme {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
  flex-shrink: 0;
}
.btn-theme:hover { background: var(--sidebar-hover); }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

.hidden { display: none !important; }

/* ── Layout ───────────────────────────────────────── */
.login-view,
.app-view { height: 100vh; }

.app-view {
  display: flex;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  color: #F1F5F9;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.3px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section { padding: 16px 0 4px; }

.nav-section-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 0 16px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 450;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  position: relative;
  cursor: pointer;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: #F1F5F9;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: #FFFFFF;
  font-weight: 500;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 12px 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-user-name {
  color: #F1F5F9;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  color: var(--sidebar-muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-logout {
  background: none;
  border: none;
  color: var(--sidebar-muted);
  padding: 6px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.btn-logout:hover { color: #F1F5F9; background: var(--sidebar-hover); }

/* ── Content ──────────────────────────────────────── */
.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--bg);
}

.screen-container {
  padding: 32px;
  width: 100%;
  box-sizing: border-box;
}

/* ── Page Header ──────────────────────────────────── */
.page-header {
  margin-bottom: 24px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.4px;
}
.page-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Login Page ───────────────────────────────────── */
.login-view {
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 28px;
}
.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 4px;
}
.login-sub {
  color: var(--text-3);
  font-size: 13px;
  margin-bottom: 24px;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ── Cards ────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 18px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}
.card-body { padding: 16px 20px 20px; }
.card-selected {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-dim) !important;
}

.brand-picker-card {
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.brand-picker-card:hover {
  border-color: var(--border-strong);
}
.brand-picker-card--active {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
  background: var(--accent-light);
}

/* ── Week Groups (Content Studio) ───────────────────────────────────────── */
.week-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 2px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.week-group-header::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-1);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text-1); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-full { width: 100%; }

.btn-icon {
  background: none;
  border: none;
  padding: 5px;
  border-radius: var(--radius);
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  transition: all var(--transition);
  cursor: pointer;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text-1); }
.btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Forms ────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; }
.label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.input, .select, .textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--text-1);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 80px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%2394A3B8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .field-full { grid-column: 1 / -1; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

/* ── Tables ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
.td-truncate { max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Badges ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-draft    { background: #F1F5F9; color: #475569; }
.badge-review   { background: var(--warning-bg); color: var(--warning-text); }
.badge-approved { background: var(--success-bg); color: var(--success-text); }
.badge-rejected { background: var(--danger-bg); color: var(--danger-text); }
.badge-published{ background: var(--info-bg); color: var(--info-text); }
.badge-pending  { background: var(--warning-bg); color: var(--warning-text); }
.badge-failed   { background: var(--danger-bg); color: var(--danger-text); }
.badge-active   { background: var(--success-bg); color: var(--success-text); }
.badge-inactive { background: #F1F5F9; color: #64748B; }

.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  max-width: 100%;
  vertical-align: middle;
}
.platform-badge svg {
  flex: 0 0 auto;
  display: block;
}
.platform-x         { background: #000; }
.platform-facebook  { background: #1877F2; }
.platform-instagram { background: linear-gradient(135deg, #F58529, #DD2A7B 50%, #8134AF); }
.platform-instagram_story { background: linear-gradient(135deg, #F58529, #DD2A7B 50%, #8134AF); }

/* ── Alerts ───────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 12px;
}
.alert-danger  { background: var(--danger-bg); color: var(--danger-text); border: 1px solid #FECACA; }
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #A7F3D0; }
.alert-info    { background: var(--info-bg); color: var(--info-text); border: 1px solid #BFDBFE; }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid #FDE68A; }

/* ── Spinner ──────────────────────────────────────── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}
.spinner-dark {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-lg {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
}

/* ── Empty State ──────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}
.empty-state-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}
.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}
.empty-state-sub { font-size: 13px; }

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
  padding: 16px;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  padding: 4px;
  border-radius: var(--radius);
  display: flex;
  cursor: pointer;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-2); color: var(--text-1); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 0 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Toast ────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--text-1);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 450;
  pointer-events: all;
  animation: slideUp 0.25s ease;
  max-width: 340px;
}
.toast-success { background: #065F46; }
.toast-danger  { background: #991B1B; }
.toast-warning { background: #92400E; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Tabs ─────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  background: none;
  border: none;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--text-1); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Tag input / chips ────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
}
.chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0;
  line-height: 1;
  font-size: 14px;
  opacity: 0.7;
}
.chip-remove:hover { opacity: 1; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* ── Misc Utilities ───────────────────────────────── */
.text-muted  { color: var(--text-3); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.font-mono   { font-family: 'SF Mono', 'Fira Mono', monospace; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center{ align-items: center; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.mb-4        { margin-bottom: 16px; }
.mt-4        { margin-top: 16px; }
.w-full      { width: 100%; }

/* ── Content Draft Card ───────────────────────────── */
.draft-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.draft-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.draft-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.draft-card-meta   { display: flex; align-items: center; gap: 6px; }
.draft-card-body   { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.draft-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.draft-card-actions{ display: flex; gap: 6px; }

/* ── Media Grid ───────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.media-item {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  position: relative;
  background: var(--surface-2);
  cursor: pointer;
  transition: box-shadow var(--transition);
}
.media-item:hover { box-shadow: var(--shadow); }
.media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity var(--transition);
}
.media-item:hover .media-item-overlay { opacity: 1; }

/* ── Post preview media ──────────────────────────── */
.post-media-preview {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  margin-bottom: 12px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.post-media-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}
.post-media-preview--story {
  max-width: 210px;
  margin-left: auto;
  margin-right: auto;
}
.post-media-preview--story img {
  aspect-ratio: 9 / 16;
  max-height: 360px;
}
.post-media-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
.post-media-preview--frame-fade::after,
.post-media-preview--frame-combo::after {
  opacity: 1;
  background: linear-gradient(180deg, rgba(15,23,42,0) 56%, rgba(15,23,42,.58) 100%);
}
.post-media-preview--frame-side_strip::after {
  opacity: 1;
  width: 8px;
  right: auto;
  background: rgba(255,255,255,.9);
}
.post-media-corner {
  position: absolute;
  z-index: 1;
  width: 34px;
  height: 34px;
  color: rgba(255,255,255,.86);
  pointer-events: none;
  display: none;
}
.post-media-preview--frame-corners .post-media-corner,
.post-media-preview--frame-combo .post-media-corner {
  display: block;
}
.post-media-corner--tl { top: 10px; left: 10px; border-top: 2px solid; border-left: 2px solid; }
.post-media-corner--tr { top: 10px; right: 10px; border-top: 2px solid; border-right: 2px solid; }
.post-media-corner--bl { bottom: 10px; left: 10px; border-bottom: 2px solid; border-left: 2px solid; }
.post-media-corner--br { bottom: 10px; right: 10px; border-bottom: 2px solid; border-right: 2px solid; width: 18px; height: 18px; }
.post-media-logo {
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 12px;
  width: 12%;
  height: auto;
  max-width: 44px;
  max-height: 30px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(15,23,42,.32));
}
.post-preview-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.post-preview-toolbar .select {
  height: 32px;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 12px;
  flex: 1;
}

/* ── Calendar ─────────────────────────────────────── */
.cal-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}
.cal-main {
  min-width: 0;
  overflow: hidden;
}
.cal-preview {
  min-width: 0;
  position: sticky;
  top: 20px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
}
.cal-header-cell {
  background: var(--surface-2);
  padding: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 0;
  overflow: hidden;
}
.cal-cell {
  background: var(--surface);
  min-height: 90px;
  padding: 6px;
  vertical-align: top;
  cursor: default;
  min-width: 0;
  overflow: hidden;
}
.cal-cell.other-month { background: var(--bg); }
.cal-cell.today       { background: var(--accent-light); }
.cal-day-num {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 4px;
}
.cal-cell.today .cal-day-num {
  color: var(--accent);
  font-weight: 700;
}
.cal-event {
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 10.5px;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  border: 1px solid transparent;
}
.cal-event:hover { background: var(--accent-light); }
.cal-event.is-selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.cal-event .platform-badge {
  margin-right: 4px;
  padding: 1px 5px;
}
.cal-event .platform-badge span {
  display: none;
}

@media (max-width: 980px) {
  .cal-layout { flex-direction: column; }
  .cal-preview { width: 100%; position: static; }
}

/* ── Pipeline bar ─────────────────────────────────── */
.pipeline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.pipeline-row:last-child { border-bottom: none; }
.pipeline-count {
  font-weight: 700;
  color: var(--text-1);
  min-width: 30px;
  text-align: right;
}

/* ── Breadcrumb / Section divider ─────────────────── */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── Progress bar ─────────────────────────────────── */
.progress-bar-wrap {
  background: var(--surface-2);
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ── Toggle / Switch ──────────────────────────────── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Search bar ───────────────────────────────────── */
.search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 10px;
  color: var(--text-3);
  pointer-events: none;
}
.search-input {
  padding-left: 34px !important;
}

/* ── Content image preview ────────────────────────── */
.img-preview {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
