/* =============================================================
   use808.digital — CSS Design System
   Mobile-first · RTL-aware · CSS Custom Properties
   ============================================================= */

@font-face {
  font-family: 'Edu AU VIC WA NT Hand';
  src: url('/assets/fonts/EduAUVICWANTHand-400.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Edu AU VIC WA NT Hand';
  src: url('/assets/fonts/EduAUVICWANTHand-500.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ── Design Tokens ──────────────────────────────────────── */
:root {
  /* Brand — ink + dark cyan/teal (logo 0) */
  --color-ink:            #1C2434;
  --color-teal:           #0D9498;
  --color-teal-dark:      #0A7478;
  --color-teal-light:     #14B8B8;
  --color-primary:        var(--color-teal);
  --color-primary-dark:   var(--color-teal-dark);
  --color-primary-light:  var(--color-teal-light);
  --color-secondary:      var(--color-ink);
  --color-accent:         #C9862A;

  /* Neutral palette */
  --color-gray-50:  #F6F7F8;
  --color-gray-100: #EEF1F3;
  --color-gray-200: #E2E6EA;
  --color-gray-300: #C8CED6;
  --color-gray-400: #8B95A1;
  --color-gray-500: #66707C;
  --color-gray-600: #4A5560;
  --color-gray-700: #33404A;
  --color-gray-800: #1F2A33;
  --color-gray-900: var(--color-ink);

  /* Semantic colours */
  --color-success:  #0D9498;
  --color-warning:  #C9862A;
  --color-danger:   #C24141;
  --color-info:     #2F6F7E;

  /* Surfaces */
  --color-bg:       #F2F4F7;
  --color-surface:  #FFFFFF;
  --color-border:   #E6EAF0;
  --color-sidebar:  #FFFFFF;
  --color-teal-soft:#E7F6F6;

  /* Typography */
  --font-sans: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-arabic: 'IBM Plex Sans Arabic', var(--font-sans);
  --font-brand: 'Edu AU VIC WA NT Hand', 'Edu VIC WA NT Hand', cursive;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;

  /* Control rhythm — buttons & inputs share one height scale */
  --control-h-sm: 2rem;      /* 32px */
  --control-h-md: 2.5rem;    /* 40px */
  --control-h-lg: 3rem;      /* 48px */
  --control-px-sm: 0.75rem;
  --control-px-md: 1rem;
  --control-px-lg: 1.25rem;

  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* Spacing (8-point grid) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border radius */
  --radius-sm:   0.375rem;
  --radius-md:   0.625rem;
  --radius-lg:   1rem;
  --radius-xl:   1.25rem;
  --radius-full: 9999px;

  /* Shadows — soft elevation (light SaaS) */
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.04);
  --shadow-md: 0 4px 16px rgb(16 24 40 / 0.06);
  --shadow-lg: 0 12px 32px rgb(16 24 40 / 0.08);
  --shadow-xl: 0 20px 40px rgb(16 24 40 / 0.1);
  --shadow-card: 0 1px 2px rgb(16 24 40 / 0.03), 0 8px 24px rgb(16 24 40 / 0.05);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --container-max: 1280px;
  --sidebar-width: 260px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-gray-800);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[dir="rtl"] body, body.rtl {
  font-family: var(--font-arabic);
  direction: rtl;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -100px;
  z-index: 1000;
  background: var(--color-ink);
  color: #fff;
  padding: .65rem 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
}
.skip-link:focus {
  top: 1rem;
}

.sidebar-nav a:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-bold);
  line-height: 1.25;
  color: var(--color-gray-900);
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

/* ── Container ───────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

@media (min-width: 640px)  { .container { padding-inline: var(--space-6); } }
@media (min-width: 1024px) { .container { padding-inline: var(--space-8); } }

/* ── Grid ────────────────────────────────────────────────── */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
}

