/* ═══════════════════════════════════════════════════════════
   KARDO — Design System
   Digital Banking Interface
   ═══════════════════════════════════════════════════════════
   
   Principles:
   1. White space > decoration
   2. Trust > wow effect
   3. Information hierarchy > animation
   4. Consistency > creativity
   
   Colors:
   80% neutral / 15% brand / 5% semantic
   ═══════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─────────────────────────────────────── */
:root {
  /* Brand */
  --brand:          #176B4D;
  --brand-hover:    #125A41;
  --brand-dark:     #0F4D38;
  --brand-light:    #E8F3EE;
  --brand-50:       #F2F8F5;

  /* Background */
  --bg:             #F7F8F7;
  --surface:        #FFFFFF;
  --surface-2:      #F0F3F1;
  --surface-3:      #E8ECE9;

  /* Text */
  --text:           #17201C;
  --text-2:         #66736D;
  --text-3:         #8A9690;
  --text-inverse:   #FFFFFF;

  /* Border */
  --border:         #E2E7E4;
  --border-2:       #CBD4CF;
  --border-3:       #A8B3AD;

  /* Semantic */
  --success:        #16845B;
  --success-bg:     #EAF7F1;
  --success-border: #B8DFCE;

  --warning:        #B7791F;
  --warning-bg:     #FFF7E6;
  --warning-border: #F2DEB0;

  --error:          #C74747;
  --error-bg:       #FDEEEE;
  --error-border:   #F2CACA;

  --info:           #3978A8;
  --info-bg:        #EDF5FB;
  --info-border:    #C9DDEE;

  /* Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;

  /* Spacing (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* Shadows — subtle */
  --shadow-xs: 0 1px 2px rgba(20, 30, 25, 0.04);
  --shadow-sm: 0 1px 3px rgba(20, 30, 25, 0.06), 0 1px 2px rgba(20, 30, 25, 0.04);
  --shadow-md: 0 4px 8px -2px rgba(20, 30, 25, 0.08), 0 2px 4px -2px rgba(20, 30, 25, 0.04);
  --shadow-lg: 0 12px 24px -6px rgba(20, 30, 25, 0.10), 0 4px 8px -4px rgba(20, 30, 25, 0.06);
  --shadow-focus: 0 0 0 3px rgba(23, 107, 77, 0.12);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 240ms;

  /* Layout */
  --max-w: 1200px;
  --bar-h: 64px;
  --dock-h: 64px;

  /* Typography */
  --font: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol { list-style: none; }

/* ─── Typography ────────────────────────────────────────── */
.display {
  font-size: 48px;
  line-height: 1.17;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1, .h1 {
  font-size: 36px;
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2, .h2 {
  font-size: 28px;
  line-height: 1.29;
  font-weight: 700;
  letter-spacing: -0.015em;
}

h3, .h3 {
  font-size: 22px;
  line-height: 1.36;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h4, .h4 {
  font-size: 18px;
  line-height: 1.44;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.body-lg {
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
}

.body {
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
}

.body-sm {
  font-size: 13px;
  line-height: 1.54;
  font-weight: 400;
}

.label {
  font-size: 13px;
  line-height: 1.38;
  font-weight: 600;
}

.caption {
  font-size: 12px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--text-3);
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-brand { color: var(--brand); }

.tabular {
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.01em;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ─── Layout ────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

@media (min-width: 640px) {
  .container { padding: 0 var(--sp-6); }
}

@media (min-width: 1024px) {
  .container { padding: 0 var(--sp-8); }
}

.stack > * + * { margin-top: var(--sp-4); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.stack-lg > * + * { margin-top: var(--sp-6); }

.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

.grid { display: grid; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 44px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  border: 1px solid transparent;
  user-select: none;
  -webkit-user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  color: var(--text-inverse);
  border-color: var(--brand);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.985);
}

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

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

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

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

.btn-danger {
  background: var(--error);
  color: var(--text-inverse);
  border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
  background: #B03E3E;
}

.btn-outline-danger {
  background: transparent;
  color: var(--error);
  border-color: var(--error-border);
}

.btn-outline-danger:hover:not(:disabled) {
  background: var(--error-bg);
}

.btn-sm {
  height: 36px;
  padding: 0 var(--sp-3);
  font-size: 13px;
}

.btn-lg {
  height: 52px;
  padding: 0 var(--sp-6);
  font-size: 15px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn.loading {
  color: transparent;
  pointer-events: none;
  position: relative;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  color: var(--text-inverse);
}

.btn-secondary.loading::after {
  color: var(--text);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Inputs ────────────────────────────────────────────── */
.field { display: block; }

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: var(--sp-2);
}

.field-hint {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  margin-top: var(--sp-2);
}

.input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 var(--sp-4);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--dur-fast) var(--ease);
}

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

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

.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--shadow-focus);
}

.input:disabled {
  background: var(--surface-2);
  color: var(--text-3);
  cursor: not-allowed;
}

.input.error {
  border-color: var(--error);
}

.input.error:focus {
  box-shadow: 0 0 0 3px rgba(199, 71, 71, 0.12);
}

textarea.input {
  height: auto;
  min-height: 96px;
  padding: var(--sp-3) var(--sp-4);
  line-height: 1.6;
  resize: vertical;
}

.select {
  appearance: none;
  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='%2366736D' 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");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 40px;
}

[dir="rtl"] .select {
  background-position: left 14px center;
  padding-left: 40px;
  padding-right: var(--sp-4);
}

/* Input with icon */
.input-wrap {
  position: relative;
}

.input-wrap .input {
  padding-left: 44px;
}

.input-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
  width: 18px;
  height: 18px;
}

[dir="rtl"] .input-wrap .input {
  padding-left: 44px;
  padding-right: var(--sp-4);
}

/* ─── Card ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-xs);
}

.card-lg { padding: var(--sp-6); }
.card-sm { padding: var(--sp-4); }
.card-flat { box-shadow: none; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-4);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.card-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: var(--sp-1);
}

/* ─── Badge / Chip ──────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 22px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-error {
  background: var(--error-bg);
  color: var(--error);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

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

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ─── Alert ─────────────────────────────────────────────── */
.alert {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid;
}

.alert svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }

.alert-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: #1E4D6F;
}

