/* =========================================
   INSTAX — Premium Dark Theme
   ========================================= */

:root {
  --bg-base: #0a0a0f;
  --bg-card: #12121a;
  --bg-sidebar: #0d0d15;
  --bg-card-inner: #1a1a26;
  --border: #1e1e2e;
  --border-bright: #2a2a3e;

  --purple: #7c3aed;
  --purple-light: #8b5cf6;
  --violet: #a855f7;
  --violet-light: #c084fc;
  --blue: #3b82f6;
  --blue-light: #60a5fa;
  --green: #10b981;
  --green-light: #34d399;
  --red: #ef4444;
  --red-light: #f87171;
  --orange: #f59e0b;

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --text-link: #a855f7;

  --sidebar-width: 230px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --glow-purple: 0 0 20px rgba(124, 58, 237, 0.3);
  --glow-violet: 0 0 20px rgba(168, 85, 247, 0.25);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.7);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple); }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(var(--glow-purple));
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.logo-badge {
  font-size: 0.6rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--purple), var(--violet));
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: rgba(124, 58, 237, 0.08);
  color: var(--text-primary);
  border-left-color: rgba(124, 58, 237, 0.3);
}

.nav-item.active {
  background: rgba(124, 58, 237, 0.12);
  color: var(--violet-light);
  border-left-color: var(--purple);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px 10px;
  border-top: 1px solid var(--border);
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.sidebar-profile:hover { background: var(--bg-card-inner); }

.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--violet));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}

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

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

.profile-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-status {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Mobile Header ---- */
.mobile-header {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  position: sticky;
  top: 0;
  z-index: 10;
}

.mobile-menu-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}

.mobile-menu-btn:hover { color: var(--text-primary); }

.mobile-logo {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 99;
  backdrop-filter: blur(4px);
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Sections ---- */
.section {
  display: none;
  padding: 32px 36px;
  flex: 1;
  animation: fadeIn 0.25s ease;
}

.section.active { display: block; }

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

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--violet-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---- Onboarding Banner ---- */
.onboarding-banner {
  display: none;
  align-items: center;
  gap: 14px;
  margin: 0 36px 0;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(168, 85, 247, 0.1));
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: var(--radius);
  position: relative;
}

.onboarding-banner.show { display: flex; margin-top: 24px; }

.onboarding-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--purple), var(--violet));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: var(--glow-purple);
}

.onboarding-text {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.onboarding-text strong { color: var(--text-primary); }

.onboarding-cta {
  background: linear-gradient(135deg, var(--purple), var(--violet));
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  white-space: nowrap;
}

.onboarding-cta:hover { opacity: 0.9; transform: translateY(-1px); }

.onboarding-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  transition: color 0.15s;
}

.onboarding-close:hover { color: var(--text-primary); }

/* ---- Glass Cards ---- */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s;
}

.glass-card:hover { border-color: var(--border-bright); }

.glass-card-inner {
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

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

.card-header h3 {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
}

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all 0.2s;
  box-shadow: var(--shadow-card);
}

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

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.purple { background: rgba(124, 58, 237, 0.15); color: var(--violet); }
.stat-icon.violet { background: rgba(168, 85, 247, 0.15); color: var(--violet-light); }
.stat-icon.blue { background: rgba(59, 130, 246, 0.15); color: var(--blue-light); }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--green-light); }

.stat-content { flex: 1; }

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1;
}

.stat-value.skeleton { color: var(--text-muted); }

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 6px;
}

.stat-change.positive { color: var(--green-light); }
.stat-change.negative { color: var(--red-light); }

/* ---- Dashboard Bottom Layout ---- */
.dashboard-bottom {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
}

.posts-section { min-height: 340px; }

.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.post-thumb {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg-card-inner);
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid var(--border);
}

.post-thumb:hover { transform: scale(1.03); }

.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-card-inner), #1e1e30);
}

.post-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: flex-end;
  padding: 8px;
  gap: 10px;
}

.post-thumb:hover .post-overlay { opacity: 1; }

.post-stat {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
}

/* ---- Dashboard Right ---- */
.dashboard-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workflow-list { display: flex; flex-direction: column; gap: 10px; }

.workflow-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card-inner);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.workflow-item:hover { border-color: var(--border-bright); }

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

.status-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.red { background: var(--red); }
.status-dot.orange { background: var(--orange); box-shadow: 0 0 6px var(--orange); }
.status-dot.grey { background: var(--text-muted); }

.workflow-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.workflow-id {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: monospace;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-btn:hover {
  background: rgba(124, 58, 237, 0.1);
  border-color: var(--purple);
  color: var(--violet-light);
  transform: translateY(-2px);
}

.quick-icon { font-size: 1.2rem; }

/* ---- Badges ---- */
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 99px;
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-xs);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--violet));
  color: white;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.35);
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
}

