/* ═══════════════════════════════════════════════════════════
   KARDO — Desert Noir Theme
   Version: 4.0.0
   
   Aesthetic: Editorial Luxury × Libyan Heritage
   
   Loaded AFTER styles.css — overrides colors, fonts, and
   adds signature elements (Amazigh pattern, matte-black card)
   
   New in v4:
   - Live background (mesh + Amazigh + particles)
   - Cinematic page transitions
   - Card idle animations
   - Performance optimizations for mobile
   - prefers-reduced-motion support
   - Improved contrast for accessibility
   ═══════════════════════════════════════════════════════════ */

/* ─── Override Design Tokens ────────────────────────────── */
:root {
  /* ── Desert Noir Palette ── */
  --ink:          #0B0F0D;   /* أسود فاحم دافئ */
  --ink-2:        #151A18;   /* أسود أفتح */
  --ink-3:        #1F2624;
  
  --sand:         #D4A574;   /* ذهبي رملي */
  --sand-2:       #C0915F;   /* ذهبي داكن */
  --sand-3:       #8B6B45;   /* ذهبي محروق */
  --sand-light:   #F2E6D2;   /* ذهبي فاتح جداً */
  --sand-bg:      rgba(212, 165, 116, 0.08);
  
  --olive:        #0A5C3F;   /* زيتوني داكن — العلامة */
  --olive-hover:  #084D34;
  --olive-dark:   #063826;
  --olive-light:  #E4F0EA;
  --olive-50:     #F1F8F4;
  
  --parchment:    #F4EDE0;   /* بيج ورق قديم */
  --parchment-2:  #EBE2D2;
  --parchment-3:  #DDD2BC;
  
  --ember:        #C84B31;   /* أحمر جمر */
  --ember-bg:     #FBEBE6;
  --ember-border: #F0C3B7;
  
  /* ── Override semantic palette ── */
  --brand:          var(--olive);
  --brand-hover:    var(--olive-hover);
  --brand-dark:     var(--olive-dark);
  --brand-light:    var(--olive-light);
  --brand-50:       var(--olive-50);
  
  --bg:             #0E1210;   /* خلفية التطبيق — أسود عميق */
  --surface:        #161B19;   /* surface داخل الأسود */
  --surface-2:      #1E2522;
  --surface-3:      #272F2C;
  
  --text:           #F4EDE0;   /* نص فاتح على الأسود */
  --text-2:         #A8B0AB;   /* نص ثانوي */
  --text-3:         #8F9A94;   /* نص ثالثي — contrast محسّن */
  --text-inverse:   #0B0F0D;
  
  --border:         #2A332F;
  --border-2:       #3A443F;
  --border-3:       #4E5852;
  
  /* ── Semantic overrides ── */
  --success:        #5FB88A;
  --success-bg:     rgba(95, 184, 138, 0.12);
  --success-border: rgba(95, 184, 138, 0.3);
  
  --warning:        var(--sand);
  --warning-bg:     rgba(212, 165, 116, 0.12);
  --warning-border: rgba(212, 165, 116, 0.3);
  
  --error:          #E5715A;
  --error-bg:       rgba(200, 75, 49, 0.12);
  --error-border:   rgba(200, 75, 49, 0.3);
  
  --info:           #7CA8C4;
  --info-bg:        rgba(124, 168, 196, 0.12);
  --info-border:    rgba(124, 168, 196, 0.3);
  
  /* ── Fonts ── */
  --font-display: 'Reem Kufi', 'IBM Plex Sans Arabic', serif;
  --font-latin-display: 'Instrument Serif', Georgia, serif;
  --font: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  
  /* ── Shadows — deeper for dark UI ── */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5), 0 2px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 32px -8px rgba(0, 0, 0, 0.6), 0 6px 12px -4px rgba(0, 0, 0, 0.4);
  --shadow-focus: 0 0 0 3px rgba(95, 184, 138, 0.25);
  --shadow-gold: 0 0 20px rgba(212, 165, 116, 0.15);
}

/* ─── Body & Base ───────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  position: relative;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   LIVE BACKGROUND — خلفية حية
   ═══════════════════════════════════════════════════════════ */

