/* ============================================================
   QazPoster — AV DS 4
   Operating interface for publishing workflows
   ============================================================ */

:root {
  /* AV DS 4 palette */
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-raised: #fcfdff;
  --text: #162033;
  --text-secondary: #4b5b73;
  --text-muted: #708198;
  --accent: #164e63;
  --accent-hover: #0f3d4e;
  --accent-light: #e7f4f7;
  --accent-subtle: rgba(22, 78, 99, 0.08);
  --feature: #155e75;
  --feature-light: #e0f2f7;
  --border: #d7e0ea;
  --border-light: #eaf0f5;

  /* Refined shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.03);
  --shadow-md: 0 2px 4px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.02), 0 12px 32px rgba(0,0,0,0.08);

  /* Geometry */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 8px;
  --radius-xl: 8px;

  --transition: 0.2s ease;

  /* Semantic colors */
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #ca8a04;
  --warning-light: #fef9c3;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #2563eb;
  --info-light: #dbeafe;

  /* Sidebar */
  --sidebar-width: 240px;
  --sidebar-width-collapsed: 64px;
  --topbar-height: 52px;
}

[data-theme="dark"] {
  --bg: #0d1218;
  --surface: #141b24;
  --surface-raised: #192230;
  --text: #e2e8f0;
  --text-secondary: #a6b3c5;
  --text-muted: #708198;
  --accent: #7cc6da;
  --accent-hover: #a2dcea;
  --accent-light: #17313d;
  --accent-subtle: rgba(124, 198, 218, 0.12);
  --feature: #7dd3c6;
  --feature-light: #103237;
  --border: #243142;
  --border-light: #1a2430;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);

  --success: #4ade80;
  --success-light: #052e16;
  --warning: #facc15;
  --warning-light: #422006;
  --danger: #f87171;
  --danger-light: #450a0a;
  --info: #60a5fa;
  --info-light: #172554;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 56px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
}

.sidebar-logo-text {
  transition: opacity 0.2s;
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s, transform 0.25s;
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
  background: var(--accent-subtle);
  color: var(--text-secondary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 20px 12px 6px;
  white-space: nowrap;
  overflow: hidden;
}
.nav-section-label:first-child {
  padding-top: 8px;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  height: 38px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  border: none;
  margin-bottom: 2px;
}
.sidebar .nav-link:hover {
  background: var(--accent-subtle);
  color: var(--text);
}
.sidebar .nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-footer {
  border-top: 1px solid var(--border-light);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 8px;
}

.sidebar-footer .theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-footer .theme-toggle:hover {
  background: var(--accent-subtle);
  color: var(--text-secondary);
}

/* Show/hide sun/moon based on theme */
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }

.sidebar-version {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ---- Collapsed State ---- */
body.sidebar-collapsed .sidebar {
  width: var(--sidebar-width-collapsed);
}
body.sidebar-collapsed .sidebar-logo-text,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-badge,
body.sidebar-collapsed .sidebar-version,
body.sidebar-collapsed .sidebar-footer .theme-toggle .nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}
body.sidebar-collapsed .sidebar-collapse-btn {
  transform: rotate(180deg);
}
body.sidebar-collapsed .sidebar .nav-link {
  justify-content: center;
  padding: 0;
}
body.sidebar-collapsed .sidebar-header {
  justify-content: center;
  padding: 0;
}
body.sidebar-collapsed .sidebar-logo {
  justify-content: center;
}
body.sidebar-collapsed .sidebar-collapse-btn {
  display: none;
}
body.sidebar-collapsed .sidebar-footer {
  justify-content: center;
  padding: 8px 4px;
}
body.sidebar-collapsed .sidebar-footer .theme-toggle {
  padding: 6px;
  justify-content: center;
}

/* Collapsed tooltip */
body.sidebar-collapsed .sidebar .nav-link[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-width-collapsed) + 4px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text);
  color: var(--bg);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

