:root {
  --gold: #D4AF37;
  --gold-light: #F0D78C;
  --gold-dark: #B8860B;
  --gold-gradient: linear-gradient(135deg, #D4AF37, #F0D78C, #D4AF37);
  --beige: #F5F0E0;
  --cream: #FFFCF5;
  --black: #1A1A1A;
  --black-light: #2C2C2C;
  --charcoal: #3D3D3D;
  --gray: #888;
  --gray-light: #E8E8E8;
  --red: #E74C3C;
  --green: #27AE60;
  --blue: #3498DB;
  --orange: #F39C12;
  --sidebar-width: 240px;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --transition: 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Cairo', sans-serif;
  background: #F8F6F1;
  background-image: radial-gradient(ellipse at 20% 50%, rgba(212,175,55,0.03) 0%, transparent 50%),
                    radial-gradient(ellipse at 80% 50%, rgba(212,175,55,0.03) 0%, transparent 50%);
  color: var(--black);
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, select { outline: none; font-family: inherit; }
img { max-width: 100%; }

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0D0D0D, #1A1A1A, #2C1F0E);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-screen::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,175,55,0.08) 0%, transparent 70%);
  top: -200px;
  left: -200px;
  animation: floatGlow 8s ease-in-out infinite;
}
.login-screen::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,175,55,0.05) 0%, transparent 70%);
  bottom: -100px;
  right: -100px;
  animation: floatGlow 10s ease-in-out infinite reverse;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes floatGlow {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -30px); }
}

.login-card {
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
  position: relative;
  z-index: 1;
}

.login-logo img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  margin: 0 auto 20px;
  box-shadow: 0 0 30px rgba(212,175,55,0.2);
}

.login-card h1 {
  font-size: 28px;
  font-weight: 900;
  color: var(--gold-dark);
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--gray);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-card .form-group {
  text-align: right;
  margin-bottom: 20px;
}

.login-card .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--charcoal);
}

.login-card .form-group label i {
  color: var(--gold);
  margin-left: 6px;
}

.login-card .form-group input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 15px;
  transition: var(--transition);
  background: var(--cream);
  direction: rtl;
}

.login-card .form-group input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(212,175,55,0.1);
}

.btn-login {
  width: 100%;
  padding: 16px;
  background: var(--gold-gradient);
  color: var(--black);
  font-size: 17px;
  font-weight: 800;
  border-radius: 50px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212,175,55,0.35);
}

.login-error {
  color: var(--red);
  font-size: 14px;
  margin-top: 16px;
  min-height: 20px;
}

/* ===== ADMIN LAYOUT ===== */
.admin-panel {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--black);
  background: linear-gradient(180deg, #0D0D0D 0%, #1A1A1A 40%, #2C1F0E 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--gold);
}

.sidebar-brand {
  font-size: 22px;
  font-weight: 900;
  color: var(--gold);
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: none;
  color: rgba(255,255,255,0.55);
  font-size: 15px;
  font-weight: 600;
  transition: var(--transition);
  width: 100%;
  text-align: right;
}

.nav-item i { width: 20px; font-size: 17px; }

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: white;
}

.nav-item.active {
  background: var(--gold-gradient);
  color: var(--black);
  box-shadow: 0 4px 16px rgba(212,175,55,0.25);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-footer .nav-item { color: rgba(255,255,255,0.4); }
.sidebar-footer .nav-item:hover { color: var(--red); background: rgba(231,76,60,0.1); }

/* ===== MAIN ===== */
.main-content {
  margin-right: var(--sidebar-width);
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeSlideIn 0.4s ease; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-header h1 i { color: var(--gold-dark); }

.date-display {
  color: var(--gray);
  font-size: 14px;
  font-weight: 600;
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid rgba(212,175,55,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(212,175,55,0.12), rgba(212,175,55,0.06));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--gold-dark);
  transition: transform 0.3s ease;
}
.stat-card:hover .stat-icon {
  transform: scale(1.1);
}

.stat-info { display: flex; flex-direction: column; }
.stat-number { font-size: 32px; font-weight: 900; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--gray); font-weight: 600; }

