/* ═══════════════════════════════════════════════════════════════════
   Dikirnis City Dashboard — Professional Responsive Upgrade
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap');

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

:root {
  /* Brand Palette */
  --primary:      #0D8A8A;
  --primary-d:    #0A6E6E;
  --primary-l:    #E6F7F7;
  --primary-xl:   #F0FAFA;
  --accent:       #F59E0B;
  --accent-l:     #FEF3C7;
  --success:      #10B981;
  --success-l:    #DCFCE7;
  --error:        #EF4444;
  --error-l:      #FEE2E2;
  --warning:      #F59E0B;
  --warning-l:    #FEF3C7;

  /* Surfaces */
  --bg:           #F0F7F7;
  --bg-2:         #E8F4F4;
  --surface:      #FFFFFF;
  --surface-alt:  #F8FCFC;
  --sidebar-bg:   #0A3D3D;
  --sidebar-text: rgba(255,255,255,0.65);
  --sidebar-act:  rgba(255,255,255,0.10);

  /* Typography */
  --text:         #0A2E2E;
  --text-s:       #4A7070;
  --text-h:       #8AABAB;
  --font:         'Cairo', sans-serif;
  --mono:         'JetBrains Mono', monospace;

  /* Borders */
  --border:       #D1E8E8;
  --border-focus: var(--primary);

  /* Shadows */
  --shadow-xs:    0 1px 2px rgba(13,138,138,0.06);
  --shadow-sm:    0 1px 3px rgba(13,138,138,0.08), 0 4px 12px rgba(13,138,138,0.06);
  --shadow:       0 2px 8px rgba(13,138,138,0.08), 0 8px 24px rgba(13,138,138,0.06);
  --shadow-lg:    0 8px 32px rgba(13,138,138,0.14);
  --shadow-xl:    0 20px 60px rgba(13,138,138,0.18);

  /* Radii */
  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    20px;
  --radius-xl:    28px;

  /* Layout */
  --sidebar-w:    268px;
  --topbar-h:     64px;
  --bottom-nav-h: 0px;
  --content-max:  1440px;
  --card-shadow:  0 2px 12px rgba(13,138,138,0.08);
}

/* ── DARK MODE ─────────────────────────────────────────────────────── */
body.dark-mode {
  --bg:         #0D1117;
  --bg-2:       #0F1822;
  --surface:    #161B22;
  --surface-alt:#1C2128;
  --border:     #2D3741;
  --text:       #E6EDF3;
  --text-s:     #8B949E;
  --text-h:     #484F58;
  --primary-l:  #0D2A2A;
  --primary-xl: #0A1F1F;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.25), 0 4px 12px rgba(0,0,0,0.20);
  --shadow:     0 2px 8px rgba(0,0,0,0.25), 0 8px 24px rgba(0,0,0,0.20);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.40);
}

/* ── BASE ──────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at -10% -10%, rgba(13,138,138,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 110% 110%, rgba(13,138,138,0.04) 0%, transparent 60%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background 0.25s, color 0.25s;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; position: relative; width: 100%; display: flex; }

/* ══════════════════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0; top: 0; bottom: 0;
  z-index: 300;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), box-shadow 0.3s;
  border-left: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
}

/* Sidebar background shimmer */
.sidebar::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(13,138,138,0.15) 0%, transparent 60%);
  pointer-events: none;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  z-index: 299;
  opacity: 0;
  transition: opacity 0.25s ease;
  display: none;
}
.sidebar-overlay.active { opacity: 1; }