/* Mesh gradient متحرك */
body::before {
  content: '';
  position: fixed;
  inset: -50%;
  z-index: -2;
  background:
    radial-gradient(circle 600px at 20% 30%, rgba(212, 165, 116, 0.12) 0%, transparent 60%),
    radial-gradient(circle 700px at 80% 70%, rgba(10, 92, 63, 0.12) 0%, transparent 60%),
    radial-gradient(circle 500px at 50% 90%, rgba(212, 165, 116, 0.06) 0%, transparent 50%);
  animation: mesh-drift 40s ease-in-out infinite alternate;
  filter: blur(60px);
  pointer-events: none;
}

@keyframes mesh-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-3%, 3%) scale(1.08); }
  100% { transform: translate(3%, -3%) scale(1); }
}

/* Noise overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.02;
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Amazigh pattern دوّار */
.bg-pattern {
  position: fixed;
  inset: -20%;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23D4A574' stroke-width='0.8' opacity='0.06'%3E%3Cpath d='M60 0 L120 60 L60 120 L0 60 Z'/%3E%3Cpath d='M60 30 L90 60 L60 90 L30 60 Z'/%3E%3Cpath d='M0 0 L30 30 M90 30 L120 0 M0 120 L30 90 M90 90 L120 120'/%3E%3Ccircle cx='60' cy='60' r='20'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 120px 120px;
  animation: pattern-rotate 180s linear infinite;
  pointer-events: none;
  opacity: 0.8;
}

@keyframes pattern-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Particles ذهبية */
.particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--sand);
  box-shadow: 0 0 8px rgba(212, 165, 116, 0.6);
  opacity: 0;
  animation: particle-rise linear infinite;
}

@keyframes particle-rise {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0;
  }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% {
    transform: translateY(-100vh) scale(0.5);
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════
   TYPOGRAPHY — Editorial
   ═══════════════════════════════════════════════════════════ */

h1, .h1, h2, .h2, h3, .h3, .display {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

h4, .h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0;
}

.display {
  font-size: 52px;
  line-height: 1.15;
  font-weight: 600;
}

h1, .h1 {
  font-size: 38px;
  line-height: 1.2;
  font-weight: 600;
}

h2, .h2 {
  font-size: 30px;
  line-height: 1.25;
  font-weight: 600;
}

.editorial-number {
  font-family: var(--font-latin-display);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* ═══════════════════════════════════════════════════════════
   AMAZIGH DECORATIVE ELEMENTS
   ═══════════════════════════════════════════════════════════ */

.amazigh-divider {
  height: 24px;
  margin: var(--sp-6) 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='24' viewBox='0 0 120 24'%3E%3Cg fill='none' stroke='%23D4A574' stroke-width='1' opacity='0.4'%3E%3Cpath d='M0 12 L10 4 L20 12 L30 4 L40 12 L50 4 L60 12 L70 4 L80 12 L90 4 L100 12 L110 4 L120 12'/%3E%3Cpath d='M0 12 L10 20 L20 12 L30 20 L40 12 L50 20 L60 12 L70 20 L80 12 L90 20 L100 12 L110 20 L120 12'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center;
  background-size: 120px 24px;
}

.amazigh-bg {
  position: relative;
  overflow: hidden;
}

.amazigh-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill='none' stroke='%23D4A574' stroke-width='0.5' opacity='0.08'%3E%3Cpath d='M30 0 L60 30 L30 60 L0 30 Z'/%3E%3Cpath d='M30 15 L45 30 L30 45 L15 30 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.amazigh-bg > * {
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════════════════════
   CARDS — Elevated with gold accent
   ═══════════════════════════════════════════════════════════ */

.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--ink-2) 100%);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(212, 165, 116, 0.3) 50%,
    transparent 100%
  );
  opacity: 0.5;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════
   BAR (Top Navigation)
   ═══════════════════════════════════════════════════════════ */

.bar {
  background: rgba(11, 15, 13, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.bar-logo {
  color: var(--text);
}

.bar-logo span,
.admin-brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */

.sidebar {
  background: var(--ink);
  border-left: 1px solid var(--border);
}

.sidebar-item {
  color: var(--text-2);
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.sidebar-item.active {
  background: linear-gradient(
    90deg,
    rgba(10, 92, 63, 0.4) 0%,
    rgba(10, 92, 63, 0.1) 100%
  );
  color: var(--sand);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--sand);
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.5);
  animation: gold-bar-pulse 2s ease-in-out infinite;
}

[dir="ltr"] .sidebar-item.active::before {
  right: auto;
  left: 0;
}

@keyframes gold-bar-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(212, 165, 116, 0.5); }
  50% { box-shadow: 0 0 20px rgba(212, 165, 116, 0.8); }
}