/* ===== TABLES ===== */
.table-container {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  border: 1px solid rgba(212,175,55,0.08);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead {
  background: linear-gradient(135deg, var(--black), var(--black-light));
  color: white;
}

.data-table th {
  padding: 14px 18px;
  text-align: right;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-light);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: rgba(212,175,55,0.04); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table .product-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
}

.action-btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-edit {
  background: rgba(52,152,219,0.1);
  color: var(--blue);
}
.btn-edit:hover { background: var(--blue); color: white; }

.btn-delete {
  background: rgba(231,76,60,0.1);
  color: var(--red);
}
.btn-delete:hover { background: var(--red); color: white; }

.btn-status {
  background: rgba(243,156,18,0.1);
  color: var(--orange);
}
.btn-status:hover { background: var(--orange); color: white; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray);
  font-size: 16px;
  font-weight: 600;
}

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
}

.badge-pending { background: rgba(243,156,18,0.12); color: var(--orange); }
.badge-confirmed { background: rgba(39,174,96,0.12); color: var(--green); }
.badge-shipping { background: rgba(52,152,219,0.12); color: var(--blue); }
.badge-delivered { background: rgba(39,174,96,0.12); color: var(--green); }
.badge-noanswer { background: rgba(231,76,60,0.12); color: var(--red); }
.badge-cancelled { background: rgba(100,100,100,0.12); color: #666; }

/* ===== BUTTONS ===== */
.btn-add {
  padding: 12px 24px;
  background: var(--gold-gradient);
  color: var(--black);
  font-weight: 800;
  font-size: 14px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-add:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(212,175,55,0.3);
}

.btn-save {
  width: 100%;
  padding: 16px;
  background: var(--gold-gradient);
  color: var(--black);
  font-weight: 800;
  font-size: 16px;
  border-radius: 50px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-save:hover { transform: translateY(-2px); }

.btn-export {
  padding: 10px 20px;
  background: var(--green);
  color: white;
  font-weight: 700;
  font-size: 13px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-export:hover { opacity: 0.9; transform: translateY(-1px); }

/* ===== FILTERS ===== */
.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-group select {
  padding: 10px 16px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  background: white;
  cursor: pointer;
}

.filter-group select:focus {
  border-color: var(--gold);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: 0.3s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 500px;
  max-width: 95%;
  max-height: 90vh;
  background: white;
  border-radius: 20px;
  z-index: 2001;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 30px 80px rgba(0,0,0,0.2);
}
.modal.active { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.modal-sm { width: 380px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-light);
  background: linear-gradient(135deg, var(--cream), var(--beige));
}
.modal-header h2 { font-size: 20px; font-weight: 800; color: var(--gold-dark); }

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  border: 1px solid var(--gray-light);
}
.modal-close:hover { background: var(--gray-light); transform: rotate(90deg); }

.modal-body { padding: 24px; overflow-y: auto; max-height: calc(90vh - 80px); }
.modal-body .form-group { margin-bottom: 16px; }

.modal-body .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--charcoal);
}

.modal-body .form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
  background: var(--cream);
  direction: rtl;
}

.modal-body .form-group input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(212,175,55,0.1);
}

.modal-body .form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--cream);
  cursor: pointer;
}