/* Logo */
.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary), #0AABAB);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(13,138,138,0.4);
}
.logo-text { color: #fff; font-weight: 800; font-size: 15px; line-height: 1.2; letter-spacing: -0.3px; }
.logo-sub  { color: var(--sidebar-text); font-size: 10px; letter-spacing: 0.3px; margin-top: 1px; }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  position: relative;
  z-index: 1;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.nav-section-label {
  color: rgba(255,255,255,0.28);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.8px;
  padding: 18px 10px 5px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s cubic-bezier(0.4,0,0.2,1);
  margin-bottom: 1px;
  text-decoration: none;
  user-select: none;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.9);
  transform: translateX(-2px);
}
.nav-item.active {
  background: rgba(13,138,138,0.25);
  color: #fff;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 3px 0 0 3px;
  box-shadow: 0 0 8px rgba(13,138,138,0.6);
}
.nav-item.active .icon { color: #4DCFCF; }
.nav-item .icon {
  font-size: 17px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: color 0.15s;
}
.nav-item .badge {
  margin-right: auto;
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

/* Footer */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
  position: relative;
  z-index: 1;
}
.admin-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  transition: background 0.15s;
}
.admin-pill:hover { background: rgba(255,255,255,0.09); }
.admin-av {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), #0AABAB);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 13px;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 8px rgba(13,138,138,0.4);
}
.admin-av::after {
  content: '';
  position: absolute;
  bottom: 1px; left: 1px;
  width: 9px; height: 9px;
  background: #22C55E;
  border-radius: 50%;
  border: 2px solid var(--sidebar-bg);
}
.admin-name { color: #fff; font-size: 13px; font-weight: 600; }
.admin-role { color: var(--sidebar-text); font-size: 10px; margin-top: 1px; }

/* ══════════════════════════════════════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════════════════════════════════════ */
.main {
  margin-right: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-right 0.3s cubic-bezier(0.4,0,0.2,1);
}

/* ══════════════════════════════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════════════════════════════ */
.topbar {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(209,232,232,0.7);
  box-shadow: 0 1px 0 rgba(13,138,138,0.05), 0 4px 20px rgba(13,138,138,0.04);
  padding: 0 24px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 200;
  transition: background 0.25s;
}
body.dark-mode .topbar {
  background: rgba(22,27,34,0.92);
  border-bottom-color: rgba(45,55,65,0.7);
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
  letter-spacing: -0.3px;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 7px 14px;
  width: 220px;
  transition: all 0.2s ease;
}
.topbar-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,138,138,0.12);
  width: 280px;
  background: var(--surface);
}
.topbar-search input {
  border: none; background: none; outline: none;
  font-family: var(--font); font-size: 13px; color: var(--text);
  width: 100%;
}
.topbar-search input::placeholder { color: var(--text-h); }

.topbar-btn {
  width: 38px; height: 38px;
  min-width: 38px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 15px;
  position: relative;
  transition: all 0.15s;
  color: var(--text-s);
  flex-shrink: 0;
}
.topbar-btn:hover {
  background: var(--primary-l);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(13,138,138,0.15);
}
.topbar-btn .dot {
  position: absolute; top: 6px; left: 6px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--surface);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

.menu-toggle {
  display: none;
  width: 38px; height: 38px;
  min-width: 38px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 17px;
  cursor: pointer;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.menu-toggle:hover { background: var(--primary-l); border-color: var(--primary); }

/* ══════════════════════════════════════════════════════════════════════
   PAGES
══════════════════════════════════════════════════════════════════════ */
.page {
  display: none;
  padding: 24px;
  animation: pageIn 0.25s cubic-bezier(0.4,0,0.2,1);
  padding-bottom: calc(var(--bottom-nav-h) + 28px);
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}
.page.active { display: block; }

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

/* ══════════════════════════════════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════════════════════════════════ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 14px;
}
.page-header-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1.2;
}
.page-header-sub {
  font-size: 13px;
  color: var(--text-s);
  margin-top: 3px;
  font-weight: 400;
}

/* ══════════════════════════════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s;
  position: relative;
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow); }

/* ══════════════════════════════════════════════════════════════════════
   STAT CARDS
══════════════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 18px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1), box-shadow 0.2s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(13,138,138,0.15), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.stat-card:hover::after { opacity: 1; }

.stat-card-stripe {
  position: absolute;
  top: 0; right: 0;
  width: 4px;
  height: 100%;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.stat-value {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1.5px;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: var(--text-s);
  margin-top: 4px;
  font-weight: 500;
}

.stat-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.stat-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
}
.stat-sparkline span {
  width: 5px;
  border-radius: 2px;
  opacity: 0.55;
  transition: opacity 0.15s, height 0.3s;
}
.stat-sparkline span:last-child { opacity: 1; }
.stat-card:hover .stat-sparkline span { opacity: 0.8; }
.stat-card:hover .stat-sparkline span:last-child { opacity: 1; }

.stat-change {
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.stat-change.up      { background: var(--success-l); color: #15803D; }
.stat-change.dn      { background: var(--error-l); color: #B91C1C; }
.stat-change.neutral { background: var(--primary-l); color: var(--primary-d); }
.stat-change.warning { background: var(--warning-l); color: #B45309; }

body.dark-mode .stat-change.up      { background: rgba(16,185,129,0.15); color: #34D399; }
body.dark-mode .stat-change.dn      { background: rgba(239,68,68,0.15);  color: #F87171; }
body.dark-mode .stat-change.neutral { background: rgba(13,138,138,0.2);  color: #5DCFCF; }
body.dark-mode .stat-change.warning { background: rgba(245,158,11,0.15); color: #FCD34D; }

/* ══════════════════════════════════════════════════════════════════════
   CHARTS GRID
══════════════════════════════════════════════════════════════════════ */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14.5px; font-weight: 700; letter-spacing: -0.2px; }
.card-sub   { font-size: 12px; color: var(--text-s); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════════════
   TABLE
══════════════════════════════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--radius) var(--radius);
  /* Horizontal scroll indicator */
  background:
    linear-gradient(to right, var(--surface) 20px, transparent),
    linear-gradient(to right, transparent, var(--surface) 20px) right,
    radial-gradient(farthest-side at 0 50%, rgba(13,138,138,0.1), transparent) 0 50%,
    radial-gradient(farthest-side at 100% 50%, rgba(13,138,138,0.1), transparent) right 50%;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 60%, 14px 60%;
  background-attachment: local, local, scroll, scroll;
}

