/* ==========================================================================
   Market POS by ramDevX: design system
   Brand: cyan #22D3EE, blue #3B82F6, purple #7C3AED, navy #0B1230
   Uses CSS logical properties everywhere so Arabic (RTL) mirrors correctly.
   ========================================================================== */
:root {
    --brand-cyan: #22D3EE;
    --brand-blue: #3B82F6;
    --brand-purple: #7C3AED;
    --brand-navy: #0B1230;
    --brand-ink: #4A5272;
    --brand-grad: linear-gradient(135deg, #22D3EE 0%, #3B82F6 52%, #7C3AED 100%);
    --brand-grad-soft: linear-gradient(135deg, rgba(34,211,238,.16), rgba(59,130,246,.16) 52%, rgba(124,58,237,.16));
    --market-radius: 16px;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

html, body {
    font-family: 'Cairo', 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

.mud-typography, .mud-button-root, .mud-input, .mud-table, .mud-nav-link {
    font-family: 'Cairo', 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif !important;
}

/* ---------- brand lockup ---------- */
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { display: block; border-radius: 22%; filter: drop-shadow(0 6px 14px rgba(59,130,246,.35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-word { font-family: Arial, Helvetica, sans-serif; font-size: 1.55rem; letter-spacing: -.01em; color: var(--brand-navy); unicode-bidi: isolate; white-space: nowrap; }
.b-ram { font-weight: 400; }
.b-dev { font-weight: 700; }
.b-x { font-weight: 700; background: linear-gradient(135deg, #0891B2, #3B82F6 50%, #7C3AED); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { margin-top: 5px; font-size: .62rem; letter-spacing: .32em; text-transform: uppercase; color: var(--brand-ink); font-weight: 600; }
.brand-light .brand-word { color: #fff; }
.brand-light .b-x { background: linear-gradient(135deg, #67E8F9, #93C5FD 50%, #C4B5FD); -webkit-background-clip: text; background-clip: text; }
.brand-light .brand-sub { color: rgba(255,255,255,.72); }
.mud-theme-dark .brand-word { color: #fff; }
.mud-theme-dark .brand-sub { color: #A9B1D6; }

.gradient-text { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.btn-brand { background: var(--brand-grad) !important; color: #fff !important; border: 0 !important; box-shadow: 0 8px 22px rgba(59,130,246,.35) !important; transition: transform .15s var(--ease), box-shadow .2s var(--ease), filter .2s; }
.btn-brand:hover { filter: brightness(1.06); box-shadow: 0 12px 28px rgba(124,58,237,.38) !important; }
.btn-brand:active { transform: translateY(1px) scale(.99); }
.btn-brand.mud-button-disabled, .btn-brand[disabled] { background: var(--mud-palette-action-disabled-background) !important; box-shadow: none !important; color: var(--mud-palette-action-disabled) !important; }

.powered-by { display: flex; flex-direction: column; align-items: center; gap: 0; opacity: .85; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--mud-palette-text-secondary); }
.powered-by img { display: block; margin-top: -4px; }

/* ---------- splash ---------- */
.market-splash { display: flex; align-items: center; justify-content: center; height: 100vh; flex-direction: column; gap: 18px; color: var(--brand-ink); }
.splash-mark { width: 96px; height: 96px; border-radius: 26px; animation: splash-pulse 1.8s var(--ease) infinite; filter: drop-shadow(0 12px 28px rgba(59,130,246,.4)); }
.splash-bar { width: 140px; height: 4px; border-radius: 4px; background: rgba(59,130,246,.18); overflow: hidden; }
.splash-bar::after { content: ""; display: block; height: 100%; width: 40%; border-radius: 4px; background: var(--brand-grad); animation: splash-slide 1.1s ease-in-out infinite; }
@keyframes splash-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes splash-slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(350%); } }

/* ---------- auth: split screen ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); background: var(--mud-palette-background); }
.auth-hero {
    position: relative; overflow: hidden; color: #fff; display: flex; align-items: center; justify-content: center; padding: 48px;
    background: radial-gradient(900px 600px at 85% 110%, rgba(124,58,237,.55), transparent 60%),
                radial-gradient(800px 520px at 0% -10%, rgba(34,211,238,.40), transparent 55%),
                linear-gradient(160deg, #101A4A 0%, #0B1230 70%);
}
.grid-overlay {
    position: absolute; inset: 0; opacity: .5; pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: radial-gradient(circle at 40% 40%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(circle at 40% 40%, #000 20%, transparent 75%);
}
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: float 14s ease-in-out infinite; pointer-events: none; }
.orb.o1 { width: 320px; height: 320px; background: var(--brand-cyan); inset-inline-start: -90px; top: -60px; opacity: .28; }
.orb.o2 { width: 380px; height: 380px; background: var(--brand-purple); inset-inline-end: -120px; bottom: -120px; animation-delay: -5s; }
.orb.o3 { width: 200px; height: 200px; background: var(--brand-blue); inset-inline-end: 22%; top: 12%; opacity: .25; animation-delay: -9s; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(24px, -28px) scale(1.08); } }

.hero-inner { position: relative; z-index: 1; max-width: 520px; width: 100%; display: flex; flex-direction: column; gap: 22px; animation: rise .7s var(--ease) both; }
.hero-title { text-wrap: balance; font-size: clamp(1.8rem, 3.2vw, 2.7rem); line-height: 1.18; font-weight: 800; margin: 14px 0 0; letter-spacing: -.01em; }
.hero-title .hl { background: linear-gradient(135deg, #67E8F9, #A5B4FC 55%, #D8B4FE); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { margin: 0; color: rgba(255,255,255,.78); font-size: 1.02rem; line-height: 1.7; }
.hero-points { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 12px; }
.hero-points li { display: flex; align-items: center; gap: 12px; font-weight: 600; color: rgba(255,255,255,.92); }
.hero-points .pt-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(6px); }

.hero-card {
    margin-top: 10px; padding: 18px; border-radius: 20px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 24px 60px rgba(0,0,0,.35); animation: float 9s ease-in-out infinite;
}
.hc-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.hc-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: rgba(34,197,94,.18); color: #86EFAC; }
.hc-total { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.hc-bars { display: flex; align-items: flex-end; gap: 7px; height: 56px; }
.hc-bars span { flex: 1; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #22D3EE, #3B82F6 55%, #7C3AED); }

.auth-shell, .auth-shell *, .auth-shell *::before, .auth-shell *::after { box-sizing: border-box; }
.auth-panel { position: relative; display: flex; flex-direction: column; padding: 20px 32px 24px; min-height: 100vh; }
.auth-topbar { display: flex; justify-content: flex-end; }
.auth-form { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 420px; margin: 0 auto; padding: 12px 0; animation: rise .55s var(--ease) both; }
.auth-foot { display: flex; justify-content: center; padding-top: 12px; }
.auth-title { font-weight: 800; letter-spacing: -.01em; margin-bottom: 4px; }
.auth-mobile-brand { display: none; justify-content: center; margin-bottom: 18px; }

@media (max-height: 840px) and (min-width: 961px) {
    .auth-hero { padding: 28px 48px; }
    .hero-inner { gap: 14px; }
    .hero-card { display: none; }
}

@media (max-width: 960px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
    .auth-panel { padding: 16px 20px 20px; }
    .auth-mobile-brand { display: flex; }
}

/* ---------- app shell ---------- */
.mud-appbar { border-bottom: 1px solid var(--mud-palette-lines-default); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.drawer-inner { display: flex; flex-direction: column; height: 100%; }
.drawer-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--mud-palette-lines-default); background: var(--brand-grad-soft); }
.drawer-nav { flex: 1; overflow-y: auto; padding: 6px 0 12px; }
.drawer-foot { padding: 6px 12px 14px; border-top: 1px solid var(--mud-palette-lines-default); display: flex; justify-content: center; }
.nav-section { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; opacity: .55; padding: 16px 22px 4px; font-weight: 700; }
.mud-drawer .mud-nav-link { border-radius: 12px; margin: 2px 10px; position: relative; transition: background .15s, transform .15s var(--ease); }
.mud-drawer .mud-nav-link:hover { background: var(--brand-grad-soft); }
.mud-drawer .mud-nav-link.active { background: var(--brand-grad-soft); font-weight: 700; color: var(--mud-palette-primary) !important; }
.mud-drawer .mud-nav-link.active::before { content: ""; position: absolute; inset-inline-start: -10px; top: 18%; bottom: 18%; width: 4px; border-radius: 4px; background: var(--brand-grad); }
.mud-drawer .mud-nav-link.active .mud-icon-root { color: var(--mud-palette-primary); }
.page-in { animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- headings, cards, stats ---------- */
.page-title { font-weight: 800; letter-spacing: -.01em; margin-bottom: 4px; }
.mud-paper { transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.stat-card { position: relative; overflow: hidden; border-radius: var(--market-radius) !important; padding: 18px; height: 100%; border: 1px solid var(--mud-palette-lines-default); background: var(--mud-palette-surface); }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(11,18,48,.12); }
.stat-card::after { content: ""; position: absolute; inset-inline-end: -28px; top: -28px; width: 96px; height: 96px; border-radius: 50%; background: var(--brand-grad); opacity: .08; }
.stat-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; background: var(--brand-grad); box-shadow: 0 8px 18px rgba(59,130,246,.3); }
.stat-value { font-weight: 800 !important; overflow: hidden; text-overflow: ellipsis; }
.accent-cyan .stat-icon { background: linear-gradient(135deg, #22D3EE, #0EA5E9); box-shadow: 0 8px 18px rgba(14,165,233,.3); }
.accent-blue .stat-icon { background: linear-gradient(135deg, #60A5FA, #3B82F6); }
.accent-purple .stat-icon { background: linear-gradient(135deg, #A78BFA, #7C3AED); box-shadow: 0 8px 18px rgba(124,58,237,.3); }
.accent-amber .stat-icon { background: linear-gradient(135deg, #FBBF24, #F97316); box-shadow: 0 8px 18px rgba(249,115,22,.3); }
.accent-green .stat-icon { background: linear-gradient(135deg, #34D399, #10B981); box-shadow: 0 8px 18px rgba(16,185,129,.3); }

.hero {
    position: relative; overflow: hidden; border-radius: 22px; padding: 26px 28px; color: #fff; margin-bottom: 20px;
    background: radial-gradient(520px 260px at 100% 0%, rgba(124,58,237,.65), transparent 60%),
                radial-gradient(420px 240px at 0% 120%, rgba(34,211,238,.45), transparent 60%),
                linear-gradient(135deg, #16205A, #0B1230);
    box-shadow: 0 18px 40px rgba(11,18,48,.28); animation: rise .5s var(--ease) both;
}
.hero h2 { margin: 0 0 4px; font-weight: 800; letter-spacing: -.01em; }
.hero p { margin: 0 0 16px; color: rgba(255,255,255,.78); }
.hero .hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero .hero-btn { border-radius: 12px !important; font-weight: 700 !important; }
.hero .hero-btn.ghost { background: rgba(255,255,255,.12) !important; color: #fff !important; border: 1px solid rgba(255,255,255,.28) !important; backdrop-filter: blur(6px); }
.hero .hero-mark { position: absolute; inset-inline-end: 22px; bottom: -22px; width: 150px; opacity: .16; pointer-events: none; }

/* mini chart */
.mini-chart { display: flex; align-items: flex-end; gap: 12px; padding-top: 8px; }
.mc-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.mc-bar { width: 100%; max-width: 56px; border-radius: 10px 10px 3px 3px; transform-origin: bottom; background: linear-gradient(180deg, #22D3EE, #3B82F6 55%, #7C3AED); animation: grow .7s var(--ease) both; }
.mc-bar.mc-last { box-shadow: 0 0 0 3px rgba(124,58,237,.18), 0 10px 22px rgba(124,58,237,.35); }
.mc-val { font-size: .68rem; white-space: nowrap; opacity: .8; margin-bottom: 4px; }
.mc-label { font-size: .72rem; margin-top: 6px; opacity: .7; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ---------- POS ---------- */
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 16px; height: calc(100vh - 96px); }
.pos-left, .pos-right { display: flex; flex-direction: column; min-height: 0; }
.pos-products { overflow-y: auto; padding: 4px; flex: 1; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.product-tile {
    position: relative; border-radius: var(--market-radius) !important; cursor: pointer; user-select: none; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 138px;
    border: 1px solid var(--mud-palette-lines-default); background: var(--mud-palette-surface);
    transition: transform .14s var(--ease), box-shadow .18s var(--ease), border-color .18s; animation: rise .35s var(--ease) both;
}
.product-tile:hover { box-shadow: 0 12px 26px rgba(11,18,48,.14); transform: translateY(-2px); border-color: rgba(59,130,246,.55); }
.product-tile:active { transform: scale(.97); }
.product-tile.out { opacity: .5; }
.tile-top { display: flex; align-items: center; gap: 10px; }
.tile-avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; font-size: 1.05rem; object-fit: cover; }
.product-name { font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: .92rem; }
.tile-price { font-weight: 800; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 1.05rem; }
.cart-panel { height: 100%; display: flex; flex-direction: column; border-radius: 20px !important; border: 1px solid var(--mud-palette-lines-default); overflow: hidden; }
.cart-head { background: var(--brand-grad-soft); border-bottom: 1px solid var(--mud-palette-lines-default); }
.cart-lines { flex: 1; overflow-y: auto; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 10px 14px; border-bottom: 1px solid var(--mud-palette-lines-default); animation: rise .25s var(--ease) both; }
.cart-totals { padding: 14px; border-top: 1px dashed var(--mud-palette-lines-default); background: var(--mud-palette-background-gray); }
.total-row { display: flex; justify-content: space-between; padding: 2px 0; }
.grand-total { font-size: 1.65rem; font-weight: 800; }
.grand-total span:last-child { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chip-scroller { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.chip-scroller::-webkit-scrollbar { display: none; }

@media (max-width: 960px) {
    .pos-grid { grid-template-columns: 1fr; height: auto; }
    .pos-right { min-height: 70vh; }
    .pos-products { max-height: 60vh; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(134px, 1fr)); }
}

/* ---------- receipt (80 mm thermal style) ---------- */
.receipt { width: 300px; margin: 0 auto; font-family: 'Courier New', monospace; font-size: 12px; color: #000; background: #fff; padding: 10px; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.receipt .r-row { display: flex; justify-content: space-between; gap: 8px; }
.receipt .r-center { text-align: center; }
.receipt .r-bold { font-weight: 700; }

@media print {
    body * { visibility: hidden !important; }
    .receipt, .receipt * { visibility: visible !important; }
    .receipt { position: absolute; left: 0; top: 0; width: 80mm; padding: 0; }
}

/* ---------- misc ---------- */
.mud-table-container { border-radius: var(--market-radius); }
.mud-table { border-radius: var(--market-radius) !important; border: 1px solid var(--mud-palette-lines-default); overflow: hidden; }
.mud-table-head .mud-table-cell { font-weight: 700; background: var(--mud-palette-background-gray); }
.mud-dialog { border-radius: 20px !important; }
.numeric-lg input { font-size: 1.6rem !important; font-weight: 700; text-align: center; }
.quick-cash { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

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

/* ---------- trial / subscription bar ---------- */
.trial-bar { position: sticky; top: var(--mud-appbar-height, 64px); z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 10px 14px; margin-block-end: 14px; border-radius: 14px; color: #fff; box-shadow: 0 8px 22px rgba(11,18,48,.18);
  background: linear-gradient(90deg, #0891B2, #2563EB 55%, #7C3AED); }
.trial-bar.warn { background: linear-gradient(90deg, #d97706, #f59e0b); color: #231500; }
.trial-bar.danger { background: linear-gradient(90deg, #be123c, #e11d48); }
.trial-bar .tb-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.2); flex: none; }
.trial-bar .tb-text { flex: 1 1 220px; display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.trial-bar .tb-sub { opacity: .92; font-size: .82rem; }
.trial-bar .tb-btn { background: #fff !important; color: #0B1230 !important; font-weight: 700; border-radius: 10px; white-space: nowrap; }
@media (max-width: 599px) { .trial-bar .tb-btn { width: 100%; } }

/* ---------- platform console ---------- */
.tenant-cell b { font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; word-break: break-all; }
.secured-card { border-radius: 16px; padding: 16px; background: linear-gradient(135deg, rgba(16,185,129,.12), rgba(34,211,238,.10)); border: 1px solid rgba(16,185,129,.35); }
