/* ==========================================================================
   LAUZ ERP — Enterprise Accounting & Financial Management Design System
   World-Class UI/UX Redesign — Design Only Mode
   ========================================================================== */

/* L2: لا استيراد لخطوط خارجية — نعتمد على خطوط النظام ليعمل البرنامج دون اتصال. */

/* ==========================================================================
   1. DESIGN TOKENS & SYSTEM VARIABLES
   ========================================================================== */
:root {
  color-scheme: light;

  /* Typography — Comfort Redesign (C): خط أكبر قليلاً لراحة العين */
  --font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, "Noto Naskh Arabic", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-family-numbers: "Segoe UI", Tahoma, Roboto, "Helvetica Neue", Arial, tabular-nums, sans-serif;
  --text-scale: 1.067;

  /* Primary Brand Crimson (LAUZ Signature Palette) */
  --primary-50:  #fff1f2;
  --primary-100: #ffe4e6;
  --primary-200: #fecdd3;
  --primary-300: #fda4af;
  --primary-400: #fb7185;
  --primary-500: #f43f5e;
  --primary-600: #e11d48;
  --primary-700: #be123c; /* Main Brand Accent */
  --primary-800: #9f1239;
  --primary-900: #881337;
  --primary-950: #4c0519;

  /* Neutral Slate Palette (High Clarity Contrast) */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* Financial Status Semantic Colors */
  --success-50:  #ecfdf5;
  --success-100: #d1fae5;
  --success-200: #a7f3d0;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;

  --danger-50:  #fff1f2;
  --danger-100: #ffe4e6;
  --danger-200: #fecdd3;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: var(--danger-600);

  --warning-50:  #fffbeb;
  --warning-100: #fef3c7;
  --warning-200: #fde68a;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;

  --violet-50:   #f5f3ff;
  --violet-100:  #ede9fe;
  --violet-200:  #ddd6fe;
  --violet-300:  #c4b5fd;
  --violet-500:  #8b5cf6;
  --violet-600:  #7c3aed;
  --violet-700:  #6d28d9;

  --info-50:  #f0f9ff;
  --info-100: #e0f2fe;
  --info-200: #bae6fd;
  --info-500: #0ea5e9;
  --info-600: #0284c7;
  --info-700: #0369a1;

  /* Semantic UI Tokens — Comfort Redesign (C): خلفية أهدأ، تباين مريح */
  --canvas: #fafbfc;
  --surface: var(--surface-color);
  --surface-subtle: #f8fafc;
  --surface-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --border-subtle: #eef1f5;
  --line: #e6eaef;
  --ink: #1e293b;
  --muted-ink: #64748b;

  /* Preserved Aliases for Complete Backwards Compatibility */
  --accent: var(--primary-700);
  --accent-color: var(--primary-700);
  --accent-dark: var(--primary-800);
  --accent-soft: var(--primary-100);
  --brand-dark: var(--ink-color);
  --danger-color: var(--danger-600);
  --text-color: var(--ink-color);
  --text-muted: var(--slate-500);
  --bg-color: var(--canvas);
  --card-bg: var(--surface);
  --bg-surface-elevated: var(--surface-subtle-color);

  /* Sidebar Design Tokens (POSHRAW Clean Light Corporate) */
  --sidebar: var(--surface-color);
  --sidebar-gradient: var(--surface-color);
  --sidebar-border: #e2e8f0;
  --sidebar-text: #1e293b;
  --sidebar-text-muted: #64748b;
  --sidebar-hover-bg: #f8fafc;
  --poshraw-navy: #0f172a;
  --poshraw-gold: #d97706;

  /* Shadows & Depth */
  --shadow-xs: 0 1px 2px 0 rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(16, 24, 40, 0.06), 0 1px 2px -1px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(16, 24, 40, 0.1), 0 4px 8px -2px rgba(16, 24, 40, 0.04);
  --shadow-xl: 0 24px 48px -8px rgba(16, 24, 40, 0.18), 0 8px 16px -4px rgba(16, 24, 40, 0.06);
  --shadow: var(--shadow-sm);
  --primary-glow: 0 4px 16px rgba(190, 18, 60, 0.28);

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 220ms;
}

/* ==========================================================================
   THEME TOKENS — تصميم (و): داكن افتراضي + تبديل داكن/فاتح
   ========================================================================== */

/* ---------- الوضع الداكن (الافتراضي) ---------- */
:root[data-theme="dark"] {
  --canvas:#0b1220;
  --panel:#0f172a;
  --panel-2:#111c33;
  --panel-3:#16233d;
  --line:#1e293b;
  --line-2:#243449;
  --ink:#f1f5f9;
  --ink-2:#cbd5e1;
  --muted:#94a3b8;
  --muted-2:#64748b;
  --brand:#f43f5e;
  --brand-2:#e11d48;
  --brand-dark:#be123c;
  --amber:#fbbf24;
  --shadow-1:0 1px 3px rgba(0,0,0,.4);
  --shadow-2:0 12px 32px -10px rgba(0,0,0,.6);
  --shadow-3:0 30px 70px -20px rgba(0,0,0,.75);
  --grid:rgba(148,163,184,.07);

  /* Semantic mappings for dark mode */
  --canvas-color: var(--canvas);
  --surface-color: var(--panel);
  --surface-subtle-color: var(--panel-2);
  --surface-hover-color: var(--panel-3);
  --border-color: var(--line);
  --border-subtle-color: var(--line-2);
  --ink-color: var(--ink);
  --muted-ink-color: var(--muted);
  --accent-color: #fb7185;
  --accent-dark-color: var(--brand-dark);
  --accent-soft-color: rgba(244, 63, 94, 0.15);
  --danger-color: #f43f5e;
  --success-color: #34d399;
  --warning-color: var(--amber);
  --info-color: #60a5fa;
  --sidebar-bg: var(--panel);
  --sidebar-border: var(--line);
  --sidebar-text: var(--ink);
  --sidebar-text-muted: var(--muted);
  --sidebar-hover: var(--panel-2);
  --shadow-color: rgba(0,0,0,0.4);
  --scrollbar-track: transparent;
  --scrollbar-thumb: #334155;
  --scrollbar-thumb-hover: #475569;

  /* ---- Contrast fix: remap legacy slate/ink text tokens so any
     var(--slate-XXX) or var(--ink-2) usage stays readable on dark ---- */
  --slate-900: var(--ink);
  --slate-800: var(--ink);
  --slate-700: var(--muted);
  --slate-600: var(--muted);
  --slate-500: var(--muted);
  --slate-400: var(--line-2);
  --slate-300: var(--line);
  --slate-200: var(--line);
  --slate-100: var(--panel-3);
  --slate-50:  var(--panel-2);
  --poshraw-navy: var(--ink);
}

/* ---------- الوضع الفاتح ---------- */
:root[data-theme="light"] {
  --canvas:#f8fafc;
  --panel:#ffffff;
  --panel-2:#f1f5f9;
  --panel-3:#e2e8f0;
  --line:#cbd5e1;
  --line-2:#e2e8f0;
  --ink:#0f172a;
  --ink-2:#1e293b;
  --muted:#475569;
  --muted-2:#64748b;
  --brand:#be123c;
  --brand-2:#e11d48;
  --brand-dark:#9f1239;
  --amber:#d97706;
  --shadow-1:0 1px 3px rgba(16,24,40,.06);
  --shadow-2:0 8px 24px -8px rgba(16,24,40,.12);
  --shadow-3:0 24px 60px -18px rgba(16,24,40,.20);
  --grid:rgba(15,23,42,.04);

  /* Semantic mappings for light mode */
  --canvas-color: var(--canvas);
  --surface-color: var(--panel);
  --surface-subtle-color: var(--panel-2);
  --surface-hover-color: var(--panel-3);
  --border-color: #cbd5e1;
  --border-subtle-color: #e2e8f0;
  --border-subtle: #e2e8f0;
  --ink-color: var(--ink);
  --muted-ink-color: var(--muted);
  --accent-color: var(--brand);
  --accent-dark-color: var(--brand-dark);
  --accent-soft-color: rgba(190, 18, 60, 0.1);
  --danger-color: #dc2626;
  --success-color: #059669;
  --warning-color: #d97706;
  --info-color: #0284c7;
  --sidebar-bg: #ffffff;
  --sidebar-border: #cbd5e1;
  --sidebar-text: var(--ink);
  --sidebar-text-muted: var(--muted);
  --sidebar-hover: #f1f5f9;
  --shadow-color: rgba(16,24,40,0.08);
  --scrollbar-track: transparent;
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-thumb-hover: #94a3b8;
}

/* Default to dark theme if no data-theme attribute */
:root:not([data-theme]) {
  --canvas-color: #0b1220;
  --surface-color: #0f172a;
  --surface-subtle-color: #111c33;
  --surface-hover-color: #16233d;
  --border-color: #1e293b;
  --border-subtle-color: #243449;
  --ink-color: #f1f5f9;
  --muted-ink-color: #94a3b8;
  --accent-color: #f43f5e;
  --accent-dark-color: #be123c;
  --accent-soft-color: rgba(244, 63, 94, 0.15);
  --danger-color: #f43f5e;
  --success-color: #34d399;
  --warning-color: #fbbf24;
  --info-color: #60a5fa;
  --sidebar-bg: #0f172a;
  --sidebar-border: #1e293b;
  --sidebar-text: #f1f5f9;
  --sidebar-text-muted: #94a3b8;
  --sidebar-hover: #111c33;
  --shadow-color: rgba(0,0,0,0.4);
  --scrollbar-track: transparent;
  --scrollbar-thumb: #334155;
  --scrollbar-thumb-hover: #475569;

  /* ---- Contrast fix: remap legacy slate text tokens so any hardcoded
     var(--slate-XXX) usage stays readable on dark surfaces ---- */
  --slate-900: var(--ink-color);
  --slate-800: var(--ink-color);
  --slate-700: var(--muted-ink-color);
  --slate-600: var(--muted-ink-color);
  --slate-500: var(--muted-ink-color);
  --slate-400: var(--border-subtle-color);
  --slate-300: var(--border-color);
  --slate-200: var(--border-color);
  --slate-100: var(--surface-hover-color);
  --slate-50:  var(--surface-subtle-color);
  --ink-2: var(--muted-ink-color);
  --poshraw-navy: var(--ink-color);
}

/* ==========================================================================
   2. GLOBAL BASE & TYPOGRAPHY
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-family-base);
  background-color: var(--canvas-color);
  color: var(--ink-color);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
}

/* Tabular figures for all financial calculations & tables */
input[type="number"],
td,
th,
.stat-value,
.report-total-card strong,
.invoice-grand-card strong,
#trial-balance-total,
#partner-statement-total,
#journal-balance,
.currency-badge,
.amount {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Accessibility & Utility */
.hidden {
  display: none !important;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}
a:hover {
  color: var(--accent-dark-color);
}

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

/* ==========================================================================
   3. AUTHENTICATION / LOGIN SCREEN
   ========================================================================== */
.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 25%, rgba(212, 160, 23, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(9, 13, 20, 0.96)),
    url("/static/poshraw-background.jpg?v=20261013") center / cover fixed;
  position: relative;
  overflow: hidden;
}

.auth-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 40%);
  pointer-events: none;
}

.auth-card {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(100%, 430px);
  gap: 18px;
  padding: 40px 36px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(20px);
  text-align: right;
  animation: authCardEntrance 0.5s var(--ease-spring);
}

@keyframes authCardEntrance {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-card .brand-mark {
  margin: 0 auto 8px;
  width: 82px;
  height: 82px;
  border: 3px solid rgba(190, 18, 60, 0.2);
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  object-fit: cover;
  transition: transform var(--duration-normal) var(--ease-spring);
}
.auth-card .brand-mark:hover {
  transform: scale(1.05) rotate(2deg);
}

.auth-card h1 {
  margin: 0;
  color: var(--ink-color);
  font-size: 1.65rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
}

.auth-card > p {
  margin: -6px 0 6px;
  color: var(--slate-500);
  font-size: 0.92rem;
  text-align: center;
  line-height: 1.6;
}

.auth-card label {
  display: grid;
  gap: 7px;
  color: var(--slate-700);
  font-size: 0.88rem;
  font-weight: 600;
}

.auth-card input {
  min-height: 46px;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--surface-color);
  color: var(--ink-color);
  font-size: 0.95rem;
  transition: all var(--duration-fast) ease;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--primary-700);
  box-shadow: 0 0 0 4px rgba(190, 18, 60, 0.12);
}

.auth-card button[type="submit"] {
  min-height: 48px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-900) 100%);
  color: var(--surface-color);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--primary-glow);
  transition: all var(--duration-fast) ease;
}
.auth-card button[type="submit"]:hover {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-800) 100%);
  box-shadow: 0 6px 20px rgba(190, 18, 60, 0.35);
  transform: translateY(-1px);
}
.auth-card button[type="submit"]:active {
  transform: translateY(1px);
}

.auth-card .auth-error {
  min-height: 1.5em;
  margin: 0;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  color: var(--danger-700);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  background: var(--danger-50);
  border: 1px solid var(--danger-200);
  display: none;
}
.auth-card .auth-error:not(:empty) {
  display: block;
  animation: shake 0.3s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ==========================================================================
   4. APP SHELL & SIDEBAR NAVIGATION
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--canvas);
}

/* Sidebar Styling */
.sidebar {
  flex: 0 0 254px;
  width: 254px;
  background: var(--sidebar-gradient);
  color: var(--sidebar-text);
  padding: 16px 12px 28px;
  border-left: 1px solid var(--sidebar-border);
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.03);
  position: relative;
  z-index: 30;
  display: flex;
  flex-direction: column;
}