table { width: 100%; border-collapse: collapse; min-width: 500px; }

th {
  text-align: right;
  padding: 11px 16px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-s);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border-bottom: 1.5px solid var(--border);
  background: var(--surface-alt);
  white-space: nowrap;
  position: sticky;
  top: 0;
  user-select: none;
}
th.sortable { cursor: pointer; transition: color 0.15s; }
th.sortable:hover { color: var(--primary); }

td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  transition: background 0.1s;
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.1s; }
tbody tr:hover td { background: var(--primary-xl) !important; }
body.dark-mode tbody tr:hover td { background: rgba(13,138,138,0.08) !important; }

/* ══════════════════════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.1px;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.badge-success { background: var(--success-l); color: #15803D; border: 1px solid rgba(21,128,61,0.18); }
.badge-success::before { background: #15803D; }
.badge-warning { background: var(--warning-l); color: #B45309; border: 1px solid rgba(180,83,9,0.18); }
.badge-warning::before { background: #D97706; }
.badge-error   { background: var(--error-l); color: #B91C1C; border: 1px solid rgba(185,28,28,0.18); }
.badge-error::before { background: #EF4444; }
.badge-info    { background: var(--primary-l); color: #0A5A5A; border: 1px solid rgba(13,138,138,0.2); }
.badge-info::before { background: var(--primary); }
.badge-gray    { background: var(--bg); color: var(--text-s); border: 1px solid var(--border); }
.badge-gray::before { background: var(--text-h); }

body.dark-mode .badge-success { background: rgba(16,185,129,0.12); color: #34D399; border-color: rgba(52,211,153,0.2); }
body.dark-mode .badge-warning { background: rgba(245,158,11,0.12); color: #FCD34D; border-color: rgba(252,211,77,0.2); }
body.dark-mode .badge-error   { background: rgba(239,68,68,0.12);  color: #F87171; border-color: rgba(248,113,113,0.2); }
body.dark-mode .badge-info    { background: rgba(13,138,138,0.15); color: #5DCFCF; border-color: rgba(93,207,207,0.2); }

/* ══════════════════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s cubic-bezier(0.4,0,0.2,1);
  white-space: nowrap;
  line-height: 1;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s;
}
.btn:hover::after { background: rgba(255,255,255,0.08); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color: #fff;
  box-shadow: 0 2px 8px rgba(13,138,138,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #0E9B9B, var(--primary));
  box-shadow: 0 4px 16px rgba(13,138,138,0.4);
  transform: translateY(-1px);
}
.btn-accent  { background: linear-gradient(135deg, var(--accent), #E08A00); color: #fff; }
.btn-accent:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--primary-l); color: var(--primary); }
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-l); }
.btn-ghost {
  background: var(--bg);
  color: var(--text-s);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--primary); color: var(--primary); }
.btn-danger {
  background: linear-gradient(135deg, var(--error), #DC2626);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}
.btn-danger:hover { box-shadow: 0 4px 14px rgba(239,68,68,0.35); transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-export {
  background: var(--bg);
  color: var(--text-s);
  border: 1.5px solid var(--border);
}
.btn-export:hover { background: var(--primary-l); color: var(--primary); border-color: var(--primary); }

/* ══════════════════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.2s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(13,138,138,0.10);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ══════════════════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  box-shadow: var(--shadow-xl);
  animation: modalSlideUp 0.3s cubic-bezier(0.34,1.56,0.64,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal > .modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky; top: 0;
  background: var(--sidebar-bg);
  z-index: 1;
  flex-shrink: 0;
}
.modal-header-icon {
  width: 34px; height: 34px;
  background: rgba(13,138,138,0.3);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex: 1;
  margin: 0;
  letter-spacing: -0.2px;
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.7);
  transition: all 0.15s;
  flex-shrink: 0;
}
.modal-close:hover { background: rgba(255,255,255,0.2); color: #fff; }

.modal-body { padding: 20px 22px; }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  position: sticky; bottom: 0;
  background: var(--surface);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════════════════════════════ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(13,138,138,0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(10,61,61,0.4) 0%, transparent 50%),
    linear-gradient(135deg, #0A3D3D 0%, #0D6A6A 50%, #0D8A8A 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
#login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.login-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.1);
  position: relative;
  z-index: 1;
  animation: loginIn 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes loginIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 30px;
}
.login-logo .icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(13,138,138,0.4);
}
.login-logo .text { font-size: 19px; font-weight: 800; letter-spacing: -0.5px; }
.login-logo .sub  { font-size: 12px; color: var(--text-s); margin-top: 2px; }
.login-title  { font-size: 24px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.5px; }
.login-sub    { font-size: 14px; color: var(--text-s); margin-bottom: 26px; }

/* ══════════════════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 20px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  min-width: 300px;
  max-width: 420px;
  width: calc(100% - 40px);
}
.toast {
  background: #1C2128;
  color: #E6EDF3;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
  pointer-events: all;
  border: 1px solid rgba(255,255,255,0.08);
}
.toast.success { background: #064E3B; border-color: rgba(16,185,129,0.3); }
.toast.error   { background: #7F1D1D; border-color: rgba(239,68,68,0.3); }
.toast.warning { background: #78350F; border-color: rgba(245,158,11,0.3); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.94); }
}

/* ══════════════════════════════════════════════════════════════════════
   CONFIRM DIALOG
══════════════════════════════════════════════════════════════════════ */
.confirm-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: modalSlideUp 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.confirm-box .confirm-icon { font-size: 48px; margin-bottom: 14px; }
.confirm-box h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.confirm-box p  { font-size: 13px; color: var(--text-s); margin-bottom: 22px; line-height: 1.6; }
.confirm-btns   { display: flex; gap: 10px; }
.confirm-btns .btn { flex: 1; justify-content: center; }