/* ============================================================
   TOP BAR
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .site-header {
  left: var(--sidebar-width-collapsed);
}

.topbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 24px;
  gap: 16px;
}

.topbar-title {
  flex: 1;
  min-width: 0;
}

.topbar-page-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.sidebar-mobile-toggle:hover {
  background: var(--accent-subtle);
}

.sidebar-desktop-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.sidebar-desktop-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
main {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
  min-height: calc(100dvh - var(--topbar-height));
  padding: 24px 0;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

body.sidebar-collapsed main {
  margin-left: var(--sidebar-width-collapsed);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
  width: 100%;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: transparent;
  border-top: 1px solid var(--border-light);
  padding: 20px 0;
  margin-left: var(--sidebar-width);
  margin-top: auto;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
body.sidebar-collapsed .site-footer {
  margin-left: var(--sidebar-width-collapsed);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-logo { font-weight: 600; color: var(--text-muted); font-size: 0.85rem; }
.footer-meta p { margin: 0; color: var(--text-muted); font-size: 0.8rem; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header { margin-bottom: 28px; }
.page-header--spacious { margin-bottom: 1.5rem; }
.page-title { font-size: 1.6rem; font-weight: 700; margin: 0 0 4px; letter-spacing: 0; }
.page-subtitle { color: var(--text-muted); margin: 0; font-size: 0.9rem; }

/* ============================================================
   STATS GRID (KPI Cards)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.stat-card--success { background: linear-gradient(135deg, var(--success-light) 0%, var(--surface) 100%); }
.stat-card--danger { background: linear-gradient(135deg, var(--danger-light) 0%, var(--surface) 100%); }
.stat-card--warning { background: linear-gradient(135deg, var(--warning-light) 0%, var(--surface) 100%); }

.stat-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-subtle);
  border-radius: 10px;
  color: var(--accent, #1a365d);
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-card--success .stat-icon { background: rgba(22,163,74,0.1); color: #16a34a; }
.stat-card--danger .stat-icon { background: rgba(220,38,38,0.1); color: #dc2626; }
.stat-card--warning .stat-icon { background: rgba(202,138,4,0.1); color: #ca8a04; }

.stat-body {
  min-width: 0;
  flex: 1;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section { margin-bottom: 28px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.section-header .section-title { margin-bottom: 0; }

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   STATUS BREAKDOWN
   ============================================================ */