/* Brand Lockup */
.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 8px 16px;
  color: var(--poshraw-navy);
  text-decoration: none;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 14px;
  transition: transform var(--duration-fast) ease;
}
.brand-lockup:hover {
  transform: translateY(-1px);
}

.poshraw-sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.poshraw-logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #0f172a;
  line-height: 1;
  font-family: var(--font-family-numbers);
}

.sidebar-hanger-icon {
  width: 28px;
  height: 28px;
  display: inline-block;
  margin: 0 1px;
}

.logo-co {
  color: #d97706;
  font-weight: 800;
}

.hero-co {
  color: #d97706;
  font-weight: 800;
}

.sidebar-brand-sub-en {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #475569;
  text-transform: uppercase;
  margin-top: 5px;
  text-align: center;
}

.sidebar-brand-sub-ar {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  margin-top: 2px;
  text-align: center;
}

.brand-mark {
  display: block;
  width: 58px;
  height: 58px;
  margin-bottom: 8px;
  border: 2px solid #e2e8f0;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Navigation Items */
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  text-align: right;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  position: relative;
  user-select: none;
}

.nav:hover {
  background: var(--sidebar-hover-bg);
  color: #0f172a;
  transform: translateX(-2px);
}

.nav.active,
.nav.active:hover {
  background: #eef2f6;
  color: #0f172a;
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  font-weight: 700;
  transform: none;
}

.nav.active::before {
  content: "";
  position: absolute;
  right: 0;
  top: 6px;
  bottom: 6px;
  width: 3.5px;
  border-radius: 3px;
  background: #0f172a;
}

.nav-content {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
}

.nav-icon {
  font-size: 1.15rem;
  width: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-titles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: right;
  line-height: 1.25;
}

.nav-main {
  font-size: 0.91rem;
  font-weight: 700;
  color: inherit;
}

.nav-sub {
  font-size: 0.71rem;
  font-weight: 500;
  color: #64748b;
  margin-top: 1px;
}

/* Accordion Nav Items */
.nav-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-chevron {
  font-size: 0.85rem;
  transition: transform var(--duration-normal) var(--ease-spring);
  color: #94a3b8;
}
.nav-parent[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
  color: #0f172a;
}

/* Submenu */
.nav-submenu {
  margin: 2px 0 6px;
  padding: 4px 14px 4px 0;
  border-right: 2px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: submenuFadeIn 0.2s ease-out;
}

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

.nav-subitem {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: #475569;
  text-align: right;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.nav-subitem:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.nav-subitem.active,
.nav-subitem.active:hover {
  background: #eef2f6;
  color: #0f172a;
  border-color: #cbd5e1;
  font-weight: 700;
}

/* ==========================================================================
   5. MAIN CONTENT AREA & TOPBAR
   ========================================================================== */
.content {
  flex: 1;
  min-width: 0;
  padding: 24px clamp(20px, 3.5vw, 40px) 40px;
  background-color: var(--canvas);
  position: relative;
}

/* Top Accent Stripe */
.content::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #0f172a 0%, #d97706 100%);
  z-index: 10;
}

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding: 10px 18px;
  background: var(--surface-color);
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

.topbar-titles {
  display: flex;
  flex-direction: column;
}

.topbar h2 {
  margin: 0;
  color: var(--ink-color);
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--slate-500);
  font-size: 0.84rem;
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Executive Topbar Pill Buttons (POSHRAW Design) */
.topbar-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: #1e293b;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  user-select: none;
  white-space: nowrap;
}

.topbar-pill-btn:hover {
  background: var(--surface-color);
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.topbar-pill-btn:active {
  transform: translateY(0);
}

.topbar-pill-btn .pill-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.topbar-clock-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 10px;
  background: var(--surface-color);
  border: 1.5px solid #e2e8f0;
  text-align: center;
  min-width: 95px;
  user-select: none;
}

#topbar-clock-date {
  font-size: 0.8rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

#topbar-clock-time {
  font-size: 0.74rem;
  font-weight: 600;
  color: #64748b;
  line-height: 1.2;
}

/* Badges */
.currency-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: var(--poshraw-navy);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
}

#current-user-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: var(--slate-700);
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}
#current-user-label:not(:empty)::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success-500);
  box-shadow: 0 0 0 2px var(--success-100);
}

/* Notifications / Messages */
.message {
  display: none;
  margin-bottom: 20px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  animation: messageSlideIn 0.3s var(--ease-spring);
}

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

.message.visible {
  display: flex;
  align-items: center;
}

.message.success {
  background: var(--success-50);
  border: 1px solid var(--success-200);
  color: var(--success-700);
}

.message.error {
  background: var(--danger-50);
  border: 1px solid var(--danger-200);
  color: var(--danger-700);
}

.message.warning {
  background: var(--warning-50);
  border: 1px solid var(--warning-200);
  color: var(--warning-600);
}

/* ==========================================================================
   6. CARDS, PANELS & CONTAINER SURFACES
   ========================================================================== */
.card,
.panel {
  background: var(--surface-color);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--duration-normal) ease, border-color var(--duration-normal) ease;
}

.card:hover,
.panel:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--slate-200);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--surface-subtle-color);
}

.panel h3,
.panel-heading h3 {
  margin: 0;
  color: var(--ink-color);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel p {
  color: var(--muted-ink-color);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0 0 16px;
}

.muted {
  color: var(--slate-500) !important;
  font-size: 0.85rem !important;
}

/* Stat Cards Grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
  border-top: 0;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--slate-400);
}

.card.blue::before { background: var(--info-600); }
.card.green::before { background: var(--success-600); }
.card.amber::before { background: var(--warning-500); }
.card.red::before { background: var(--primary-700); }

.card label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-500);
  margin-bottom: 6px;
}

.card strong {
  display: block;
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--ink-color);
  line-height: 1.2;
}

/* ==========================================================================
   7. DASHBOARD SCREEN & HERO
   ========================================================================== */
.dashboard-premium-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Hero Section */
/* Hero Section - POSHRAW School Supplies & Apparel */
.poshraw-hero-banner {
  background: var(--surface-color);
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  margin-bottom: 22px;
}

/* Left Brand Box inside Hero */
.hero-brand-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: var(--surface-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  flex-shrink: 0;
}

.hero-logo-row {
  display: flex;
  align-items: center;
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #0f172a;
  line-height: 1;
  font-family: var(--font-family-numbers);
}

.hero-o-hanger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: 0 1px;
}

.hero-hanger-icon {
  width: 100%;
  height: 100%;
}

.hero-brand-sub-en {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #334155;
  margin-top: 5px;
  text-transform: uppercase;
}

.hero-brand-sub-ar {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  margin-top: 2px;
}

/* Center Text inside Hero */
.hero-center-info {
  text-align: center;
  flex: 1;
  padding: 0 20px;
}

.hero-main-title {
  margin: 0;
  font-size: 2.15rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #0f172a;
  line-height: 1.1;
  font-family: var(--font-family-numbers);
}
.title-dots {
  color: #d97706;
}
.title-co {
  color: #d97706;
  font-weight: 800;
}

.hero-arabic-title {
  margin: 6px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}

.hero-tagline-text {
  margin: 3px 0 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: #64748b;
}

/* Right Illustration inside Hero */
.hero-sketches-container {
  width: 270px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.hero-sketch-svg {
  width: 100%;
  height: 100%;
}

/* Legacy Brand Hero Fallback */
.brand-hero {
  position: relative;
  display: flex;
  min-height: 160px;
  align-items: center;
  overflow: hidden;
  padding: 24px 32px;
  border-radius: var(--radius-xl);
  background: var(--surface-color);
  color: #0f172a;
  border: 1px solid var(--line);
}

.date-widget {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  padding: 10px 16px !important;
  border-radius: var(--radius-md) !important;
}

#dashboard-date {
  font-size: 0.88rem;
  color: #1e293b;
  font-weight: 600;
}

#dashboard-time {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

/* ==========================================================================
   POSHRAW COMPREHENSIVE PORTALS GRID (11 PASTEL CARDS + WATERMARK)
   ========================================================================== */
.poshraw-portals-section {
  margin-top: 4px;
}

.poshraw-portals-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 16px 0;
  text-align: right;
  letter-spacing: -0.01em;
}

.poshraw-portals-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.portal-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-align: right;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  min-height: 82px;
}

.portal-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.portal-card:active {
  transform: translateY(0);
}

.portal-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.portal-ar {
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
}

.portal-ku {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.85;
  line-height: 1.2;
}

.portal-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.portal-icon-box svg {
  width: 22px;
  height: 22px;
}

/* 1. Green Theme (المخازن والمخزون) */
.portal-green {
  background-color: #dcfce7;
  border-color: #86efac;
  color: #14532d;
}
.portal-green .portal-icon-box {
  background-color: var(--success-200);
  color: var(--success-600);
}

/* 2. Cyan Theme (العملاء والموردون) */
.portal-cyan {
  background-color: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
}
.portal-cyan .portal-icon-box {
  background-color: #bae6fd;
  color: #0284c7;
}

/* 3. Purple Theme (إدارة الموظفين) */
.portal-purple {
  background-color: #f3e8ff;
  border-color: #d8b4fe;
  color: #6b21a8;
}
.portal-purple .portal-icon-box {
  background-color: #e9d5ff;
  color: #7e22ce;
}

/* 4. Peach Theme (المصروفات) */
.portal-peach {
  background-color: #ffedd5;
  border-color: #fed7aa;
  color: #c2410c;
}
.portal-peach .portal-icon-box {
  background-color: #fed7aa;
  color: #ea580c;
}

/* 5. Soft Blue Theme (المدارس والطلبات) */
.portal-blue {
  background-color: #dbeafe;
  border-color: #93c5fd;
  color: var(--info-600);
}
.portal-blue .portal-icon-box {
  background-color: var(--info-200);
  color: #2563eb;
}

/* 6. Indigo Theme (إدارة المبيعات) */
.portal-indigo {
  background-color: #e0e7ff;
  border-color: #a5b4fc;
  color: #3730a3;
}
.portal-indigo .portal-icon-box {
  background-color: #c7d2fe;
  color: #4338ca;
}

/* 7. Warm Gold Theme (الإنتاج والتفصيل) */
.portal-gold {
  background-color: var(--warning-100);
  border-color: #fde047;
  color: #854d0e;
}
.portal-gold .portal-icon-box {
  background-color: #fef08a;
  color: #ca8a04;
}

/* 8. Rose Pink Theme (المشتريات) */
.portal-pink {
  background-color: #ffe4e6;
  border-color: #fecdd3;
  color: #9f1239;
}
.portal-pink .portal-icon-box {
  background-color: #fecdd3;
  color: #e11d48;
}

/* 9. Light Slate Theme (القيود اليومية) */
.portal-slate {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}
.portal-slate .portal-icon-box {
  background-color: #e2e8f0;
  color: #475569;
}

/* 10. Pearl White Theme (شجرة الحسابات) */
.portal-pearl {
  background-color: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
}
.portal-pearl .portal-icon-box {
  background-color: #f1f5f9;
  color: #334155;
}

/* 11. Mint Green Theme (التقارير المالية) */
.portal-mint {
  background-color: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.portal-mint .portal-icon-box {
  background-color: #d1fae5;
  color: #059669;
}

/* Watermark Art in 12th slot */
.portal-watermark-art {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  height: 100%;
  pointer-events: none;
}
.watermark-svg {
  width: 100%;
  max-height: 80px;
}

/* Status Footer Bar */
.poshraw-status-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 8px 6px;
  margin-top: 24px;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 500;
  border-top: 1px solid #f1f5f9;
}

.footer-left-status,
.footer-right-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-separator {
  color: #cbd5e1;
}

/* ==========================================================================
   7B. INJAZ EXECUTIVE LAUNCHER DASHBOARD (POSHRAW.CO)
   Complete styling for the Executive Launcher, KPI Grid, 22 App Squircles,
   and the macOS-inspired Floating Action Dock.
   ========================================================================== */

/* Main Dashboard Container */
.injaz-dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 8px 4px 96px; /* Extra bottom padding so floating dock doesn't overlap contents */
  position: relative;
  min-height: calc(100vh - 130px);
  animation: injazDashboardFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* 1. Top Header: Brand + Overview + Live Status */
.injaz-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 24px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

:root[data-theme="dark"] .injaz-top-header {
  background: linear-gradient(135deg, rgba(17, 28, 51, 0.9) 0%, rgba(15, 23, 42, 0.98) 100%);
  border-color: rgba(56, 189, 248, 0.2);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.injaz-brand-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.poshraw-avatar-shield {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.35));
  transition: transform 0.25s ease;
}

.poshraw-avatar-shield:hover {
  transform: scale(1.06) rotate(-2deg);
}

.poshraw-avatar-shield svg {
  width: 48px;
  height: 48px;
  display: block;
}

.injaz-brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.injaz-brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--ink-color);
  letter-spacing: 0.02em;
}

:root[data-theme="light"] .injaz-brand-title span:first-child {
  color: #0f172a !important;
}

:root[data-theme="dark"] .injaz-brand-title span:first-child {
  color: #ffffff !important;
}

.injaz-overview-tag {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted-ink-color);
  line-height: 1.3;
}

.injaz-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.injaz-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-size: 0.82rem;
  font-weight: 700;
  color: #10b981;
}

.injaz-live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: livePulseAnim 2s infinite;
}

@keyframes livePulseAnim {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.injaz-dashboard-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff !important;
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.injaz-dashboard-pill-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.injaz-dashboard-pill-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
  filter: brightness(1.1);
}

.injaz-dashboard-pill-btn:active {
  transform: translateY(0);
}