/* ══════════════════════════════════════════════════════════════════════
   BOTTOM NAV (mobile)
══════════════════════════════════════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 250;
  padding: 6px 4px env(safe-area-inset-bottom, 8px);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.bottom-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 8px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--text-h);
  font-size: 10px;
  font-weight: 600;
  transition: all 0.15s;
  flex: 1;
  position: relative;
}
.bottom-nav-item .nav-icon { font-size: 21px; line-height: 1; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active .nav-icon-bg {
  position: absolute;
  top: 3px;
  width: 44px; height: 26px;
  background: var(--primary-l);
  border-radius: 20px;
}
.bottom-nav-item .bn-badge {
  position: absolute;
  top: 4px; right: 8px;
  background: var(--error);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
  padding: 0 3px;
}

/* ══════════════════════════════════════════════════════════════════════
   MISC UTILITIES
══════════════════════════════════════════════════════════════════════ */
.flex           { display: flex; }
.items-center   { align-items: center; }
.gap-2          { gap: 8px; }
.gap-3          { gap: 12px; }
.ml-auto        { margin-right: auto; }
.text-s         { color: var(--text-s); font-size: 13px; }
.text-xs        { font-size: 11px; }
.fw-700         { font-weight: 700; }
.mb-4           { margin-bottom: 16px; }
.mt-4           { margin-top: 16px; }

.tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--primary-l);
  color: var(--primary-d);
  white-space: nowrap;
  border: 1px solid rgba(13,138,138,0.15);
}

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-l);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  color: var(--primary);
  flex-shrink: 0;
}

.empty-state-pro {
  display: flex; flex-direction: column; align-items: center;
  padding: 52px 24px; text-align: center; color: var(--text-s);
}
.empty-state-pro .es-icon  { font-size: 52px; margin-bottom: 14px; opacity: 0.4; }
.empty-state-pro .es-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state-pro .es-sub   { font-size: 13px; margin-bottom: 20px; max-width: 300px; line-height: 1.6; }