.alert-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: #0E5C3F;
}

.alert-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: #7A5214;
}

.alert-error {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: #8B3030;
}

/* ─── Divider ───────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  border: none;
}

.divider-y {
  width: 1px;
  background: var(--border);
  align-self: stretch;
}

/* ─── List ──────────────────────────────────────────────── */
.list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.list-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
  cursor: pointer;
  text-align: right;
  width: 100%;
}

[dir="ltr"] .list-row { text-align: left; }

.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-2); }

.list-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.list-icon.success {
  background: var(--success-bg);
  color: var(--success);
}

.list-icon.error {
  background: var(--error-bg);
  color: var(--error);
}

.list-icon.brand {
  background: var(--brand-light);
  color: var(--brand);
}

.list-content { flex: 1; min-width: 0; }

.list-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.list-end {
  flex-shrink: 0;
  text-align: left;
}

[dir="rtl"] .list-end { text-align: left; }
[dir="ltr"] .list-end { text-align: right; }

.list-amount {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.list-amount.credit { color: var(--success); }

/* ─── Table ─────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

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

.table th {
  text-align: right;
  padding: var(--sp-3) var(--sp-4);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

.table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }

/* ─── Empty State ───────────────────────────────────────── */
.empty {
  text-align: center;
  padding: var(--sp-10) var(--sp-5);
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  color: var(--text-3);
  display: grid;
  place-items: center;
  margin: 0 auto var(--sp-4);
}

.empty-icon svg { width: 24px; height: 24px; }

.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-2);
}

.empty-desc {
  font-size: 13px;
  color: var(--text-2);
  max-width: 320px;
  margin: 0 auto var(--sp-5);
}

/* ─── Skeleton ──────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    var(--surface-3) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  border-radius: var(--r-sm);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

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

.skeleton-text { height: 14px; margin-bottom: var(--sp-2); }
.skeleton-title { height: 20px; width: 40%; margin-bottom: var(--sp-3); }
.skeleton-circle { border-radius: 50%; }
.skeleton-card { height: 80px; border-radius: var(--r-lg); }

/* ─── Modal / Sheet ─────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(23, 32, 28, 0.4);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 640px) {
  .overlay { align-items: center; padding: var(--sp-4); }
}

.overlay.open { display: flex; }

.modal {
  background: var(--surface);
  width: 100%;
  max-width: 480px;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--sp-6);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--dur-slow) var(--ease-out);
}

@media (min-width: 640px) {
  .modal { border-radius: var(--r-xl); }
}

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

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-5);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  display: grid;
  place-items: center;
  transition: all var(--dur-fast) var(--ease);
}

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

/* ─── Toast ─────────────────────────────────────────────── */
#toasts {
  position: fixed;
  top: var(--sp-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: min(92vw, 400px);
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toast-in var(--dur) var(--ease-out);
}

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