/* ===== RECENT SECTION ===== */
.recent-section h2 {
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.recent-section h2 i { color: var(--gold-dark); }

/* ===== ABANDONED CHECKOUTS ===== */
.abandoned-info {
  color: var(--gray);
  font-size: 14px;
  font-weight: 600;
}

.abandoned-summary {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.summary-item {
  background: white;
  border-radius: var(--radius);
  padding: 16px 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(212,175,55,0.08);
  display: flex;
  flex-direction: column;
  min-width: 150px;
}

.summary-number {
  font-size: 32px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--gold-dark);
}

.summary-label {
  font-size: 13px;
  color: var(--gray);
  font-weight: 600;
  margin-top: 4px;
}

/* ===== PROFIT TREND ===== */
.profit-chart-section {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(212,175,55,0.08);
  margin-bottom: 24px;
}
.profit-chart-section h2 {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.profit-chart-section h2 i { color: var(--gold-dark); }

.profit-trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 220px;
  padding: 10px 0;
  overflow-x: auto;
  direction: ltr;
}
.trend-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 60px;
}
.trend-bar-group {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
}
.trend-bar {
  width: 18px;
  border-radius: 4px 4px 0 0;
  transition: height 0.8s ease;
  min-height: 2px;
}
.trend-bar-rev { background: var(--blue); opacity: 0.6; }
.trend-bar-profit { }
.trend-bar-pos { background: var(--green); }
.trend-bar-neg { background: var(--red); }
.trend-info { text-align: center; }
.trend-month { display: block; font-size: 12px; font-weight: 700; color: var(--charcoal); }
.trend-value { display: block; font-size: 11px; font-weight: 800; }
.trend-orders { display: block; font-size: 10px; color: var(--gray); }

.c-green { color: var(--green); }
.c-red { color: var(--red); }

.badge-abandoned {
  background: rgba(231,76,60,0.12);
  color: var(--red);
  display: inline-block;
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
}

.badge-completed-checkout {
  background: rgba(39,174,96,0.12);
  color: var(--green);
  display: inline-block;
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
}

/* ===== TEAM ===== */
.team-summary { margin-bottom: 24px; }

.role-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
}

.role-badge-owner {
  background: linear-gradient(135deg, rgba(212,175,55,0.15), rgba(212,175,55,0.08));
  color: var(--gold-dark);
  border: 1px solid rgba(212,175,55,0.25);
}

.role-badge-admin {
  background: rgba(52,152,219,0.12);
  color: var(--blue);
}

/* ===== INVENTORY ===== */
.inventory-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(243,156,18,0.12), rgba(243,156,18,0.06));
  border: 1px solid rgba(243,156,18,0.2);
  border-radius: var(--radius);
  color: var(--orange);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 24px;
}
.inventory-banner i { font-size: 20px; }