/* ── Flex utilities ──────────────────────────────────────── */
.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between{ justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2  { gap: var(--space-2); }
.gap-4  { gap: var(--space-4); }
.gap-6  { gap: var(--space-6); }
.gap-8  { gap: var(--space-8); }

/* ── Brand mark: use + handwritten 808 + .digital ───────── */
/* Always LTR — domain must never reverse under Arabic dir=rtl */
.brand-mark {
  display: inline-flex;
  align-items: baseline;
  color: inherit;
  text-decoration: none !important;
  line-height: 1;
  font-size: var(--brand-size, 1.75rem);
  direction: ltr;
  unicode-bidi: isolate;
}
.brand-mark:hover { text-decoration: none !important; }
.brand-mark-wordmark {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
}
.brand-prefix,
.brand-suffix {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.52em;
  letter-spacing: 0.01em;
  color: var(--color-ink);
  opacity: 0.88;
}
.brand-prefix { margin-inline-end: 0.06em; }
.brand-suffix { margin-inline-start: 0.02em; }
.brand-mark-808 {
  font-family: var(--font-brand);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.85;
  font-size: 1em;
}
.brand-mark .brand-8 { color: var(--color-ink); }
.brand-mark .brand-0 { color: var(--color-teal); }
.brand-mark--on-dark .brand-8 { color: #fff; }
.brand-mark--on-dark .brand-0 { color: var(--color-teal-light); }
.brand-mark--on-dark .brand-prefix,
.brand-mark--on-dark .brand-suffix { color: rgba(255,255,255,.88); opacity: 1; }
/* Legacy aliases (no-op layouts kept for old class names) */
.brand-mark--stack,
.brand-mark--horizontal,
.brand-mark--wordmark { /* integrated wordmark */ }

/* ── Custom file upload ──────────────────────────────────── */
.file-upload { display: grid; gap: .65rem; position: relative; }
.file-upload-preview img {
  height: 64px; width: auto; border-radius: 10px; object-fit: cover;
  border: 1px solid var(--color-border);
}
.file-upload-drop {
  display: grid; gap: .35rem; justify-items: center; text-align: center;
  padding: 1.25rem 1rem; border: 1.5px dashed var(--color-border);
  border-radius: 12px; background: var(--color-gray-50, #f7f8f9);
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.file-upload-drop:hover,
.file-upload.is-dragover .file-upload-drop {
  border-color: var(--color-teal); background: rgba(13,148,152,.06);
}
.file-upload-icon { color: var(--color-teal); }
.file-upload-icon svg { width: 1.35rem; height: 1.35rem; }
.file-upload-title { font-size: .9rem; font-weight: 600; color: var(--color-ink); }
.file-upload-hint { font-size: .78rem; color: var(--color-gray-500); }
.file-upload-btn {
  margin-top: .25rem; font-size: .8rem; font-weight: 600; color: var(--color-teal);
}
.file-upload-name { font-size: .8rem; color: var(--color-gray-700); word-break: break-all; }
.file-upload-input {
  position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0,0,0,0);
}

/* ── Wizard stepper ──────────────────────────────────────── */
.wizard-steps {
  display: flex; flex-wrap: wrap; gap: .65rem; align-items: center;
}
.wizard-step {
  display: inline-flex; align-items: center; gap: .45rem;
  text-decoration: none; color: var(--color-gray-600);
  padding: .45rem .75rem; border-radius: 999px;
  border: 1px solid var(--color-border); background: #fff;
  font-size: .85rem; font-weight: 500;
}
.wizard-step-num {
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; background: var(--color-gray-100);
  color: var(--color-gray-600);
}
.wizard-step.is-done {
  border-color: rgba(13,148,152,.35); color: var(--color-ink);
}
.wizard-step.is-done .wizard-step-num {
  background: rgba(13,148,152,.15); color: var(--color-teal);
}
.wizard-step.is-current {
  border-color: var(--color-teal); background: rgba(13,148,152,.08);
  color: var(--color-ink); font-weight: 600;
}
.wizard-step.is-current .wizard-step-num {
  background: var(--color-teal); color: #fff;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-sizing: border-box;
  height: var(--control-h-md);
  min-height: var(--control-h-md);
  padding: 0 var(--control-px-md);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  vertical-align: middle;
}

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

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
  text-decoration: none;
}

.btn-secondary {
  background: var(--color-gray-100);
  color: var(--color-gray-800);
  border-color: var(--color-border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--color-gray-200);
  text-decoration: none;
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.btn-danger:hover:not(:disabled) { background: #A83333; text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--color-gray-600);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--color-gray-100); text-decoration: none; }

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline:hover:not(:disabled) {
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
}

.btn-sm {
  height: var(--control-h-sm);
  min-height: var(--control-h-sm);
  padding: 0 var(--control-px-sm);
  font-size: var(--text-xs);
}
.btn-lg {
  height: var(--control-h-lg);
  min-height: var(--control-h-lg);
  padding: 0 var(--control-px-lg);
  font-size: var(--text-base);
}

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-5); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-gray-700);
  margin-bottom: var(--space-2);
}

.form-control,
.form-input {
  width: 100%;
  box-sizing: border-box;
  height: var(--control-h-md);
  min-height: var(--control-h-md);
  padding: 0 var(--control-px-md);
  font-family: inherit;
  font-size: var(--text-sm);
  line-height: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--color-gray-900);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
}