/* 2. Top Metric Cards (6 KPI Cards) */
.injaz-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

.injaz-kpi-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

:root[data-theme="dark"] .injaz-kpi-card {
  background: linear-gradient(145deg, rgba(17, 28, 51, 0.75) 0%, rgba(15, 23, 42, 0.92) 100%);
  border-color: rgba(56, 189, 248, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.injaz-kpi-card:hover {
  transform: translateY(-3px);
  border-color: #38bdf8;
  box-shadow: 0 10px 24px -6px rgba(56, 189, 248, 0.25);
}

.injaz-kpi-card:active {
  transform: translateY(0);
}

.injaz-kpi-data {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.injaz-kpi-val {
  font-family: var(--font-family-numbers);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink-color);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.injaz-kpi-lbl {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted-ink-color);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.injaz-kpi-sub {
  font-size: 0.72rem;
  color: var(--muted-ink-color);
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.injaz-kpi-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #38bdf8;
  transition: transform 0.2s ease;
}

.injaz-kpi-icon-box svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
}

.injaz-kpi-card:hover .injaz-kpi-icon-box {
  transform: scale(1.1);
}

/* Individual KPI Card Accents */
.injaz-kpi-card:nth-child(1) .injaz-kpi-icon-box {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.28);
}
.injaz-kpi-card:nth-child(2) .injaz-kpi-icon-box {
  color: #0ea5e9;
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(14, 165, 233, 0.28);
}
.injaz-kpi-card:nth-child(3) .injaz-kpi-icon-box {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.28);
}
.injaz-kpi-card:nth-child(4) .injaz-kpi-icon-box {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.28);
}
.injaz-kpi-card:nth-child(5) .injaz-kpi-icon-box {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.28);
}
.injaz-kpi-card:nth-child(6) .injaz-kpi-icon-box {
  color: #06b6d4;
  background: rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.28);
}

/* 3. Squircle Apps Launcher Grid (22 Rounded Square Buttons) */
.injaz-apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 16px 12px;
  padding: 24px 20px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.08);
}

:root[data-theme="dark"] .injaz-apps-grid {
  background: linear-gradient(135deg, rgba(17, 28, 51, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: rgba(56, 189, 248, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.injaz-app-item {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  padding: 10px 6px;
  margin: 0;
  cursor: pointer;
  outline: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  border-radius: 16px;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
}

.injaz-app-item:hover {
  transform: translateY(-4px);
  background: rgba(56, 189, 248, 0.06);
}

.injaz-app-item:active {
  transform: translateY(0) scale(0.97);
}

.injaz-squircle {
  width: 62px;
  height: 62px;
  border-radius: 18px; /* Smooth squircle curve */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: var(--surface-subtle-color);
  border: 1.5px solid var(--border-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  color: var(--ink-color);
}

:root[data-theme="dark"] .injaz-squircle {
  background: linear-gradient(145deg, #162544 0%, #0d192e 100%);
  border: 1px solid rgba(56, 189, 248, 0.2);
  box-shadow: 0 6px 14px -2px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.injaz-squircle svg {
  width: 28px;
  height: 28px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s ease;
}

.injaz-app-item:hover .injaz-squircle {
  transform: scale(1.08);
  border-color: #38bdf8;
  box-shadow: 0 10px 22px -4px rgba(56, 189, 248, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.injaz-app-item:hover .injaz-squircle svg {
  transform: scale(1.08);
}

.injaz-app-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-color);
  line-height: 1.2;
  transition: color 0.15s ease;
}

.injaz-app-item:hover .injaz-app-label {
  color: #38bdf8;
}

.injaz-app-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted-ink-color);
  line-height: 1.1;
  opacity: 0.85;
}

/* Individual App Color Accents */
.injaz-app-item[data-quick-nav*="page:accounts"] .injaz-squircle { color: #10b981; }
.injaz-app-item[data-quick-nav*="page:sales"] .injaz-squircle { color: #0ea5e9; }
.injaz-app-item[data-quick-nav*="data-inventory-view=items"] .injaz-squircle { color: #f59e0b; }
.injaz-app-item[data-quick-nav*="data-inventory-view=movements"] .injaz-squircle { color: #6366f1; }
.injaz-app-item[data-quick-nav*="data-employee-view=employees"] .injaz-squircle { color: #8b5cf6; }
.injaz-app-item[data-quick-nav*="procurement"] .injaz-squircle,
.injaz-app-item[data-quick-nav*="purchases"] .injaz-squircle { color: #f43f5e; }
.injaz-app-item[data-quick-nav*="admin-panel-button"] .injaz-squircle { color: #38bdf8; }
.injaz-app-item[data-quick-nav*="data-partner-view=customers"] .injaz-squircle { color: #ec4899; }
.injaz-app-item[data-quick-nav*="page:workshop"] .injaz-squircle { color: #f97316; }
.injaz-app-item[data-quick-nav*="data-partner-view=statements"] .injaz-squircle { color: #84cc16; }
.injaz-app-item[data-quick-nav*="audit-log"] .injaz-squircle { color: #14b8a6; }
.injaz-app-item[data-quick-nav*="data-partner-view=suppliers"] .injaz-squircle { color: #a855f7; }
.injaz-app-item[data-quick-nav*="data-report-view=trial-balance"] .injaz-squircle { color: #06b6d4; }
.injaz-app-item[data-quick-nav*="page:dashboard"] .injaz-squircle { color: #38bdf8; }
.injaz-app-item[data-quick-nav*="page:journals"] .injaz-squircle { color: #6366f1; }
.injaz-app-item[data-quick-nav*="data-partner-view=receipts"] .injaz-squircle { color: #10b981; }
.injaz-app-item[data-quick-nav*="manage-users-button"] .injaz-squircle { color: #3b82f6; }

/* Active squircle state */
.injaz-app-item.active .injaz-squircle {
  border-color: #38bdf8;
  background: linear-gradient(145deg, #1e3a66 0%, #102545 100%);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.45);
}

/* 4. Floating Action Dock (macOS Style) */
.injaz-floating-dock {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  border-radius: 9999px;
  z-index: 99;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(56, 189, 248, 0.2);
  transition: all 0.25s ease;
}

#page-dashboard:not(.active) .injaz-floating-dock {
  display: none !important;
}

:root[data-theme="light"] .injaz-floating-dock {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(2, 132, 199, 0.15);
}

.dock-pill-btn {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  outline: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

:root[data-theme="light"] .dock-pill-btn {
  color: #475569;
}

.dock-pill-btn svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock-pill-btn:hover {
  transform: scale(1.22) translateY(-4px);
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.35);
}

.dock-pill-btn:active {
  transform: scale(1.05);
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
  .injaz-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .injaz-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .injaz-apps-grid {
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    gap: 12px 8px;
    padding: 16px 12px;
  }
  .injaz-squircle {
    width: 54px;
    height: 54px;
    border-radius: 15px;
  }
  .injaz-squircle svg {
    width: 24px;
    height: 24px;
  }
  .injaz-top-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .injaz-header-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* Dashboard Quick Actions Compatibility */
.dashboard-quick-actions {
  margin-top: 8px;
}
.section-title-modern {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink-color);
  margin: 0 0 16px;
}
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}
.quick-action-card {
  background: var(--surface-color);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-spring);
  box-shadow: var(--shadow-sm);
  color: var(--ink-color);
}
.quick-action-card:hover {
  transform: translateY(-4px);
  border-color: #cbd5e1;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.05);
}
.qa-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qa-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-color);
}

/* ==========================================================================
   8. FORMS, INPUTS & CONTROLS
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px 18px;
  align-items: end;
}

.wide-field {
  grid-column: span 2;
}

.form-grid label,
.inline-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--slate-700);
  font-size: 0.9rem;
  font-weight: 600;
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--surface-color);
  color: var(--ink-color);
  font-size: 0.92rem;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

textarea {
  min-height: 90px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: var(--slate-400);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--slate-400);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-700) !important;
  box-shadow: 0 0 0 3px rgba(190, 18, 60, 0.12) !important;
}

input[readonly] {
  background-color: var(--surface-subtle-color);
  color: var(--slate-500);
  cursor: not-allowed;
}

/* Checkbox & Radio fields */
.checkbox-field,
.check-label {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 42px;
  cursor: pointer;
  user-select: none;
}

.checkbox-field input,
.check-label input {
  width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  accent-color: var(--primary-700);
  cursor: pointer;
}

/* Button System */
button {
  font-family: inherit;
  transition: all var(--duration-fast) ease;
}

button[type="submit"],
.secondary-button,
td button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

/* Primary Button (Crimson Gradient) */
button[type="submit"],
#install-standard-chart,
#run-reports,
#run-account-ledger,
#show-partner-statement {
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-800) 100%);
  border-color: var(--primary-800);
  color: var(--surface-color);
  box-shadow: var(--shadow-xs);
}

button[type="submit"]:hover,
#install-standard-chart:hover,
#run-reports:hover,
#run-account-ledger:hover,
#show-partner-statement:hover {
  background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
  border-color: var(--primary-700);
  box-shadow: var(--primary-glow);
  transform: translateY(-1px);
}

button[type="submit"]:active,
.secondary-button:active,
td button:active {
  transform: translateY(1px);
}

/* Secondary Button (Crisp White Slate) */
.secondary-button {
  background: var(--surface-color);
  border-color: var(--border-color);
  color: var(--slate-700);
  box-shadow: var(--shadow-xs);
}

.secondary-button:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
  color: var(--ink-color);
  box-shadow: var(--shadow-sm);
}

/* Danger Button */
td button.danger {
  background: linear-gradient(135deg, var(--danger-600) 0%, var(--danger-700) 100%);
  border-color: var(--danger-700);
  color: var(--surface-color);
}
td button.danger:hover {
  background: var(--danger-500);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

/* Table Inline Action Buttons */
td button {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 0.82rem;
  border-radius: var(--radius-xs);
  background: var(--ink-color);
  border-color: var(--ink-color);
  color: var(--surface-color);
}
td button:hover {
  background: var(--primary-700);
  border-color: var(--primary-800);
}

/* Form Actions Row */
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

#journal-balance {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-color);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle-color);
  border: 1px solid var(--slate-200);
}

/* ===== شريط إجراءات نقطة البيع ===== */
#sales-invoice-form .form-actions {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-subtle-color);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  gap: 10px;
}
#sales-invoice-form .form-actions .invoice-total-badge {
  flex: 1 1 auto;
  justify-content: center;
  min-width: 0;
}

/* مسافات أنعم داخل نموذج نقطة البيع */
#sales-invoice-form .pos-scan-box {
  margin: 0;
}

/* ==========================================================================
   9. TABS SYSTEM
   ========================================================================== */
.section-tabs,
.workshop-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--slate-200);
  overflow-x: auto;
  padding-bottom: 2px;
}

.section-tab,
.workshop-tab {
  padding: 10px 18px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--slate-500);
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: -2px;
  transition: all var(--duration-fast) ease;
  white-space: nowrap;
}

.section-tab:hover,
.workshop-tab:hover {
  color: var(--ink-color);
  background: rgba(0, 0, 0, 0.02);
}

.section-tab.active,
.workshop-tab.active {
  color: var(--primary-700);
  border-bottom-color: var(--primary-700);
  background: var(--primary-50);
  font-weight: 700;
}

.section-tab.has-data::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-inline-start: 6px;
  border-radius: 50%;
  background: var(--primary-700);
  vertical-align: middle;
}

.tab-content,
.workshop-view {
  display: none;
}

.tab-content.active,
.workshop-view.active {
  display: block;
  animation: tabFadeIn 0.25s ease-out;
}

/* تبويبات فرعية داخل تبويب رئيسي (إضافة مادة: مادة واحدة / مقاسات متعددة) */
.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid var(--border-color, var(--slate-200));
  border-radius: var(--radius-md, 12px);
  background: var(--surface-subtle-color, var(--slate-50));
}

.sub-tab {
  flex: 1 1 auto;
  min-width: 140px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  color: var(--muted-ink-color, var(--slate-500));
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background var(--duration-fast) ease, color var(--duration-fast) ease,
    border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.sub-tab:hover {
  color: var(--ink-color);
  background: var(--surface-hover-color, rgba(0, 0, 0, 0.04));
}

.sub-tab.active {
  color: #fff;
  border-color: var(--accent-dark-color, #be123c);
  background: linear-gradient(135deg, var(--accent-dark-color, #be123c), var(--accent-color, #e11d48));
  box-shadow: 0 8px 18px -10px rgba(190, 18, 60, 0.65);
}

.sub-tab-content {
  display: none;
}

.sub-tab-content.active {
  display: block;
  animation: tabFadeIn 0.22s ease-out;
}

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

/* Page Section visibility */
.page-section {
  display: none;
}
.page-section.active {
  display: block;
  animation: pageFadeIn 0.25s ease-out;
}
@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.partner-view,
.employee-view,
.inventory-view,
.purchase-view,
.report-view {
  display: none;
}
.partner-view.active,
.employee-view.active,
.inventory-view.active,
.purchase-view.active,
.report-view.active {
  display: block;
  animation: tabFadeIn 0.25s ease-out;
}

/* ==========================================================================
   10. FINANCIAL & ACCOUNTING DATA TABLES
   ========================================================================== */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  overflow: auto;
  max-height: 70vh;
  box-shadow: var(--shadow-xs);
  margin-bottom: 12px;
}

/* Table Toolbar Tools */
.table-tools {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) repeat(4, minmax(130px, 1fr)) auto;
  align-items: end;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  box-shadow: var(--shadow-xs);
}

.table-tools label {
  display: grid;
  gap: 5px;
  color: var(--muted-ink-color);
  font-size: 0.8rem;
  font-weight: 600;
}

.table-tools input,
.table-tools select {
  min-height: 38px;
  padding: 6px 10px;
  font-size: 0.86rem;
  border-radius: var(--radius-xs);
}

.table-export-actions {
  display: flex;
  gap: 8px;
}

.table-export-actions .secondary-button {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.table-filtered-out {
  display: none !important;
}

/* Tables — Comfort Redesign (C): صفوف أوسع ورأس ثابت */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 600px;
}

th,
td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: right;
  vertical-align: middle;
}

th {
  background: var(--slate-50);
  color: var(--muted-ink-color);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

/* رأس الجدول ثابت أثناء التمرير داخل .table-wrap */
.table-wrap > table > thead > tr > th,
.table-wrap > table > thead > tr > td {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px 0 var(--line);
}

/* حافة فاصلة أنيقة أسفل الرأس الثابت */
.table-wrap > table > thead::after {
  content: none;
}

td {
  color: var(--ink-color);
  font-size: 0.9rem;
}

tbody tr {
  transition: background-color var(--duration-fast) ease;
}

tbody tr:nth-child(even) {
  background-color: #fcfdfe;
}

tbody tr:hover {
  background-color: var(--surface-subtle-color) !important;
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* Special Accounting Table Rows */
.account-group-row,
.group-row {
  background-color: var(--surface-subtle-color) !important;
  font-weight: 700;
  color: var(--ink-color);
}
.account-group-row td,
.group-row td {
  border-top: 1px solid var(--slate-200);
  border-bottom: 1px solid var(--slate-200);
}

.account-detail-row td,
.child-row td {
  color: var(--slate-700);
}

.total-row td,
.invoice-grand-total-table-row td {
  font-weight: 800 !important;
  border-top: 2px solid var(--ink-color) !important;
  border-bottom: 3px double var(--ink-color) !important;
  background-color: var(--slate-50) !important;
  color: var(--slate-950) !important;
}

.account-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-inline-end: 8px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  background: var(--surface-color);
  color: var(--muted-ink-color);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}
.account-toggle:hover {
  background: var(--surface-subtle-color);
  border-color: var(--slate-400);
  color: var(--ink-color);
}

.negative-balance,
.account-balance.negative-balance {
  color: var(--danger-600) !important;
  font-weight: 700 !important;
}

.empty-row {
  padding: 28px !important;
  color: var(--slate-400) !important;
  text-align: center !important;
  font-style: italic;
}

/* Specific Account Balance Table Styling */
.account-balance-table th:last-child,
.account-balance-table td:last-child {
  width: 220px;
  text-align: left;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   11. FINANCIAL REPORTS & SUMMARY CARDS
   ========================================================================== */
.report-view {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.report-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--slate-50);
}

.report-heading h3 {
  margin: 0 0 4px;
  color: var(--ink-color);
  font-size: 1.15rem;
  font-weight: 700;
}

.report-heading p {
  margin: 0;
}

.report-company-panel {
  padding: 16px 24px;
  margin-bottom: 20px;
}

/* Report Totals KPI Row */
.report-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 16px 0 20px;
}

.item-movement-table td.num-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* فقرة اختيار الأعمدة الظاهرة في تقرير حركة مادة */.columns-chooser {
  margin: 4px 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--surface-color) 0%, var(--slate-50) 100%);
}

.columns-chooser-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.columns-chooser-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ink-2);
}

.columns-chooser-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.columns-mini-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.columns-mini-btn:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: #fff5f7;
}

.columns-chooser-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.column-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 750;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.column-chip .column-chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: background 0.15s ease;
}