.sidebar-label {
  color: var(--sand-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
}

/* ═══════════════════════════════════════════════════════════
   BOTTOM NAV
   ═══════════════════════════════════════════════════════════ */

.bottom-nav {
  background: rgba(11, 15, 13, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
}

.nav-item {
  color: var(--text-3);
  transition: color .2s ease;
}

.nav-item.active {
  color: var(--sand);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--sand);
  border-radius: 0 0 2px 2px;
  box-shadow: 0 0 12px rgba(212, 165, 116, 0.6);
  animation: nav-dot-in .3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes nav-dot-in {
  from { transform: translateX(-50%) scaleX(0); opacity: 0; }
  to   { transform: translateX(-50%) scaleX(1); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */

.btn-primary {
  background: linear-gradient(180deg, var(--olive) 0%, var(--olive-hover) 100%);
  color: var(--parchment);
  border-color: var(--olive-dark);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 1px 3px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(212, 165, 116, 0.25) 50%,
    transparent 100%
  );
  transition: left .6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.btn-primary:hover::after {
  left: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--olive-hover) 0%, var(--olive-dark) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 4px 12px rgba(10, 92, 63, 0.4);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-2);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--border-3);
}

.btn-ghost {
  color: var(--text-2);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--sand);
}

/* ═══════════════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════════════ */

.input {
  background: var(--ink-2);
  border-color: var(--border-2);
  color: var(--text);
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
}

.input::placeholder {
  color: var(--text-3);
  opacity: 0.6;
}

.input:hover:not(:focus):not(:disabled) {
  border-color: var(--border-3);
}

.input:focus {
  border-color: var(--sand);
  box-shadow:
    0 0 0 3px rgba(212, 165, 116, 0.15),
    0 0 20px rgba(212, 165, 116, 0.08);
}

.select {
  background-color: var(--ink-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23D4A574' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* ═══════════════════════════════════════════════════════════
   VCARD — الأثرية (النجم)
   ═══════════════════════════════════════════════════════════ */

.vcard {
  background:
    linear-gradient(135deg, #0E1210 0%, #050807 100%),
    radial-gradient(circle at 20% 20%, rgba(212, 165, 116, 0.15), transparent 40%);
  background-blend-mode: normal, overlay;
  color: var(--parchment);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 2px 6px rgba(0, 0, 0, 0.5),
    0 20px 60px -12px rgba(212, 165, 116, 0.15),
    0 12px 32px -8px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(212, 165, 116, 0.12);
  transition: transform .4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* النقش الأمازيغي */
.vcard::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23D4A574' stroke-width='0.7'%3E%3Cpath d='M40 0 L80 40 L40 80 L0 40 Z' opacity='0.35'/%3E%3Cpath d='M40 20 L60 40 L40 60 L20 40 Z' opacity='0.25'/%3E%3Cpath d='M0 0 L20 20 M60 20 L80 0 M0 80 L20 60 M60 60 L80 80' opacity='0.15'/%3E%3Ccircle cx='40' cy='40' r='8' opacity='0.2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 80px 80px;
  opacity: 0.5;
  pointer-events: none;
}

/* Glow عند الحواف */
.vcard::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 0% 0%, rgba(212, 165, 116, 0.3), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(10, 92, 63, 0.2), transparent 40%);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

.vcard > * {
  position: relative;
  z-index: 1;
}

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

.vcard-brand {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--sand);
  text-shadow: 0 0 12px rgba(212, 165, 116, 0.4);
}

.vcard-tier {
  color: var(--sand);
  opacity: 0.6;
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
}

.vcard-number {
  font-family: var(--font-mono);
  color: var(--parchment);
  text-shadow:
    0 0 20px rgba(212, 165, 116, 0.15),
    0 1px 1px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.12em;
}

.vcard-label {
  color: var(--sand);
  opacity: 0.5;
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
}

.vcard-value {
  color: var(--parchment);
  font-family: var(--font-mono);
}

.vcard-chip {
  background:
    linear-gradient(135deg,
      #8B6B45 0%,
      #D4A574 25%,
      #F2E6D2 50%,
      #D4A574 75%,
      #8B6B45 100%);
  box-shadow:
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(212, 165, 116, 0.3),
    0 1px 2px rgba(0, 0, 0, 0.3);
}

.vcard-chip::before,
.vcard-chip::after {
  background: rgba(11, 15, 13, 0.35);
}

.vcard-foot {
  border-top: 1px solid rgba(212, 165, 116, 0.15);
  padding-top: var(--sp-4);
}

/* ═══════════════════════════════════════════════════════════
   BALANCE CARD (Dashboard Hero)
   ═══════════════════════════════════════════════════════════ */

.balance-card {
  background:
    linear-gradient(135deg, var(--ink-2) 0%, var(--ink) 100%),
    radial-gradient(circle at 0% 100%, rgba(212, 165, 116, 0.1), transparent 50%);
  background-blend-mode: normal, overlay;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.balance-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(212, 165, 116, 0.08) 0%, transparent 70%);
  pointer-events: none;
  animation: balance-glow 6s ease-in-out infinite;
}

@keyframes balance-glow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.balance-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--sand-3);
}