/* ===== VISIT STATS ===== */
.visits-summary { margin-bottom: 24px; }
.visits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.visit-source-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(212,175,55,0.08);
}
.visit-source-icon { font-size: 28px; margin-bottom: 8px; }
.visit-source-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.visit-source-name { font-size: 14px; font-weight: 700; color: var(--charcoal); }
.visit-source-count { font-size: 22px; font-weight: 900; }
.visit-source-bar {
  height: 6px;
  background: var(--gray-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.visit-source-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease; }
.visit-source-pct { font-size: 12px; color: var(--gray); font-weight: 600; }

.visits-section {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(212,175,55,0.08);
}
.visits-section h2 {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.visits-section h2 i { color: var(--gold-dark); }

.chart-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.chart-label {
  width: 110px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.chart-bar-bg {
  flex: 1;
  height: 28px;
  background: var(--gray-light);
  border-radius: 14px;
  overflow: hidden;
}
.chart-bar-fill {
  height: 100%;
  border-radius: 14px;
  transition: width 1s ease;
  min-width: 4px;
}
.chart-value {
  width: 100px;
  font-size: 13px;
  font-weight: 700;
  color: var(--charcoal);
  text-align: left;
  direction: ltr;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  .sidebar-brand,
  .nav-item span {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 14px;
  }
  .sidebar-header {
    justify-content: center;
    padding: 16px 8px;
  }
  .sidebar-logo { margin: 0; }
  .main-content {
    margin-right: 60px;
    padding: 16px;
  }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .filter-group { flex-wrap: wrap; }
  .profit-summary { grid-template-columns: 1fr 1fr; }
  .visits-grid { grid-template-columns: 1fr 1fr; }
  .chart-label { width: 70px; font-size: 12px; }
  .chart-value { width: 70px; font-size: 11px; }
}

.sidebar { content-visibility: auto; }

/* ===== Profit Dashboard ===== */
.profit-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.profit-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 4px solid var(--gold);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.profit-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.profit-card.revenue { border-right-color: var(--blue); }
.profit-card.costs { border-right-color: var(--red); }
.profit-card.net { border-right-color: var(--green); }
.profit-card.margin { border-right-color: var(--orange); }
.profit-label { font-size: 13px; color: var(--gray); font-weight: 600; }
.profit-number { font-size: 22px; font-weight: 800; }

.profit-section {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header-row h2 { font-size: 18px; color: var(--charcoal); }
.fixed-costs-total {
  text-align: left;
  padding: 10px 0;
  font-size: 15px;
  color: var(--charcoal);
  border-top: 1px solid var(--gray-light);
  margin-top: 8px;
}
.var-costs-display {
  display: flex;
  gap: 32px;
  padding: 8px 0;
}
.var-cost-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.var-cost-label { font-size: 13px; color: var(--gray); font-weight: 600; }
.var-cost-value { font-size: 18px; font-weight: 800; color: var(--charcoal); }

.profit-margin-badge {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
}
.profit-margin-badge.high { background: #e8f5e9; color: var(--green); }
.profit-margin-badge.mid { background: #fff3e0; color: var(--orange); }
.profit-margin-badge.low { background: #ffebee; color: var(--red); }

.date-display {
  color: var(--gray);
  font-size: 14px;
  font-weight: 600;
}
.btn-add-sm {
  padding: 8px 16px;
  font-size: 13px;
}

@media (max-width: 900px) {
  .profit-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .profit-summary { grid-template-columns: 1fr; }
  .var-costs-display { flex-direction: column; gap: 12px; }
}

/* ===== Settings ===== */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.settings-form { max-width: 820px; }

/* ===== Search ===== */
.settings-search-box {
  display: flex;
  align-items: center;
  background: white;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 0 16px;
  margin-bottom: 16px;
  transition: var(--transition);
}
.settings-search-box:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(212,175,55,0.1);
}
.settings-search-box i { color: var(--gray); }
.settings-search-box input {
  border: none;
  padding: 12px;
  font-size: 14px;
  width: 100%;
  background: transparent;
  font-family: inherit;
  direction: rtl;
}
.settings-search-box input:focus { outline: none; }

/* ===== Inner Tabs ===== */
.settings-nav {
  display: flex;
  gap: 4px;
  background: var(--cream);
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 24px;
  overflow-x: auto;
}
.settings-nav-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--charcoal);
  font-weight: 700;
  font-size: 13px;
  border-radius: 11px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font-family: inherit;
}
.settings-nav-btn:hover { background: rgba(212,175,55,0.1); }
.settings-nav-btn.active {
  background: white;
  color: var(--gold-dark);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ===== Tab Content ===== */
.stab-content { display: none; animation: fadeSlideUp 0.35s ease; }
.stab-content.active { display: block; }

/* ===== Annotated Section Layout ===== */
.s-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(212,175,55,0.08);
  animation: fadeSlideUp 0.4s ease;
}
.s-sidebar h2 {
  font-size: 15px;
  color: var(--gold-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.s-sidebar h2 i { font-size: 17px; }
.s-desc {
  font-size: 13px;
  color: var(--gray);
  line-height: 1.6;
  font-weight: 500;
}
.s-fields { min-width: 0; }
.s-fields .form-group { margin-bottom: 20px; }
.s-fields .form-group:last-child { margin-bottom: 0; }

.s-fields .form-group > label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--charcoal);
}
.s-fields .form-group > label i { color: var(--gold); margin-left: 6px; }

.s-fields .form-group input,
.s-fields .form-group select,
.s-fields .form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
  background: var(--cream);
  direction: rtl;
  font-family: inherit;
  box-sizing: border-box;
}
.s-fields .form-group input:focus,
.s-fields .form-group select:focus,
.s-fields .form-group textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(212,175,55,0.1);
  outline: none;
}

.field-hint {
  font-size: 12px;
  color: var(--gray);
  margin-top: 4px;
  font-weight: 500;
}

/* ===== Form Row ===== */
.form-row {
  display: flex;
  gap: 20px;
}
.form-row .form-group { flex: 1; }

/* ===== Color Picker ===== */
.color-picker-group {
  display: flex;
  gap: 10px;
  align-items: center;
}
.color-swatch {
  width: 44px !important;
  height: 44px !important;
  padding: 3px !important;
  border-radius: 10px !important;
  cursor: pointer;
  flex: none !important;
}
.color-swatch::-webkit-color-swatch-wrapper { padding: 2px; }
.color-swatch::-webkit-color-swatch { border-radius: 6px; border: none; }
.color-hex {
  font-family: 'Courier New', monospace !important;
  direction: ltr !important;
  text-align: left;
  flex: 1;
}

/* ===== Wilaya Fees ===== */
.wilaya-fee-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.wilaya-fee-row select,
.wilaya-fee-row .amount-input {
  padding: 12px 16px;
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--cream);
  transition: var(--transition);
  font-family: inherit;
  direction: rtl;
}
.wilaya-fee-row select:focus,
.wilaya-fee-row .amount-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(212,175,55,0.1);
  outline: none;
}
.wilaya-fee-row select { flex: 1; }
.wilaya-fee-row .amount-input { width: 120px; flex: none; }
.btn-add-fee {
  padding: 12px 20px;
  background: var(--gold-gradient);
  color: var(--black);
  font-weight: 800;
  font-size: 13px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
  flex: none;
}
.btn-add-fee:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(212,175,55,0.3); }
.wilaya-table { margin-top: 8px; }
.wilaya-table .data-table th:last-child,
.wilaya-table .data-table td:last-child { width: 80px; text-align: center; }
.btn-remove-fee {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(231,76,60,0.1);
  color: var(--red);
  transition: var(--transition);
}
.btn-remove-fee:hover { background: var(--red); color: white; }