.column-chip:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

.column-chip.active {
  border-color: var(--brand);
  background: linear-gradient(135deg, var(--brand), #e11d48);
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(190, 18, 60, 0.7);
}

.column-chip.active .column-chip-dot {
  background: #fff;
}

.report-total-card {
  flex: 1;
  background: linear-gradient(135deg, var(--surface-color) 0%, var(--slate-50) 100%);
  border: 1px solid var(--line);
  padding: 18px 22px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  text-align: center;
  min-width: 190px;
  transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.report-total-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.report-total-card span {
  display: block;
  font-size: 0.85rem;
  color: var(--slate-500);
  margin-bottom: 6px;
  font-weight: 600;
}

.report-total-card strong {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ink-color);
}

.report-total-card.balanced strong,
.report-total-card.profit strong {
  color: var(--success-600);
}

.report-total-card.unbalanced strong,
.report-total-card.loss strong {
  color: var(--danger-600);
}

/* Balance Sheet Layout */
.balance-sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.bs-column {
  background: var(--surface-color);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.drilldown-link {
  color: var(--info-700);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}
.drilldown-link:hover {
  text-decoration: underline;
  color: var(--info-600);
}

/* ==========================================================================
   12. INVOICE BADGES & SUMMARY CARDS
   ========================================================================== */
.invoice-total-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--warning-50);
  color: var(--warning-600);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warning-200);
  box-shadow: var(--shadow-xs);
  font-size: 1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.invoice-total-badge .badge-subtotal { color: var(--slate-500); font-weight: 700; }
.invoice-total-badge .badge-discount { color: var(--danger-600); font-weight: 700; }
.invoice-total-badge .badge-net      { color: var(--warning-600); font-weight: 800; }
.invoice-total-badge .badge-iqd      { color: var(--success-600); font-weight: 800; }

.invoice-grand-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.invoice-grand-card {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--slate-50);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.invoice-grand-card span {
  font-size: 0.82rem;
  color: var(--slate-500);
  font-weight: 600;
}

.invoice-grand-card strong {
  font-size: 1.25rem;
  color: var(--ink-color);
  font-weight: 800;
}

.invoice-grand-card.highlight {
  background: linear-gradient(135deg, var(--ink-color) 0%, var(--ink-color) 100%);
  border-color: var(--ink-color);
  color: var(--surface-color);
}
.invoice-grand-card.highlight span { color: var(--primary-200); }
.invoice-grand-card.highlight strong { color: var(--surface-color); font-size: 1.35rem; }

.invoice-grand-card.due {
  background: var(--danger-50);
  border-color: var(--danger-200);
}
.invoice-grand-card.due strong { color: var(--danger-700); }

.invoice-grand-card.settled {
  background: var(--success-50);
  border-color: var(--success-200);
}
.invoice-grand-card.settled strong { color: var(--success-700); }

.invoice-tafqeet-box {
  padding: 14px 18px;
  background: var(--slate-50);
  border: 1px solid var(--line);
  border-right: 4px solid var(--primary-700);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--slate-700);
}
.invoice-tafqeet-box strong {
  color: var(--ink-color);
}

.invoice-signatures-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
}

.invoice-signature-box {
  text-align: center;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-color);
}

.invoice-signature-box .sig-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted-ink-color);
  margin-bottom: 40px;
}

.invoice-signature-box .sig-line {
  border-top: 1px dotted var(--slate-400);
  padding-top: 4px;
  font-size: 0.76rem;
  color: var(--slate-400);
}

/* Invoice Table Footers (tfoot) & Rows */
#invoice-detail-lines-foot {
  border-top: 2px solid var(--ink-color);
  font-weight: 700;
}

#invoice-detail-lines-foot tr td {
  padding: 10px 14px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--line);
}

#invoice-detail-lines-foot .invoice-foot-sub td {
  color: var(--muted-ink-color);
  font-size: 0.88rem;
  background: var(--slate-50);
}

#invoice-detail-lines-foot .invoice-foot-subtotal td {
  background: var(--slate-50);
  color: var(--ink-color);
  font-weight: 700;
}

#invoice-detail-lines-foot .invoice-foot-discount td {
  background: var(--danger-50);
  color: var(--danger-700);
  font-weight: 700;
}

#invoice-detail-lines-foot .invoice-foot-grand-total td {
  background: var(--ink-color) !important;
  color: var(--surface-color) !important;
  font-size: 1.1rem;
  font-weight: 800;
}

#invoice-detail-lines-foot .invoice-foot-iqd td {
  background: var(--success-50);
  color: var(--success-700);
  font-weight: 700;
}

#invoice-detail-lines-foot .invoice-foot-paid td {
  background: var(--slate-50);
  color: var(--success-700);
  font-weight: 700;
}

#invoice-detail-lines-foot .invoice-foot-balance td {
  background: var(--slate-50);
  font-weight: 800;
}

#invoice-detail-lines-foot .invoice-foot-balance.due td:last-child {
  color: var(--danger-700);
}

#invoice-detail-lines-foot .invoice-foot-balance.paid td:last-child {
  color: var(--success-700);
}

.invoice-tfoot-summary {
  background: var(--slate-50);
  border-top: 2px solid var(--ink-color);
  border-bottom: 2px solid var(--ink-color);
  font-weight: 700;
}
.invoice-tfoot-summary td {
  padding: 12px 14px;
  font-size: 0.92rem;
  color: var(--ink-color);
}
.invoice-tfoot-summary .total-sum {
  color: var(--info-700);
  font-weight: 800;
}
.invoice-tfoot-summary .paid-sum {
  color: var(--success-700);
  font-weight: 800;
}
.invoice-tfoot-summary .balance-sum {
  color: var(--danger-700);
  font-weight: 800;
}

.invoice-open-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary-700);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
  cursor: pointer;
}
.invoice-open-button:hover {
  color: var(--primary-900);
}

.invoice-sub-total-row td {
  padding: 8px 12px !important;
  font-size: 0.92rem !important;
  color: var(--slate-700) !important;
  font-weight: 700 !important;
}
.invoice-sub-total-row.discount td:last-child {
  color: var(--danger-600) !important;
}
.invoice-sub-total-row.paid td:last-child {
  color: var(--success-600) !important;
}

.invoice-breakdown-note-row td {
  padding: 8px 12px !important;
  font-size: 0.85rem !important;
  color: var(--slate-500) !important;
  background: var(--slate-50) !important;
  text-align: center !important;
  border-top: 1px dashed var(--slate-200) !important;
}

.line-table-wrap {
  margin: 18px 0 14px;
}
.line-table-wrap input,
.line-table-wrap select {
  min-width: 120px;
}

.employee-company-panel,
.inventory-company-panel,
.partner-company-panel,
.purchase-company-panel {
  padding: 16px 24px;
  margin-bottom: 20px;
}

.form-subheading {
  margin: 1.25rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--line);
  font-size: 1rem;
  color: var(--text-muted, #94a3b8);
}

/* ==========================================================================
   13. DIALOGS & MODAL WINDOWS
   ========================================================================== */
.invoice-details-dialog {
  width: min(1040px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  background: var(--surface-color);
  color: var(--ink);
}

.invoice-details-dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
}

.invoice-details-content {
  display: grid;
  gap: 20px;
}

.invoice-brand-header {
  display: flex;
  min-height: 140px;
  align-items: center;
  gap: 20px;
  overflow: hidden;
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.85) 60%, rgba(212, 160, 23, 0.3) 100%),
    url("/static/poshraw-background.jpg?v=20261013") center / cover;
  color: var(--surface-color);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.invoice-brand-header > img {
  width: 78px;
  height: 78px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.invoice-brand-title {
  flex: 1;
}

.invoice-brand-title > span {
  color: var(--primary-200);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.invoice-brand-title h2 {
  margin: 6px 0 0;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--surface-color);
}

.invoice-toolbar {
  display: flex;
  gap: 10px;
}

.invoice-toolbar .secondary-button {
  background: var(--primary-700);
  border-color: var(--primary-800);
  color: var(--surface-color);
  box-shadow: var(--primary-glow);
}
.invoice-toolbar .secondary-button:hover {
  background: var(--primary-600);
}

.invoice-detail-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.invoice-detail-field {
  display: grid;
  gap: 5px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.invoice-detail-field span {
  color: var(--slate-500);
  font-size: 0.82rem;
  font-weight: 600;
}

.invoice-detail-field strong {
  color: var(--ink-color);
  font-size: 1rem;
}

/* User Management Dialog */
.permissions-editor {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.permissions-matrix {
  display: grid;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.permission-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) repeat(5, minmax(90px, 1fr));
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.permission-choice {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

/* ==========================================================================
   14. PRINT ENGINE (STRICT FULL-FIDELITY PRESERVATION)
   ========================================================================== */
@media print {
  body {
    background: var(--surface-color) !important;
    color: #000000 !important;
    font-size: 11pt !important;
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  .sidebar,
  .topbar,
  #page-title,
  #page-reports > .panel:first-child,
  #run-reports,
  #print-trial-balance,
  #message,
  #app-message,
  .table-tools,
  .form-actions {
    display: none !important;
  }

  .content {
    padding: 0 !important;
    background: var(--surface-color) !important;
  }
  .content::before {
    display: none !important;
  }

  /* Comfort Redesign (C): لا تقصّ الجداول المطبوعة ولا تثبّت رؤوسها على الورق */
  .table-wrap {
    overflow: visible !important;
    max-height: none !important;
  }
  .table-wrap > table > thead > tr > th,
  .table-wrap > table > thead > tr > td {
    position: static !important;
    box-shadow: none !important;
  }

  /* شريط إجراءات نقطة البيع لا يثبّت على الورق */
  #sales-invoice-form .form-actions {
    position: static !important;
    box-shadow: none !important;
    background: var(--surface-color) !important;
    backdrop-filter: none !important;
  }

  /* Invoice Print Layout */
  body.printing-invoice * {
    visibility: hidden !important;
  }
  body.printing-invoice #invoice-details-dialog,
  body.printing-invoice #invoice-details-dialog * {
    visibility: visible !important;
  }

  body.printing-invoice #invoice-details-dialog {
    position: fixed !important;
    inset: 0 auto auto 0 !important;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: var(--surface-color) !important;
  }

  body.printing-invoice .invoice-toolbar {
    display: none !important;
  }

  body.printing-invoice .invoice-brand-header {
    border-radius: 0 !important;
    min-height: 120px !important;
  }

  body.printing-invoice .invoice-details-content {
    gap: 12px !important;
  }
  body.printing-invoice .invoice-details-content section {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
  }

  body.printing-invoice table {
    min-width: 0 !important;
  }

  body.printing-invoice #invoice-detail-lines-foot .invoice-foot-grand-total td {
    background: #1e293b !important;
    color: var(--surface-color) !important;
    font-weight: 800 !important;
    font-size: 1.05rem !important;
  }

  body.printing-invoice .invoice-bottom-container {
    break-inside: avoid;
    margin-top: 14px;
  }

  body.printing-invoice .invoice-grand-cards {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    gap: 8px;
  }

  body.printing-invoice .invoice-grand-card {
    padding: 8px 10px;
    border: 1px solid #cbd5e1 !important;
  }

  body.printing-invoice .invoice-grand-card.highlight {
    background: #1e293b !important;
    color: var(--surface-color) !important;
  }

  body.printing-invoice .invoice-signatures-row {
    break-inside: avoid;
    margin-top: 10px;
    padding-top: 10px;
  }

  /* Financial Report Print */
  .page-section {
    display: none !important;
  }
  #page-reports.page-section {
    display: block !important;
  }
  #page-reports > :not(#trial-balance-report) {
    display: none !important;
  }

  .report-view {
    border: 0 !important;
    box-shadow: none !important;
  }
  .report-heading {
    padding: 8px 0 !important;
    background: var(--surface-color) !important;
  }
  .account-toggle {
    display: none !important;
  }
  .account-balance-table tr[hidden] {
    display: none !important;
  }
  #trial-balance-total {
    padding: 10px 0 !important;
  }
}