.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-bright);
}

.btn-outline:hover {
  background: var(--bg-card-inner);
  color: var(--text-primary);
  border-color: var(--border-bright);
}

.btn-ghost {
  background: transparent;
  color: var(--violet);
  border: none;
}

.btn-ghost:hover { background: rgba(168, 85, 247, 0.1); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

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

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

.btn-danger:hover { background: #dc2626; }

.btn-danger-outline {
  background: transparent;
  color: var(--red-light);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--red);
}

/* ---- Tabs ---- */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  width: fit-content;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius-xs);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--purple), var(--violet));
  color: white;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
}

.tab-btn:hover:not(.active) {
  color: var(--text-secondary);
  background: var(--bg-card-inner);
}

/* ---- Create Layout ---- */
.create-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}

.style-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.style-card {
  padding: 10px 8px;
  background: var(--bg-card-inner);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.style-card:hover {
  border-color: var(--purple);
  color: var(--violet-light);
  background: rgba(124, 58, 237, 0.08);
}

.style-card.selected {
  border-color: var(--violet);
  background: rgba(124, 58, 237, 0.15);
  color: var(--violet-light);
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.2);
}

.style-card .style-emoji { font-size: 1.1rem; display: block; margin-bottom: 4px; }

.create-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.preview-card { height: 100%; }

.preview-area {
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.preview-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 40px;
  text-align: center;
}

.preview-image {
  width: 100%;
  border-radius: var(--radius-sm);
  object-fit: cover;
  max-height: 300px;
}

.preview-caption { margin-top: 14px; }

.preview-type-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 4px;
  background: rgba(124, 58, 237, 0.2);
  color: var(--violet-light);
  border: 1px solid rgba(124, 58, 237, 0.3);
}

/* Duration slider */
.duration-slider-wrap { display: flex; flex-direction: column; gap: 8px; }

.duration-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border-bright);
  outline: none;
}

.duration-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--violet));
  cursor: pointer;
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.5);
}

.duration-marks {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ---- Form Elements ---- */
.form-group { margin-bottom: 18px; }

.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: 0.2px;
}

.label-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: var(--bg-card-inner);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xs);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

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

.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.form-select {
  cursor: pointer;
  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='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

.input-with-action { display: flex; gap: 8px; align-items: center; }
.input-with-action .form-input { flex: 1; }

.field-status {
  margin-top: 6px;
  font-size: 0.75rem;
  min-height: 16px;
}

.field-status.ok { color: var(--green-light); }
.field-status.err { color: var(--red-light); }

/* ---- Chips ---- */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 6px 14px;
  border-radius: 99px;
  border: 1.5px solid var(--border-bright);
  background: var(--bg-card-inner);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.chip:hover {
  border-color: var(--purple);
  color: var(--violet-light);
}

.chip.selected {
  border-color: var(--violet);
  background: rgba(124, 58, 237, 0.15);
  color: var(--violet-light);
}

/* ---- Influencer Layout ---- */
.influencer-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 20px;
  align-items: start;
}

.avatar-section {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  align-items: flex-start;
}

.avatar-upload {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px dashed var(--border-bright);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg-card-inner);
  position: relative;
}

.avatar-upload:hover {
  border-color: var(--purple);
  background: rgba(124, 58, 237, 0.08);
}

.avatar-upload.drag-over { border-color: var(--violet); background: rgba(124, 58, 237, 0.15); }

#avatar-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  padding: 8px;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.ref-photos-section { flex: 1; }

.ref-photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ref-photo-add, .ref-photo-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xs);
  border: 1.5px dashed var(--border-bright);
  background: var(--bg-card-inner);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.ref-photo-add:hover { border-color: var(--purple); color: var(--violet); }

.ref-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ref-photo-thumb .remove-ref {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 10px;
  color: white;
}

.ref-photo-thumb:hover .remove-ref { display: flex; }

/* ---- Token Info ---- */
.token-info { margin: 14px 0; }

.token-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.token-days {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---- Expandable ---- */
.expandable-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  width: 100%;
  transition: color 0.15s;
}

.expandable-toggle:hover { color: var(--violet-light); }

.expand-chevron { margin-left: auto; transition: transform 0.2s; }

.expand-chevron.open { transform: rotate(180deg); }

.expandable-content {
  background: var(--bg-card-inner);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 8px;
}

.guide-steps {
  list-style: decimal;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-steps li { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }

.guide-note {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 8px 12px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-xs);
}

.link { color: var(--text-link); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---- Calendar ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.calendar-day {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  min-height: 130px;
  transition: border-color 0.15s, transform 0.15s;
  cursor: pointer;
}

.calendar-day:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
}

.calendar-day.today {
  border-color: rgba(124, 58, 237, 0.5);
  background: rgba(124, 58, 237, 0.05);
}

