/* ============================================================
   Libra — Management Suite
   Design system: Accessible & Ethical · WCAG · light + dark
   ============================================================ */

:root {
  --primary: #2563EB;
  --secondary: #3B82F6;
  --accent: #059669;
  --bg: #F8FAFC;
  --fg: #0F172A;
  --muted: #F1F5F9;
  --border: #E2E8F0;
  --border-soft: #EEF2F7;
  --destructive: #DC2626;
  --ring: rgba(37, 99, 235, 0.35);
  --card: #FFFFFF;
  --card-2: #F8FAFC;
  --nav-w: 248px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, .25);
  --radius: 14px;
  --radius-sm: 9px;
  --family-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --family-display: 'Cormorant Garamond', Georgia, serif;
  --sidebar-bg: #0F1B33;
  --sidebar-bg-2: #16233F;
  --sidebar-fg: #B8C4DD;
  --sidebar-active: #FFFFFF;
  --font-display: 'Cormorant Garamond', Georgia, serif;
}

html[data-theme="dark"] {
  --bg: #0B1120;
  --fg: #E6EDF7;
  --muted: #131C30;
  --border: #1E2A44;
  --border-soft: #16213A;
  --card: #0F1729;
  --card-2: #111B30;
  --primary: #3B82F6;
  --secondary: #60A5FA;
  --accent: #10B981;
  --ring: rgba(59, 130, 246, 0.4);
  --destructive: #F87171;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 6px 18px rgba(0,0,0,.4);
  --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.6);
  --sidebar-bg: #0A1122;
  --sidebar-bg-2: #0E1730;
  --sidebar-fg: #93A3C0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--family-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

.hidden { display: none !important; }

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }

::selection { background: var(--ring); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ COMPONENTS ============================ */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-weight: 600; font-size: .92rem;
  padding: 9px 16px; border-radius: var(--radius-sm);
  cursor: pointer; user-select: none;
  transition: background .18s, border-color .18s, transform .06s, box-shadow .18s, color .18s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.28); }