/* Skeleton */
.skel {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.skel-line { height: 14px; border-radius: 6px; margin-bottom: 8px; }
.skel-card { height: 90px; border-radius: var(--radius); }

/* Spinner */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress */
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 3px; background: var(--primary); transition: width 0.6s ease; }

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.alert-success { background: var(--success-l); color: #15803D; }
.alert-error   { background: var(--error-l); color: #B91C1C; }

/* ══════════════════════════════════════════════════════════════════════
   ADS PAGE
══════════════════════════════════════════════════════════════════════ */
#ads-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)) !important;
  gap: 18px !important;
  width: 100% !important;
}
#ads-grid .stat-card { cursor: default; }
#ads-grid .stat-card:hover { transform: translateY(-4px); }

/* ══════════════════════════════════════════════════════════════════════
   PLANS GRID
══════════════════════════════════════════════════════════════════════ */
#plans-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(175px, 210px)) !important;
  gap: 12px !important;
  padding-top: 8px;
  justify-content: start;
}

/* ══════════════════════════════════════════════════════════════════════
   NOTIFICATION PANEL
══════════════════════════════════════════════════════════════════════ */
#notif-panel {
  position: fixed;
  top: calc(var(--topbar-h) + 8px);
  left: 20px;
  width: 400px;
  max-height: 80vh;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  z-index: 400;
  display: none;
  flex-direction: column;
  border: 1px solid var(--border);
  animation: modalSlideUp 0.2s ease;
  overflow: hidden;
}
#notif-panel.open { display: flex; }

/* ══════════════════════════════════════════════════════════════════════
   AI ASSISTANT
══════════════════════════════════════════════════════════════════════ */
.ai-fab {
  position: fixed;
  left: 24px; bottom: calc(var(--bottom-nav-h) + 20px);
  z-index: 1200;
  width: 52px; height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0A3D3D, #0D8A8A);
  color: #fff; border: none; cursor: pointer;
  box-shadow: 0 4px 20px rgba(13,138,138,0.45);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.ai-fab:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 28px rgba(13,138,138,0.55);
}

/* ══════════════════════════════════════════════════════════════════════
   SEARCH OVERLAY
══════════════════════════════════════════════════════════════════════ */
#search-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9000;
  align-items: flex-start; justify-content: center;
  padding-top: 80px;
  backdrop-filter: blur(6px);
}
#search-overlay.open { display: flex; }
.search-modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%; max-width: 600px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalSlideUp 0.2s ease;
  border: 1px solid var(--border);
}
.search-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.search-input-wrap input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--font); font-size: 17px; color: var(--text);
}
#search-results { max-height: 420px; overflow-y: auto; padding: 6px 0; }
.search-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 22px; cursor: pointer; transition: background 0.1s;
}
.search-result-item:hover { background: var(--bg); }
.search-result-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--primary-l);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}

