* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #e8872a;
  --primary-dark: #d4751f;
  --primary-light: #fdf0e4;
  --primary-lighter: #fef7f0;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-border: #f0e0d0;
  --surface-hover: #f9f1ea;
  --text: #2d2d2d;
  --text-muted: #888888;
  --white: #ffffff;
  --card-bg: #ffffff;
  --table-hover: #fef6ee;
  --modal-bg: #ffffff;
  --input-bg: #ffffff;
  --shadow: rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --primary: #e8872a;
  --primary-dark: #f5a04e;
  --primary-light: #3a2a1a;
  --primary-lighter: #1a1a1a;
  --bg: #121212;
  --surface: #1e1e1e;
  --surface-border: #333333;
  --surface-hover: #2a2a2a;
  --text: #f0f0f0;
  --text-muted: #999999;
  --white: #1e1e1e;
  --card-bg: #1e1e1e;
  --table-hover: #2a2218;
  --modal-bg: #242424;
  --input-bg: #2a2a2a;
  --shadow: rgba(0,0,0,0.3);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--primary-lighter);
  color: var(--text);
  min-height: 100vh;
}

.screen { display: none; }
.screen.active { display: block; }

/* Login */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d1a0e 50%, #1a1a1a 100%);
  display: flex; justify-content: center; align-items: center;
  position: relative;
}
.login-brand {
  position: absolute; top: 28px; left: 36px;
  display: flex; align-items: center; gap: 10px;
}
.login-brand-logo { width: 36px; height: 36px; border-radius: 10px; }
.login-brand-name { font-size: 16px; font-weight: 600; color: #fff; }
.login-glass {
  width: 400px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px; padding: 40px; text-align: center;
}
.login-title { font-size: 24px; font-weight: 700; color: #fff; margin: 0 0 4px; }
.login-subtitle { font-size: 13px; color: #888; margin: 0 0 24px; }
.login-label { display: block; text-align: left; font-size: 12px; color: #888; margin-bottom: 4px; }
.login-footer { font-size: 12px; color: #555; margin: 16px 0 0; }
.nav-logo { height: 32px; vertical-align: middle; margin-right: 10px; border-radius: 4px; }
.login-tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.tab-btn {
  flex: 1; padding: 11px; border: none; border-radius: 10px;
  background: rgba(255,255,255,0.06); color: #888; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: all 0.25s;
}
.tab-btn.active { background: var(--primary); color: #fff; }
.login-glass input {
  width: 100%; padding: 13px 16px; margin-bottom: 14px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
  color: #fff; font-size: 14px; outline: none; transition: border-color 0.2s;
}
.login-glass input:focus { border-color: var(--primary); }
.login-glass input::placeholder { color: #666; }
.error { color: #ff6b6b; font-size: 13px; margin-top: 8px; }

/* Buttons */
.btn-primary {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: var(--white); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; box-shadow: 0 2px 8px rgba(232,135,42,0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,135,42,0.35); }
.btn-small {
  padding: 9px 18px; border: none; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: var(--white); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; box-shadow: 0 2px 6px rgba(232,135,42,0.2);
}
.btn-small:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(232,135,42,0.3); }
.btn-secondary {
  padding: 10px 20px; border: 1.5px solid var(--surface-border); border-radius: 10px;
  background: var(--white); color: var(--text-muted); cursor: pointer; font-size: 14px; transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-logout {
  padding: 8px 18px; border: 1.5px solid rgba(255,255,255,0.5); border-radius: 8px;
  background: rgba(255,255,255,0.1); color: var(--white); cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.8); }
.btn-pay {
  padding: 7px 16px; border: none; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: var(--white); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; box-shadow: 0 2px 6px rgba(232,135,42,0.2);
}
.btn-pay:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(232,135,42,0.3); }
.whatsapp-pay-btn { background: linear-gradient(135deg, #25d366, #1ebe5d); box-shadow: 0 2px 6px rgba(37,211,102,0.25); }
.whatsapp-pay-btn:hover { box-shadow: 0 4px 10px rgba(37,211,102,0.35); }

/* Nav */
nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 32px; background: linear-gradient(135deg, #e8872a, #d4751f); border-bottom: none;
  box-shadow: 0 2px 12px rgba(232,135,42,0.3);
}
nav h2 { font-size: 20px; color: var(--white); display: flex; align-items: center; font-weight: 600; }
nav .nav-logo { border-radius: 6px; background: var(--white); padding: 3px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.nav-right { display: flex; align-items: center; gap: 12px; position: relative; }

.dark-toggle {
  background: none; border: none; font-size: 20px; cursor: pointer;
  padding: 4px 8px; border-radius: 6px;
}
.dark-toggle:hover { background: rgba(255,255,255,0.15); }

.notif-wrapper { position: relative; }
.notif-bell {
  background: none; border: none; font-size: 22px; cursor: pointer; position: relative;
  padding: 4px 8px; border-radius: 6px;
}
.notif-bell:hover { background: rgba(255,255,255,0.15); }
.notif-badge, .notif-badge-admin {
  position: absolute; top: -4px; right: -2px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.notif-dropdown {
  position: absolute; top: 44px; right: 0; width: 380px;
  background: var(--surface); border-radius: 12px; box-shadow: 0 8px 30px var(--shadow);
  z-index: 1000;
}
.notif-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--surface-border); background: var(--surface);
  position: relative; z-index: 1001;
}
.notif-header .btn-small { pointer-events: all; position: relative; z-index: 1002; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item {
  padding: 12px 16px; border-bottom: 1px solid #f0f0f0; cursor: default;
}
.notif-item:hover { background: var(--table-hover); }
.notif-item.unread { background: var(--primary-light); }
.notif-item .notif-msg { font-size: 13px; color: var(--text); line-height: 1.4; }
.notif-item .notif-time { font-size: 11px; color: #999; margin-top: 4px; }
.notif-icon { margin-right: 8px; font-size: 16px; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-box { background: var(--surface); border-radius: 14px; padding: 20px; border: 1px solid var(--surface-border); box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.chart-box h4 { margin: 0 0 14px 0; font-size: 15px; color: var(--text); }
.chart-box.chart-small { grid-column: 1 / -1; max-width: 400px; margin: 0 auto; }
@media (max-width: 768px) { .charts-grid { grid-template-columns: 1fr; } .chart-box.chart-small { max-width: 100%; } }

.activity-table { width: 100%; border-collapse: collapse; }
.activity-table th { text-align: left; padding: 10px 12px; font-size: 12px; text-transform: uppercase; color: var(--primary); border-bottom: 2px solid var(--primary); }
.activity-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; }
.activity-table tr:hover { background: var(--table-hover); }
.nav-right select {
  padding: 8px 14px; border-radius: 6px; border: 2px solid var(--white);
  background: transparent; color: var(--white); font-size: 13px; font-weight: 600;
  cursor: pointer; outline: none;
}
.nav-right select option { color: var(--text); background: var(--white); }

/* Back button */
.btn-back {
  padding: 8px 18px; border: 1.5px solid rgba(255,255,255,0.5); border-radius: 8px;
  background: rgba(255,255,255,0.1); color: var(--white); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.btn-back:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.8); }

/* Cities grid */
/* Welcome Banner */
.welcome-banner {
  background: linear-gradient(135deg, #e8590c, #d9480f);
  border-radius: 14px; padding: 24px 28px; margin-bottom: 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.banner-btn {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  padding: 8px 16px; border-radius: 8px; font-size: 13px; cursor: pointer;
  transition: background 0.2s;
}
.banner-btn:hover { background: rgba(255,255,255,0.35); }

/* Overall Stats */
.overall-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border-radius: 12px; padding: 18px 20px;
  border: 1px solid var(--surface-border);
}
.stat-label { font-size: 13px; color: var(--text-muted); display: block; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); display: block; margin-top: 4px; }
.stat-growth { font-size: 12px; display: block; margin-top: 4px; }
.stat-alltime { font-size: 12px; color: var(--text-muted); display: block; margin-top: 6px; }
.card-alltime { font-size: 12px; color: rgba(255,255,255,0.75); margin-top: 6px; }

/* Quick Actions */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0; }
.quick-action-card {
  background: var(--white); border: 1px solid var(--surface-border); border-radius: 12px;
  padding: 16px; text-align: center; cursor: pointer; transition: all 0.2s;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.quick-action-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

/* Bottom Panels */
.bottom-panels { display: flex; gap: 16px; margin-top: 20px; }

/* City Cards */
.cities-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 20px;
}
.city-card {
  padding: 20px 22px; background: var(--white); border-radius: 14px;
  border: 1.5px solid var(--surface-border); cursor: pointer;
  transition: all 0.25s; text-align: left;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.city-card:hover { border-color: var(--primary); box-shadow: 0 8px 24px rgba(232,135,42,0.15); transform: translateY(-4px); }
.city-card-name { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.city-card-count { font-size: 13px; color: var(--text-muted); }
.city-card-stats {
  display: flex; gap: 16px; margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--surface-border);
}
.city-stat-label { font-size: 11px; color: var(--text-muted); display: block; }
.city-stat-value { font-size: 14px; font-weight: 600; color: var(--text); display: block; margin-top: 2px; }
.city-badge {
  font-size: 12px; padding: 3px 10px; border-radius: 8px; font-weight: 600;
}
.city-badge.unpaid { background: #fff3e0; color: #e67e22; }
.city-badge.allpaid { background: #e8f5e9; color: #27ae60; }
[data-theme="dark"] .city-badge.unpaid { background: #4e342e; color: #ffab91; }
[data-theme="dark"] .city-badge.allpaid { background: #1b5e20; color: #a5d6a7; }
.city-card-actions { display: flex; gap: 6px; margin-top: 12px; }
.btn-delete { padding: 5px 14px; border: 1.5px solid #e74c3c; border-radius: 8px; background: var(--white); color: #e74c3c; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-delete:hover { background: #e74c3c; color: #fff; }
.btn-edit {
  padding: 5px 14px; border: 1.5px solid var(--primary); border-radius: 8px;
  background: var(--white); color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; margin-right: 6px; transition: all 0.2s;
}
.btn-edit:hover { background: var(--primary); color: var(--white); }
.btn-undo {
  padding: 4px 10px; border: 1px solid #c0392b; border-radius: 6px;
  background: var(--white); color: #c0392b; font-size: 11px; cursor: pointer; margin-left: 6px;
}
.btn-undo:hover { background: #fde8e8; }

/* Ad Groups */
.ad-group { border: 1px solid var(--surface-border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.ad-group-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; cursor: pointer; background: var(--primary-lighter);
  transition: background 0.2s;
}
.ad-group-header:hover { background: var(--primary-light); }
.ad-group-info { display: flex; flex-direction: column; gap: 2px; }
.ad-group-name { font-size: 15px; font-weight: 700; color: var(--text); }
.ad-group-meta { font-size: 13px; color: var(--text-muted); }
.ad-group-arrow { font-size: 16px; color: var(--primary); font-weight: 700; }
.ad-group-body { padding: 0; }
.ad-group-body table { margin: 0; }
.ad-group-body th { background: var(--white); }
.inline-form.compact { gap: 8px; }
.inline-form.compact input { padding: 8px 12px; font-size: 13px; }

/* Admin Sidebar Layout */
.admin-layout { display: flex; min-height: calc(100vh - 60px); }
.admin-sidebar {
  width: 170px; background: var(--white); border-right: 1px solid var(--surface-border);
  padding: 16px 0; flex-shrink: 0; position: sticky; top: 0; height: calc(100vh - 60px); overflow-y: auto;
}
.sidebar-item {
  padding: 11px 16px; font-size: 13px; color: var(--text-muted); cursor: pointer;
  border-left: 3px solid transparent; transition: all 0.15s;
}
.sidebar-item:hover { background: var(--primary-lighter); color: var(--text); }
.sidebar-item.active { background: rgba(232,135,42,0.08); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.admin-main { flex: 1; padding: 24px 28px; background: var(--primary-lighter); overflow-y: auto; }
.tab-content { display: none; opacity: 0; transform: translateY(8px); }
.tab-content.active { display: block; animation: tabFadeIn 0.3s ease forwards; }
@keyframes tabFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Greeting */
.dashboard-greeting { margin-bottom: 20px; animation: tabFadeIn 0.5s ease forwards; }
.dashboard-greeting h2 { font-size: 1.6rem; font-weight: 700; margin: 0; color: var(--text); }
.dashboard-greeting p { margin: 4px 0 0; font-size: 0.95rem; color: #888; }

/* Restaurant Profile */
.profile-info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.profile-info-card { background: var(--white); border: 1px solid var(--surface-border); border-radius: 10px; padding: 14px 16px; }
.profile-info-label { font-size: 12px; color: var(--text-muted); display: block; }
.profile-info-value { font-size: 15px; font-weight: 600; color: var(--text); display: block; margin-top: 4px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.profile-timeline { position: relative; padding-left: 24px; }
.timeline-item { position: relative; padding: 0 0 20px 20px; border-left: 2px solid var(--surface-border); }
.timeline-item:last-child { border-left: 2px solid transparent; padding-bottom: 0; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; position: absolute; left: -7px; top: 4px; }
.timeline-dot.paid { background: #27ae60; }
.timeline-dot.pending { background: #e67e22; }
.timeline-content { padding-left: 8px; }
.timeline-month { font-size: 14px; font-weight: 600; color: var(--text); }
.timeline-amount { font-size: 15px; font-weight: 700; color: var(--primary); margin-top: 2px; }
.timeline-status { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Sortable Headers */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--primary); }

/* Growth Arrows */
.growth-badge { font-size: 0.78rem; margin-top: 6px; color: rgba(255,255,255,0.85); }
.growth-up { color: #b9f6ca; font-weight: 700; }
.growth-down { color: #ff8a80; font-weight: 700; }
.growth-flat { color: rgba(255,255,255,0.7); font-weight: 600; }

/* Online Users */
.online-user-card { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--surface-border); font-size: 0.95rem; }
.online-user-card:last-child { border-bottom: none; }
.online-role { font-size: 0.75rem; padding: 2px 8px; border-radius: 12px; font-weight: 600; }
.online-role.super { background: #fff3e0; color: #e65100; }
.online-role.manager { background: #e3f2fd; color: #1565c0; }
.online-role.viewer { background: #f3e5f5; color: #7b1fa2; }
.online-city { font-size: 0.85rem; color: #888; }
.online-ago { margin-left: auto; font-size: 0.8rem; color: #aaa; }
[data-theme="dark"] .online-role.super { background: #4e342e; color: #ffab91; }
[data-theme="dark"] .online-role.manager { background: #1a237e; color: #90caf9; }
[data-theme="dark"] .online-role.viewer { background: #4a148c; color: #ce93d8; }

/* Dashboard */
.dashboard { padding: 24px 40px; max-width: 100%; margin: 0 auto; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  padding: 24px; border-radius: 14px; border: none; color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1); transition: transform 0.2s;
}
.card:hover { transform: translateY(-3px); }
.card span { font-size: 13px; color: rgba(255,255,255,0.85); display: block; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.card strong { font-size: 28px; color: #fff; }
.card.blue strong { color: #fff; }
.card.green strong { color: #fff; }
.card.purple strong { color: #fff; }

.card.blue { background: linear-gradient(135deg, #e8872a, #f5a04e); }
.card.green { background: linear-gradient(135deg, #22c55e, #4ade80); }
.card.purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }

.section {
  background: var(--white); border-radius: 14px; border: 1px solid var(--surface-border);
  padding: 24px; margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04); transition: box-shadow 0.2s;
}
.section h3 { font-size: 16px; color: var(--text); margin-bottom: 16px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-header h3 { margin-bottom: 0; }
.section-header select {
  padding: 8px 14px; background: var(--primary-lighter); border: 1px solid var(--surface-border);
  border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 600; outline: none;
}
.section-header select:focus { border-color: var(--primary); }
.section-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }

/* Filter bar */
.filter-bar {
  display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.filter-bar input {
  flex: 1; min-width: 180px; padding: 11px 14px; background: var(--primary-lighter);
  border: 1.5px solid var(--surface-border); border-radius: 10px;
  color: var(--text); font-size: 14px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.filter-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(232,135,42,0.1); }
.filter-bar input::placeholder { color: #b0b0b0; }
.filter-bar select {
  padding: 10px 14px; background: var(--primary-lighter);
  border: 1px solid var(--surface-border); border-radius: 8px;
  color: var(--text); font-size: 14px; outline: none; min-width: 120px;
}
.filter-bar select:focus { border-color: var(--primary); }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 12px 14px; color: var(--primary); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  border-bottom: 2px solid var(--primary-light); background: var(--primary-lighter);
}
td { padding: 14px; font-size: 14px; border-bottom: 1px solid var(--surface-border); color: var(--text); }
tr { transition: background 0.15s; }
tr:hover td { background: var(--primary-lighter); }

.badge {
  display: inline-block; padding: 5px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600; text-transform: capitalize;
}
.badge.paid { background: #dcfce7; color: #166534; }
.badge.pending { background: #fff3e0; color: #e67e22; }
.badge.no.payout { background: #f5f5f5; color: #999; }

/* Forms */
.inline-form {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.inline-form input, .inline-form select {
  padding: 10px 14px; background: var(--primary-lighter); border: 1px solid var(--surface-border);
  border-radius: 8px; color: var(--text); font-size: 14px; outline: none;
}
.inline-form input:focus, .inline-form select:focus { border-color: var(--primary); }
.inline-form input::placeholder { color: #b0b0b0; }
.inline-form .btn-primary { width: auto; padding: 10px 20px; }
.inline-form select { min-width: 160px; }

/* Chart */
.chart-container { height: 300px; position: relative; }

/* Modal */
.modal {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(232,135,42,0.2); backdrop-filter: blur(4px); z-index: 100;
  align-items: center; justify-content: center;
  padding: 16px; box-sizing: border-box;
}
.modal.active { display: flex; }
.modal-content {
  background: var(--white); border-radius: 18px; padding: 32px;
  width: 400px; max-width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
  border: 1px solid var(--surface-border);
}
.modal-content h3 { color: var(--primary); margin-bottom: 20px; }
.modal-content input {
  width: 100%; padding: 10px 14px; margin-bottom: 12px;
  background: var(--primary-lighter); border: 1px solid var(--surface-border); border-radius: 8px;
  color: var(--text); font-size: 14px; outline: none;
}
.modal-content input:focus, .modal-content select:focus { border-color: var(--primary); }
.modal-content select {
  width: 100%; padding: 10px 14px; margin-bottom: 12px;
  background: var(--primary-lighter); border: 1px solid var(--surface-border); border-radius: 8px;
  color: var(--text); font-size: 14px; outline: none;
}
.modal-content input::placeholder { color: #b0b0b0; }
.field-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text);
  margin-bottom: 4px; text-align: left;
}
.modal-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  border-bottom: 2px solid var(--primary-lighter);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }
.modal-actions .btn-primary { width: auto; flex: 1; }

/* Month cards */
.months-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px;
}
.month-card {
  padding: 20px; background: var(--white); border-radius: 14px;
  border: 1.5px solid var(--surface-border); cursor: pointer;
  transition: all 0.25s; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.month-card:hover { border-color: var(--primary); box-shadow: 0 8px 24px rgba(232,135,42,0.15); transform: translateY(-4px); }
.month-card-name { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.month-card-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.month-card-amount { font-size: 20px; font-weight: 700; color: var(--text); }
.month-card-pending { border-color: var(--primary); background: var(--primary-light); }

/* Month detail view */
.ad-month-search {
  width: 100%; padding: 10px 14px; margin-bottom: 14px;
  background: var(--primary-lighter); border: 1px solid var(--surface-border);
  border-radius: 8px; color: var(--text); font-size: 14px; outline: none;
}
.ad-month-search:focus { border-color: var(--primary); }
.ad-month-search::placeholder { color: #b0b0b0; }
.month-restaurant { margin-bottom: 20px; border: 2px solid var(--primary); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(232,135,42,0.08); }
.month-restaurant-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; background: var(--primary); color: var(--white);
}
.month-restaurant-name { font-size: 16px; font-weight: 700; color: var(--white); }
.month-restaurant-total { font-size: 16px; font-weight: 700; color: var(--white); background: rgba(255,255,255,0.2); padding: 4px 12px; border-radius: 6px; }
.month-restaurant-ads { padding: 4px 0; }
.month-ad-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-bottom: 1px solid #f5ebe0;
}
.month-ad-row:last-child { border-bottom: none; }
/* Ad cards in month detail */
.ad-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; margin: 8px 12px; background: var(--primary-lighter);
  border-radius: 10px; border: 1px solid var(--surface-border);
}
.ad-card-fields { display: flex; gap: 24px; flex: 1; flex-wrap: wrap; }
.ad-card-field { display: flex; flex-direction: column; gap: 2px; min-width: 120px; }
.ad-card-label { font-size: 11px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; }
.ad-card-value { font-size: 15px; font-weight: 600; color: var(--text); }
.ad-card-amount { color: var(--primary); }
.ad-card-actions { display: flex; gap: 6px; }
.month-ad-info { display: flex; gap: 16px; align-items: center; flex: 1; }
.month-ad-client { font-size: 14px; color: var(--text); font-weight: 500; }
.month-ad-amount { font-size: 14px; color: var(--primary); font-weight: 600; }
.month-ad-actions { display: flex; gap: 6px; }

/* Invoice upload */
.upload-area { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.upload-area input[type="month"] {
  padding: 10px 14px; background: var(--primary-lighter); border: 1px solid var(--surface-border);
  border-radius: 8px; color: var(--text); font-size: 14px; outline: none;
}
.upload-area input[type="month"]:focus { border-color: var(--primary); }
.invoice-info {
  display: flex; gap: 24px; padding: 14px 18px; background: var(--primary-lighter);
  border-radius: 8px; border-left: 4px solid var(--primary); flex-wrap: wrap;
}
.invoice-info div { font-size: 14px; color: var(--text); }
.invoice-info strong { color: var(--primary); }
.invoice-match {
  padding: 6px 10px; border: 1px solid var(--surface-border); border-radius: 6px;
  background: var(--primary-lighter); color: var(--text); font-size: 13px; outline: none;
  max-width: 250px; width: 100%;
}
.invoice-match:focus { border-color: var(--primary); }

/* Payment detail cards */
.payment-card {
  border: 1px solid var(--surface-border); border-radius: 10px;
  margin-bottom: 12px; overflow: hidden;
}
.payment-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: var(--primary); color: var(--white);
}
.payment-card-name { font-size: 15px; font-weight: 700; color: var(--white); }
.payment-card-header .btn-edit {
  border-color: var(--white); color: var(--white); background: transparent;
}
.payment-card-header .btn-edit:hover { background: rgba(255,255,255,0.15); }
.payment-card-body { padding: 14px 18px; }
.payment-field {
  display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid #f5ebe0;
}
.payment-field:last-child { border-bottom: none; }
.payment-label {
  font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase;
  letter-spacing: 0.5px; min-width: 80px;
}
.payment-value { font-size: 14px; font-weight: 600; color: var(--text); }

/* Owner info bar */
.owner-info-bar {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 32px; background: var(--primary-light);
  font-size: 14px; font-weight: 600; color: var(--primary);
}
.owner-info-dot { color: var(--text-muted); }

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
  /* Nav */
  nav {
    padding: 12px 16px; flex-wrap: wrap; gap: 10px;
  }
  nav h2 { font-size: 16px; }
  .nav-logo { height: 26px; margin-right: 6px; }
  .nav-right { gap: 8px; }
  .btn-back, nav .btn-logout { padding: 6px 12px; font-size: 12px; }

  /* Login */
  .login-glass { width: 90%; padding: 28px 20px; }
  .login-title { font-size: 20px; }

  /* Dashboard */
  .dashboard { padding: 16px; }

  /* Cards */
  .cards { grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
  .card { padding: 18px; }
  .card strong { font-size: 24px; }

  /* Cities grid */
  .cities-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .city-card { padding: 20px 16px; }
  .city-card-name { font-size: 17px; }

  /* Sections */
  .section { padding: 16px; margin-bottom: 14px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-header h3 { font-size: 15px; }

  /* Tables */
  th { padding: 8px 10px; font-size: 11px; }
  td { padding: 10px; font-size: 13px; }

  /* Inline forms */
  .inline-form { flex-direction: column; }
  .inline-form input, .inline-form select { width: 100%; min-width: 0; }
  .inline-form .btn-primary { width: 100%; }
  .inline-form.compact { flex-direction: row; }
  .inline-form.compact input { flex: 1; min-width: 0; }

  /* Ad groups */
  .ad-group-header { padding: 12px 14px; }
  .ad-group-name { font-size: 14px; }
  .ad-group-meta { font-size: 12px; }
  .ad-group-body { overflow-x: auto; }

  /* Buttons */
  .btn-small { padding: 7px 12px; font-size: 12px; }
  .btn-edit, .btn-delete { padding: 4px 8px; font-size: 11px; }
  .btn-pay { padding: 5px 10px; font-size: 11px; }

  /* Filter bar */
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select { width: 100%; min-width: 0; }

  /* Month cards */
  .months-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .month-card { padding: 16px; }
  .month-card-name { font-size: 15px; }
  .month-card-amount { font-size: 17px; }

  /* Month detail */
  .month-restaurant-header { padding: 12px 14px; }
  .ad-card { flex-direction: column; align-items: flex-start; gap: 10px; margin: 8px 8px; padding: 12px 14px; }
  .ad-card-fields { gap: 14px; }
  .ad-card-actions { width: 100%; justify-content: flex-end; }

  /* Chart */
  .chart-container { height: 220px; }

  /* Modal */
  .modal-content { padding: 24px 18px; width: 95%; }
}

@media (max-width: 400px) {
  .cities-grid { grid-template-columns: 1fr; }
  .login-glass { width: 95%; padding: 24px 16px; }
  nav h2 { font-size: 14px; }
  .card strong { font-size: 20px; }
  .inline-form.compact { flex-direction: column; }
  .inline-form.compact input { width: 100%; }
}

/* Loading Spinner */
.spinner-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.15); z-index: 9998;
  display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 48px; height: 48px; border: 5px solid #e0e0e0;
  border-top: 5px solid var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-text { color: var(--primary); font-weight: 600; font-size: 14px; margin-top: 12px; text-align: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast Notifications */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column-reverse; gap: 10px;
}
.toast {
  padding: 14px 20px; border-radius: 10px; color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2); min-width: 280px; max-width: 400px;
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}
.toast-success { background: #22c55e; }
.toast-error { background: #ef4444; }
.toast-warning { background: #f59e0b; }
.toast-info { background: #3b82f6; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(10px); } }

/* Dark Mode */
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] .tab-btn { background: var(--surface); color: var(--text-muted); border-color: var(--surface-border); }
[data-theme="dark"] .section { background: var(--surface); }
[data-theme="dark"] .card { color: #fff; }
[data-theme="dark"] .city-card { background: var(--surface); border-color: var(--surface-border); }
[data-theme="dark"] table th { color: var(--primary); }
[data-theme="dark"] table td { border-color: var(--surface-border); color: var(--text); }
[data-theme="dark"] table tr:hover { background: var(--table-hover); }
[data-theme="dark"] input, [data-theme="dark"] select { background: var(--input-bg); color: var(--text); border-color: var(--surface-border); }
[data-theme="dark"] .modal-content { background: var(--modal-bg); color: var(--text); }
[data-theme="dark"] .modal { background: rgba(0,0,0,0.6); }
[data-theme="dark"] .month-card { background: var(--surface); border-color: var(--surface-border); }
[data-theme="dark"] .month-card-name { color: var(--text); }
[data-theme="dark"] .badge.paid { background: #166534; color: #4ade80; }
[data-theme="dark"] .btn-secondary { background: var(--surface); color: var(--text); border-color: var(--surface-border); }
[data-theme="dark"] .btn-edit { background: var(--surface); color: var(--primary); border-color: var(--primary); }
[data-theme="dark"] .filter-bar input, [data-theme="dark"] .filter-bar select { background: var(--input-bg); color: var(--text); }
[data-theme="dark"] .upload-area { background: var(--surface); border-color: var(--surface-border); }
[data-theme="dark"] .invoice-info { background: var(--surface); border-color: var(--primary); }
[data-theme="dark"] .payment-card { background: var(--surface); border-color: var(--surface-border); }
[data-theme="dark"] .ad-group { border-color: var(--surface-border); }
[data-theme="dark"] .ad-group-header { background: var(--primary-light); }
[data-theme="dark"] .notif-item { border-color: var(--surface-border); }
[data-theme="dark"] .chart-box h4 { color: var(--text); }
[data-theme="dark"] .owner-info-bar { background: var(--surface); color: var(--text); }
[data-theme="dark"] .section-subtitle { color: var(--text-muted); }
[data-theme="dark"] .field-label { color: var(--text); }
[data-theme="dark"] .modal-section-title { color: var(--primary); border-color: var(--surface-border); }
[data-theme="dark"] .admin-sidebar { background: var(--surface); border-color: var(--surface-border); }
[data-theme="dark"] .sidebar-item:hover { background: var(--surface-hover); }
[data-theme="dark"] .sidebar-item.active { background: rgba(232,135,42,0.15); }
[data-theme="dark"] .admin-main { background: var(--bg); }
