/* ===================================================
   FBAutoPoster – Design System
   =================================================== */

/* --- Tokens --- */
:root {
  --bg-base:        #0d1117;
  --bg-surface:     #161b22;
  --bg-card:        #1c2333;
  --bg-hover:       #21293d;
  --border:         rgba(255,255,255,0.07);
  --border-focus:   rgba(99, 102, 241, 0.6);

  --accent:         #6366f1;
  --accent-light:   #818cf8;
  --accent-dark:    #4f46e5;
  --accent-glow:    rgba(99, 102, 241, 0.25);

  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;

  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;

  --sidebar-w:      240px;
  --topbar-h:       60px;

  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;

  --shadow-card:    0 2px 12px rgba(0,0,0,0.4);
  --shadow-glow:    0 0 24px rgba(99,102,241,0.2);

  --transition:     0.18s ease;
}

/* --- Light Theme Overrides --- */
:root[data-theme="light"] {
  --bg-base:        #f0f2f5;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-hover:       #f3f4f6;
  --border:         rgba(0,0,0,0.1);
  --border-focus:   rgba(99, 102, 241, 0.4);

  --accent:         #4f46e5;
  --accent-light:   #6366f1;
  --accent-dark:    #4338ca;
  --accent-glow:    rgba(79, 70, 229, 0.15);

  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;

  --shadow-card:    0 2px 12px rgba(0,0,0,0.06);
  --shadow-glow:    0 0 24px rgba(99,102,241,0.1);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg-base); color: var(--text-primary); line-height: 1.6; }
a { color: var(--accent-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; }
input, textarea, select { font-family: inherit; }

/* ===== LAYOUT ===== */
.app-body { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-weight: 700;
  font-size: 1rem;
  background: linear-gradient(135deg, var(--accent-light), #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(99,102,241,0.08));
  color: var(--accent-light);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 14px 14px 18px;
  border-top: 1px solid var(--border);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #c084fc);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem; color: #fff;
  flex-shrink: 0;
}
.user-meta { min-width: 0; }
.user-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-link { font-size: 0.73rem; color: var(--text-muted); }
.logout-link:hover { color: var(--danger); }

/* Main wrapper */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.sidebar-toggle {
  display: none;
  background: none;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); flex: 1; }
.topbar-actions { display: flex; gap: 10px; }

/* Main content */
.main-content { padding: 28px 32px; flex: 1; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition);
}
.card:hover { border-color: rgba(255,255,255,0.12); }
.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--stat-color, var(--accent));
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,0.3); }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: rgba(var(--stat-rgb, 99,102,241), 0.12);
  display: flex; align-items: center; justify-content: center;
  color: var(--stat-color, var(--accent));
  flex-shrink: 0;
}
.stat-info { min-width: 0; }
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; font-weight: 500; }