/* ==========================================================================
   15. RESPONSIVE BREAKPOINTS & MOBILE ADAPTATION
   ========================================================================== */
@media (max-width: 1200px) {
  .poshraw-portals-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1024px) {
  .poshraw-hero-banner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  .hero-center-info {
    padding: 0;
  }
  .hero-sketches-container {
    display: none;
  }
  .sidebar {
    flex-basis: 220px;
    width: 220px;
    padding: 18px 10px;
  }
  .content {
    padding: 20px 22px;
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table-search-field,
  .table-export-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    width: 100%;
    flex-basis: auto;
    padding: 16px;
    border-left: 0;
    border-bottom: 1px solid var(--sidebar-border);
  }
  .brand-lockup {
    flex-direction: row;
    justify-content: center;
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
  }
  .brand-mark {
    width: 52px;
    height: 52px;
    margin-bottom: 0;
  }
  .brand-tagline {
    display: none;
  }
  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .nav-submenu {
    grid-column: 1 / -1;
  }
  .content {
    padding: 16px 14px 32px;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .cards,
  .form-grid,
  .invoice-detail-summary,
  .balance-sheet-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .wide-field {
    grid-column: auto;
  }
  .brand-hero {
    min-height: 180px;
    padding: 20px;
  }
  .invoice-brand-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
  }
  .invoice-toolbar {
    width: 100%;
  }
  .invoice-toolbar button {
    flex: 1;
  }
}

@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;
  }
}

/* ==========================================================================
   15. POS (نقطة البيع) — إعادة تصميم مريحة متوافقة مع نظام التصميم
   ========================================================================== */

/* شريط عمليات الكاشير السريعة (أعلى النموذج) */
.pos-actions-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-subtle-color);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.pos-toolbar-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted-ink-color);
  margin-left: 4px;
  white-space: nowrap;
}

.pos-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: var(--radius-sm, 8px);
  border: 1.5px solid var(--border-color);
  background: var(--surface-subtle-color);
  color: var(--ink-color);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.pos-tool-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

/* Tool buttons in Light Mode */
:root[data-theme="light"] .pos-tool-btn--info {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
}
:root[data-theme="light"] .pos-tool-btn--info:hover {
  background: #dbeafe !important;
  border-color: #1e40af !important;
}
:root[data-theme="light"] .pos-tool-btn--danger {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
}
:root[data-theme="light"] .pos-tool-btn--danger:hover {
  background: #fee2e2 !important;
  border-color: #991b1b !important;
}
:root[data-theme="light"] .pos-tool-btn--warn {
  background: #fffbeb !important;
  border-color: #f59e0b !important;
  color: #b45309 !important;
}
:root[data-theme="light"] .pos-tool-btn--warn:hover {
  background: #fef3c7 !important;
  border-color: #92400e !important;
}
:root[data-theme="light"] .pos-tool-btn--success {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #047857 !important;
  font-weight: 800 !important;
}
:root[data-theme="light"] .pos-tool-btn--success:hover {
  background: #d1fae5 !important;
  border-color: #065f46 !important;
}

/* Tool buttons in Dark Mode */
:root[data-theme="dark"] .pos-tool-btn--info {
  background: rgba(59, 130, 246, 0.18) !important;
  border-color: #3b82f6 !important;
  color: #93c5fd !important;
}
:root[data-theme="dark"] .pos-tool-btn--info:hover {
  background: rgba(59, 130, 246, 0.3) !important;
}
:root[data-theme="dark"] .pos-tool-btn--danger {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: #ef4444 !important;
  color: #fca5a5 !important;
}
:root[data-theme="dark"] .pos-tool-btn--danger:hover {
  background: rgba(239, 68, 68, 0.3) !important;
}
:root[data-theme="dark"] .pos-tool-btn--warn {
  background: rgba(245, 158, 11, 0.18) !important;
  border-color: #f59e0b !important;
  color: #fde68a !important;
}
:root[data-theme="dark"] .pos-tool-btn--warn:hover {
  background: rgba(245, 158, 11, 0.3) !important;
}
:root[data-theme="dark"] .pos-tool-btn--success {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: #10b981 !important;
  color: #6ee7b7 !important;
  font-weight: 800 !important;
}
:root[data-theme="dark"] .pos-tool-btn--success:hover {
  background: rgba(16, 185, 129, 0.3) !important;
}

/* صندوق مسح الباركود */
.pos-scan-box {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 10px 14px;
  background: var(--surface-subtle-color);
  border: 1.5px dashed var(--border-color);
  border-radius: var(--radius-md, 10px);
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.pos-scan-box:focus-within {
  border-color: #0284c7;
  border-style: solid;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}
.pos-scan-box--purchase:focus-within {
  border-color: var(--info-color);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}
.pos-scan-box__label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pos-scan-box__label strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink-color);
}
.pos-scan-box__label small {
  color: var(--muted-ink-color);
  font-size: 0.82rem;
  font-weight: 600;
}
.pos-scan-box__icon {
  font-size: 1.5rem;
  line-height: 1;
}
.pos-scan-box__input {
  flex: 1;
  min-width: 240px;
}
.pos-scan-box__input input {
  min-height: 44px;
  font-size: 1.12rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 0 14px;
}
.pos-scan-box__status {
  font-weight: 800;
  font-size: 0.9rem;
  min-width: 130px;
  text-align: center;
}

/* شريط اختصارات لوحة المفاتيح المدمج */
.pos-shortcuts-ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 7px 12px;
  background: var(--surface-subtle-color);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md, 10px);
  font-size: 0.78rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.pos-shortcuts-ribbon__title {
  font-weight: 800;
  color: var(--ink-color);
  margin-left: 4px;
  white-space: nowrap;
}

/* كبسولة المفتاح (F-Key cap) */
.pos-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-color);
  border: 1.5px solid var(--border-color);
  color: var(--ink-color);
  font-weight: 700;
  font-size: 0.78rem;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  letter-spacing: 0.2px;
  line-height: 1.2;
}

/* F-Keys in Light Mode */
:root[data-theme="light"] .pos-key {
  background: #ffffff !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}
:root[data-theme="light"] .pos-key--info {
  background: #eff6ff !important;
  border-color: #3b82f6 !important;
  color: #1d4ed8 !important;
  font-weight: 800 !important;
}
:root[data-theme="light"] .pos-key--danger {
  background: #fef2f2 !important;
  border-color: #ef4444 !important;
  color: #b91c1c !important;
  font-weight: 800 !important;
}
:root[data-theme="light"] .pos-key--warn {
  background: #fffbeb !important;
  border-color: #f59e0b !important;
  color: #b45309 !important;
  font-weight: 800 !important;
}
:root[data-theme="light"] .pos-key--violet {
  background: #f5f3ff !important;
  border-color: #8b5cf6 !important;
  color: #5b21b6 !important;
  font-weight: 800 !important;
}
:root[data-theme="light"] .pos-key--success {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #047857 !important;
  font-weight: 800 !important;
}

/* F-Keys in Dark Mode */
:root[data-theme="dark"] .pos-key {
  background: #1e293b !important;
  border-color: #475569 !important;
  color: #f8fafc !important;
}
:root[data-theme="dark"] .pos-key--info {
  background: rgba(59, 130, 246, 0.2) !important;
  border-color: #60a5fa !important;
  color: #93c5fd !important;
  font-weight: 800 !important;
}
:root[data-theme="dark"] .pos-key--danger {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: #f87171 !important;
  color: #fca5a5 !important;
  font-weight: 800 !important;
}
:root[data-theme="dark"] .pos-key--warn {
  background: rgba(245, 158, 11, 0.2) !important;
  border-color: #fbbf24 !important;
  color: #fde68a !important;
  font-weight: 800 !important;
}
:root[data-theme="dark"] .pos-key--violet {
  background: rgba(139, 92, 246, 0.2) !important;
  border-color: #a78bfa !important;
  color: #c4b5fd !important;
  font-weight: 800 !important;
}
:root[data-theme="dark"] .pos-key--success {
  background: rgba(16, 185, 129, 0.2) !important;
  border-color: #34d399 !important;
  color: #6ee7b7 !important;
  font-weight: 800 !important;
}

/* زر الحفظ والترحيل الرئيسي في نقطة البيع */
.pos-submit-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  padding: 12px 24px !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
  border-radius: 10px !important;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.pos-submit-btn:hover {
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45) !important;
  transform: translateY(-1px);
}

/* توافق متوافق مع الكلاس القديم إن وُجد */
.barcode-pos-box {
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.barcode-pos-box:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* ===== تخطيط نقطة البيع المريح: شريط العمليات في رأس اللوحة ===== */
#tab-sales-create .panel-heading {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 20px;
}
#tab-sales-create .panel-heading > div:first-child {
  flex: 1 1 320px;
  min-width: 0;
}
#tab-sales-create .panel-heading h3 {
  margin-bottom: 4px;
}
#tab-sales-create .panel-heading p.muted {
  margin: 0;
}

/* رأس لوحة نقطة البيع */
.pos-panel {
  padding: 20px 22px;
}
.pos-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}
/* على الشاشات الواسعة: العنوان والفِرَق جنباً إلى جنب لتقليل الطول */
@media (min-width: 960px) {
  .pos-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .pos-header__title {
    flex: 1 1 340px;
    min-width: 0;
  }
  .pos-actions-toolbar {
    flex: 0 0 auto;
  }
}
.pos-header__title h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink-color);
}
.pos-header__title p.muted {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
}

/* مجموعات الحقول: فواصل واضحة تمنع الإحساس بالتشابك */
.pos-fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  padding: 16px 18px 18px;
  margin: 0 0 16px;
  min-width: 0;
}
.pos-fieldset > legend {
  padding: 0 8px;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--accent-color);
  background: var(--surface-color);
}
.pos-fieldset > .form-grid {
  margin-bottom: 0;
}
.pos-fieldset .pos-scan-box {
  margin-top: 0;
}
/* داخل الحقل: زر الإضافة أسفل الجدول */
.pos-fieldset > .table-wrap {
  margin-bottom: 12px;
}

/* عنوان قسم داخل نموذج البيع (بدل الحقول المحاطة) */
.pos-section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent-color);
}
.pos-section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}
#sales-invoice-form > .pos-section-label:first-child {
  margin-top: 0;
}

/* حقل صار مطلوباً بشكل ديناميكي (مثل حساب الدفع عند إدخال مبلغ مدفوع) */
label.field-needed > input,
label.field-needed > select {
  border-color: var(--warning-color);
  box-shadow: 0 0 0 3px var(--warning-100);
}
label.field-needed::after {
  content: "مطلوب — سجّل الدفعة";
  margin-inline-start: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--warning-600);
}

/* صف المجاميع: المجموع الجزئي — الخصم — الصافي */
.pos-totals-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.pos-total-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle-color);
  border: 1px solid var(--border-subtle);
}
.pos-total-cell span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted-ink-color);
}
.pos-total-cell strong {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink-color);
  font-variant-numeric: tabular-nums;
}
.pos-total-cell--discount {
  background: var(--danger-50);
  border-color: var(--danger-200);
}
.pos-total-cell--discount strong { color: var(--danger-600); }
.pos-total-cell--net {
  background: var(--warning-50);
  border-color: var(--warning-200);
}
.pos-total-cell--net strong { color: var(--warning-600); }

@media (max-width: 900px) {
  .pos-totals-row { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   MODERN ERGONOMIC 2-COLUMN POS LAYOUT
   ========================================================================== */
.pos-modern-layout {
  padding: 16px 20px;
  background: var(--surface-color);
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.pos-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.pos-badge-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pos-live-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.pos-header-compact .pos-header__title h3 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--ink-color);
}

.pos-header-compact .pos-header__title p.muted {
  margin: 2px 0 0;
  font-size: 0.8rem;
}

/* شريط العميل العلوي المختصر */
.pos-top-customer-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface-subtle-color);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 10px);
  padding: 8px 14px;
  margin-bottom: 12px;
}