.balance-value {
  color: var(--parchment);
  font-family: var(--font-display);
  font-weight: 600;
  text-shadow: 0 0 30px rgba(212, 165, 116, 0.15);
}

.balance-secondary {
  color: var(--text-3);
  font-family: var(--font-mono);
}

.balance-action .icon {
  background: rgba(212, 165, 116, 0.1);
  color: var(--sand);
  border: 1px solid rgba(212, 165, 116, 0.15);
  transition: all .2s ease;
}

.balance-action:hover {
  background: rgba(212, 165, 116, 0.06);
  color: var(--sand);
}

.balance-action:hover .icon {
  background: rgba(212, 165, 116, 0.18);
  transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════
   SERVICE CARD
   ═══════════════════════════════════════════════════════════ */

.service-card {
  background: var(--surface);
  border-color: var(--border);
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
}

.service-card:hover {
  border-color: rgba(212, 165, 116, 0.35);
  background: var(--ink-2);
  box-shadow:
    0 0 0 1px rgba(212, 165, 116, 0.1),
    0 8px 24px -8px rgba(0, 0, 0, 0.5);
  transform: translateY(-1px);
}

.service-name {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text);
}

.service-desc {
  color: var(--text-3);
}

.service-price {
  color: var(--sand);
  font-family: var(--font-mono);
}

.service-logo {
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--ink-3) 100%);
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   QUICK TILES
   ═══════════════════════════════════════════════════════════ */

.quick-tile {
  background: var(--surface);
  border-color: var(--border);
  transition: all .2s cubic-bezier(0.16, 1, 0.3, 1);
}

.quick-tile:hover {
  border-color: var(--sand);
  background: var(--ink-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px -4px rgba(212, 165, 116, 0.15);
}

.quick-tile:active {
  transform: scale(.98) translateY(0);
}

.quick-icon {
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.15) 0%, rgba(10, 92, 63, 0.15) 100%);
  color: var(--sand);
  border: 1px solid rgba(212, 165, 116, 0.2);
}