.toast svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast.success { border-color: var(--success-border); }
.toast.success svg { color: var(--success); }
.toast.error { border-color: var(--error-border); }
.toast.error svg { color: var(--error); }

/* ─── Section ───────────────────────────────────────────── */
.section {
  padding: var(--sp-12) 0;
}

@media (min-width: 768px) {
  .section { padding: var(--sp-16) 0; }
}

.section-head {
  margin-bottom: var(--sp-6);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
}

.section-desc {
  font-size: 13.5px;
  color: var(--text-2);
  margin-top: var(--sp-2);
}

/* ─── Card Component (Virtual Card) ─────────────────────── */
.vcard {
  position: relative;
  aspect-ratio: 1.586 / 1;
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  color: #F5F4EF;
  overflow: hidden;
  background: linear-gradient(135deg, #1E4D3D 0%, #183C30 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 4px 12px -2px rgba(20, 30, 25, 0.2),
    0 12px 32px -8px rgba(20, 30, 25, 0.15);
}

.vcard::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  opacity: 0.06;
  pointer-events: none;
}

.vcard-light {
  background: linear-gradient(135deg, #F5F4EF 0%, #E8E6DE 100%);
  color: #183C30;
}

.vcard-graphite {
  background: linear-gradient(135deg, #202523 0%, #15181A 100%);
  color: #F5F4EF;
}

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

.vcard-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: auto;
}

.vcard-brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.vcard-tier {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.vcard-chip {
  width: 36px;
  height: 26px;
  border-radius: 4px;
  margin-bottom: var(--sp-4);
  background:
    linear-gradient(135deg,
      #E8D7A8 0%,
      #C9B678 25%,
      #F0E0B8 50%,
      #C9B678 75%,
      #E8D7A8 100%);
  box-shadow:
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.15);
  position: relative;
}

.vcard-chip::before,
.vcard-chip::after {
  content: '';
  position: absolute;
  background: rgba(0, 0, 0, 0.12);
}

.vcard-chip::before {
  inset: 4px 6px;
  border-top: 0.5px solid;
  border-bottom: 0.5px solid;
}

.vcard-chip::after {
  top: 4px;
  bottom: 4px;
  left: 50%;
  width: 0.5px;
}

.vcard-number {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.08em;
  direction: ltr;
  margin-bottom: var(--sp-5);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

.vcard-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--sp-4);
}

.vcard-field {
  flex: 1;
  min-width: 0;
}

.vcard-label {
  font-size: 8.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.6;
  margin-bottom: 3px;
}

.vcard-value {
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vcard-brand-logo {
  height: 24px;
  width: auto;
  flex-shrink: 0;
}

/* Card states */
.vcard.frozen { opacity: 0.7; }
.vcard.frozen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(23, 32, 28, 0.3);
  backdrop-filter: blur(2px);
}

.vcard.blocked { opacity: 0.5; }

/* Card back */
.vcard-back {
  aspect-ratio: 1.586 / 1;
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, #183C30 0%, #0F2620 100%);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  color: #F5F4EF;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.vcard-stripe {
  height: 42px;
  margin: calc(var(--sp-5) * -1) calc(var(--sp-5) * -1) 0;
  background: #0A1310;
}

.vcard-signature {
  display: flex;
  margin-top: var(--sp-4);
  background: #F5F4EF;
  border-radius: 4px;
  overflow: hidden;
}

.vcard-signature-bar {
  flex: 1;
  height: 34px;
  background: repeating-linear-gradient(
    135deg,
    #D6DBD8 0 8px,
    #C4CBC7 8px 16px
  );
}

.vcard-cvv {
  background: #F5F4EF;
  color: #183C30;
  display: grid;
  place-items: center;
  padding: 0 var(--sp-3);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

/* ─── Skeleton for cards ────────────────────────────────── */
.vcard-skeleton {
  aspect-ratio: 1.586 / 1;
  border-radius: var(--r-xl);
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    var(--surface-3) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* ─── Header / Bar ──────────────────────────────────────── */
.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--bar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-4);
}

@media (min-width: 1024px) {
  .bar { padding: 0 var(--sp-8); }
}

.bar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.bar-actions {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

[dir="rtl"] .bar-actions { margin-right: auto; margin-left: 0; }
[dir="ltr"] .bar-actions { margin-left: auto; margin-right: 0; }

.bar-balance {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
}

/* ─── Icon Button ───────────────────────────────────────── */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: all var(--dur-fast) var(--ease);
  position: relative;
  flex-shrink: 0;
}

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

.icon-btn svg { width: 20px; height: 20px; }

.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--error);
  border: 2px solid var(--surface);
}