.status-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.status-item { display: flex; align-items: center; gap: 8px; }
.status-count { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge,
.post-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.post-status--published, .status-badge--published { background: var(--success-light); color: var(--success); }
.post-status--draft, .status-badge--draft { background: var(--border-light); color: var(--text-muted); }
.post-status--scheduled, .status-badge--scheduled { background: var(--warning-light); color: var(--warning); }
.post-status--publishing, .status-badge--publishing { background: var(--info-light); color: var(--info); }
.post-status--partially_published, .status-badge--partially_published { background: var(--warning-light); color: var(--warning); }
.post-status--failed, .status-badge--failed { background: var(--danger-light); color: var(--danger); }
.post-status--pending_review, .status-badge--pending_review { background: #fef3c7; color: #92400e; }
.post-status--approved, .status-badge--approved { background: #d1fae5; color: #065f46; }

[data-theme="dark"] .post-status--published, [data-theme="dark"] .status-badge--published { background: rgba(74,222,128,0.12); color: var(--success); }
[data-theme="dark"] .post-status--draft, [data-theme="dark"] .status-badge--draft { background: rgba(94,101,119,0.2); color: var(--text-muted); }
[data-theme="dark"] .post-status--scheduled, [data-theme="dark"] .status-badge--scheduled { background: rgba(250,204,21,0.12); color: var(--warning); }
[data-theme="dark"] .post-status--publishing, [data-theme="dark"] .status-badge--publishing { background: rgba(96,165,250,0.12); color: var(--info); }
[data-theme="dark"] .post-status--partially_published, [data-theme="dark"] .status-badge--partially_published { background: rgba(250,204,21,0.1); color: var(--warning); }
[data-theme="dark"] .post-status--failed, [data-theme="dark"] .status-badge--failed { background: rgba(248,113,113,0.12); color: var(--danger); }
[data-theme="dark"] .post-status--pending_review, [data-theme="dark"] .status-badge--pending_review { background: rgba(251,191,36,0.12); color: #fcd34d; }
[data-theme="dark"] .post-status--approved, [data-theme="dark"] .status-badge--approved { background: rgba(52,211,153,0.12); color: #6ee7b7; }

/* ============================================================
   POSTS LIST
   ============================================================ */
.posts-list {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.post-item {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
.post-item:last-child { border-bottom: none; }
.post-item:hover { background: var(--accent-subtle); }
.post-item__meta { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.post-source {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 100px;
  padding: 1px 8px;
}
.post-item__title { font-size: 0.9rem; font-weight: 500; margin-bottom: 4px; }
.post-item__time { font-size: 0.78rem; color: var(--text-muted); }

/* ============================================================
   ORG LIST
   ============================================================ */
.org-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.org-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
}
.org-item:last-child { border-bottom: none; }
.org-name { font-size: 0.88rem; font-weight: 500; }
.org-type {
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}
.org-type--government { background: var(--info-light); color: var(--info); }
.org-type--media { background: var(--success-light); color: var(--success); }
.org-type--ngo { background: #f3e8ff; color: #7c3aed; }
.org-type--other { background: var(--border-light); color: var(--text-muted); }

[data-theme="dark"] .org-type--ngo { background: rgba(124,58,237,0.15); color: #a78bfa; }

/* ============================================================
   TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 12px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border-light);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--accent-subtle); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filter-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  height: 40px;
  font-size: 0.88rem;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  min-width: 160px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-outline {
  border-color: var(--border);
  color: var(--text-secondary);
  background: var(--surface);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { opacity: 0.9; }
.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-soft {
  border-color: color-mix(in srgb, var(--feature) 20%, var(--border));
  color: var(--feature);
  background: color-mix(in srgb, var(--feature) 9%, var(--surface));
}
.btn-soft:hover {
  border-color: var(--feature);
  background: color-mix(in srgb, var(--feature) 14%, var(--surface));
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ============================================================
   INPUTS
   ============================================================ */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; min-height: 80px; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}
.pagination-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  transition: all 0.15s;
  background: var(--surface);
}
.pagination-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}
.pagination-info { color: var(--text-muted); font-size: 0.85rem; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 56px 32px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.empty-state__icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.6;
}
.empty-state__title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.empty-state__text {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 380px;
  margin: 0 auto 20px;
  line-height: 1.5;
}
.empty-state__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.empty-state__cta:hover { background: var(--accent-hover); }

/* ── Illustration empty states ────────────────── */
.empty-state__img {
  display: block;
  margin: 0 auto 12px;
  opacity: 0.85;
}
.chart-empty .empty-state__img {
  margin-bottom: 8px;
  opacity: 0.7;
}

/* ── Error pages ────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 40px 20px;
}
.error-page__img {
  margin-bottom: 16px;
  opacity: 0.85;
}
.error-page__code {
  font-size: 4rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0;
  line-height: 1;
}
.error-page__title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin: 8px 0 4px;
}
.error-page__text {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}
.error-page__btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
  transition: background var(--transition);
}
.error-page__btn:hover {
  background: var(--accent-hover);
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-muted { color: var(--text-muted); }

/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.15s;
  z-index: 50;
  box-shadow: var(--shadow-md);
}
.back-to-top.visible { opacity: 1; pointer-events: all; }
.back-to-top:hover { transform: translateY(-2px); }

/* ============================================================
   HAMBURGER (kept for backward compat, hidden by default)
   ============================================================ */
.hamburger { display: none; }

/* ============================================================
   DESKTOP RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-select { min-width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Phase 6 — Notification Bell + User Panel
   ═══════════════════════════════════════════════════════════════════════════ */

/* Sidebar header flex layout */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ── Notification Bell ─────────────────────────────────────────────────── */
.notif-bell-wrapper {
  position: relative;
}

.notif-bell-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm, 6px);
  color: var(--text-secondary, #4a5568);
  cursor: pointer;
  transition: background var(--transition, 0.2s ease), color var(--transition, 0.2s ease);
}

.notif-bell-btn:hover {
  background: var(--border-light, #edf2f7);
  color: var(--accent, #1a365d);
}

/* Unread badge on bell */
.notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  background: var(--danger, #e53e3e);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 16px;
  border-radius: 8px;
  text-align: center;
  pointer-events: none;
}

/* Notification dropdown panel */
.notif-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 10px);
  box-shadow: var(--shadow-lg, 0 8px 30px rgba(0,0,0,0.12));
  z-index: 1000;
  overflow: hidden;
}

.notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light, #edf2f7);
}

.notif-dropdown-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text, #1a1a2e);
}

.notif-read-all-btn {
  background: transparent;
  border: none;
  color: var(--accent, #1a365d);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: background var(--transition, 0.2s ease);
}

.notif-read-all-btn:hover {
  background: var(--border-light, #edf2f7);
}

.notif-list {
  max-height: 360px;
  overflow-y: auto;
}

.notif-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-muted, #718096);
  font-size: 0.85rem;
}

/* Individual notification item */
.notif-item {
  display: block;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-light, #edf2f7);
  text-decoration: none;
  color: var(--text, #1a1a2e);
  transition: background var(--transition, 0.2s ease);
  position: relative;
}

.notif-item:last-child { border-bottom: none; }

.notif-item:hover {
  background: var(--bg, #f0f2f5);
}

.notif-item.notif-unread {
  background: rgba(26,54,93,0.04);
}

.notif-item.notif-unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--accent, #1a365d);
}

.notif-type-success.notif-unread::before { background: var(--success, #38a169); }
.notif-type-warning.notif-unread::before { background: var(--warning, #d69e2e); }
.notif-type-error.notif-unread::before   { background: var(--danger, #e53e3e); }

.notif-item-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text, #1a1a2e);
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item-body {
  font-size: 0.78rem;
  color: var(--text-secondary, #4a5568);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.2rem;
}

.notif-item-time {
  font-size: 0.7rem;
  color: var(--text-muted, #718096);
}

/* ── Sidebar User Panel ────────────────────────────────────────────────── */
.sidebar-user-panel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--bg, #f0f2f5);
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-light, #edf2f7);
}

.sidebar-user-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent, #1a365d);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.sidebar-user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text, #1a1a2e);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.05rem 0.35rem;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
  background: var(--text-muted, #718096);
  width: fit-content;
}

.sidebar-role-admin     { background: var(--accent, #1a365d); }
.sidebar-role-editor    { background: var(--success, #38a169); }
.sidebar-role-publisher { background: var(--warning, #d69e2e); color: #1a1a2e; }
.sidebar-role-viewer    { background: var(--text-muted, #718096); }

.sidebar-logout-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm, 6px);
  color: var(--text-muted, #718096);
  cursor: pointer;
  transition: background var(--transition, 0.2s ease), color var(--transition, 0.2s ease);
}

.sidebar-logout-btn:hover {
  background: rgba(229, 62, 62, 0.1);
  color: var(--danger, #e53e3e);
}

/* Dark theme overrides */
[data-theme="dark"] .notif-dropdown {
  background: var(--surface, #14171c);
  border-color: var(--border, #2a2d37);
}

[data-theme="dark"] .notif-item.notif-unread {
  background: rgba(59, 130, 246, 0.07);
}

[data-theme="dark"] .sidebar-user-panel {
  background: var(--surface, #14171c);
  border-color: var(--border, #2a2d37);
}

/* Collapsed sidebar — hide user panel text */
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-logout-btn {
  display: none;
}

.sidebar.collapsed .sidebar-user-panel {
  justify-content: center;
  padding: 0.5rem;
}

/* ── Language Switcher ─────────────────────────────────────────────── */
.lang-switch {
  display: flex;
  gap: 2px;
  padding: 4px 12px;
  margin-bottom: 8px;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm, 6px);
  transition: all var(--transition, 0.2s ease);
  background: transparent;
  border: none;
  cursor: pointer;
}
.lang-btn:hover {
  color: var(--text);
  background: var(--border-light, #edf2f7);
}
.lang-btn.active {
  color: var(--accent, #1a365d);
  background: rgba(26, 54, 93, 0.08);
  font-weight: 700;
}
[data-theme="dark"] .lang-btn.active {
  color: #93c5fd;
  background: rgba(100, 150, 220, 0.12);
}
.sidebar.collapsed .lang-switch {
  flex-direction: column;
  padding: 4px 6px;
}
.sidebar.collapsed .lang-switch .lang-btn {
  padding: 3px 6px;
  font-size: 0.65rem;
}
/* Login page lang switch */
.login-lang-switch .lang-btn {
  padding: 5px 12px;
  font-size: 0.78rem;
}