textarea.form-control,
textarea.form-input {
  height: auto;
  min-height: 6.5rem;
  padding: var(--space-3) var(--control-px-md);
  line-height: 1.5;
  resize: vertical;
}

.form-control:focus,
.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgb(13 148 152 / 0.18);
}

.form-control.is-invalid,
.form-input.is-invalid { border-color: var(--color-danger); }
.form-control.is-invalid:focus,
.form-input.is-invalid:focus { box-shadow: 0 0 0 3px rgb(239 68 68 / 0.15); }

.form-error {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

.form-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-gray-500);
  margin-top: var(--space-1);
}

textarea.form-control,
textarea.form-input { min-height: 120px; resize: vertical; }
select.form-control,
select.form-input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right var(--space-3) center; padding-right: var(--space-8); }

[dir="rtl"] select.form-control,
[dir="rtl"] select.form-input { background-position: left var(--space-3) center; padding-right: var(--space-3); padding-left: var(--space-8); }

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.card-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-gray-900);
}

.card-body  { padding: var(--space-6); }
.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Table ───────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th,
.table td {
  text-align: start;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.table th {
  font-weight: var(--weight-semibold);
  color: var(--color-gray-600);
  background: var(--color-gray-50);
  white-space: nowrap;
}

.table tr:hover > td { background: var(--color-gray-50); }
.table tr:last-child > td { border-bottom: none; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15em var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-info    { background: #E6F7F7; color: #0A5F62; }
.badge-gray    { background: var(--color-gray-100); color: var(--color-gray-700); }
.badge-primary { background: #E6F7F7; color: var(--color-teal-dark); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  border-width: 1px;
  border-style: solid;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.alert-success { background: #ECFDF5; border-color: #6EE7B7; color: #065F46; }
.alert-error   { background: #FEF2F2; border-color: #FCA5A5; color: #991B1B; }
.alert-warning { background: #FFFBEB; border-color: #FCD34D; color: #92400E; }
.alert-info    { background: #E6F7F7; border-color: #99D8D9; color: #0A5F62; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgb(0 0 0 / 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.modal-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-gray-500);
  font-size: var(--text-xl);
  line-height: 1;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--color-gray-100); }

.modal-body   { padding: var(--space-6); }
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: var(--space-1);
  align-items: center;
  flex-wrap: wrap;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-gray-700);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.page-link:hover { background: var(--color-gray-100); text-decoration: none; }
.page-link.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.page-link:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Dashboard Layout (soft light shell) ─────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg);
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  color: var(--color-gray-800);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 100;
  overflow-y: auto;
  border-inline-end: 1px solid var(--color-border);
  box-shadow: none;
}

.sidebar-brand {
  padding: 1.25rem 1.35rem 1rem;
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-ink);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-tenant {
  margin: .85rem 1rem 0;
  padding: .85rem .9rem;
  border-radius: var(--radius-lg);
  background: var(--color-gray-50);
  border: 1px solid var(--color-border);
}
.sidebar-tenant-label {
  font-size: .7rem;
  font-weight: 600;
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .2rem;
}
.sidebar-tenant-name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--color-ink);
  line-height: 1.3;
}
.sidebar-tenant-switch {
  display: inline-block;
  margin-top: .35rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--color-teal);
  text-decoration: none;
}
.sidebar-tenant-switch:hover { color: var(--color-teal-dark); text-decoration: none; }

