/* ═══════════════════════════════════════════════════════════════
   DotStudio® POS — APPLE 2026 DESIGN SYSTEM
   "Liquid Glass" tokens, typography, base styles and utilities.
   Loaded FIRST on every page. Legacy token names are kept as
   aliases so every existing dashboard keeps working unchanged.
   ═══════════════════════════════════════════════════════════════ */

/* Fonts live in assets/css/fonts.css and are loaded before this file. */

/* ───────────────────────── APPLE TOKENS ───────────────────────── */
:root {
  color-scheme: dark;

  /* Backgrounds — true black canvas + frosted glass layers */
  --bg-body: #000000;
  --bg-surface: #1C1C1E;
  --bg-primary: #000000;
  --bg-elevated: rgba(28, 28, 30, 0.72);
  --bg-glass: rgba(28, 28, 30, 0.72);

  /* Text — Apple label hierarchy */
  --text-primary: #F5F5F7;
  --text-secondary: #86868B;
  --text-tertiary: #48484A;

  /* Apple accents */
  --accent: #007AFF;
  --accent-blue: #007AFF;
  --accent-green: #30D158;
  --accent-lime: #82FF1F;
  --accent-red: #FF453A;
  --accent-yellow: #FFD60A;
  --accent-orange: #FF9F0A;
  --accent-purple: #BF5AF2;
  --accent-teal: #64D2FF;
  --accent-indigo: #5E5CE6;

  /* Radius — continuous-curve Apple geometry */
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 44px;
  --radius-xs: 6px;
  --radius-2xl: 36px;
  --radius-full: 999px;

  /* Blur + materials */
  --blur-glass: 50px;
  --blur-soft: 24px;
  --material-thin: rgba(255, 255, 255, 0.03);
  --material-regular: rgba(255, 255, 255, 0.06);
  --material-thick: rgba(255, 255, 255, 0.10);
  --material-dark: rgba(22, 22, 24, 0.78);

  /* Shadows — soft, floating, never harsh */
  --shadow-float: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.36);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.34);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 48px 120px rgba(0, 0, 0, 0.65);
  --shadow-lime: 0 12px 40px rgba(130, 255, 31, 0.28);
  --shadow-blue: 0 12px 40px rgba(0, 122, 255, 0.32);
  --ring: 0 0 0 3px rgba(0, 122, 255, 0.28);
  --ring-lime: 0 0 0 3px rgba(130, 255, 31, 0.24);

  /* Motion — Apple spring-like easing */
  --transition-apple: all 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-fast: 160ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-base: 280ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-slow: 480ms cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* ── Legacy aliases (keep existing app + page CSS working) ── */
  --bg: var(--bg-body);
  --surface-solid: var(--bg-surface);
  --bg-elevated-solid: #1C1C1E;
  --surface: var(--bg-glass);
  --surface-2: rgba(255, 255, 255, 0.08);
  --surface-3: rgba(255, 255, 255, 0.12);
  --surface-hover: rgba(255, 255, 255, 0.10);
  --surface-inverse: #F5F5F7;
  --lime: var(--accent-lime);
  --lime-strong: #94FF45;
  --lime-deep: #63D400;
  --lime-soft: rgba(130, 255, 31, 0.10);
  --lime-soft-2: rgba(130, 255, 31, 0.18);
  --lime-glow: rgba(130, 255, 31, 0.26);
  --on-lime: #050505;
  --text-disabled: #3A3A3C;
  --text-inverse: #050505;
  --border: rgba(255, 255, 255, 0.10);
  --border-soft: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-lime: rgba(130, 255, 31, 0.34);
  --danger: var(--accent-red);
  --danger-soft: rgba(255, 69, 58, 0.14);
  --success: var(--accent-green);
  --success-soft: rgba(48, 209, 88, 0.14);
  --warning: var(--accent-yellow);
  --warning-soft: rgba(255, 214, 10, 0.14);
  --info: var(--accent-teal);
  --info-soft: rgba(100, 210, 255, 0.14);
  --purple: var(--accent-purple);
  --purple-soft: rgba(191, 90, 242, 0.14);
  --orange: var(--accent-orange);
  --orange-soft: rgba(255, 159, 10, 0.14);
  --blue-soft: rgba(0, 122, 255, 0.14);
  --indigo-soft: rgba(94, 92, 230, 0.16);

  /* Typography */
  --font-ar: 'SF Pro Arabic', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-en: 'SF Pro Display', 'SF Pro Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'SF Pro Display', 'SF Pro Arabic', -apple-system, sans-serif;
  --font-body: 'SF Pro Arabic', 'SF Pro Display', -apple-system, sans-serif;
  --font-mono: 'SFMono-Regular', ui-monospace, 'Cascadia Code', Menlo, monospace;
  --fs-2xs: 10px;
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-base: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 32px;
  --fs-4xl: 40px;
  --fs-5xl: 52px;
  --lh-tight: 1.1;
  --lh-snug: 1.35;
  --lh-normal: 1.6;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-black: 700;
  --tracking-tight: -0.022em;

  /* Spacing */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 40px;
  --space-10: 48px;
  --space-12: 64px;
  --space-16: 80px;

  /* Layout */
  --sidebar-w: 280px;
  --sidebar-w-collapsed: 84px;
  --topbar-h: 72px;
  --content-max: 1440px;
  --z-dropdown: 60;
  --z-sticky: 40;
  --z-drawer: 80;
  --z-modal: 100;
  --z-toast: 120;
  --z-command: 130;

  /* Ambient mesh colours */
  --mesh-blue: #007AFF;
  --mesh-lime: #82FF1F;
  --mesh-indigo: #5E5CE6;
}