.pos-customer-quick-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1;
}

.pos-inline-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-color);
}

.pos-field-icon {
  font-size: 1rem;
}

.pos-select-styled {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  color: var(--ink-color);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pos-select-styled:focus {
  border-color: #38bdf8;
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.pos-toggle-advanced-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: transparent;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  color: var(--muted-ink-color);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pos-toggle-advanced-btn:hover {
  background: var(--surface-color);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.pos-toggle-advanced-btn .pos-chevron {
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.pos-toggle-advanced-btn[aria-expanded="true"] .pos-chevron {
  transform: rotate(180deg);
}

/* اللوحة المنسدلة للخيارات المتقدمة */
.pos-advanced-drawer {
  background: var(--surface-color);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md, 10px);
  padding: 12px 16px;
  margin-bottom: 12px;
  animation: slide-down 0.2s ease-out;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pos-advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin: 0;
}

.pos-advanced-grid label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-color);
}

/* تقسيم نقطة البيع: سلة المشتريات (يمين) + لوحة الدفع الثابتة (يسار) */
.pos-split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(360px, 385px);
  gap: 16px;
  align-items: start;
}

@media (max-width: 1080px) {
  .pos-split-grid {
    grid-template-columns: 1fr;
  }
  .pos-checkout-pane {
    position: static !important;
  }
}

/* عمود السلة */
.pos-cart-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pos-table-card {
  background: var(--surface-color);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md, 10px);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.pos-cart-table-wrap {
  min-height: 320px;
  max-height: calc(100vh - 350px);
  overflow-y: auto;
  border-bottom: 1.5px solid var(--border-color);
}

.pos-cart-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.pos-cart-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-subtle-color) !important;
  font-size: 0.85rem !important;
  font-weight: 800 !important;
  color: var(--ink-color) !important;
  padding: 10px 10px !important;
  border: 1px solid var(--border-color) !important;
  border-bottom: 2px solid var(--border-color) !important;
  text-align: right;
}

.pos-cart-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.15s ease;
}

.pos-cart-table tbody tr:hover td {
  background-color: rgba(56, 189, 248, 0.05) !important;
}

.pos-cart-table td {
  padding: 8px 10px;
  vertical-align: middle;
  border: 1px solid var(--border-color) !important;
}

/* حقول الإدخال المريحة لجدول الكاشير */
.pos-cart-table td input,
.pos-cart-table td select {
  min-height: 38px !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  border: 1.5px solid var(--border-color) !important;
  padding: 6px 10px !important;
  background: var(--surface-subtle-color) !important;
  color: var(--ink-color) !important;
}

.pos-cart-table td input:focus,
.pos-cart-table td select:focus {
  border-color: #0284c7 !important;
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2) !important;
}

.pos-cart-table input.invoice-qty {
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  text-align: center !important;
  color: var(--accent-color) !important;
  max-width: 90px !important;
}

.pos-cart-table input.invoice-price {
  font-size: 1.05rem !important;
  font-weight: 800 !important;
  text-align: center !important;
  color: var(--ink-color) !important;
  max-width: 130px !important;
}

.pos-cart-table button.remove-line {
  min-height: 34px !important;
  min-width: 34px !important;
  padding: 2px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 8px !important;
  border: 1.5px solid rgba(239, 68, 68, 0.35) !important;
  background: rgba(239, 68, 68, 0.08) !important;
  color: #ef4444 !important;
  font-size: 1.15rem !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.pos-cart-table button.remove-line:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
}

.pos-cart-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--surface-subtle-color);
  border-top: 1px solid var(--border-color);
}

.pos-counter-pill {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted-ink-color);
  background: var(--surface-color);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--border-color);
}

/* عمود الدفع والحساب الجانبي */
.pos-checkout-pane {
  position: sticky;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* بطاقة الصافي الكبرى (شاشة نقد رقمية ذات تباين فائق) */
.pos-summary-card {
  background: linear-gradient(145deg, #0f172a, #1e293b);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  padding: 14px 18px;
  color: #ffffff !important;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-summary-card span,
.pos-summary-card strong,
.pos-summary-card div {
  color: #ffffff;
}

.pos-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #94a3b8 !important;
}

.pos-currency-tag {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8 !important;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.pos-grand-net {
  display: flex;
  flex-direction: column;
}

.pos-grand-net span {
  font-size: 0.75rem;
  color: #94a3b8 !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pos-grand-net strong {
  font-size: 2.2rem !important;
  font-weight: 900 !important;
  color: #38bdf8 !important;
  letter-spacing: -0.5px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.pos-subtotals-breakdown {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 0.82rem;
}

.pos-sub-item {
  display: flex;
  gap: 4px;
  color: #cbd5e1 !important;
}

.pos-sub-item strong {
  color: #f8fafc !important;
  font-weight: 700;
}

.pos-sub-item--discount strong {
  color: #f87171 !important;
}

/* أقسام اللوحة الجانبية */
.pos-pane-section {
  background: var(--surface-color);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md, 10px);
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.pos-pane-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-color);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pos-discount-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pos-discount-select {
  flex: 0 0 120px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--border-color);
  background: var(--surface-subtle-color);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-color);
}

.pos-discount-input {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--border-color);
  background: var(--surface-subtle-color);
  color: var(--ink-color);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

/* النقد المستلم والشرائح */
.pos-paid-amount-input {
  width: 100%;
  min-height: 48px;
  font-size: 1.45rem !important;
  font-weight: 900 !important;
  text-align: center;
  color: #10b981 !important;
  border: 2px solid rgba(16, 185, 129, 0.45) !important;
  border-radius: 10px !important;
  padding: 8px !important;
  background: rgba(16, 185, 129, 0.04) !important;
}

.pos-paid-amount-input:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25) !important;
}

.pos-quick-cash-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pos-chip-btn {
  flex: 1;
  min-width: 58px;
  min-height: 34px;
  padding: 5px 6px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: var(--surface-subtle-color);
  color: var(--ink-color);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.pos-chip-btn:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: #0284c7;
  color: #0284c7;
}

.pos-chip-btn--exact {
  flex: 2;
  background: rgba(16, 185, 129, 0.12);
  border-color: #10b981;
  color: #059669;
}

.pos-chip-btn--exact:hover {
  background: #10b981;
  color: #ffffff;
}

/* مؤشر الباقي للزبون */
.pos-change-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1.5px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
}

.pos-change-box.pos-change-warning {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.25);
}

.pos-change-lbl {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted-ink-color);
}

.pos-change-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: #10b981;
  font-variant-numeric: tabular-nums;
}

.pos-compact-account-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pos-compact-account-row input,
.pos-compact-account-row select {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1.5px solid var(--border-color);
}

/* زر الحفظ الرئيسي الضخم */
.pos-submit-btn--hero {
  width: 100%;
  min-height: 52px;
  padding: 12px 20px !important;
  font-size: 1.15rem !important;
  font-weight: 900 !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #10b981, #059669) !important;
  border: none !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4) !important;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pos-submit-btn--hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5) !important;
}

.pos-submit-btn--hero:active {
  transform: translateY(0);
}

.pos-shortcuts-ribbon--compact {
  margin-top: 6px;
  padding: 7px 10px;
  font-size: 0.76rem;
  justify-content: center;
  gap: 7px;
}

/* ===== ملصقات الباركود (طباعة 50×30 مم) ===== */
#labels-print-area {
  display: none;
}
.label-qty-input {
  width: 4.5rem;
  padding: 0.3rem;
  text-align: center;
}
#labels-items-table input[type="checkbox"] {
  accent-color: #d4a017;
  width: 1.05rem;
  height: 1.05rem;
  cursor: pointer;
}
.labels-sheet {
  display: flex;
  flex-wrap: wrap;
  gap: 4mm;
  padding: 6mm;
}
.label-box {
  width: 50mm;
  height: 30mm;
  border: 0.3mm dashed #9aa2ad;
  border-radius: 1.5mm;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.2mm 1mm;
  box-sizing: border-box;
  background: var(--surface-color);
  color: #000000;
  page-break-inside: avoid;
}
.label-box svg {
  max-width: 100%;
  height: auto !important;
}
.label-barcode-fallback {
  font-family: "Courier New", monospace;
  font-size: 12pt;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 2mm 0;
}
.label-item-name {
  font-size: 7.5pt;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: auto;
}
.label-item-footer {
  font-size: 7.5pt;
  color: #333333;
  margin-top: 0.5mm;
}

@media print {
  body.printing-labels * {
    visibility: hidden !important;
  }
  body.printing-labels #labels-print-area,
  body.printing-labels #labels-print-area * {
    visibility: visible !important;
  }
  body.printing-labels #labels-print-area {
    display: block !important;
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
  }
  body.printing-labels .label-box {
    border-color: #666666;
  }
}



/* ===== إدخال المقاسات يدوياً (شرائح قابلة للحذف) ===== */
.sizes-field {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--surface-subtle-color);
}

.sizes-field-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-color);
}

.sizes-entry {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.sizes-entry input {
  flex: 1;
  min-width: 150px;
  min-height: 42px;
  padding: 0 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  background: var(--surface-color);
  color: var(--ink-color);
}

.sizes-entry input#multi-size-pieces {
  flex: 0 0 auto;
  min-width: 120px;
  max-width: 150px;
  text-align: center;
  font-weight: 700;
}

.sizes-entry input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-soft-color);
}

.sizes-add-btn {
  border: none;
  border-radius: 10px;
  padding: 0 18px;
  min-height: 42px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent-dark-color), var(--accent-color));
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sizes-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -8px rgba(190, 18, 60, 0.6);
}

/* أدوات الدرزن: عدد القطع الإجمالي + توزيع متساوٍ + تصفير */
.sizes-dozens-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--border-color);
  border-radius: 10px;
  background: var(--surface-color);
}

.sizes-dozen-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted-ink-color);
}

.sizes-dozen-label input {
  width: 90px;
  min-height: 36px;
  padding: 0 10px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  text-align: center;
  font: inherit;
  font-weight: 700;
  background: var(--surface-subtle-color);
  color: var(--ink-color);
}

.sizes-dozens-tools .secondary-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-subtle-color);
  color: var(--ink-color);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sizes-dozens-tools .secondary-button:hover {
  border-color: var(--accent-color);
  background: var(--surface-hover-color);
}

.sizes-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
  align-items: center;
}

.sizes-chips:empty::before {
  content: "لا توجد مقاسات بعد — اكتب مقاساً وعدد القطع في المربع أعلاه";
  font-size: 0.8rem;
  color: var(--muted-ink-color);
}

.size-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--accent-dark-color);
  background: linear-gradient(135deg, var(--accent-dark-color), var(--accent-color));
  color: #fff;
  font-size: 0.84rem;
  font-weight: 800;
  box-shadow: 0 6px 14px -8px rgba(190, 18, 60, 0.7);
}

/* شريحة المقاس مع خانة عدد القطع */
.size-chip--pieces {
  padding: 4px 8px 4px 12px;
  gap: 6px;
}

.size-chip-label {
  color: #fff;
  font-weight: 800;
}

.size-chip-pieces {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.size-chip-pieces-input {
  width: 54px;
  min-height: 26px;
  padding: 0 4px;
  border: none;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  text-align: center;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.size-chip-pieces-input:focus {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.size-chip-pieces small {
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.9;
}

.size-chip-remove {
  border: none;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease;
}

.size-chip-remove:hover {
  background: rgba(255, 255, 255, 0.5);
  color: #7f1d1d;
}

.sizes-hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted-ink-color);
}

/* إجمالي القطع وتحويله إلى درازن */
.sizes-total {
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--success-color);
  background: var(--surface-color);
  border: 1px solid var(--border-color);
}

.sizes-total--warn {
  color: var(--warning-color);
}