.btn.primary:hover { background: #1D4ED8; color: #fff; box-shadow: 0 6px 18px rgba(37,99,235,.35); }
html[data-theme="dark"] .btn.primary:hover { background: #2563EB; }
.btn.success { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.success:hover { background: #047857; color: #fff; }
html[data-theme="dark"] .btn.success:hover { background: #10B981; }
.btn.danger { background: transparent; border-color: #FECACA; color: var(--destructive); }
.btn.danger:hover { background: #FEF2F2; border-color: var(--destructive); }
html[data-theme="dark"] .btn.danger:hover { background: rgba(248,113,113,.12); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg); }
.btn.ghost:hover { background: var(--muted); border-color: transparent; color: var(--fg); }
.btn.small { padding: 6px 11px; font-size: .82rem; border-radius: 8px; }
.btn.large { padding: 13px 24px; font-size: 1rem; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--fg);
  cursor: pointer; transition: background .18s, border-color .18s, color .18s;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--muted); }
.icon-btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  padding: 3px 9px; border-radius: 999px; line-height: 1.4;
}
.badge.blue { background: #DBEAFE; color: #1D4ED8; }
.badge.green { background: #D1FAE5; color: #047857; }
.badge.amber { background: #FEF3C7; color: #B45309; }
.badge.red { background: #FEE2E2; color: #B91C1C; }
.badge.gray { background: var(--muted); color: var(--fg); }
html[data-theme="dark"] .badge.blue { background: rgba(59,130,246,.16); color: #93C5FD; }
html[data-theme="dark"] .badge.green { background: rgba(16,185,129,.16); color: #6EE7B7; }
html[data-theme="dark"] .badge.amber { background: rgba(251,191,36,.14); color: #FCD34D; }
html[data-theme="dark"] .badge.red { background: rgba(248,113,113,.16); color: #FCA5A5; }
html[data-theme="dark"] .badge.gray { background: var(--muted); color: #CBD5E1; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
}
.card-head h3 { margin: 0; font-size: .98rem; font-weight: 700; }
.card-head p { margin: 2px 0 0; font-size: .8rem; color: var(--fg); opacity: .6; }
.card-body { padding: 18px 20px; }

.pulse-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); position: relative;
}
.pulse-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid var(--accent); animation: pulse 2s ease-out infinite;
  opacity: 0;
}
@keyframes pulse {
  0% { transform: scale(.6); opacity: .8; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--fg); opacity: .55; font-weight: 700; padding: 10px 14px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: var(--card-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }

.row-actions button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--fg); cursor: pointer; transition: all .15s;
}
.row-actions button:hover { border-color: var(--primary); color: var(--primary); }
.row-actions button.del:hover { border-color: var(--destructive); color: var(--destructive); }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: .74rem; color: var(--fg); opacity: .55; margin-top: 4px; }
.input, .select, textarea.input {
  width: 100%; padding: 10px 12px; font-size: .9rem; font-family: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card); color: var(--fg); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring);
}
.input::placeholder { color: var(--fg); opacity: .4; }
.input.has-icon { padding-left: 38px; }
.input-wrap, .search-box { position: relative; }
.input-wrap .pre-icon, .search-box .pre-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--fg); opacity: .5; pointer-events: none; display: flex;
}
.search-box input:focus ~ .pre-icon { opacity: .8; }

.chk-low { display: inline-flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 500; cursor: pointer; user-select: none; }
.chk-low input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center;
  background: rgba(8, 13, 26, .55); backdrop-filter: blur(4px);
  padding: 6vh 16px 16px; overflow-y: auto;
  animation: fadeIn .18s ease;
}
html[data-theme="dark"] .modal-backdrop { background: rgba(2,6,16,.6); }
.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; animation: pop .22s cubic-bezier(.2,.9,.3,1.2);
}
.modal.lg { max-width: 760px; }
.modal.sm { max-width: 420px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border-soft);
}
.modal-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.modal-head .x {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--fg); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.modal-head .x:hover { background: var(--muted); }
.modal-body { padding: 20px 22px; max-height: 70vh; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px; padding: 15px 22px;
  border-top: 1px solid var(--border-soft);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* Toasts */
.toast-root {
  position: fixed; bottom: 22px; right: 22px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--fg); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; font-size: .86rem; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: slideUp .25s ease;
  max-width: 360px;
}
.toast.ok svg { color: #34D399; }
.toast.err svg { color: #F87171; }
.toast.info svg { color: #60A5FA; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Empty state */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 44px 20px; color: var(--fg); opacity: .55; gap: 8px;
}
.empty svg { opacity: .35; }
.empty b { font-size: .95rem; }

/* ============================ LANDING ============================ */

.landing { position: relative; min-height: 100vh; overflow: hidden; background: var(--bg); }
.landing-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(900px 420px at 85% -5%, rgba(37,99,235,.10), transparent 60%),
    radial-gradient(700px 380px at -10% 25%, rgba(5,150,105,.08), transparent 60%),
    linear-gradient(var(--bg), var(--bg));
}
html[data-theme="dark"] .landing-bg {
  background:
    radial-gradient(900px 420px at 85% -5%, rgba(37,99,235,.16), transparent 60%),
    radial-gradient(700px 380px at -10% 25%, rgba(16,185,129,.10), transparent 60%),
    linear-gradient(var(--bg), var(--bg));
}
.landing-orbs { position: absolute; inset: 0; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.orb-a { width: 420px; height: 420px; background: #3B82F6; top: -120px; right: -80px; animation: drift 14s ease-in-out infinite alternate; }
.orb-b { width: 320px; height: 320px; background: #10B981; bottom: 8%; left: -120px; animation: drift 18s ease-in-out infinite alternate-reverse; }
.orb-c { width: 240px; height: 240px; background: #8B5CF6; top: 45%; right: 12%; opacity: .25; animation: drift 22s ease-in-out infinite alternate; }
html[data-theme="dark"] .orb { opacity: .28; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(40px,-30px) scale(1.12); } }

.landing-nav {
  position: relative; z-index: 5; max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 28px;
}
.landing-brand, .side-brand {
  display: flex; align-items: center; gap: 12px; color: var(--fg);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #2563EB, #4F46E5);
  color: #fff; font-family: var(--family-display); font-size: 1.15rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(37,99,235,.35);
}
.brand-name { font-family: var(--family-display); font-size: 1.45rem; font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.brand-name small, .brand-name span { display: block; font-family: var(--family-ui); font-size: .6rem; font-weight: 600; text-transform: uppercase; letter-spacing: .22em; opacity: .55; margin-top: 3px; }
.landing-links { display: flex; gap: 26px; }
.landing-links a { color: var(--fg); opacity: .75; font-size: .9rem; font-weight: 500; transition: opacity .15s, color .15s; }
.landing-links a:hover { opacity: 1; color: var(--primary); }
.landing-actions { display: flex; align-items: center; gap: 10px; }

.landing-main { position: relative; z-index: 4; }
.hero {
  max-width: 1180px; margin: 0 auto; padding: 60px 28px 90px;
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--card); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.hero-badge .pulse-dot { width: 7px; height: 7px; }
.hero-title {
  font-family: var(--family-display); font-size: clamp(2.5rem, 5vw, 3.9rem);
  line-height: 1.04; font-weight: 600; letter-spacing: -.015em; margin: 22px 0 18px;
}
.hero-title em { font-style: italic; color: var(--primary); }
html[data-theme="dark"] .hero-title em { color: #60A5FA; }
.hero-sub {
  font-size: 1.08rem; line-height: 1.7; opacity: .78; max-width: 520px; margin: 0 0 30px;
}
.hero-cta { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.hero-trust { display: flex; align-items: center; gap: 10px; font-size: .8rem; opacity: .7; }
.avatar-stack { display: flex; }
.avatar-stack span {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: .62rem; font-weight: 700; color: #fff; margin-left: -8px;
  background: linear-gradient(135deg, #2563EB, #8B5CF6);
}
.avatar-stack span:first-child { margin-left: 0; background: linear-gradient(135deg, #059669, #10B981); }
.avatar-stack span:nth-child(2) { background: linear-gradient(135deg, #7C3AED, #EC4899); }
.avatar-stack span:nth-child(3) { background: linear-gradient(135deg, #F59E0B, #EF4444); }
.hero-logos {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px;
}
.hero-logos span {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 7px 14px; border: 1px dashed var(--border); border-radius: 999px; color: var(--fg); opacity: .6;
}
html[data-theme="dark"] .hero-logos span { border-color: #22304F; }

.window-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow-lg); overflow: hidden; transform: rotate(1.2deg);
  animation: floaty 8s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: rotate(1.2deg) translateY(0); } 50% { transform: rotate(.8deg) translateY(-10px); } }
.window-bar { display: flex; gap: 7px; padding: 13px 16px; background: var(--card-2); border-bottom: 1px solid var(--border-soft); }
.window-bar span { width: 11px; height: 11px; border-radius: 50%; }
.window-bar span:nth-child(1) { background: #F87171; } .window-bar span:nth-child(2) { background: #FBBF24; } .window-bar span:nth-child(3) { background: #34D399; }
.window-body { display: flex; min-height: 320px; }
.win-side { width: 64px; background: var(--sidebar-bg); padding: 14px 12px; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.win-logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg,#2563EB,#4F46E5); color: #fff; font-family: var(--family-display); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .8rem; }
.win-nav { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.win-nav i { height: 9px; border-radius: 5px; background: var(--sidebar-bg-2); }
.win-nav i:nth-child(1) { background: rgba(59,130,246,.6); }
.win-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg,#F59E0B,#EF4444); margin-top: auto; }
.win-main { flex: 1; padding: 16px 18px; display: flex; flex-direction: column; gap: 16px; }
.win-row { display: flex; justify-content: space-between; align-items: center; }
.win-sparkline { width: 120px; height: 20px; background: linear-gradient(90deg, var(--border), transparent); border-radius: 6px; position: relative; overflow: hidden; }
.win-sparkline::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 12px, var(--card-2) 12px 13px),
              linear-gradient(180deg, transparent 0 8px, var(--card-2) 8px 9px, transparent 9px 20px);
  opacity: .5;
}
.win-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.win-stats span { height: 58px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--border-soft); position: relative; overflow: hidden; }
.win-stats span::before {
  content: ''; position: absolute; left: 10px; top: 10px; width: 40%; height: 7px; border-radius: 4px; background: var(--border);
}
.win-stats span:first-child::before { background: rgba(37,99,235,.4); width: 30%; }
.win-stats span::after {
  content: ''; position: absolute; left: 10px; bottom: 10px; width: 55%; height: 5px; border-radius: 4px; background: var(--border-soft);
}
.win-chart { flex: 1; display: flex; align-items: flex-end; gap: 8px; padding-top: 8px; }
.win-chart i { flex: 1; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--secondary), rgba(59,130,246,.25)); }
.win-chart i:nth-child(1){height:38%}.win-chart i:nth-child(2){height:64%}
.win-chart i:nth-child(3){height:48%}.win-chart i:nth-child(4){height:84%}
.win-chart i:nth-child(5){height:70%}

.land-section { max-width: 1180px; margin: 0 auto; padding: 60px 28px 70px; }
.land-section.alt { max-width: none; background: var(--card-2); border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
.land-h { font-family: var(--family-display); font-size: 2.35rem; font-weight: 600; margin: 0 0 10px; line-height: 1.1; }
.land-h em { font-style: italic; color: var(--primary); }
.land-sub { margin: 0 0 36px; opacity: .7; max-width: 520px; }

.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.module-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 26px; box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s, border-color .2s;
  position: relative; overflow: hidden;
}
.module-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent)); opacity: .5;
}
.module-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.module-icon {
  width: 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}
.module-icon.blue { background: #DBEAFE; color: #1D4ED8; }
.module-icon.emerald { background: #D1FAE5; color: #047857; }
.module-icon.violet { background: #EDE9FE; color: #6D28D9; }
html[data-theme="dark"] .module-icon.blue { background: rgba(59,130,246,.16); color: #93C5FD; }
html[data-theme="dark"] .module-icon.emerald { background: rgba(16,185,129,.16); color: #6EE7B7; }
html[data-theme="dark"] .module-icon.violet { background: rgba(139,92,246,.16); color: #C4B5FD; }
.module-card h3 { font-family: var(--family-display); font-size: 1.4rem; margin: 0 0 8px; }
.module-card p { margin: 0 0 16px; font-size: .9rem; opacity: .75; line-height: 1.65; }
.module-feats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.module-feats li {
  display: flex; align-items: center; gap: 9px; font-size: .83rem; font-weight: 500;
  color: var(--fg); opacity: .85;
}
.module-feats li::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: var(--muted); border: 1px solid var(--border);
  background-image: radial-gradient(circle at center, var(--accent) 0 3.5px, transparent 4px);
}

.feat-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; padding: 20px 28px; }
.feat-item { display: flex; gap: 14px; align-items: flex-start; }
.feat-item svg { color: var(--primary); flex: none; margin-top: 3px; }
.feat-item h4 { margin: 0 0 4px; font-size: .95rem; font-weight: 700; }
.feat-item p { margin: 0; font-size: .83rem; opacity: .68; line-height: 1.6; }

.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 56px; }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px 20px; text-align: center; box-shadow: var(--shadow-sm);
}
.stat strong { display: block; font-family: var(--family-display); font-size: 2.6rem; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat span { font-size: .8rem; opacity: .7; }
.land-cta {
  background: linear-gradient(135deg, #2563EB, #4F46E5); border-radius: 22px;
  padding: 52px 36px; text-align: center; color: #fff; position: relative; overflow: hidden;
}
.land-cta::before {
  content: ''; position: absolute; width: 300px; height: 300px; border-radius: 50%;
  background: rgba(255,255,255,.08); top: -140px; right: -80px;
}
.land-cta::after {
  content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%;
  background: rgba(255,255,255,.06); bottom: -110px; left: -60px;
}
.land-cta h3 { font-family: var(--family-display); font-size: 2rem; font-weight: 600; margin: 0 0 22px; position: relative; z-index: 1; }
.land-cta h3 em { font-style: italic; }
.land-cta .btn { position: relative; z-index: 1; background: #fff; color: #1D4ED8; border-color: #fff; }
.land-cta .btn:hover { background: #EFF6FF; }

.landing-footer {
  position: relative; z-index: 4; max-width: 1180px; margin: 0 auto; padding: 30px 28px 40px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: .78rem; opacity: .6;
}

/* ============================ APP SHELL ============================ */

.app { display: flex; min-height: 100vh; }
.side-overlay { display: none; }

.sidebar {
  width: var(--nav-w); flex: none; background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  padding: 18px 14px; z-index: 60; overflow-y: auto;
}
.side-brand { padding: 2px 10px 18px; color: #fff; }
.side-brand .brand-mark { width: 38px; height: 38px; }
.side-brand .brand-name { font-size: 1.3rem; color: #fff; }
.side-brand .brand-name small { color: var(--sidebar-fg); }
.side-collapse {
  display: none; position: absolute; right: -42px; top: 18px; width: 38px; height: 38px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--card);
  color: var(--fg); cursor: pointer; align-items: center; justify-content: center; box-shadow: var(--shadow-sm);
}
.side-group-label {
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em;
  color: var(--sidebar-fg); opacity: .6; padding: 16px 12px 8px;
}
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--sidebar-fg); font-size: .9rem; font-weight: 500; transition: background .15s, color .15s;
}
.side-nav a svg { flex: none; }
.side-nav a:hover { background: var(--sidebar-bg-2); color: #E2EAF7; }
.side-nav a.active {
  background: linear-gradient(90deg, rgba(37,99,235,.22), rgba(37,99,235,.06));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(59,130,246,.25);
}
.side-nav a.active svg { color: #60A5FA; }
.nav-badge {
  margin-left: auto; font-size: .66rem; font-weight: 700; min-width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--primary); color: #fff; padding: 0 6px;
}
.nav-badge.amber { background: #F59E0B; }
.side-spacer { flex: 1; }
.side-nav.bottom { border-top: 1px solid var(--sidebar-bg-2); padding-top: 10px; margin-top: 10px; }

.main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  padding: 0 clamp(16px, 3vw, 32px) 24px;
}
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 0 14px; position: sticky; top: 0; z-index: 40;
  background: var(--bg); border-bottom: 1px solid var(--border-soft);
}
body:has(.sidebar) .topbar { backdrop-filter: blur(8px); }
.topbar-title h1 { font-family: var(--family-display); font-size: 1.55rem; font-weight: 700; margin: 0; line-height: 1.15; }
.topbar-title p { margin: 2px 0 0; font-size: .78rem; opacity: .6; }
.topbar-spacer { flex: 1; }
.chip.online {
  display: inline-flex; align-items: center; gap: 8px; font-size: .74rem; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--border);
}
.quick-sell { border-color: var(--accent); color: var(--accent); }
.quick-sell:hover { background: #ECFDF5; color: #047857; border-color: var(--accent); }

.content { padding: 22px 0 10px; flex: 1; }
.app-footer { padding: 18px 4px 0; font-size: .74rem; opacity: .5; text-align: right; }

/* ============================ DASHBOARD VIEW ============================ */

.welcome-banner {
  background: linear-gradient(120deg, #EEF2FF, #ECFDF5);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 26px; margin-bottom: 22px; display: flex; align-items: center; gap: 18px;
}
html[data-theme="dark"] .welcome-banner { background: linear-gradient(120deg, rgba(37,99,235,.12), rgba(16,185,129,.10)); }
.welcome-banner h2 { font-family: var(--family-display); font-size: 1.5rem; margin: 0 0 4px; }
.welcome-banner p { margin: 0; font-size: .86rem; opacity: .7; }
.welcome-banner svg { flex: none; color: var(--primary); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card .sc-ico {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.sc-ico.blue { background: #DBEAFE; color: #1D4ED8; }
.sc-ico.green { background: #D1FAE5; color: #047857; }
.sc-ico.amber { background: #FEF3C7; color: #B45309; }
.sc-ico.violet { background: #EDE9FE; color: #6D28D9; }
.sc-ico.red { background: #FEE2E2; color: #B91C1C; }
html[data-theme="dark"] .sc-ico.blue { background: rgba(59,130,246,.16); color: #93C5FD; }
html[data-theme="dark"] .sc-ico.green { background: rgba(16,185,129,.16); color: #6EE7B7; }
html[data-theme="dark"] .sc-ico.amber { background: rgba(251,191,36,.14); color: #FCD34D; }
html[data-theme="dark"] .sc-ico.violet { background: rgba(139,92,246,.16); color: #C4B5FD; }
html[data-theme="dark"] .sc-ico.red { background: rgba(248,113,113,.16); color: #FCA5A5; }
.stat-card .sc-label { font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; opacity: .6; }
.stat-card .sc-value { font-size: 1.62rem; font-weight: 800; letter-spacing: -.02em; margin: 3px 0 2px; font-variant-numeric: tabular-nums; }
.stat-card .sc-trend { font-size: .76rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.trend-up { color: var(--accent); }
.trend-down { color: var(--destructive); }

.dash-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; margin-bottom: 22px; }
.dash-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px; }

.chart-bars { display: flex; align-items: flex-end; gap: 12px; height: 190px; padding: 10px 8px 0; }
.chart-bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bars .bar {
  width: 100%; max-width: 42px; border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--secondary), var(--primary));
  transition: height .4s cubic-bezier(.2,.8,.3,1); position: relative; cursor: pointer;
}
.chart-bars .bar:hover { filter: brightness(1.1); }
.chart-bars .bar .tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--fg); color: var(--bg); font-size: .66rem; font-weight: 700;
  padding: 3px 8px; border-radius: 7px; white-space: nowrap; opacity: 0; transition: opacity .15s;
  pointer-events: none;
}
.chart-bars .bar:hover .tip { opacity: 1; }
.chart-bars .xl { height: 22px; border-top: 1px solid var(--border); text-align: center; font-size: .62rem; opacity: .6; width: 100%; padding-top: 5px; }
.chart-bars .yl { font-size: .62rem; opacity: .6; white-space: nowrap; text-transform: uppercase; }

.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut {
  width: 150px; height: 150px; border-radius: 50%; flex: none;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.donut::before { content: ''; position: absolute; inset: 20px; border-radius: 50%; background: var(--card); }
.donut .dcenter { position: relative; z-index: 1; text-align: center; }
.donut .dcenter b { display: block; font-size: 1.1rem; }
.donut .dcenter span { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; opacity: .6; }
.donut-legend { display: grid; gap: 8px; flex: 1; min-width: 150px; }
.donut-legend .li { display: flex; align-items: center; gap: 9px; font-size: .82rem; }
.donut-legend .li i { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.donut-legend .li .pct { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

.side-list { display: flex; flex-direction: column; }
.side-list-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.side-list-row:last-child { border-bottom: none; }
.mini-av {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .74rem; color: #fff;
}
.stock-bar { flex: 1; }
.stock-bar .sb-top { display: flex; justify-content: space-between; font-size: .78rem; font-weight: 600; margin-bottom: 5px; }
.stock-bar .sb-top span:first-child { opacity: .85; }
.stock-bar .sb-track { height: 7px; border-radius: 99px; background: var(--muted); overflow: hidden; }
.stock-bar .sb-fill { height: 100%; border-radius: 99px; }

/* ============================ PRODUCTS VIEW ============================ */

.view-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.view-head h2 { font-family: var(--family-display); font-size: 1.5rem; margin: 0; }
.view-head p { margin: 2px 0 0; font-size: .8rem; opacity: .6; }
.view-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-box { position: relative; }
.search-box input { min-width: 260px; }

.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.p-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px; box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s;
  display: flex; flex-direction: column; gap: 9px;
}
.p-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.p-card .p-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.p-card .p-name { font-weight: 700; font-size: .9rem; line-height: 1.3; }
.p-card .p-code { font-size: .68rem; opacity: .5; letter-spacing: .04em; text-transform: uppercase; }
.p-card .p-cat { font-size: .74rem; color: var(--primary); font-weight: 600; }
.p-card .p-price-row { display: flex; justify-content: space-between; align-items: baseline; }
.p-card .p-price { font-weight: 800; font-size: 1.15rem; }
.p-card .p-cost { font-size: .72rem; opacity: .55; }
.p-card .p-foot { display: flex; justify-content: space-between; align-items: center; }
.p-card .p-qty { font-size: .78rem; font-weight: 600; }
.p-card .p-qty.low { color: var(--destructive); }
.p-tag { position: absolute; display: none; }

/* ============================ POS VIEW ============================ */

.pos-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.pos-catalog { max-height: calc(100vh - 260px); overflow-y: auto; padding: 4px; margin: -4px; }
.pos-search-strip { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.pos-search-strip .search-box { flex: 1; min-width: 200px; }
.strip-actions { display: flex; gap: 8px; }

.pos-cart { padding: 0; }
.cart-scroll { max-height: 40vh; overflow-y: auto; }
.cart-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.cart-item .ci-name { flex: 1; min-width: 0; }
.cart-item .ci-name b { display: block; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item .ci-name span { font-size: .72rem; opacity: .55; }
.qty-ctrl { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.qty-ctrl button { width: 28px; height: 28px; border: none; background: var(--card-2); cursor: pointer; color: var(--fg); font-size: .95rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.qty-ctrl button:hover { background: var(--border); }
.qty-ctrl span { min-width: 34px; text-align: center; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }
.ci-line { font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 62px; text-align: right; }
.ci-del { width: 28px; height: 28px; border: none; border-radius: 8px; background: transparent; color: var(--fg); opacity: .4; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ci-del:hover { background: #FEE2E2; color: var(--destructive); opacity: 1; }

.cart-totals { padding: 16px 18px; border-top: 1px solid var(--border-soft); display: grid; gap: 8px; }
.cart-totals .trow { display: flex; justify-content: space-between; font-size: .85rem; }
.cart-totals .trow.total { font-size: 1.25rem; font-weight: 800; padding-top: 6px; border-top: 1px dashed var(--border); margin-top: 4px; }
.cart-totals .trow.total span:last-child { color: var(--primary); }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 18px 12px; }
.pay-method {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 11px 6px; border-radius: 11px; border: 1.5px solid var(--border);
  background: var(--card); cursor: pointer; font-size: .78rem; font-weight: 600;
  color: var(--fg); transition: all .15s;
}
.pay-method:hover { border-color: var(--primary); }
.pay-method.active { border-color: var(--primary); background: #EFF6FF; color: #1D4ED8; box-shadow: 0 0 0 3px var(--ring); }
html[data-theme="dark"] .pay-method.active { background: rgba(59,130,246,.14); color: #93C5FD; }
.cart-foot { padding: 12px 18px 18px; display: grid; gap: 9px; }

/* ----- Receipt ----- */
.receipt {
  font-family: var(--family-ui); font-size: .8rem; max-width: 320px; margin: 0 auto; color: var(--fg);
}
.receipt .r-head { text-align: center; padding-bottom: 10px; border-bottom: 1.5px dashed var(--border); margin-bottom: 10px; }
.receipt .r-head b { font-family: var(--family-display); font-size: 1.4rem; display: block; }
.receipt .r-head small { opacity: .6; }
.receipt .r-row { display: flex; justify-content: space-between; padding: 3px 0; }
.receipt .r-row.totals { font-weight: 800; border-top: 1.5px dashed var(--border); margin-top: 6px; padding-top: 8px; }
.receipt .r-items { margin: 8px 0; }
.receipt .r-item { display: flex; gap: 6px; padding: 2px 0; }
.receipt .r-item .q { opacity: .6; min-width: 46px; }
.receipt .r-item .n { flex: 1; }
.receipt .r-item .a { font-variant-numeric: tabular-nums; }
.receipt .r-foot { text-align: center; margin-top: 12px; padding-top: 10px; border-top: 1.5px dashed var(--border); opacity: .6; font-size: .72rem; }
.receipt .barcode { text-align: center; font-family: monospace; letter-spacing: .2em; font-size: .8rem; opacity: .5; margin-top: 6px; }

/* ============================ REPORTS ============================ */

.kpi-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.kpi {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.kpi .k-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; opacity: .6; font-weight: 700; }
.kpi .k-value { font-size: 1.45rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: .74rem; opacity: .6; margin-top: 2px; }

.line-chart { width: 100%; height: 240px; }
.line-chart svg { width: 100%; height: 100%; overflow: visible; }
.axis-line { stroke: var(--border); stroke-width: 1; }
.grid-line { stroke: var(--border-soft); stroke-width: 1; stroke-dasharray: 4 4; }
.line-path { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.area-path { fill: url(#gradline); stroke: none; }
.line-dot { fill: var(--card); stroke: var(--primary); stroke-width: 2.5; }
.chart-xlab { font-size: 9px; fill: var(--fg); opacity: .55; text-anchor: middle; }

/* ============================ CRM ============================ */

.crm-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.customer-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: .86rem;
}
.balance-chip { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.balance-chip.neg { color: var(--destructive); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 16px; }
.tl-item::before {
  content: ''; position: absolute; left: -22px; top: 4px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--card); border: 2.5px solid var(--primary); box-sizing: border-box; margin-left: 0;
}
.tl-item.credit::before { border-color: var(--destructive); }
.tl-item.payment::before { border-color: var(--accent); }
.tl-title { font-size: .88rem; font-weight: 700; }
.tl-sub { font-size: .76rem; opacity: .65; }
.tl-amt { float: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.tl-amt.pos { color: var(--accent); }
.tl-amt.neg { color: var(--destructive); }

/* ============================ SETTINGS ============================ */

.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 15px 20px; border-bottom: 1px solid var(--border-soft);
}
.setting-row:last-child { border-bottom: none; }
.setting-row b { display: block; font-size: .9rem; }
.setting-row p { margin: 2px 0 0; font-size: .8rem; opacity: .6; }

/* ============================ RESPONSIVE ============================ */

@media (max-width: 1100px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .hero-right { max-width: 560px; }
  .module-grid { grid-template-columns: 1fr 1fr; }
  .feat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .dash-grid, .dash-grid-two { grid-template-columns: 1fr; }
  .pos-layout { grid-template-columns: 1fr; }
  .crm-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .landing-links { display: none; }
  .landing-actions .btn { padding: 9px 13px; }
  .hero { padding: 36px 20px 60px; }
  .hero-title { font-size: 2.2rem; }
  .module-grid { grid-template-columns: 1fr; }
  .feat-grid { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .land-cta { padding: 40px 22px; }
  .landing-footer { flex-direction: column; text-align: center; }

  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .topbar-title { order: 2; flex: 1 1 100%; min-width: 0; }
  .topbar-title h1 { font-size: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .quick-sell { padding: 8px 11px; white-space: nowrap; }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 264px;
    transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .side-overlay { display: block; position: fixed; inset: 0; background: rgba(8,13,26,.5); z-index: 55; border: none; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .side-overlay.show { opacity: 1; pointer-events: auto; }
  .main { padding: 0 14px 20px; }
  .burger { display: inline-flex !important; }
  .topbar-title p { display: none; }
  .chip.online { display: none; }
  .quick-sell span, .quick-sell { display: inline-flex; font-size: .82rem; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .sc-value { font-size: 1.25rem; }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .toast-root { left: 14px; right: 14px; }
  .modal { max-width: calc(100vw - 24px); }
}

@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .pay-methods { grid-template-columns: repeat(2, 1fr); }
  .btn.primary.large { width: 100%; justify-content: center; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .orb, .window-card, .pulse-dot::after { animation: none; }
}

/* ============================ RTL (ARABIC) ============================ */

html[dir="rtl"] {
  --family-ui: 'Noto Sans Arabic', Tahoma, 'Segoe UI', sans-serif;
  --family-display: 'Noto Sans Arabic', Tahoma, 'Segoe UI', sans-serif;
}

/* Typography: Arabic must not stretch with letter-spacing or uppercase */
html[dir="rtl"] .side-group-label,
html[dir="rtl"] .k-label,
html[dir="rtl"] .sc-label,
html[dir="rtl"] .brand-name small,
html[dir="rtl"] .hero-logos span,
html[dir="rtl"] .p-code,
html[dir="rtl"] .land-h,
html[dir="rtl"] .hero-title { letter-spacing: 0; text-transform: none; }

/* Inputs with a leading icon: icon sits on the right in RTL */
html[dir="rtl"] .input.has-icon { padding-left: 12px; padding-right: 38px; }
html[dir="rtl"] .input-wrap .pre-icon,
html[dir="rtl"] .search-box .pre-icon { left: auto; right: 12px; }

/* Tables: header text aligned to the reading start (right) */
html[dir="rtl"] .tbl th { text-align: right; }

/* Toasts: mirror to bottom-left */
html[dir="rtl"] .toast-root { left: 22px; right: auto; }

/* Landing: decorative orbs mirrored */
html[dir="rtl"] .orb-a { right: auto; left: -80px; }
html[dir="rtl"] .orb-b { left: auto; right: -120px; }
html[dir="rtl"] .orb-c { right: auto; left: 12%; }

/* Landing mock window: skeleton lines anchored to the right */
html[dir="rtl"] .win-stats span::before,
html[dir="rtl"] .win-stats span::after { left: auto; right: 10px; }

/* Landing mock window: mirror the decorative tilt */
html[dir="rtl"] .window-card { transform: rotate(-1.2deg); animation-name: floaty-rtl; }
@keyframes floaty-rtl { 0%,100% { transform: rotate(-1.2deg) translateY(0); } 50% { transform: rotate(-.8deg) translateY(-10px); } }

/* Avatar stack overlap flips to the right */
html[dir="rtl"] .avatar-stack span { margin-left: 0; margin-right: -8px; }
html[dir="rtl"] .avatar-stack span:first-child { margin-right: 0; }

/* App shell */
html[dir="rtl"] .side-collapse { right: auto; left: -42px; }
html[dir="rtl"] .nav-badge { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .app-footer { text-align: left; }

/* Donut legend: push percentage to the start edge */
html[dir="rtl"] .donut-legend .li .pct { margin-left: 0; margin-right: auto; }

/* CRM timeline: rail on the right */
html[dir="rtl"] .timeline { padding-left: 0; padding-right: 22px; }
html[dir="rtl"] .timeline::before { left: auto; right: 7px; }
html[dir="rtl"] .tl-item::before { left: auto; right: -22px; }
html[dir="rtl"] .tl-amt { float: left; }

/* POS cart: line total aligns to the far edge */
html[dir="rtl"] .ci-line { text-align: left; }

/* Mobile: slide the sidebar in from the right */
@media (max-width: 760px) {
  html[dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(105%); }
  html[dir="rtl"] .sidebar.open { transform: translateX(0); }
  html[dir="rtl"] .toast-root { left: 14px; right: 14px; }
}

/* Language chooser active button */
.lang-chooser .btn[aria-pressed="true"] {
  border-color: var(--primary); color: var(--primary); background: rgba(37, 99, 235, .08);
}