.day-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.day-number {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.today .day-number {
  background: linear-gradient(135deg, var(--purple), var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.day-events { display: flex; flex-direction: column; gap: 4px; }

.cal-event {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-event.post { background: rgba(124, 58, 237, 0.2); color: var(--violet-light); }
.cal-event.story { background: rgba(59, 130, 246, 0.2); color: var(--blue-light); }
.cal-event.reel { background: rgba(16, 185, 129, 0.2); color: var(--green-light); }

.calendar-legend {
  display: flex;
  gap: 20px;
  padding: 12px 0;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.purple { background: var(--violet); }
.legend-dot.blue { background: var(--blue); }
.legend-dot.green { background: var(--green); }

.week-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0 8px;
}

/* ---- Settings ---- */
.settings-card { margin-bottom: 20px; }

.settings-fields { display: flex; flex-direction: column; gap: 0; }

.settings-field {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.settings-field:last-child { border-bottom: none; padding-bottom: 0; }

.settings-field:first-child { padding-top: 0; }

.settings-field-info {
  width: 200px;
  flex-shrink: 0;
  padding-top: 2px;
}

.field-name {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.field-desc {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.field-row {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.field-row.two-inputs { flex-wrap: wrap; }
.field-row.two-inputs .form-input { flex: 1; min-width: 140px; }

.key-status { font-size: 1rem; min-width: 20px; }

/* ---- Danger Zone ---- */
.danger-zone { border-color: rgba(239, 68, 68, 0.2); }

.danger-zone:hover { border-color: rgba(239, 68, 68, 0.35); }

.danger-title { color: var(--red-light); }

.danger-actions { display: flex; flex-direction: column; gap: 0; }

.danger-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}

.danger-action:last-child { border-bottom: none; padding-bottom: 0; }
.danger-action:first-child { padding-top: 0; }

.danger-action strong {
  display: block;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.danger-action p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-modal);
  text-align: center;
  animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.modal-icon.danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-light);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.modal p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* ---- Toast ---- */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(255,255,255,0.1);
  max-width: 320px;
  backdrop-filter: blur(10px);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

.toast.success { background: rgba(16, 185, 129, 0.9); border-color: rgba(52, 211, 153, 0.3); }
.toast.error { background: rgba(239, 68, 68, 0.9); border-color: rgba(248, 113, 113, 0.3); }
.toast.info { background: rgba(124, 58, 237, 0.9); border-color: rgba(168, 85, 247, 0.3); }
.toast.warning { background: rgba(245, 158, 11, 0.9); border-color: rgba(251, 191, 36, 0.3); }

/* ---- Loader ---- */
.loading-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: dotBounce 1.2s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* ---- Responsive ---- */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-bottom { grid-template-columns: 1fr; }
  .dashboard-right { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0, 0, 0, 0.8);
  }

  .mobile-overlay.show { display: block; }
  .mobile-header { display: flex; }

  .main-content { margin-left: 0; }

  .section { padding: 24px 20px; }

  .onboarding-banner { margin: 0 20px; }
  .onboarding-banner.show { margin-top: 20px; }

  .create-layout { grid-template-columns: 1fr; }
  .influencer-layout { grid-template-columns: 1fr; }
  .calendar-grid { grid-template-columns: repeat(3, 1fr); }
  .settings-field { flex-direction: column; gap: 10px; }
  .settings-field-info { width: 100%; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .style-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-right { display: flex; flex-direction: column; }
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
  .section-header { flex-direction: column; align-items: flex-start; }
  .field-row { flex-wrap: wrap; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── Template Picker ── */
.template-picker {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}
.template-cats {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  padding: 2px;
  background: rgba(0,0,0,0.2);
}
.template-cats::-webkit-scrollbar { display: none; }
.tcat-btn {
  flex-shrink: 0;
  padding: 7px 13px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s;
  white-space: nowrap;
}
.tcat-btn:hover { background: rgba(124,58,237,0.15); color: var(--text); }
.tcat-btn.active { background: var(--accent); color: #fff; }
.template-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  max-height: 130px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.tpl-chip {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.tpl-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(124,58,237,0.1);
}
.scene-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
  margin-bottom: 8px;
}

/* Upload Panel */
.upload-panel {
  padding: 24px;
  margin-bottom: 24px;
}
.upload-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-muted);
}
.upload-drop-zone:hover, .upload-drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(124,58,237,0.08);
  color: var(--text-primary);
}
.upload-drop-zone p {
  margin: 10px 0 4px;
  font-size: 15px;
  font-weight: 500;
}
.upload-drop-zone span {
  font-size: 12px;
  color: var(--text-muted);
}
.upload-type-toggle {
  display: flex;
  gap: 10px;
}
.toggle-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.toggle-btn.active {
  border-color: var(--accent);
  background: rgba(124,58,237,0.15);
  color: var(--accent);
}