/* Light appearance — opt-in, same semantics */
html[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #F5F5F7;
  --bg-elevated: rgba(255, 255, 255, 0.78);
  --bg-glass: rgba(255, 255, 255, 0.55);
  --material-dark: rgba(255, 255, 255, 0.82);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-2: rgba(0, 0, 0, 0.045);
  --surface-3: rgba(0, 0, 0, 0.075);
  --surface-hover: rgba(0, 0, 0, 0.05);
  --text-primary: #1D1D1F;
  --text-secondary: #6E6E73;
  --text-tertiary: #AEAEB2;
  --text-disabled: #C7C7CC;
  --border: rgba(0, 0, 0, 0.10);
  --border-soft: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.18);
  --on-lime: #050505;
  --shadow-float: 0 20px 60px rgba(0, 0, 0, 0.14);
}

/* ───────────────────────────── RESET ───────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  letter-spacing: -0.006em;
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
table { border-collapse: collapse; border-spacing: 0; width: 100%; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
}
hr { border: 0; border-top: 1px solid var(--border); }
::selection { background: var(--accent-lime); color: #050505; }
:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }

/* Scrollbars — barely there, like macOS */
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); background-clip: padding-box; border: 2px solid transparent; }

/* ─────────────────────────── UTILITIES ─────────────────────────── */
.hidden, [hidden] { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.container { width: 100%; max-width: var(--content-max); margin-inline: auto; padding-inline: var(--space-6); }
.grid { display: grid; gap: var(--space-4); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.w-full { width: 100%; }
.h-full { height: 100%; }
.text-center { text-align: center; }
.text-start { text-align: start; }
.text-end { text-align: end; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.muted { color: var(--text-secondary); }
.dim { color: var(--text-tertiary); }
.lime { color: var(--accent-lime); }
.danger { color: var(--danger); }
.success { color: var(--success); }
.warning { color: var(--warning); }
.fs-xs { font-size: var(--fs-xs); }
.fs-sm { font-size: var(--fs-sm); }
.fs-md { font-size: var(--fs-md); }
.fs-lg { font-size: var(--fs-lg); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 700; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.rounded { border-radius: var(--radius-md); }
.border { border: 1px solid var(--border); }
.divider { height: 1px; background: var(--border); margin-block: var(--space-4); }
.surface { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.surface-2 { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-md); }

/* ─────────────────────── APPLE 2026 MATERIALS ──────────────────── */
.glass,
.glass-card,
.glass-panel {
  position: relative;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.028) 46%, rgba(255, 255, 255, 0.012)),
    var(--bg-elevated);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(180%);
  backdrop-filter: blur(var(--blur-glass)) saturate(180%);
}
.glass::before,
.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 38%);
  opacity: 0.7;
}
.glass-hover { transition: var(--transition-apple); }
.glass-hover:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.glass-lime {
  border-color: rgba(130, 255, 31, 0.26);
  box-shadow: var(--shadow-float), inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 0 0 1px rgba(130, 255, 31, 0.08);
}

/* Ambient light behind glass surfaces */
.mesh-bg { position: relative; isolation: isolate; }
.mesh-bg::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(38% 42% at 18% 12%, rgba(0, 122, 255, 0.20), transparent 70%),
    radial-gradient(34% 36% at 82% 22%, rgba(94, 92, 230, 0.18), transparent 72%),
    radial-gradient(40% 38% at 62% 88%, rgba(130, 255, 31, 0.10), transparent 74%);
  filter: blur(40px);
  pointer-events: none;
}

/* Brand logo */
.brand-logo { height: 40px !important; width: auto !important; max-height: 40px; object-fit: contain; display: block; }
.brand-logo-lg { height: 56px !important; width: auto !important; object-fit: contain; }
.brand-icon { height: 40px !important; width: 40px !important; object-fit: contain; border-radius: 12px; }
.brand-wordmark {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.045em;
  font-size: 24px; line-height: 1; direction: ltr; unicode-bidi: isolate;
}
.brand-wordmark .dot { color: var(--accent-lime); }
.logo { font-family: var(--font-display) !important; }

/* Motion */
@keyframes dsFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dsSlideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dsSlideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dsScaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes dsShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes dsSpin { to { transform: rotate(360deg); } }
@keyframes dsPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.42; } }

.anim-fade { animation: dsFadeIn var(--transition-base) both; }
.anim-up { animation: dsSlideUp var(--transition-slow) both; }
.anim-scale { animation: dsScaleIn var(--transition-slow) both; }

/* RTL / LTR layout primitives */
[dir="rtl"] { --flow-start: right; --flow-end: left; }
[dir="ltr"] { --flow-start: left; --flow-end: right; }

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