/* Color variants */
.stat-published { --stat-color: #10b981; }
.stat-failed    { --stat-color: #ef4444; }
.stat-scheduled { --stat-color: #f59e0b; }
.stat-draft     { --stat-color: #6b7280; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem; font-weight: 600;
  transition: all var(--transition);
  cursor: pointer; border: none; line-height: 1.4;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 2px 10px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.12); transform: translateY(-1px); box-shadow: 0 4px 18px var(--accent-glow); color: #fff; }
.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.25); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-warning { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.25); }
.btn-warning:hover { background: var(--warning); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.83rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 7px; }
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 110px; }
select.form-control { cursor: pointer; }
.form-hint { font-size: 0.76rem; color: var(--text-muted); margin-top: 5px; }
.form-row { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Checkbox / Radio */
.checkbox-group, .radio-group { display: flex; flex-direction: column; gap: 8px; }
.checkbox-item, .radio-item {
  display: flex; align-items: center; gap: 9px;
  font-size: 0.875rem; color: var(--text-secondary);
  cursor: pointer;
}
.checkbox-item input[type="checkbox"],
.radio-item input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }
.checkbox-item.selected, .radio-item.selected { color: var(--text-primary); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.025); }
tbody td { padding: 13px 18px; font-size: 0.875rem; color: var(--text-secondary); vertical-align: middle; }
tbody td a { color: var(--text-primary); font-weight: 500; }
tbody td a:hover { color: var(--accent-light); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.12);  color: var(--danger); }
.badge-muted   { background: rgba(107,114,128,0.12); color: #6b7280; }
.badge-info    { background: rgba(59,130,246,0.12);  color: var(--info); }

/* ===== FLASH ALERTS ===== */
.flash-container { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.alert {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500;
  animation: slideIn 0.25s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.alert-success { background: rgba(16,185,129,0.1); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.alert-error, .alert-danger { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info    { background: rgba(59,130,246,0.1); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }
.alert-close { background: none; color: currentColor; opacity: 0.6; font-size: 1.1rem; line-height: 1; padding: 2px 6px; border-radius: 4px; transition: opacity var(--transition); }
.alert-close:hover { opacity: 1; }

/* ===== AUTH PAGE ===== */
.auth-main { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 32px; background: var(--bg-base); }
.auth-flash { position: fixed; top: 24px; right: 24px; width: 340px; z-index: 200; }
.auth-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 42px;
  text-align: center;
  max-width: 440px; width: 100%;
  box-shadow: var(--shadow-card);
  animation: fadeUp 0.35s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.auth-logo {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), #c084fc);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px var(--accent-glow);
  color: #fff;
}
.auth-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; }
.auth-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 32px; }
.btn-facebook {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px;
  background: #1877f2; color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.95rem; font-weight: 700;
  transition: all var(--transition);
  border: none; cursor: pointer;
}
.btn-facebook:hover { background: #1565d6; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(24,119,242,0.35); color: #fff; }
.btn-demo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 13px;
  background: var(--bg-hover); color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600;
  transition: all var(--transition);
  border: 1px solid var(--border); cursor: pointer; margin-top: 12px;
  text-decoration: none;
}
.btn-demo:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-muted); font-size: 0.78rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-features { margin-top: 32px; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.auth-feature { display: flex; align-items: center; gap: 10px; font-size: 0.83rem; color: var(--text-secondary); }
.auth-feature-icon { color: var(--accent-light); flex-shrink: 0; }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.page-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); }
.page-header p { font-size: 0.875rem; color: var(--text-secondary); margin-top: 4px; }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }

/* ===== PAGE CARD (for Facebook pages) ===== */
.page-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; align-items: center; gap: 14px;
  transition: all var(--transition);
}
.page-card:hover { border-color: rgba(255,255,255,0.12); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.page-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, #1877f2, #c084fc);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; color: #fff;
  flex-shrink: 0; overflow: hidden;
}
.page-avatar img { width: 100%; height: 100%; object-fit: cover; }
.page-info { flex: 1; min-width: 0; }
.page-name { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-id { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }
.page-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ===== POST CARD ===== */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: all var(--transition);
}
.post-card:hover { border-color: rgba(255,255,255,0.1); }
.post-content-preview { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 0.77rem; color: var(--text-muted); }
.post-actions { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ===== UPCOMING SCHEDULE ===== */
.upcoming-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.upcoming-item:last-child { border-bottom: none; }
.upcoming-time { flex-shrink: 0; text-align: center; width: 56px; }
.upcoming-time .time-val { font-size: 0.9rem; font-weight: 700; color: var(--accent-light); }
.upcoming-time .time-date { font-size: 0.7rem; color: var(--text-muted); }
.upcoming-body { flex: 1; min-width: 0; }
.upcoming-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-page { font-size: 0.75rem; color: var(--text-muted); }

/* ===== FILTERS BAR ===== */
.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.filter-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
.filter-select:focus { border-color: var(--border-focus); }

/* ===== CALENDAR ===== */
.calendar-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
/* FullCalendar overrides */
.fc { color: var(--text-primary) !important; }
.fc .fc-toolbar-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.fc .fc-button { background: var(--bg-hover) !important; border: 1px solid var(--border) !important; color: var(--text-secondary) !important; font-size: 0.82rem !important; box-shadow: none !important; border-radius: var(--radius-sm) !important; transition: all var(--transition) !important; }
.fc .fc-button:hover { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }
.fc .fc-button-active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent-dark) !important; }
.fc .fc-daygrid-day { background: transparent; }
.fc .fc-daygrid-day:hover { background: rgba(255,255,255,0.02); }
.fc th { color: var(--text-muted) !important; font-size: 0.78rem !important; font-weight: 700 !important; }
.fc .fc-col-header-cell { padding: 10px 0 !important; }
.fc .fc-daygrid-day-number { color: var(--text-secondary) !important; font-size: 0.85rem; }
.fc-today-button { display: none !important; }
.fc .fc-daygrid-day.fc-day-today { background: rgba(99,102,241,0.05) !important; }
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number { background: var(--accent); color: #fff !important; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.fc .fc-event { border-radius: 5px !important; font-size: 0.75rem !important; padding: 2px 5px !important; border: none !important; }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--border) !important; }
.fc-theme-standard .fc-scrollgrid { border-color: var(--border) !important; }

/* ===== EVENT POPUP ===== */
.event-popup {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  width: 300px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  z-index: 500;
  animation: popIn 0.15s ease;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.event-popup h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 8px; }
.event-popup p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; }
.event-popup-close { position: absolute; top: 10px; right: 12px; background: none; color: var(--text-muted); font-size: 1rem; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { width: 52px; height: 52px; margin: 0 auto 16px; opacity: 0.3; }
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.875rem; max-width: 360px; margin: 0 auto 20px; }

/* ===== LOGS ===== */
.log-row-success { border-left: 3px solid var(--success); }
.log-row-failed  { border-left: 3px solid var(--danger); }

/* ===== MEDIA PREVIEW ===== */
.media-preview { margin-top: 10px; border-radius: var(--radius-sm); overflow: hidden; max-width: 200px; border: 1px solid var(--border); }

/* ===== PROGRESS BAR ===== */
.progress { height: 6px; background: var(--bg-hover); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-light)); border-radius: 999px; transition: width 0.4s ease; }

/* ===== CSV IMPORT ===== */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.drop-zone:hover { border-color: var(--accent); background: rgba(99,102,241,0.04); }
.drop-zone.dragover { border-color: var(--accent); background: var(--accent-glow); }
.drop-zone-icon { width: 56px; height: 56px; margin: 0 auto 16px; opacity: 0.4; }
.drop-zone-text { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.drop-zone-hint { font-size: 0.8rem; color: var(--text-muted); }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 400; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; max-width: 520px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.5); animation: fadeUp 0.25s ease; }
.modal-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ===== TOGGLE SWITCH ===== */
.toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input { display: none; }
.toggle-track { width: 38px; height: 22px; background: var(--bg-hover); border-radius: 11px; border: 1px solid var(--border); transition: background var(--transition); position: relative; flex-shrink: 0; }
.toggle-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-muted); transition: transform var(--transition), background var(--transition); }
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent-dark); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); background: #fff; }
.toggle-label { font-size: 0.85rem; color: var(--text-secondary); }

/* ===== TIMELINE ===== */
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 14px; padding-bottom: 18px; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 1px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.6rem; }
.timeline-dot-success { background: rgba(16,185,129,0.15); border: 1px solid rgba(16,185,129,0.25); color: var(--success); }
.timeline-dot-failed  { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.25); color: var(--danger); }
.timeline-body { flex: 1; min-width: 0; }
.timeline-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.timeline-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== SECTION TITLE ===== */
.section-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 14px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .main-wrapper { margin-left: 0; }
  .main-content { padding: 20px; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .main-content { padding: 14px; }
  .auth-box { padding: 32px 22px; }
}