.quick-label {
  color: var(--text-2);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════ */

.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.badge-success {
  background: rgba(95, 184, 138, 0.15);
  color: #7DD6A5;
}

.badge-warning {
  background: rgba(212, 165, 116, 0.15);
  color: var(--sand);
}

.badge-info {
  background: rgba(124, 168, 196, 0.15);
  color: #A8CDE5;
}

.badge-error {
  background: rgba(200, 75, 49, 0.15);
  color: #F0947E;
}

.badge-neutral {
  background: var(--surface-2);
  color: var(--text-2);
}

/* ═══════════════════════════════════════════════════════════
   PILLS
   ═══════════════════════════════════════════════════════════ */

.pill {
  background: var(--surface);
  border-color: var(--border-2);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  transition: all .2s ease;
}

.pill:hover:not(.active) {
  border-color: rgba(212, 165, 116, 0.4);
  color: var(--sand);
}

.pill.active {
  background: linear-gradient(180deg, var(--sand) 0%, var(--sand-2) 100%);
  border-color: var(--sand-2);
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 0 16px rgba(212, 165, 116, 0.3);
}

/* ═══════════════════════════════════════════════════════════
   LIST ROWS
   ═══════════════════════════════════════════════════════════ */

.list {
  background: var(--surface);
  border-color: var(--border);
}

.list-row {
  border-bottom-color: var(--border);
  color: var(--text);
  transition: background .15s ease;
}

.list-row:hover {
  background: var(--surface-2);
}

.list-title {
  color: var(--text);
  font-weight: 500;
}

.list-meta {
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 11px;
}

.list-amount {
  color: var(--parchment);
  font-family: var(--font-mono);
}

.list-amount.credit {
  color: #7DD6A5;
}

.list-icon {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  transition: all .2s ease;
}

.list-icon.success {
  background: rgba(95, 184, 138, 0.15);
  color: #7DD6A5;
  border-color: rgba(95, 184, 138, 0.2);
}

.list-icon.brand {
  background: rgba(212, 165, 116, 0.12);
  color: var(--sand);
  border-color: rgba(212, 165, 116, 0.2);
}

/* ═══════════════════════════════════════════════════════════
   COPY BOX
   ═══════════════════════════════════════════════════════════ */

.copy-box {
  background: var(--ink-2);
  border-color: var(--border);
}

.copy-value {
  color: var(--sand);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */

.modal {
  background: linear-gradient(180deg, var(--surface) 0%, var(--ink-2) 100%);
  border: 1px solid var(--border);
  position: relative;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--sand) 50%,
    transparent 100%
  );
  opacity: 0.4;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  pointer-events: none;
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text);
}

.modal-close {
  color: var(--text-2);
}

.modal-close:hover {
  background: var(--surface-2);
  color: var(--sand);
}

/* ═══════════════════════════════════════════════════════════
   OVERLAY
   ═══════════════════════════════════════════════════════════ */

