:root {
  --primary: #505050;
  --accent: #f37649;
  --accent-light: #f9b99e;
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --bg: #f5f6fa;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6c757d;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.07);
}

* { box-sizing: border-box; }

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

h1, h2, h3, h4, h5, h6, .brand-name, .sidebar-brand {
  font-family: 'Poppins', sans-serif;
}

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 6px;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}

.sidebar-tagline {
  color: rgba(255,255,255,0.45);
  font-size: 0.7rem;
  padding: 0 20px 16px;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav-item.active {
  background: var(--accent);
  color: #fff;
}

.nav-item i { font-size: 1.2rem; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}

.user-avatar {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-details { flex: 1; overflow: hidden; }
.user-name {
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-email {
  color: rgba(255,255,255,0.45);
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  color: rgba(255,255,255,0.5);
  font-size: 1.2rem;
  text-decoration: none;
  transition: color 0.15s;
  flex-shrink: 0;
}
.logout-btn:hover { color: #fff; }

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

.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
  color: var(--text);
}

.flash-container { padding: 12px 24px 0; }

.content-area { padding: 24px; flex: 1; }

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ── Stat cards ──────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.orange { background: rgba(243,118,73,0.12); color: var(--accent); }
.stat-icon.blue   { background: rgba(59,130,246,0.12); color: #3b82f6; }
.stat-icon.green  { background: rgba(34,197,94,0.12);  color: #22c55e; }
.stat-icon.red    { background: rgba(239,68,68,0.12);  color: #ef4444; }
.stat-icon.grey   { background: rgba(80,80,80,0.1);    color: var(--primary); }

.stat-value {
  font-family: 'Poppins', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── Platform badge ──────────────────────── */
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  text-transform: capitalize;
}
.platform-badge.linkedin  { background: #0A66C2; }
.platform-badge.facebook  { background: #1877F2; }
.platform-badge.instagram { background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); }
.platform-badge.twitter   { background: #000; }

/* ── Status badge ────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.status-badge.scheduled  { background: rgba(59,130,246,0.12);  color: #3b82f6; }
.status-badge.published  { background: rgba(34,197,94,0.12);   color: #22c55e; }
.status-badge.failed     { background: rgba(239,68,68,0.12);   color: #ef4444; }
.status-badge.draft      { background: rgba(107,114,128,0.12); color: #6b7280; }
.status-badge.publishing { background: rgba(243,118,73,0.12);  color: var(--accent); }

/* ── Buttons ─────────────────────────────── */
.btn-primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  font-weight: 600;
}
.btn-primary:hover {
  background: #e0633a !important;
  border-color: #e0633a !important;
}
.btn-outline-primary {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}
.btn-outline-primary:hover {
  background: var(--accent) !important;
  color: #fff !important;
}

/* ── Account card ────────────────────────── */
.account-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.account-card:hover { border-color: var(--accent-light); }

.account-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}
.account-avatar-placeholder {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.account-info { flex: 1; overflow: hidden; }
.account-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ── Platform connect cards ──────────────── */
.connect-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}
.connect-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(243,118,73,0.15);
  color: inherit;
}
.connect-card .platform-icon { font-size: 2.5rem; margin-bottom: 12px; }
.connect-card .platform-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1rem;
}
.connect-card .platform-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Post preview ────────────────────────── */
.post-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  min-height: 80px;
}

/* ── Login page ──────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #333 100%);
}
.login-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .logo-icon {
  width: 56px; height: 56px;
  background: var(--accent);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 10px;
}
.login-logo h4 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0;
}
.login-logo p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* ── Responsive ──────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
}