/* API Bar */
.api-bar {
  background: #0A3D3D;
  color: #a8d8ff;
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  word-break: break-all;
}
.api-bar .method {
  background: var(--success);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.api-bar .method.post { background: var(--accent); }
.api-bar .method.del  { background: var(--error); }

/* ══════════════════════════════════════════════════════════════════════
   IMAGES UPLOAD
══════════════════════════════════════════════════════════════════════ */
.img-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}
.img-upload-area:hover { border-color: var(--primary); background: var(--primary-xl); }
.img-upload-area input[type=file] { display: none; }
.img-preview {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  display: none;
  border: 1px solid var(--border);
}
.imgs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; margin-top: 10px; }
.imgs-grid-item { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; }
.imgs-grid-item img { width: 100%; height: 100%; object-fit: cover; }
.imgs-grid-item .del-img-btn {
  position: absolute; top: 3px; left: 3px;
  background: rgba(239,68,68,0.9); color: #fff; border: none;
  border-radius: 50%; width: 20px; height: 20px; font-size: 12px;
  cursor: pointer; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* ══════════════════════════════════════════════════════════════════════
   BULK TOOLBAR
══════════════════════════════════════════════════════════════════════ */
.bulk-toolbar {
  display: none; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 13px; font-weight: 600;
}
.bulk-toolbar.show { display: flex; }
.bulk-toolbar .btn { background: rgba(255,255,255,0.2); color: #fff; border: none; }
.bulk-toolbar .btn:hover { background: rgba(255,255,255,0.3); }

/* ══════════════════════════════════════════════════════════════════════
   DASHBOARD WIDGETS
══════════════════════════════════════════════════════════════════════ */
.dash-alert-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; margin-bottom: 8px;
  cursor: pointer; transition: all 0.15s;
}
.dash-alert-item:hover { transform: translateX(-2px); }
.dash-alert-item:last-child { margin-bottom: 0; }
.dash-alert-item .alert-time { margin-right: auto; font-size: 11px; opacity: 0.65; font-weight: 400; }
.dash-alert-danger { background: #FEE2E2; color: #991B1B; border: 1px solid rgba(185,28,28,0.12); }
.dash-alert-warn   { background: #FEF3C7; color: #92400E; border: 1px solid rgba(180,83,9,0.12); }
.dash-alert-info   { background: #EFF6FF; color: #1E40AF; border: 1px solid rgba(30,64,175,0.12); }

body.dark-mode .dash-alert-danger { background: rgba(239,68,68,0.10); color: #FCA5A5; }
body.dark-mode .dash-alert-warn   { background: rgba(245,158,11,0.10); color: #FCD34D; }
body.dark-mode .dash-alert-info   { background: rgba(13,138,138,0.12); color: #5DCFCF; }

/* Heat grid */
.heat-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.heat-cell { height: 14px; border-radius: 3px; background: var(--border); transition: transform 0.1s; cursor: default; }
.heat-cell:hover { transform: scale(1.3); }
.heat-0 { background: var(--border); }
.heat-1 { background: #B2E8E8; }
.heat-2 { background: #4DBFBF; }
.heat-3 { background: #0D8A8A; }
.heat-4 { background: #0A5A5A; }

/* Audit Log */
.audit-action {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  white-space: nowrap; flex-shrink: 0;
}
.audit-create { background: var(--success-l); color: #15803D; }
.audit-update { background: var(--primary-l);  color: var(--primary); }
.audit-delete { background: var(--error-l);   color: #B91C1C; }
.audit-login  { background: var(--warning-l); color: #B45309; }

/* Notif target buttons */
.notif-target-btn {
  flex: 1; padding: 10px 8px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg); cursor: pointer; text-align: center;
  font-family: var(--font); font-size: 12px; font-weight: 600;
  color: var(--text-s); transition: all 0.15s;
}
.notif-target-btn.selected {
  border-color: var(--primary);
  background: var(--primary-l);
  color: var(--primary);
}
.notif-target-btn .icon { font-size: 20px; display: block; margin-bottom: 4px; }

/* Rating widget */
.rating-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.rating-mini-cell { background: var(--bg); border-radius: var(--radius-sm); padding: 8px; text-align: center; }
.rating-mini-val  { font-size: 17px; font-weight: 700; }
.rating-mini-lbl  { font-size: 10px; color: var(--text-s); margin-top: 2px; }

/* Conversion ring */
.conv-ring { position: relative; width: 80px; height: 80px; margin: 8px auto; }
.conv-ring svg { transform: rotate(-90deg); }
.conv-ring-label {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px; font-weight: 800;
}

/* Revenue widget */
.rev-main { font-size: 28px; font-weight: 900; letter-spacing: -1px; color: var(--accent); }
.rev-sub  { font-size: 12px; color: var(--text-s); margin-top: 3px; }
.rev-row  { display: flex; justify-content: space-between; font-size: 12px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); }

/* Week calendar */
.week-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 8px; }
.week-cal-day  { text-align: center; }
.week-cal-lbl  { font-size: 10px; color: var(--text-s); margin-bottom: 4px; font-weight: 500; }
.week-cal-num  { border-radius: 8px; padding: 6px 2px; font-size: 13px; font-weight: 700; background: var(--bg); color: var(--text); transition: transform 0.15s; }
.week-cal-num.today { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(13,138,138,0.35); }
.week-cal-num.busy  { background: var(--primary-l); color: var(--primary); }
.week-cal-num.empty { opacity: 0.35; }

/* ══════════════════════════════════════════════════════════════════════
   FEED & TOP SECTIONS
══════════════════════════════════════════════════════════════════════ */
.dash-feed-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.dash-feed-item:last-child { border-bottom: none; }
.dash-feed-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.dash-feed-meta  { font-size: 11px; color: var(--text-s); margin-top: 2px; }

.top-user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.top-user-row:last-child { border-bottom: none; }

.top-section-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.top-section-row:last-child { border-bottom: none; }

/* ══════════════════════════════════════════════════════════════════════
   MEDIA LIBRARY GRID
══════════════════════════════════════════════════════════════════════ */
.media-card {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  background: var(--surface);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border);
}
.media-card:hover {
  transform: scale(1.02) translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ══════════════════════════════════════════════════════════════════════
   PTR / KEYBOARD HINTS
══════════════════════════════════════════════════════════════════════ */
.ptr-indicator {
  position: fixed;
  top: var(--topbar-h); left: 50%;
  transform: translateX(-50%) translateY(-60px);
  background: var(--primary);
  color: #fff; padding: 8px 18px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  z-index: 199; transition: transform 0.3s;
  pointer-events: none; display: none; white-space: nowrap;
  box-shadow: var(--shadow);
}
.ptr-indicator.show { display: block; transform: translateX(-50%) translateY(12px); }

#kbd-hint {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 12px);
  left: 50%; transform: translateX(-50%);
  background: rgba(10,61,61,0.95);
  color: rgba(255,255,255,0.6);
  padding: 7px 16px; border-radius: 20px; font-size: 11px;
  z-index: 100; pointer-events: none; opacity: 0;
  transition: opacity 0.3s; white-space: nowrap;
  backdrop-filter: blur(8px);
}
#kbd-hint.show { opacity: 1; }
.kbd {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border-radius: 4px; padding: 1px 5px;
  margin: 0 2px; font-size: 10px;
  border: 1px solid rgba(255,255,255,0.1);
}

/* FAB */
.fab {
  display: none;
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 20px);
  left: 20px;
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color: #fff; border-radius: 16px; font-size: 24px;
  align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(13,138,138,0.45);
  cursor: pointer; z-index: 199; border: none;
  font-family: var(--font); transition: transform 0.15s, box-shadow 0.15s;
}
.fab:active { transform: scale(0.95); }

/* Search highlight */
.search-highlight { background: #FEF08A; border-radius: 2px; padding: 0 2px; }

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (≤1024px)
══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr; }
  #advanced-charts-row { grid-template-columns: 1fr !important; }
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤768px)
══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --topbar-h:     56px;
    --bottom-nav-h: 68px;
  }

  /* Sidebar: slide in from the right (RTL) */
  .sidebar {
    transform: translateX(100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: -8px 0 40px rgba(0,0,0,0.35);
  }

  .main { margin-right: 0 !important; }
  .menu-toggle { display: flex; }

  .topbar {
    padding: 0 14px;
    height: var(--topbar-h);
    gap: 8px;
  }
  .topbar-title { font-size: 15px; }
  .topbar-search { display: none; }
  .topbar-btn { display: none; }
  .topbar-btn.topbar-notif,
  .topbar-btn.topbar-dark { display: flex; }

  .bottom-nav { display: block; }
  .fab { display: flex; }

  .page { padding: 14px 14px calc(var(--bottom-nav-h) + 22px); }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }
  .stat-card { padding: 12px 12px 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 16px; border-radius: 10px; }
  .stat-value { font-size: 22px; letter-spacing: -1px; }
  .stat-label { font-size: 11px; }
  .stat-card-footer { margin-top: 10px; padding-top: 8px; }

  .charts-grid { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 14px; }
  .card-title { font-size: 14px; }

  .page-header { margin-bottom: 16px; }
  .page-header-title { font-size: 18px; }

  /* Tables */
  table { min-width: 540px; }
  th, td { padding: 9px 12px; font-size: 12px; }

  /* Modal as full bottom sheet */
  .modal-overlay { align-items: flex-end; }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
    max-width: 100%;
  }
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; justify-content: center; }

  /* Notification panel */
  #notif-panel {
    top: auto;
    bottom: calc(var(--bottom-nav-h) + 8px);
    left: 8px; right: 8px;
    width: auto;
    max-height: 70vh;
    border-radius: var(--radius);
  }

  #ads-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  #plans-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Dashboard multi-col grids */
  #page-dashboard > div[style*="grid-template-columns:1fr 1fr 1fr"],
  #page-dashboard > div[style*="grid-template-columns: 1fr 1fr 1fr"],
  #page-dashboard > div[style*="grid-template-columns:1fr 1fr"],
  #page-dashboard > div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  #page-dashboard > div[style*="grid-template-columns:2fr 1fr"],
  #page-dashboard > div[style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Page header stacks */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header > div:last-child { width: 100%; }
  .page-header .btn { flex: 1; justify-content: center; }

  /* Search overlay */
  #search-overlay { padding: 16px 8px 8px; align-items: flex-start; }
  .search-modal   { border-radius: var(--radius); }

  /* Bottom nav adjust */
  .bottom-nav-item { padding: 6px 4px; }
  .bottom-nav-item .nav-icon { font-size: 20px; }
  .bottom-nav-item { font-size: 9.5px; }
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (≤480px)
══════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  :root { --sidebar-w: 100vw; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 10.5px; }

  #plans-grid {
    grid-template-columns: 1fr !important;
  }

  #ads-grid { gap: 12px !important; }

  .topbar { padding: 0 12px; }
  .page   { padding: 12px 12px calc(var(--bottom-nav-h) + 20px); }

  th, td { padding: 8px 10px; font-size: 11.5px; }

  /* Confirm dialog full width */
  .confirm-box { padding: 24px 20px; border-radius: var(--radius); }
}

/* ══════════════════════════════════════════════════════════════════════
   ADS PAGE — ENHANCED AD CARDS
══════════════════════════════════════════════════════════════════════ */

/* ── Stats bar above the grid ── */
.ads-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.ads-stat-mini {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.ads-stat-mini:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.ads-stat-mini-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.ads-stat-mini-val  { font-size: 20px; font-weight: 900; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.ads-stat-mini-lbl  { font-size: 11px; color: var(--text-s); margin-top: 1px; font-weight: 500; }

/* ── Filter / sort bar ── */
.ads-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.ads-filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-s);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ads-filter-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-l); }
.ads-filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Ad card (replaces generic stat-card in #ads-grid) ── */
.ad-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1), box-shadow 0.2s ease;
  position: relative;
  cursor: default;
}
.ad-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Left color accent stripe */
.ad-card::before {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--ad-accent, var(--primary));
}