/* ─── Bottom Nav (Mobile) ───────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: calc(var(--dock-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
}

@media (min-width: 1024px) {
  .bottom-nav { display: none; }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 500;
  transition: color var(--dur-fast) var(--ease);
  position: relative;
}

.nav-item svg { width: 22px; height: 22px; }

.nav-item.active {
  color: var(--brand);
  font-weight: 600;
}

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
  display: none;
  width: 240px;
  padding: var(--sp-6) var(--sp-3);
  border-left: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
}

[dir="ltr"] .sidebar {
  border-left: none;
  border-right: 1px solid var(--border);
}

@media (min-width: 1024px) {
  .sidebar { display: block; }
}

.sidebar-group {
  margin-bottom: var(--sp-4);
}

.sidebar-label {
  display: block;
  padding: 0 var(--sp-3);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-2);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--dur-fast) var(--ease);
  width: 100%;
  text-align: right;
  margin-bottom: 2px;
}

[dir="ltr"] .sidebar-item { text-align: left; }

.sidebar-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-item.active {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
}

.sidebar-badge {
  margin-right: auto;
  background: var(--brand);
  color: var(--text-inverse);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  min-width: 20px;
  text-align: center;
}

[dir="ltr"] .sidebar-badge { margin-right: 0; margin-left: auto; }

/* ─── App Shell ─────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 100vh;
}

@media (min-width: 1024px) {
  .app-shell { grid-template-columns: 1fr 240px; }
  [dir="ltr"] .app-shell { grid-template-columns: 240px 1fr; }
}

.app-main {
  min-width: 0;
  padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom) + var(--sp-4));
}

@media (min-width: 1024px) {
  .app-main { padding-bottom: var(--sp-8); }
}

.app-content {
  padding: var(--sp-5) var(--sp-4);
  max-width: var(--max-w);
  margin: 0 auto;
}

@media (min-width: 640px) {
  .app-content { padding: var(--sp-6); }
}

@media (min-width: 1024px) {
  .app-content { padding: var(--sp-8); }
}

/* ─── Page transitions ──────────────────────────────────── */
.page-enter {
  animation: page-in var(--dur-slow) var(--ease-out);
}

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

/* ─── Balance Card (Dashboard) ──────────────────────────── */
.balance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-xs);
}

.balance-label {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: var(--sp-2);
}

.balance-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.balance-secondary {
  font-size: 14px;
  color: var(--text-3);
  margin-top: var(--sp-2);
  font-variant-numeric: tabular-nums;
}

.balance-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}

.balance-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  transition: all var(--dur-fast) var(--ease);
  text-align: center;
}

.balance-action:hover {
  background: var(--surface-2);
  color: var(--text);
}

.balance-action .icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--brand-light);
  color: var(--brand);
  display: grid;
  place-items: center;
}

.balance-action .icon svg { width: 20px; height: 20px; }

/* ─── Service Card (Shop, Subscriptions) ────────────────── */
.service-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: all var(--dur) var(--ease);
  cursor: pointer;
  text-align: right;
  width: 100%;
}

[dir="ltr"] .service-card { text-align: left; }

.service-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow-sm);
}

.service-card:active {
  transform: scale(0.995);
}

.service-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}

.service-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.service-logo svg { width: 24px; height: 24px; color: var(--text-3); }

.service-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.service-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}

.service-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: var(--sp-1);
}

.service-price-unit {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
}

/* ─── Segmented Control ─────────────────────────────────── */
.segments {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  gap: 2px;
}

.segment {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
}

.segment:hover { color: var(--text); }

.segment.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ─── Tabs ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: var(--sp-3) var(--sp-4);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* ─── Pill filters ──────────────────────────────────────── */
.pills {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.pills::-webkit-scrollbar { display: none; }

.pill {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}

.pill:hover {
  border-color: var(--border-3);
  color: var(--text);
}

.pill.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--text-inverse);
}

