:root {
  --primary: #FF6B35;
  --primary-dark: #e55a26;
  --sidebar-bg: #1a1a2e;
  --sidebar-hover: #16213e;
  --sidebar-active: #FF6B35;
  --sidebar-width: 260px;
  --topbar-height: 64px;
}

/* ─── Base ─── */
* { box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f0f2f5; color: #2d3748; overflow-x: hidden; }

/* ─── Login ─── */
.login-bg {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-card { width: 100%; max-width: 420px; padding: 0 16px; }
.login-logo {
  width: 72px; height: 72px; background: linear-gradient(135deg, #FF6B35, #f7c59f);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #fff; margin: 0 auto;
}

/* ─── Sidebar ─── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 1000; transition: transform .3s ease;
}
.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-width))); }

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo-icon {
  font-size: 1.8rem;
  color: var(--primary);
}
.sidebar-brand { font-size: 1.1rem; font-weight: 700; color: #fff; }
.sidebar-biz   { font-size: .75rem; color: rgba(255,255,255,.5); margin-top: 2px; }

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .9rem;
  transition: all .2s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: rgba(255,107,53,.15);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.nav-item i { font-size: 1.1rem; width: 20px; }
.nav-divider { border-top: 1px solid rgba(255,255,255,.08); margin: 8px 0; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.sidebar-user-name { font-size: .85rem; color: #fff; font-weight: 600; }
.sidebar-user-role { font-size: .75rem; color: rgba(255,255,255,.5); }
.btn-logout {
  margin-left: auto; background: none; border: none;
  color: rgba(255,255,255,.4); font-size: 1.1rem; padding: 4px;
  cursor: pointer; transition: color .2s;
}
.btn-logout:hover { color: #ff4444; }

/* ─── Main Wrap ─── */
.main-wrap {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
  transition: margin .3s ease;
}

/* ─── Topbar ─── */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.topbar-title { font-size: 1.1rem; font-weight: 700; color: #1a202c; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.sidebar-toggle { background: none; border: none; font-size: 1.4rem; color: #666; cursor: pointer; padding: 4px; }
.badge-plan {
  background: linear-gradient(135deg, #FF6B35, #f7c59f);
  color: #fff; font-size: .75rem; font-weight: 700;
  padding: 3px 10px; border-radius: 12px;
}

/* ─── Page Content ─── */
.page-content { flex: 1; padding: 24px; }

/* ─── Stat Cards ─── */
.stat-card {
  background: #fff; border-radius: 12px;
  padding: 20px; border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: transform .2s, box-shadow .2s;
  height: 100%;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.stat-value { font-size: 1.8rem; font-weight: 700; color: #1a202c; }
.stat-label { font-size: .82rem; color: #718096; }
.stat-change { font-size: .78rem; }

/* ─── Cards ─── */
.panel-card {
  background: #fff; border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  border: none; overflow: hidden;
}
.panel-card .card-header {
  background: #fff; border-bottom: 1px solid #f0f2f5;
  padding: 16px 20px; font-weight: 700;
}

/* ─── Tables ─── */
.table-panel { border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.table-panel .table { margin: 0; }
.table-panel .table th { background: #f8fafc; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #718096; border-bottom: 1px solid #e2e8f0; }
.table-panel .table td { font-size: .88rem; vertical-align: middle; color: #2d3748; }
.table-panel .table-hover tbody tr:hover { background: #f8fafc; }

/* ─── Filters & Search ─── */
.filter-bar {
  background: #fff; border-radius: 12px;
  padding: 16px 20px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.filter-bar .form-control, .filter-bar .form-select { font-size: .88rem; }

/* ─── Menu Theme Selector ─── */
.theme-card {
  border: 2px solid #e2e8f0; border-radius: 10px; padding: 16px;
  cursor: pointer; transition: all .2s; text-align: center;
}
.theme-card:hover { border-color: var(--primary); }
.theme-card.selected { border-color: var(--primary); background: rgba(255,107,53,.05); }
.theme-preview { height: 80px; border-radius: 6px; margin-bottom: 10px; }

/* ─── Loyalty ─── */
.points-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, #FF6B35, #f7c59f);
  color: #fff; font-weight: 700; font-size: .8rem;
  padding: 3px 10px; border-radius: 12px;
}
.add-points-form {
  background: #fff; border-radius: 12px; padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); max-width: 480px;
}
.phone-lookup { position: relative; }
.customer-found {
  background: #f0fff4; border: 1px solid #9ae6b4;
  border-radius: 8px; padding: 12px 16px; margin-top: 8px;
}

/* ─── Campaign ─── */
.campaign-card {
  background: #fff; border-radius: 12px;
  padding: 18px 20px; border: 1px solid #e2e8f0;
  transition: border-color .2s, box-shadow .2s;
  cursor: pointer;
}
.campaign-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(255,107,53,.1); }
.campaign-status { font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 12px; }
.status-sent     { background: #c6f6d5; color: #276749; }
.status-draft    { background: #fef3cd; color: #856404; }
.status-active   { background: #bee3f8; color: #2a69ac; }
.status-archived { background: #e2e8f0; color: #718096; }

/* ─── Reviews ─── */
.star-display { color: #f6c90e; font-size: 1rem; }
.star-empty   { color: #e2e8f0; }
.review-card {
  background: #fff; border-radius: 10px; padding: 16px;
  border: 1px solid #e2e8f0; margin-bottom: 10px;
}
.feedback-card {
  background: #fff; border-radius: 10px; padding: 16px;
  border-left: 4px solid var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 10px;
}
.feedback-card.resolved { border-left-color: #48bb78; opacity: .8; }

/* ─── Plan Cards ─── */
.plan-card {
  border: 2px solid #e2e8f0; border-radius: 14px;
  padding: 28px 24px; transition: all .2s; height: 100%;
}
.plan-card.current { border-color: var(--primary); box-shadow: 0 4px 20px rgba(255,107,53,.2); }
.plan-card.popular { border-color: #667eea; }
.plan-price { font-size: 2rem; font-weight: 800; color: #1a202c; }
.plan-price small { font-size: .9rem; font-weight: 400; color: #718096; }
.plan-feature { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .9rem; }
.plan-feature i { color: #48bb78; }

/* ─── Progress ─── */
.usage-bar { height: 8px; border-radius: 4px; background: #e2e8f0; overflow: hidden; }
.usage-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #FF6B35, #f7c59f); transition: width .6s ease; }
.usage-fill.warning { background: linear-gradient(90deg, #ed8936, #f6ad55); }
.usage-fill.danger  { background: linear-gradient(90deg, #e53e3e, #fc8181); }

/* ─── Tag badges ─── */
.tag-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px; font-size: .75rem; font-weight: 600;
}

/* ─── QR ─── */
.qr-container { background: #fff; border-radius: 12px; padding: 20px; text-align: center; }
#qr-canvas { border-radius: 8px; }

/* ─── Spinner overlay ─── */
.loading-overlay {
  position: absolute; inset: 0; background: rgba(255,255,255,.7);
  display: flex; align-items: center; justify-content: center; z-index: 10; border-radius: inherit;
}

/* ─── Mobile ─── */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,.3); }
  .main-wrap { margin-left: 0; }
  .page-content { padding: 16px; }
}

/* ─── Empty state ─── */
.empty-state { text-align: center; padding: 60px 20px; color: #a0aec0; }
.empty-state i { font-size: 3rem; margin-bottom: 12px; }

/* ─── Form improvements ─── */
.form-label { font-weight: 600; font-size: .875rem; margin-bottom: 4px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,53,.15); }
.btn-primary-custom { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary-custom:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ─── Animations ─── */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Page header ─── */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 1.5rem; font-weight: 800; color: #1a202c; margin: 0; }
.page-header p { color: #718096; margin: 4px 0 0; font-size: .9rem; }

/* Overlay for mobile sidebar */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 999; display: none;
}
.sidebar-overlay.show { display: block; }