/* ===== Skeleton Loading ===== */
.settings-skeleton { display: block; }
.hidden { display: none !important; }
.settings-skeleton.hidden { display: none; }
.sk-card {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.sk-line {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--cream) 25%, #e8e0d0 50%, var(--cream) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  margin-bottom: 12px;
}
.sk-line:last-child { margin-bottom: 0; }
.sk-line.w-60 { width: 60%; }
.sk-line.w-80 { width: 80%; }
.sk-line.w-100 { width: 100%; }

/* ===== Logo Upload ===== */
.logo-zone {
  position: relative;
  border: 2px dashed var(--gray-light);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--cream);
}
.logo-zone:hover,
.logo-zone.drag-over {
  border-color: var(--gold);
  background: rgba(212,175,55,0.05);
}
.logo-placeholder i {
  font-size: 40px;
  color: var(--gold);
  margin-bottom: 8px;
}
.logo-placeholder p {
  font-size: 14px;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 4px;
}
.logo-placeholder span {
  font-size: 12px;
  color: var(--gray);
}
.logo-preview {
  position: relative;
  display: inline-block;
  max-width: 200px;
}
.logo-preview img {
  width: 100%;
  height: auto;
  max-height: 100px;
  object-fit: contain;
  border-radius: 8px;
}
.logo-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  border: 2px solid white;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.logo-remove:hover { transform: scale(1.1); }
.logo-progress {
  height: 4px;
  background: var(--gray-light);
  border-radius: 4px;
  margin-top: 12px;
  overflow: hidden;
}
.logo-progress-fill {
  height: 100%;
  background: var(--gold-gradient);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

/* ===== Theme Presets ===== */
.theme-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.theme-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 2px solid var(--gray-light);
  border-radius: 50px;
  background: white;
  font-size: 12px;
  font-weight: 700;
  color: var(--charcoal);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.theme-btn:hover {
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(212,175,55,0.15);
}
.theme-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: none;
}