/* ─── QR / Copy Box ─────────────────────────────────────── */
.copy-box {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.copy-value {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.copy-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: all var(--dur-fast) var(--ease);
}

.copy-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ─── Utility ───────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.p-0 { padding: 0; }
.p-4 { padding: var(--sp-4); }
.p-5 { padding: var(--sp-5); }
.p-6 { padding: var(--sp-6); }

/* ─── Focus visible ─────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

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

::selection {
  background: var(--brand-light);
  color: var(--text);
}

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

/* ─── Print ─────────────────────────────────────────────── */
@media print {
  .bar, .bottom-nav, .sidebar, .btn { display: none !important; }
   }

/* v6 — أحجام أيقونات الأزرار ومتجر */
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-sm svg { width: 14px; height: 14px; }
.prod-ph svg { width: 34px; height: 34px; opacity: .55; }
.service-card[disabled] { opacity: .5; cursor: default; }
@media (prefers-reduced-motion: reduce) { .page-enter, .page-enter > * { animation: none !important; } }

/* v7.1 — المتجر: بطاقات منتجات وأقسام وصور */
.prod-card { display:flex; flex-direction:column; text-align:right; padding:0; overflow:hidden; border-radius:16px;
  background:var(--surface-1, #161b19); border:1px solid var(--border, #2a312d); cursor:pointer; transition:transform .15s, border-color .15s; width:100%; }
.prod-card:active { transform:scale(.98); }
.prod-card:hover { border-color:var(--brand, #c9a24a); }
.prod-card[data-na] { opacity:.6; }
.prod-img { position:relative; aspect-ratio:4/3; width:100%; background:linear-gradient(135deg, var(--surface-2, #1d2421), #0f1312); display:grid; place-items:center; overflow:hidden; }
.prod-img img { width:100%; height:100%; object-fit:cover; }
.prod-tag { position:absolute; top:8px; left:8px; background:var(--error, #c0392b); color:#fff; font-size:11px; font-weight:700; padding:2px 8px; border-radius:999px; }
.prod-fast, .prod-na { position:absolute; bottom:8px; right:8px; font-size:10.5px; padding:2px 8px; border-radius:999px; background:rgba(0,0,0,.65); color:#e9e4d6; backdrop-filter:blur(4px); }
.prod-na { color:#f1948a; }
.prod-body { padding:10px 12px 12px; }
.prod-name { font-weight:600; font-size:13.5px; line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; min-height:40px; }
.prod-price { display:flex; gap:8px; align-items:baseline; margin-top:6px; }
.prod-price b { color:var(--brand, #c9a24a); font-size:14px; }
.prod-price s { font-size:11px; color:var(--text-3, #7d7869); }
.cat-tile { position:relative; aspect-ratio:16/10; border-radius:16px; overflow:hidden; border:1px solid var(--border, #2a312d);
  background:linear-gradient(135deg, var(--surface-2, #1d2421), #0f1312); display:grid; place-items:center; cursor:pointer; padding:0; width:100%; }
.cat-tile img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.cat-tile::after { content:''; position:absolute; inset:0; background:linear-gradient(to top, rgba(0,0,0,.75), rgba(0,0,0,0) 60%); }
.cat-tile .cat-ico { font-size:34px; margin-bottom:18px; }
.cat-tile .cat-name { position:absolute; bottom:10px; right:12px; left:12px; z-index:1; color:#fff; font-weight:700; font-size:14px; text-align:right; }
.cat-tile[disabled] { opacity:.5; cursor:default; }
.prod-hero { width:100%; aspect-ratio:16/10; border-radius:14px; overflow:hidden; margin-bottom:12px; background:#0f1312; cursor:zoom-in; }
.prod-hero img { width:100%; height:100%; object-fit:cover; }
.img-zoom { position:fixed; inset:0; z-index:9999; background:rgba(0,0,0,.92); display:grid; place-items:center; padding:16px; cursor:zoom-out; }
.img-zoom img { max-width:100%; max-height:90vh; border-radius:12px; object-fit:contain; }

.prod-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; }
@media (min-width: 768px) { .prod-grid { grid-template-columns:repeat(3, minmax(0, 1fr)); gap:14px; } }
@media (min-width: 1200px) { .prod-grid { grid-template-columns:repeat(4, minmax(0, 1fr)); } }