.sidebar-nav {
  flex: 1;
  padding: .85rem .75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .85rem;
  color: var(--color-gray-600);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: .75rem;
  border-inline-start: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-nav a:hover {
  background: var(--color-gray-50);
  color: var(--color-ink);
  text-decoration: none;
}

.sidebar-nav a.active {
  background: var(--color-teal-soft);
  color: var(--color-teal-dark);
  font-weight: 600;
  text-decoration: none;
}

.sidebar-nav a svg {
  width: 1.1rem;
  height: 1.1rem;
  opacity: .85;
  flex-shrink: 0;
  color: currentColor;
}

.sidebar-nav .nav-section-title {
  padding: 1rem .85rem .4rem;
  font-size: .68rem;
  font-weight: 700;
  color: var(--color-gray-400);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.main-content {
  margin-inline-start: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  background: rgb(255 255 255 / 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  padding: 0 1.35rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-toggle {
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--color-gray-600);
  display: inline-flex;
  padding: .4rem;
  border-radius: .6rem;
}
.topbar-toggle:hover { background: var(--color-gray-100); color: var(--color-ink); }
.topbar-toggle svg { width: 1.35rem; height: 1.35rem; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-inline-start: auto;
}
.topbar-lang {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--color-gray-500);
  text-decoration: none;
}
.topbar-lang:hover { color: var(--color-teal); text-decoration: none; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.topbar-email {
  font-size: .8125rem;
  color: var(--color-gray-600);
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-content {
  padding: 1.5rem 1.5rem 2.5rem;
  flex: 1;
  max-width: 1120px;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -.02em;
  line-height: 1.25;
}
.page-subtitle {
  margin: .35rem 0 0;
  color: var(--color-gray-500);
  font-size: .875rem;
  line-height: 1.5;
}

/* ── Stats Cards ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-card);
}

.stat-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--color-gray-500);
  margin-bottom: .45rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -.02em;
  line-height: 1.1;
}

.stat-change {
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}

.stat-change.up   { color: var(--color-success); }
.stat-change.down { color: var(--color-danger); }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-gray-500);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-state-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-gray-700);
  margin-bottom: var(--space-2);
}

.empty-state-desc { margin-bottom: var(--space-6); }

/* ── Toast Notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  inset-block-end: var(--space-6);
  inset-inline-end: var(--space-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 360px;
}

.toast {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

.toast-success { border-inline-start: 4px solid var(--color-success); }
.toast-error   { border-inline-start: 4px solid var(--color-danger);  }
.toast-warning { border-inline-start: 4px solid var(--color-warning); }

/* ── Loading Spinner ─────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--color-gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* ── Public page specific styles ─────────────────────────── */
.public-header {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.hero-section {
  position: relative;
  overflow: hidden;
  min-height: 400px;
  display: flex;
  align-items: center;
}

.hero-cover {
  position: absolute;
  inset: 0;
  object-fit: cover;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgb(0 0 0 / 0.4), rgb(0 0 0 / 0.6));
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  color: #fff;
}

.section-block {
  padding-block: var(--space-16);
  border-bottom: 1px solid var(--color-border);
}

.section-block:last-child { border-bottom: none; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-6);
}

.product-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: block;
  color: inherit;
  text-decoration: none;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.product-card:hover {
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-2px);
}
.product-card:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.product-card-image {
  aspect-ratio: 4/3;
  object-fit: cover;
  width: 100%;
}

.product-card-body { padding: var(--space-4); }

.product-card-name {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-gray-900);
  margin-bottom: var(--space-2);
}

.product-card-price {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-primary);
}

/* ── Responsive overrides ────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="rtl"] .sidebar.open { transform: translateX(0); }
  .main-content { margin-inline-start: 0; }
}

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

/* ── Utility classes ─────────────────────────────────────── */
.text-center { text-align: center; }
.text-start  { text-align: start; }
.text-end    { text-align: end; }
.text-sm     { font-size: var(--text-sm); }
.text-muted  { color: var(--color-gray-500); }
.fw-bold     { font-weight: var(--weight-bold); }
.mt-4        { margin-top: var(--space-4); }
.mb-4        { margin-bottom: var(--space-4); }
.mb-6        { margin-bottom: var(--space-6); }
.mb-8        { margin-bottom: var(--space-8); }
.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; }
.rounded     { border-radius: var(--radius-md); }
.w-full      { width: 100%; }