/* ===== Live Preview ===== */
.design-preview {
  border: 2px solid var(--gray-light);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 280px;
  direction: rtl;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.pv-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.pv-logo img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--pv-gold, var(--gold));
}
.pv-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--pv-gold-dark, var(--gold-dark));
}
.pv-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pv-card {
  height: 40px;
  border-radius: 8px;
  background: var(--pv-gold, var(--gold));
  opacity: 0.35;
  transition: background 0.3s ease;
}

/* ===== Toggle Switch ===== */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.toggle-row span { font-size: 13px; font-weight: 700; color: var(--charcoal); }
.toggle-row span i { color: var(--gold); margin-left: 6px; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-light);
  border-radius: 24px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch input:checked + .toggle-slider { background: var(--gold); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== Unsaved Changes Bar ===== */
.unsaved-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: linear-gradient(135deg, #2c3e50, #34495e);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  direction: rtl;
}
.unsaved-bar.visible { transform: translateY(0); }
.unsaved-bar span { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.unsaved-bar span i { color: #f1c40f; font-size: 16px; }
.unsaved-bar-actions { display: flex; gap: 8px; }
.btn-discard {
  padding: 8px 16px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: transparent;
  color: white;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-discard:hover { background: rgba(255,255,255,0.1); }
.btn-save-bar {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--gold-gradient);
  color: var(--black);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-save-bar:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(212,175,55,0.3); }

/* ===== Save Button ===== */
.btn-save-settings {
  width: 100%;
  padding: 16px;
  background: var(--gold-gradient);
  color: var(--black);
  font-weight: 800;
  font-size: 16px;
  border-radius: 50px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}
.btn-save-settings:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(212,175,55,0.3); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .s-section { grid-template-columns: 1fr; gap: 16px; }
  .settings-nav { gap: 2px; padding: 3px; }
  .settings-nav-btn { padding: 8px 12px; font-size: 12px; }
}
@media (max-width: 600px) {
  .s-section { padding: 20px 16px; }
  .form-row { flex-direction: column; gap: 0; }
  .wilaya-fee-row { flex-wrap: wrap; }
  .wilaya-fee-row .amount-input { width: 100%; }
  .btn-add-fee { width: 100%; justify-content: center; }
  .color-picker-group { flex-wrap: wrap; }
  .color-hex { flex: 1; min-width: 0; }
  .theme-presets { flex-direction: column; }
  .theme-btn { width: 100%; justify-content: center; }
  .unsaved-bar { flex-direction: column; gap: 8px; text-align: center; }
  .design-preview { max-width: 100%; }
}

@media (max-width: 480px) {
  .sidebar { width: 50px; }
  .sidebar-header { padding: 12px 4px; }
  .sidebar-logo { width: 30px; height: 30px; }
  .nav-item { padding: 10px 6px; font-size: 13px; }
  .sidebar-nav { padding: 8px 4px; gap: 2px; }
  .main-content { margin-right: 50px; padding: 8px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-number { font-size: 18px; }
  .stat-label { font-size: 11px; }
  .page-header h1 { font-size: 16px; }
  .table-container { margin: 0 -8px; border-radius: 0; }
  .data-table th, .data-table td { padding: 8px 6px; font-size: 12px; white-space: nowrap; }
  .filter-group { flex-direction: column; gap: 8px; }
  .filter-group select, .filter-group input { width: 100%; }
  .modal { width: 100%; max-width: 100%; margin: 0; border-radius: 0; min-height: 100vh; min-height: 100dvh; }
  .modal-body { padding: 16px; max-height: none; }
  .modal-header { padding: 16px; }
  .modal-sm { max-width: 100%; }
  .s-card { padding: 16px; }
  .s-section { gap: 12px; }
  .settings-nav { overflow-x: auto; white-space: nowrap; flex-wrap: nowrap; justify-content: flex-start; }
  .settings-nav-btn { flex-shrink: 0; }
  .login-card { margin: 20px 16px; padding: 24px 20px; }
  .admin-panel { flex-direction: column; }
}