.sizes-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.size-quick-btn {
  border: 1.5px solid var(--line, #e2e8f0);
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.size-quick-btn:hover {
  border-color: var(--brand, #be123c);
  color: #9f1239;
}

.size-quick-btn.active {
  border-color: var(--brand, #be123c);
  background: linear-gradient(135deg, var(--brand, #be123c), #e11d48);
  color: #fff;
}

/* ===== شريط تصدير التقارير الموحّد (Excel / PDF / CSV) ===== */
.report-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--surface-color) 0%, #f8fafc 100%);
}

.report-export-bar-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-2, #334155);
}

.report-export-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-inline-start: auto;
}

.report-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.report-export-xlsx {
  background: linear-gradient(135deg, var(--success-600), #22c55e);
  box-shadow: 0 8px 18px -10px rgba(21, 128, 61, 0.7);
}

.report-export-pdf {
  background: linear-gradient(135deg, var(--danger-600), #ef4444);
  box-shadow: 0 8px 18px -10px rgba(185, 28, 28, 0.7);
}

.report-export-btn.report-export-csv {
  background: #fff;
  color: var(--ink-2, #334155);
  border: 1.5px solid var(--line, #e2e8f0);
  box-shadow: none;
}

.report-export-icon {
  font-size: 1rem;
  line-height: 1;
}

@media (max-width: 720px) {
  .report-export-bar-actions {
    margin-inline-start: 0;
    width: 100%;
  }
  .report-export-btn {
    flex: 1;
    justify-content: center;
  }
}

/* شريط التصدير داخل الصفحات البياناتية (مبيعات/مشتريات/مخزون...) */
.page-export-bar {
  margin-bottom: 14px;
  background: linear-gradient(135deg, var(--surface-color) 0%, #f8fafc 100%);
}

/* ==========================================================================
   THEME OVERRIDES — تطبيق متغيرات الثيم على كل المكونات
   هذه القواعد تطبق الألوان الصحيحة للوضع الداكن/الفاتح
   ========================================================================== */

/* ---- Layout Shell ---- */
.app-shell,
.main,
.area,
.page-section,
.tab-wrapper {
  background-color: var(--canvas-color) !important;
  color: var(--ink-color) !important;
}

/* ---- Sidebar ---- */
.sidebar {
  background: var(--sidebar-bg) !important;
  border-left: 1px solid var(--sidebar-border) !important;
}
.sidebar .nav {
  color: var(--sidebar-text) !important;
}
.sidebar .nav:hover,
.sidebar .nav:focus {
  background: var(--sidebar-hover) !important;
  color: var(--sidebar-text) !important;
}
.sidebar .nav.active {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark-color)) !important;
  color: #fff !important;
}
.sidebar .nav .nav-icon,
.sidebar .nav .nav-main {
  color: inherit !important;
}
.sidebar .nav-parent[aria-expanded="true"] .nav-chevron {
  color: var(--accent-color) !important;
}
.sidebar .nav-submenu {
  background: var(--sidebar-bg) !important;
  border-left: 1px solid var(--sidebar-border) !important;
}
.sidebar .nav-subitem {
  color: var(--sidebar-text-muted) !important;
}
.sidebar .nav-subitem:hover,
.sidebar .nav-subitem.active {
  background: var(--sidebar-hover) !important;
  color: var(--sidebar-text) !important;
}
.sidebar .brand-lockup .logo-p,
.sidebar .brand-lockup .logo-shraw,
.sidebar .brand-lockup .logo-co {
  color: #fff !important;
}
.sidebar__wm b,
.sidebar__wm small {
  color: inherit !important;
}
.sidebar__grp {
  color: var(--sidebar-text-muted) !important;
}
.sidebar .ico {
  background: var(--sidebar-hover) !important;
}

/* ---- Top Bar / Header ---- */
.top,
header.top,
.header,
.topbar {
  background: var(--surface-color) !important;
  border-bottom: 1px solid var(--border-color) !important;
}
.top__title b {
  color: var(--ink-color) !important;
}
.top__title small {
  color: var(--muted-ink-color) !important;
}
.icon-btn {
  background: var(--surface-subtle-color) !important;
  border: 1.5px solid var(--border-color) !important;
  color: var(--ink-color) !important;
}
.icon-btn:hover {
  border-color: var(--border-subtle-color) !important;
}
.pill {
  background: var(--surface-subtle-color) !important;
  border: 1.5px solid var(--border-color) !important;
  color: var(--ink-color) !important;
}
.user-box {
  background: var(--surface-subtle-color) !important;
  border: 1.5px solid var(--border-color) !important;
}
.user-box b {
  color: var(--ink-color) !important;
}
.user-box small {
  color: var(--muted-ink-color) !important;
}
.avatar {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark-color)) !important;
}

/* ---- Theme Toggle Button ---- */
.theme-toggle {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 40px !important;
  padding: 0 15px !important;
  border-radius: 999px !important;
  border: 1.5px solid var(--border-color) !important;
  background: var(--surface-subtle-color) !important;
  color: var(--ink-color) !important;
  font: inherit !important;
  font-weight: 800 !important;
  font-size: 0.83rem !important;
  cursor: pointer !important;
  transition: transform .18s, box-shadow .18s, border-color .18s, color .18s !important;
}
.theme-toggle:hover {
  border-color: var(--accent-color) !important;
  color: var(--accent-color) !important;
  transform: translateY(-1px) !important;
}
.theme-toggle .tg-icon {
  font-size: 1.05rem !important;
  line-height: 1 !important;
}

/* ---- Panels / Cards ---- */
.panel,
.card,
.pos-panel,
.report-view,
.section-panel {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
}
.panel-heading,
.card__head,
.pos-header {
  border-bottom: 1px solid var(--border-subtle-color) !important;
  background: var(--surface-color) !important;
}
.panel-heading h3,
.card__head h3,
.pos-header__title h3 {
  color: var(--ink-color) !important;
}
.muted,
.muted-text,
.card__head .muted,
.pos-header__title p {
  color: var(--muted-ink-color) !important;
}

/* ---- Form Elements ---- */
input,
select,
textarea,
.field input,
.field select,
.field textarea {
  background: var(--surface-subtle-color) !important;
  border: 1.5px solid var(--border-color) !important;
  color: var(--ink-color) !important;
}
input:focus,
select:focus,
textarea:focus,
.field input:focus,
.field select:focus {
  outline: none !important;
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 0 3px var(--accent-soft-color) !important;
}
input::placeholder,
select::placeholder,
textarea::placeholder {
  color: var(--muted-ink-color) !important;
}
label.field > span {
  color: var(--ink-color) !important;
}

/* ---- Buttons ---- */
.btn,
button.secondary-button,
button:not(.theme-toggle):not(.icon-btn):not(.pill):not(.nav):not(.nav-subitem):not(.sub-tab):not(.section-tab):not(.workshop-tab) {
  background: var(--surface-subtle-color) !important;
  border: 1.5px solid var(--border-color) !important;
  color: var(--ink-color) !important;
}
.btn:hover,
button.secondary-button:hover,
button:not(.theme-toggle):not(.icon-btn):not(.pill):not(.nav):not(.nav-subitem):not(.sub-tab):not(.section-tab):not(.workshop-tab):hover {
  border-color: var(--muted-ink-color) !important;
}
.btn--grad,
button.primary-button {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark-color)) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: 0 10px 24px -8px rgba(190, 18, 60, 0.6) !important;
}
.btn--grad:hover,
button.primary-button:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 14px 30px -8px rgba(190, 18, 60, 0.7) !important;
}

/* ---- Tables ---- */
.table-wrap,
table {
  background: var(--surface-color) !important;
}
table {
  border-collapse: collapse;
  width: 100%;
}
thead {
  background: var(--surface-subtle-color) !important;
}
th {
  background: var(--surface-subtle-color) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--ink-color) !important;
  font-weight: 700 !important;
}
td {
  border: 1px solid var(--border-color) !important;
  color: var(--ink-color) !important;
}
tbody tr:nth-child(even) td {
  background: var(--surface-hover-color) !important;
}
tbody tr:hover td {
  background: var(--surface-hover-color) !important;
}
.table-tools {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
  border-bottom: none !important;
}
.table-search,
.table-filter-column,
.table-filter-value,
.table-date-from,
.table-date-to {
  background: var(--surface-subtle-color) !important;
  border: 1.5px solid var(--border-color) !important;
  color: var(--ink-color) !important;
}

/* ---- Report Totals / Summary Cards ---- */
.report-total-card,
.report-totals .card,
.stat-card,
.kpi-card {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
}
.report-total-card span,
.report-total-card strong,
.stat-card .stat-value {
  color: var(--ink-color) !important;
}
.report-total-card strong {
  color: var(--accent-color) !important;
}

/* ---- Column Chips / Size Chips ---- */
.column-chip,
.size-chip {
  background: var(--surface-subtle-color) !important;
  border: 1.5px solid var(--border-color) !important;
  color: var(--ink-2-color, var(--ink-color)) !important;
}
.column-chip.active,
.size-chip.active {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark-color)) !important;
  border-color: var(--accent-color) !important;
  color: #fff !important;
}
.column-chip:hover:not(.active),
.size-chip:hover:not(.active) {
  border-color: var(--accent-color) !important;
}
.column-chip-dot {
  background: var(--accent-color) !important;
}
.columns-chooser-title {
  color: var(--ink-color) !important;
}

/* ---- Size Quick Buttons ---- */
.size-quick-btn {
  border: 1.5px solid var(--border-color) !important;
  background: var(--surface-color) !important;
  color: var(--muted-ink-color) !important;
}
.size-quick-btn:hover {
  border-color: var(--accent-color) !important;
  color: var(--accent-color) !important;
}
.size-quick-btn.active {
  border-color: var(--accent-color) !important;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-dark-color)) !important;
  color: #fff !important;
}

/* ---- Export Buttons ---- */
.report-export-btn,
.table-export-xlsx,
.table-export-pdf {
  background: var(--accent-color) !important;
  color: #fff !important;
}
.report-export-btn:hover,
.table-export-xlsx:hover,
.table-export-pdf:hover {
  background: var(--accent-dark-color) !important;
}
.report-export-bar {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
}
.page-export-bar {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
}
.report-export-bar-label {
  color: var(--ink-color) !important;
}

/* ---- Column Chip Active Dot ---- */
.column-chip.active .column-chip-dot {
  background: #fff !important;
}

/* ---- Badges / Chips ---- */
.chip,
.badge,
.status-chip {
  background: var(--accent-soft-color) !important;
  color: var(--accent-color) !important;
  border: 1px solid var(--accent-color) !important;
}

/* ---- Alerts / Notifications ---- */
.alert,
.notification,
.toast {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--ink-color) !important;
}
.alert--bad,
.alert-danger {
  background: rgba(244, 63, 94, 0.1) !important;
  border-color: var(--danger-color) !important;
  color: var(--danger-color) !important;
}
.alert--warn,
.alert-warning {
  background: rgba(251, 191, 36, 0.1) !important;
  border-color: var(--warning-color) !important;
  color: var(--warning-color) !important;
}
.alert--info,
.alert-info {
  background: rgba(96, 165, 250, 0.1) !important;
  border-color: var(--info-color) !important;
  color: var(--info-color) !important;
}
.alert--ok,
.alert-success {
  background: rgba(52, 211, 153, 0.1) !important;
  border-color: var(--success-color) !important;
  color: var(--success-color) !important;
}

/* ---- Modals / Dialogs ---- */
.modal,
.dialog,
.drawer {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-3) !important;
}
.modal-header,
.dialog-header {
  border-bottom: 1px solid var(--border-subtle-color) !important;
}

/* ---- Dropdown / Select Options ---- */
select option {
  background: var(--surface-color) !important;
  color: var(--ink-color) !important;
}

/* ---- Tooltips ---- */
.tooltip,
[title]:hover::after {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--ink-color) !important;
}

/* ---- Tabs ---- */
.section-tabs,
.tabs {
  border-bottom: 1px solid var(--border-color) !important;
}
.section-tab,
.tab-btn {
  color: var(--muted-ink-color) !important;
  border-bottom: 2px solid transparent !important;
}
.section-tab.active,
.tab-btn.active {
  color: var(--accent-color) !important;
  border-bottom-color: var(--accent-color) !important;
}

/* ---- Progress / Loading ---- */
.progress-bar,
.loading-spinner {
  background: var(--surface-subtle-color) !important;
}
.progress-bar::-webkit-progress-value,
.progress-bar::-moz-progress-bar {
  background: var(--accent-color) !important;
}

/* ---- POS Specific ---- */
.pos-scan-box {
  background: var(--surface-subtle-color) !important;
  border: 1px solid var(--border-color) !important;
}
.pos-scan-box__input input {
  background: var(--surface-color) !important;
  border: 1.5px solid var(--border-color) !important;
}
.pos-fieldset {
  border: 1px solid var(--border-color) !important;
  background: var(--surface-color) !important;
}
.pos-section-label {
  color: var(--accent-color) !important;
}
.pos-section-label::after {
  background: var(--border-subtle-color) !important;
}
.pos-total-cell {
  background: var(--surface-subtle-color) !important;
  border: 1px solid var(--border-subtle-color) !important;
}
.pos-total-cell span {
  color: var(--muted-ink-color) !important;
}
.pos-total-cell strong {
  color: var(--ink-color) !important;
}
.pos-total-cell--discount {
  background: var(--accent-soft-color) !important;
  border-color: var(--accent-color) !important;
}
.pos-total-cell--discount strong {
  color: var(--accent-color) !important;
}
.pos-total-cell--net {
  background: rgba(251, 191, 36, 0.1) !important;
  border-color: var(--warning-color) !important;
}
.pos-total-cell--net strong {
  color: var(--warning-color) !important;
}
.pos-tool-btn:not([class*="--"]) {
  background: var(--surface-subtle-color) !important;
  border: 1.5px solid var(--border-color) !important;
  color: var(--ink-color) !important;
}
.pos-tool-btn:not([class*="--"]):hover {
  border-color: var(--accent-color) !important;
  color: var(--accent-color) !important;
}

/* ---- Portal / Quick Access Cards ---- */
.portal,
.quick-access-card {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
}
.portal:hover,
.quick-access-card:hover {
  border-color: var(--accent-color) !important;
  box-shadow: var(--shadow-2) !important;
}
.portal__ico,
.portal__icon {
  background: var(--accent-soft-color) !important;
  color: var(--accent-color) !important;
}
.portal__txt b {
  color: var(--ink-color) !important;
}
.portal__txt small {
  color: var(--muted-ink-color) !important;
}

/* ---- Dashboard Hero ---- */
.hero,
.dashboard-hero {
  background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-dark-color) 100%) !important;
  color: #fff !important;
}
.hero__mark,
.hero-logo {
  background: rgba(255, 255, 255, 0.2) !important;
}
.kpi-card {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
}
.kpi__label {
  color: var(--muted-ink-color) !important;
}
.kpi__value {
  color: var(--ink-color) !important;
}
.kpi__delta.up {
  color: var(--success-color) !important;
}
.kpi__delta.down {
  color: var(--danger-color) !important;
}

/* ---- Barcode Labels ---- */
#labels-print-area {
  background: var(--canvas-color) !important;
}
.label-box {
  background: var(--surface-color) !important;
  border-color: var(--border-color) !important;
  color: var(--ink-color) !important;
}
@media print {
  .label-box {
    border-color: var(--border-color) !important;
    background: var(--surface-color) !important;
    color: var(--ink-color) !important;
  }
}