/* ── Auth / selector shells ──────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(700px 360px at 80% 0%, rgba(13,148,152,.12), transparent 55%),
    var(--color-bg);
}
.auth-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-md);
  position: relative;
}
.auth-logo { text-align: center; margin-bottom: 1.75rem; display: flex; justify-content: center; }
.auth-title { font-size: 1.5rem; font-weight: 700; margin: 0 0 .5rem; text-wrap: balance; }
.auth-subtitle { color: var(--color-gray-500); font-size: .875rem; margin: 0 0 1.5rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: .875rem; color: var(--color-gray-600); }
.biz-list { margin-bottom: 1rem; }
.biz-btn {
  display: block; width: 100%; text-align: start;
  padding: 1rem 1.25rem; margin-bottom: .75rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: #fff; cursor: pointer; color: var(--color-ink);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.biz-btn strong { display: block; font-weight: 600; }
.biz-btn span { display: block; font-size: .8125rem; color: var(--color-gray-500); margin-top: .2rem; }
.biz-btn:hover { border-color: var(--color-teal); background: rgba(13,148,152,.06); }
.biz-create { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--color-border); }

/* ── Public storefront (products list/detail) ────────────── */
.storefront { background: var(--color-bg); min-height: 100vh; }
.storefront-header {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 20;
}
.storefront-header-inner {
  min-height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.storefront-brand {
  font-size: 1.15rem; font-weight: 700; color: var(--color-ink);
  text-decoration: none; text-wrap: balance;
}
.storefront-brand:hover { color: var(--color-teal); text-decoration: none; }
.storefront-main { padding-block: 2rem 3rem; }
.storefront-page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.75rem;
}
.storefront-page-head h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); text-wrap: balance; }
.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
.product-detail-media img {
  width: 100%; border-radius: var(--radius-xl);
  object-fit: cover; max-height: 480px; background: var(--color-gray-100);
  aspect-ratio: 1;
}
.product-detail-body h1 { margin: 0 0 .75rem; font-size: clamp(1.4rem, 3vw, 1.85rem); text-wrap: balance; }
.product-detail-price {
  font-size: 1.5rem; font-weight: 700; color: var(--color-teal);
  margin: 0 0 1rem; font-variant-numeric: tabular-nums;
}
.product-detail-lead { color: var(--color-gray-700); margin: 0 0 1rem; }
.product-detail-desc { color: var(--color-gray-600); line-height: 1.7; }
@media (max-width: 720px) {
  .product-detail { grid-template-columns: 1fr; }
}

/* ── Soft motion helpers ─────────────────────────────────── */
.motion-fade-up {
  animation: uiFadeUp .7s ease both;
}
@keyframes uiFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .motion-fade-up { animation: none; }
  .product-card:hover { transform: none; }
}

html { color-scheme: light; }
body { touch-action: manipulation; -webkit-tap-highlight-color: rgba(13,148,152,.12); }

/* ── Dashboard home — soft light widgets ─────────────────── */
.dash-panel {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1.25rem;
}
.dash-panel-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.dash-kicker {
  font-size: .78rem;
  font-weight: 600;
  color: var(--color-gray-500);
  margin-bottom: .4rem;
}
.dash-metric {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: -.02em;
  line-height: 1.1;
}
.dash-share {
  grid-column: 1 / -1;
  padding-top: .35rem;
  border-top: 1px solid var(--color-border);
}
.dash-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-start;
}
.dash-qr {
  text-align: center;
  flex-shrink: 0;
}
.dash-qr img {
  display: block;
  width: 140px;
  height: 140px;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: #fff;
}
.dash-qr .btn { margin-top: .65rem; }
.dash-share-main { flex: 1; min-width: min(100%, 220px); }
.dash-link-box {
  display: block;
  word-break: break-all;
  padding: .8rem .9rem;
  background: var(--color-gray-50);
  border-radius: 12px;
  font-size: .85rem;
  color: var(--color-ink);
  border: 1px solid var(--color-border);
}
.dash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}
.dash-quick {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 1.5rem;
}
.dash-quick-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 1.15rem 1.2rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.dash-quick-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: inherit;
}
.dash-quick-card strong {
  display: block;
  margin-bottom: .3rem;
  font-size: .95rem;
}
.dash-quick-card span {
  color: var(--color-gray-500);
  font-size: .82rem;
  line-height: 1.45;
}
.dash-check-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.dash-check {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .7rem;
  border-radius: .75rem;
  color: var(--color-ink);
  text-decoration: none;
  font-size: .875rem;
  transition: background .15s ease;
}
.dash-check:hover { background: var(--color-gray-50); text-decoration: none; color: var(--color-ink); }
.dash-check.is-done { opacity: .55; }
.dash-check.is-done .dash-check-label { text-decoration: line-through; }
.dash-check-dot {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  border: 2px solid var(--color-gray-300);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: .7rem;
  color: #fff;
}
.dash-check.is-done .dash-check-dot {
  border-color: var(--color-teal);
  background: var(--color-teal);
}
.card-title-sm { font-size: 1rem; }
@media (max-width: 800px) {
  .dash-quick { grid-template-columns: 1fr; }
  .topbar-email { display: none; }
  .page-content { padding: 1.15rem 1rem 2rem; }
}