/* ── Card header ── */
.ad-card-head {
  padding: 16px 18px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.ad-card-thumb {
  width: 52px; height: 52px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.ad-card-meta { flex: 1; min-width: 0; }
.ad-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}
.ad-card-sub {
  font-size: 11.5px;
  color: var(--text-s);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ad-card-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid currentColor;
  opacity: 0.8;
}

/* ── Metrics row ── */
.ad-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ad-metric {
  padding: 10px 8px;
  text-align: center;
  border-left: 1px solid var(--border);
}
.ad-metric:last-child { border-left: none; }
.ad-metric-val {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.ad-metric-lbl {
  font-size: 9.5px;
  color: var(--text-s);
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ── Progress bar (budget) ── */
.ad-card-budget {
  padding: 10px 18px 4px;
}
.ad-budget-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-s);
  margin-bottom: 5px;
  font-weight: 500;
}
.ad-budget-header span:last-child { font-weight: 700; color: var(--text); }
.ad-budget-bar {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.ad-budget-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), #0AABAB);
  transition: width 0.6s ease;
}
.ad-budget-fill.danger { background: linear-gradient(90deg, var(--error), #DC2626); }
.ad-budget-fill.warn   { background: linear-gradient(90deg, var(--accent), #E08A00); }

/* ── Footer row ── */
.ad-card-foot {
  padding: 10px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ad-card-dates {
  font-size: 10.5px;
  color: var(--text-s);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ad-card-dates strong { color: var(--text); font-weight: 600; }
.ad-card-actions {
  display: flex;
  gap: 6px;
}
.ad-action-btn {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-s);
  transition: all 0.15s;
}
.ad-action-btn:hover { background: var(--primary-l); border-color: var(--primary); color: var(--primary); }
.ad-action-btn.danger:hover { background: var(--error-l); border-color: var(--error); color: var(--error); }

/* ── Status variants ── */
.ad-card[data-status="active"]  { --ad-accent: var(--success); }
.ad-card[data-status="paused"]  { --ad-accent: var(--warning); }
.ad-card[data-status="ended"]   { --ad-accent: var(--text-h); }
.ad-card[data-status="draft"]   { --ad-accent: var(--primary); }

/* Active pulse on thumb */
.ad-card[data-status="active"] .ad-card-thumb::after {
  content: '';
  position: absolute;
  top: -2px; left: -2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--surface);
  animation: pulse-dot 2s infinite;
}
.ad-card-thumb { position: relative; }

/* ── Dark mode ── */
body.dark-mode .ad-card      { background: var(--surface); }
body.dark-mode .ad-card-thumb { background: var(--surface-alt); }
body.dark-mode .ad-action-btn { background: var(--surface-alt); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .ads-stats-bar { grid-template-columns: repeat(2, 1fr); }
  .ad-card-metrics { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .ads-stats-bar { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .ads-filter-bar { gap: 6px; }
  .ads-filter-btn { padding: 5px 10px; font-size: 11px; }
}

/* ══════════════════════════════════════════════════════════════════════
   PRINT STYLES
══════════════════════════════════════════════════════════════════════ */
@media print {
  .sidebar, .topbar, .bottom-nav, .fab, .ai-fab,
  #notif-panel, #search-overlay, #toast-container,
  .confirm-overlay, .modal-overlay { display: none !important; }
  .main { margin-right: 0 !important; }
  .page { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  .btn  { display: none !important; }
}