/* ---- Report Export Print Window ---- */
@media print {
  body {
    background: var(--canvas-color) !important;
    color: var(--ink-color) !important;
  }
  .letterhead {
    border-color: var(--border-color) !important;
    border-right-color: var(--accent-color) !important;
    background: var(--surface-subtle-color) !important;
  }
  .lh-name {
    color: var(--accent-color) !important;
  }
  .lh-code {
    color: var(--muted-ink-color) !important;
  }
  .letterhead-meta {
    color: var(--muted-ink-color) !important;
  }
  header {
    border-bottom-color: var(--accent-color) !important;
  }
  h1 {
    color: var(--accent-color) !important;
  }
  .meta {
    color: var(--muted-ink-color) !important;
  }
  .report-section h2 {
    color: var(--ink-color) !important;
    border-right-color: var(--accent-color) !important;
  }
  table {
    border-color: var(--border-color) !important;
  }
  th, td {
    border-color: var(--border-color) !important;
    color: var(--ink-color) !important;
  }
  th {
    background: var(--surface-subtle-color) !important;
  }
  tfoot td {
    background: var(--accent-soft-color) !important;
    color: var(--accent-color) !important;
    border-top-color: var(--accent-color) !important;
  }
  tr:nth-child(even) td {
    background: var(--surface-hover-color) !important;
  }
}

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .report-export-bar-actions {
    margin-inline-start: 0 !important;
    width: 100% !important;
  }
  .report-export-btn {
    flex: 1 !important;
    justify-content: center !important;
  }
}

/* ==========================================================================
   END THEME OVERRIDES
   ========================================================================== */

/* ==========================================================================
   CONTRAST FIX — readable text in BOTH light and dark themes
   Targets elements that still carry hardcoded hex colors (#0f172a, #334155,
   #1e293b, #475569 ...) so they never end up dark-on-dark.
   ========================================================================== */

/* ---- Form labels & helper text ---- */
.form-grid label,
.inline-field,
label.field > span,
label > span.field-label,
.field-label,
.form-label {
  color: var(--muted-ink-color) !important;
}

/* ---- Sidebar brand / logo text ---- */
.brand-lockup,
.poshraw-sidebar-logo,
.poshraw-logo-row,
.sidebar-brand,
.sidebar-brand strong,
.sidebar-brand-sub,
.sidebar-brand-sub-en,
.sidebar-brand-title {
  color: var(--ink-color) !important;
}

.sidebar-brand-sub,
.sidebar-brand-sub-en {
  color: var(--muted-ink-color) !important;
}

/* ---- Topbar pills & user label ---- */
.topbar-pill-btn,
.topbar-pill-btn span,
.pill-icon,
.pill-text,
#current-user-label,
.user-chip,
.user-chip span {
  color: var(--ink-color) !important;
}

.topbar-pill-btn {
  background: var(--surface-subtle-color) !important;
  border-color: var(--border-color) !important;
}

/* ---- Hero / dashboard headings ---- */
.hero-logo-row,
.hero-p,
.hero-shraw,
.hero-main-title,
.title-poshraw,
.hero-arabic-title,
.hero-brand-sub-en,
.poshraw-portals-title,
.hero p,
.hero small {
  color: var(--ink-color) !important;
}

.hero-brand-sub-en,
.hero-main-title + p,
.hero .muted {
  color: var(--muted-ink-color) !important;
}

/* ---- Generic headings that may be hardcoded dark ---- */
h1, h2, h3, h4, h5, h6 {
  color: var(--ink-color);
}

/* ---- Generic readable text in panels / cards / sections ---- */
.panel p,
.panel li,
.panel td,
.panel th,
.panel span:not([class*="badge"]):not([class*="chip"]):not([class*="tag"]),
.stat-card,
.stat-card span,
.stat-card strong,
.card,
.card p,
.card span,
.section-title,
.section-subtitle,
.muted {
  color: inherit;
}

.panel p,
.panel li,
.section-subtitle,
.muted,
small.muted {
  color: var(--muted-ink-color) !important;
}

/* ---- Tables ---- */
table,
table td,
table th,
table span,
table strong {
  color: var(--ink-color);
}

table thead th {
  color: var(--muted-ink-color) !important;
}

/* ---- Placeholders must stay visible ---- */
input::placeholder,
textarea::placeholder,
select::placeholder {
  color: var(--muted-ink-color) !important;
  opacity: 1;
}

/* ---- Links inside content ---- */
.panel a,
.card a,
main a {
  color: var(--accent-color);
}

/* ---- Light theme: keep the same guarantees ---- */
:root[data-theme="light"] .hero-logo-row,
:root[data-theme="light"] .hero-p,
:root[data-theme="light"] .hero-shraw,
:root[data-theme="light"] .hero-main-title,
:root[data-theme="light"] .title-poshraw,
:root[data-theme="light"] .hero-arabic-title,
:root[data-theme="light"] .brand-lockup,
:root[data-theme="light"] .poshraw-portals-title,
:root[data-theme="light"] h1,
:root[data-theme="light"] h2,
:root[data-theme="light"] h3 {
  color: var(--ink-color) !important;
}

/* ==========================================================================
   END CONTRAST FIX
   ========================================================================== */

/* ==========================================================================
   FINAL CONTRAST FIX — secondary / muted text that used fixed #64748b
   (#64748b on a dark surface is nearly invisible. These selectors are
   intentionally last so they win over every earlier hardcoded rule.)
   ========================================================================== */

/* Secondary nav + brand subtitles */
.nav-sub,
.nav-sub span,
.nav-item .nav-sub,
.sidebar-brand-sub,
.sidebar-brand-sub-ar,
.sidebar-brand-sub-en,
.brand-lockup .brand-sub,
.brand-lockup small {
  color: var(--muted-ink-color) !important;
}

/* Hero / dashboard secondary copy */
.hero-brand-sub,
.hero-brand-sub-ar,
.hero-brand-sub-en,
.hero-tagline-text,
.hero .muted,
.hero-main-title + p {
  color: var(--muted-ink-color) !important;
}

/* Status footer */
.poshraw-status-footer,
.poshraw-status-footer span,
.footer-left-status,
.footer-left-status span,
.footer-right-status,
.footer-right-status span,
.footer-status,
.footer-status span {
  color: var(--muted-ink-color) !important;
}

/* Any leftover muted utility text */
.text-muted,
.help-text,
.hint,
.field-hint,
.form-hint,
small.muted,
p.muted {
  color: var(--muted-ink-color) !important;
}

/* Date / time chips in the sidebar & topbar */
.sidebar-date,
.sidebar-time,
.topbar-date,
.topbar-time,
.topbar-clock-widget,
.topbar-clock-widget span,
.topbar-clock-widget div,
.clock,
.timestamp {
  color: var(--muted-ink-color) !important;
}

/* Clock date line stays slightly brighter than the time line */
.topbar-clock-widget .clock-date,
.topbar-clock-widget strong {
  color: var(--ink-color) !important;
}

/* ---- Light theme: same elements keep a readable mid-grey ---- */
:root[data-theme="light"] .nav-sub,
:root[data-theme="light"] .sidebar-brand-sub,
:root[data-theme="light"] .sidebar-brand-sub-ar,
:root[data-theme="light"] .sidebar-brand-sub-en,
:root[data-theme="light"] .hero-brand-sub,
:root[data-theme="light"] .hero-brand-sub-ar,
:root[data-theme="light"] .hero-brand-sub-en,
:root[data-theme="light"] .hero-tagline-text,
:root[data-theme="light"] .poshraw-status-footer,
:root[data-theme="light"] .poshraw-status-footer span,
:root[data-theme="light"] .footer-left-status,
:root[data-theme="light"] .footer-right-status,
:root[data-theme="light"] .text-muted,
:root[data-theme="light"] .help-text,
:root[data-theme="light"] .hint {
  color: var(--muted-ink-color) !important;
}

/* ==========================================================================
   END FINAL CONTRAST FIX
   ========================================================================== */

/* ---- Item Image Dropzone & Lightbox Modals ---- */
.item-image-dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  background: var(--surface-subtle-color);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}
.item-image-preview-wrapper {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.item-image-preview {
  width: 75px;
  max-width: 100%;
  height: 75px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
}
.item-image-dropzone:hover,
.item-image-dropzone.dragover {
  border-color: var(--accent-color);
  background: rgba(56, 189, 248, 0.08);
}
.table-item-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: transform 0.15s ease;
}
.table-item-thumb:hover {
  transform: scale(1.15);
}
.image-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}
.image-modal-backdrop[hidden] {
  display: none !important;
}
.image-modal-content {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 90%;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}
.image-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}
.image-modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted-ink-color);
}
.image-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.image-modal-body img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}
.image-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   POS CASH SHIFT & Z-REPORT (ورديات الكاشير والصندوق المالي)
   ========================================================================== */

.pos-shift-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.95rem;
  margin-bottom: 0.65rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pos-shift-info-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pos-shift-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--surface-subtle-color);
  color: var(--muted-ink-color);
  border: 1px solid var(--border-color);
  transition: all var(--duration-fast) var(--ease-smooth);
}

.pos-shift-pill-badge--open {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.35);
}

.pos-shift-pill-badge--closed {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.pos-shift-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  display: inline-block;
}

.pos-shift-pill-badge--open .pos-shift-dot {
  box-shadow: 0 0 8px #10b981;
  animation: pos-pulse-green 2s infinite ease-in-out;
}

@keyframes pos-pulse-green {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.pos-shift-details-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--ink-color);
}

.pos-shift-cashier {
  font-weight: 600;
}

.pos-shift-divider {
  color: var(--muted-ink-color);
  opacity: 0.6;
}

.pos-shift-drawer-amount {
  font-family: var(--font-family-numbers);
  font-weight: 700;
  color: var(--brand);
  background: var(--surface-subtle-color);
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.pos-shift-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pos-shift-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.pos-shift-action-btn:hover {
  transform: translateY(-1px);
}

.pos-shift-action-btn:active {
  transform: translateY(0);
}

.pos-shift-action-btn--open {
  background: #059669;
  color: #ffffff;
}

.pos-shift-action-btn--open:hover {
  background: #047857;
}

.pos-shift-action-btn--close {
  background: #be123c;
  color: #ffffff;
}

.pos-shift-action-btn--close:hover {
  background: #9f1239;
}

.pos-shift-action-btn--report {
  background: var(--surface-subtle-color);
  color: var(--ink-color);
  border-color: var(--border-color);
}

.pos-shift-action-btn--report:hover {
  background: var(--surface-hover-color);
}

/* Preset buttons for opening float */
.pos-preset-btn {
  background: var(--surface-subtle-color);
  color: var(--ink-color);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.pos-preset-btn:hover {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

/* Close dialog stats grid */
.pos-close-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
}

.pos-stat-card {
  background: var(--surface-subtle-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pos-stat-card--highlight {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.3);
}

.pos-stat-val {
  font-family: var(--font-family-numbers);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink-color);
}

.pos-stat-val--success {
  color: #10b981;
}

.pos-stat-val--danger {
  color: #ef4444;
}

.pos-stat-val--primary {
  color: var(--brand);
}

.pos-diff-banner {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--surface-subtle-color);
  color: var(--muted-ink-color);
  transition: all var(--duration-fast) var(--ease-smooth);
}

.pos-diff-banner--exact {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  border-color: #10b981;
}

.pos-diff-banner--shortage {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
  border-color: #ef4444;
}

.pos-diff-banner--overage {
  background: rgba(59, 130, 246, 0.15);
  color: #1d4ed8;
  border-color: #3b82f6;
}

/* Thermal Z-Report Receipt (80mm) */
.pos-z-ticket {
  background: #ffffff;
  color: #000000;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 16px 14px;
  font-family: 'Courier New', Courier, monospace, Tahoma, sans-serif;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  max-height: 480px;
  overflow-y: auto;
}

.pos-z-ticket-loading {
  text-align: center;
  padding: 2rem 1rem;
  color: #64748b;
}

.pos-z-ticket-header {
  text-align: center;
  border-bottom: 2px dashed #000000;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.pos-z-ticket-title {
  font-size: 1.15rem;
  font-weight: 900;
  margin: 0 0 4px 0;
}

.pos-z-ticket-subtitle {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.pos-z-ticket-meta {
  font-size: 0.8rem;
  color: #333333;
}

.pos-z-ticket-section {
  border-bottom: 1px dashed #444444;
  padding: 8px 0;
}

.pos-z-ticket-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.pos-z-ticket-row--bold {
  font-weight: 800;
  font-size: 0.95rem;
}

.pos-z-ticket-row--highlight {
  font-weight: 900;
  font-size: 1rem;
  background: #f1f5f9;
  padding: 2px 4px;
  border-radius: 3px;
}

.pos-z-ticket-row--diff-shortage {
  color: #b91c1c;
  font-weight: 800;
}

.pos-z-ticket-row--diff-overage {
  color: #1d4ed8;
  font-weight: 800;
}

.pos-z-ticket-row--diff-exact {
  color: #047857;
  font-weight: 800;
}

.pos-z-ticket-footer {
  text-align: center;
  padding-top: 12px;
  font-size: 0.78rem;
  color: #555555;
}

.pos-z-ticket-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px dotted #888888;
  font-size: 0.8rem;
}

/* Media Print for Z-Report */
@media print {
  body * {
    visibility: hidden;
  }
  #pos-z-report-dialog,
  #pos-z-report-ticket,
  #pos-z-report-ticket * {
    visibility: visible;
  }
  #pos-z-report-dialog {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm !important;
    max-width: 80mm !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
  .pos-z-ticket {
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }
}