.overlay {
  background: rgba(5, 8, 7, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ═══════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════ */

.toast {
  background: var(--ink-2);
  border-color: var(--border-2);
  color: var(--text);
  box-shadow:
    0 0 0 1px rgba(212, 165, 116, 0.1),
    var(--shadow-md);
}

.toast.success {
  border-color: rgba(95, 184, 138, 0.3);
}

.toast.error {
  border-color: rgba(200, 75, 49, 0.3);
}

/* ═══════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════ */

.alert-info {
  background: rgba(124, 168, 196, 0.1);
  border-color: rgba(124, 168, 196, 0.25);
  color: #A8CDE5;
}

.alert-success {
  background: rgba(95, 184, 138, 0.1);
  border-color: rgba(95, 184, 138, 0.25);
  color: #7DD6A5;
}

.alert-warning {
  background: rgba(212, 165, 116, 0.1);
  border-color: rgba(212, 165, 116, 0.25);
  color: var(--sand);
}

.alert-error {
  background: rgba(200, 75, 49, 0.1);
  border-color: rgba(200, 75, 49, 0.25);
  color: #F0947E;
}

/* ═══════════════════════════════════════════════════════════
   ICON BUTTONS
   ═══════════════════════════════════════════════════════════ */

.icon-btn {
  color: var(--text-2);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--sand);
}

.bar-balance {
  background: var(--ink-2);
  border: 1px solid var(--border);
  color: var(--sand);
  font-family: var(--font-mono);
}

.bar-balance .caption {
  color: var(--sand-3);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 10px;
}

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */

.empty-icon {
  background: var(--surface-2);
  color: var(--sand);
  border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════
   HERO AMAZIGH PATTERN (Public)
   ═══════════════════════════════════════════════════════════ */

.hero-amazigh {
  position: relative;
  overflow: hidden;
}

.hero-amazigh::before {
  content: '';
  position: absolute;
  top: -10%;
  right: -5%;
  width: 60%;
  height: 120%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill='none' stroke='%23D4A574' stroke-width='0.5' opacity='0.15'%3E%3Cpath d='M50 0 L100 50 L50 100 L0 50 Z'/%3E%3Cpath d='M50 25 L75 50 L50 75 L25 50 Z'/%3E%3Cpath d='M0 0 L25 25 M75 25 L100 0 M0 100 L25 75 M75 75 L100 100'/%3E%3Cpath d='M50 10 L90 50 L50 90 L10 50 Z'/%3E%3Ccircle cx='50' cy='50' r='15'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100px 100px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  animation: hero-drift 80s linear infinite;
}

@keyframes hero-drift {
  from { transform: translate(0, 0) rotate(0deg); }
  to   { transform: translate(-100px, -100px) rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════
   SECTION DIVIDER
   ═══════════════════════════════════════════════════════════ */

.section + .section {
  position: relative;
}

.section + .section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(90%, 600px);
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--border-2) 20%,
    var(--sand) 50%,
    var(--border-2) 80%,
    transparent 100%
  );
  opacity: 0.3;
}

/* ═══════════════════════════════════════════════════════════
   SKELETON — GOLD SHIMMER
   ═══════════════════════════════════════════════════════════ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    rgba(212, 165, 116, 0.08) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ═══════════════════════════════════════════════════════════
   PAGE ENTER — CINEMATIC
   ═══════════════════════════════════════════════════════════ */

.page-enter {
  animation: page-in-cinematic 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes page-in-cinematic {
  from {
    opacity: 0;
    transform: translateY(12px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* Staggered children */
.page-enter > * {
  animation: child-in 500ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

.page-enter > *:nth-child(1) { animation-delay: 40ms; }
.page-enter > *:nth-child(2) { animation-delay: 80ms; }
.page-enter > *:nth-child(3) { animation-delay: 120ms; }
.page-enter > *:nth-child(4) { animation-delay: 160ms; }
.page-enter > *:nth-child(5) { animation-delay: 200ms; }
.page-enter > *:nth-child(6) { animation-delay: 240ms; }
.page-enter > *:nth-child(n+7) { animation-delay: 280ms; }

@keyframes child-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════════════════════
   FOCUS — GOLD
   ═══════════════════════════════════════════════════════════ */

:focus-visible {
  outline: 2px solid var(--sand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ═══════════════════════════════════════════════════════════
   SELECTION — SAND
   ═══════════════════════════════════════════════════════════ */

::selection {
  background: rgba(212, 165, 116, 0.3);
  color: var(--parchment);
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR — GOLD HINT
   ═══════════════════════════════════════════════════════════ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--sand-3);
}
::-webkit-scrollbar-track { background: transparent; }

/* ═══════════════════════════════════════════════════════════
   TYPOGRAPHY — Editorial sections
   ═══════════════════════════════════════════════════════════ */

.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text);
}

.divider {
  background: var(--border);
}

.tabular, .mono {
  font-family: var(--font-mono);
}

/* Button loading spinner override */
.btn.loading::after {
  color: var(--parchment) !important;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (min-width: 640px) {
  .display { font-size: 64px; }
  h1, .h1 { font-size: 44px; }
  h2, .h2 { font-size: 34px; }
}

@media (min-width: 1024px) {
  .display { font-size: 72px; }
  h1, .h1 { font-size: 52px; }
  h2, .h2 { font-size: 38px; }
}

/* ═══════════════════════════════════════════════════════════
   MOBILE OPTIMIZATIONS — خفيف على الموبايل
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Hide particles on mobile (performance) */
  .particles,
  .particle {
    display: none !important;
  }

  /* Slow down animations */
  body::before {
    animation-duration: 60s;
  }

  .bg-pattern {
    animation-duration: 300s;
    opacity: 0.4;
  }

  /* Reduce motion blur */
  .page-enter {
    animation-duration: 300ms;
  }

  .page-enter > * {
    animation-duration: 350ms;
  }

  /* Disable hover transforms on touch */
  .service-card:hover,
  .quick-tile:hover,
  .vcard:hover {
    transform: none;
  }

  /* Hero pattern — reduce */
  .hero-amazigh::before {
    opacity: 0.4;
    animation-duration: 120s;
  }
}

/* Very small screens */
@media (max-width: 400px) {
  .balance-card::before {
    animation: none;
  }

  .card::before {
    background: rgba(212, 165, 116, 0.2);
  }
}

/* ═══════════════════════════════════════════════════════════
   PREFERS REDUCED MOTION
   ═══════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  body::before,
  body::after,
  .bg-pattern,
  .particles,
  .particle,
  .hero-amazigh::before,
  .balance-card::before {
    animation: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   HIGH CONTRAST MODE (accessibility)
   ═══════════════════════════════════════════════════════════ */

@media (prefers-contrast: more) {
  :root {
    --text-3: #B8C2BC;
    --border: #3A443F;
    --border-2: #4E5852;
  }
     }
