/* ====== Design tokens ====== */
:root {
  --bg: #f6f3ef; --surface: #ffffff; --surface-2: #faf7f3; --text: #1c1917; --muted: #78716c; --border: #e7e0d8;
  --brand-1: #f97316; --brand-2: #ea580c; --brand-3: #10b981; --accent: #f59e0b;
  --c1-rgb: 249,115,22; --c2-rgb: 234,88,12; --c3-rgb: 245,158,11;
  --grad: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--c1-rgb),.13), rgba(var(--c3-rgb),.10));
  --ok: #10b981; --warn: #f59e0b; --bad: #ef4444; --info: var(--brand-1);
  --radius: 16px; --shadow: 0 1px 2px rgba(28,25,23,.04), 0 8px 24px rgba(28,25,23,.07);
  --side-1: #15110e; --side-2: #231a14; --hero-2: #4a2410;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
/* ----- colour duos (user choice, saved in the browser) ----- */
:root[data-palette="blue"] {
  --bg: #eef2f7; --surface-2: #f5f7fb; --text: #0f172a; --muted: #64748b; --border: #dde4ee;
  --brand-1: #0ea5e9; --brand-2: #2563eb; --accent: #22d3ee; --c1-rgb: 14,165,233; --c2-rgb: 37,99,235; --c3-rgb: 6,182,212;
  --side-1: #060c1b; --side-2: #0b1a33; --hero-2: #0e3a5e; --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
}
:root[data-palette="emerald"] {
  --bg: #eff5f2; --surface-2: #f5faf7; --text: #0f1f19; --muted: #5f7a6e; --border: #d8e5de;
  --brand-1: #10b981; --brand-2: #047857; --accent: #14b8a6; --c1-rgb: 16,185,129; --c2-rgb: 4,120,87; --c3-rgb: 20,184,166;
  --side-1: #04130e; --side-2: #082a1f; --hero-2: #0b4a37;
}
:root[data-palette="slate"] {
  --bg: #eff1f3; --surface-2: #f5f6f8; --text: #1f2328; --muted: #6b7280; --border: #dde1e6;
  --brand-1: #64748b; --brand-2: #475569; --accent: #94a3b8; --c1-rgb: 100,116,139; --c2-rgb: 71,85,105; --c3-rgb: 148,163,184;
  --side-1: #1b1f24; --side-2: #2a3038; --hero-2: #3b4452; --shadow: 0 1px 2px rgba(31,35,40,.04), 0 8px 24px rgba(31,35,40,.06);
}
[data-bs-theme="dark"] {
  --bg: #12100e; --surface: #1c1815; --surface-2: #241f1b; --text: #f1ebe4; --muted: #a39a90; --border: #352e28;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.4);
  --bs-body-bg: #12100e; --bs-body-color: #f1ebe4; --bs-border-color: #352e28;
}
:root[data-palette="blue"][data-bs-theme="dark"] {
  --bg: #060b16; --surface: #0d1526; --surface-2: #111c33; --text: #e6edf7; --muted: #8da0bd; --border: #1c2a47;
  --bs-body-bg: #060b16; --bs-body-color: #e6edf7; --bs-border-color: #1c2a47;
}
:root[data-palette="emerald"][data-bs-theme="dark"] {
  --bg: #07110d; --surface: #0e1c16; --surface-2: #132620; --text: #e5f2ec; --muted: #8aa89a; --border: #1d3329;
  --bs-body-bg: #07110d; --bs-body-color: #e5f2ec; --bs-border-color: #1d3329;
}
:root[data-palette="slate"][data-bs-theme="dark"] {
  --bg: #121417; --surface: #1b1e22; --surface-2: #22262b; --text: #e6e8eb; --muted: #9097a1; --border: #2f343b;
  --bs-body-bg: #121417; --bs-body-color: #e6e8eb; --bs-border-color: #2f343b;
}
* { -webkit-tap-highlight-color: transparent; }
body { font-family: 'JetBrains Mono', 'Cairo', system-ui, sans-serif; font-variant-numeric: tabular-nums; background: var(--bg); color: var(--text); }
a { text-decoration: none; }
.text-muted, .form-text { color: var(--muted) !important; }
::selection { background: rgba(var(--c1-rgb),.3); }

/* ====== Cards, tables, forms ====== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.card h5, .card h6 { font-weight: 700; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); --bs-table-hover-bg: var(--surface-2); margin-bottom: 0; }
.table thead th { font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 700; border-bottom-width: 1px; white-space: nowrap; }
.table td, .table th { vertical-align: middle; }
.form-control, .form-select { background-color: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); padding: .6rem .85rem; transition: border-color .15s, box-shadow .15s, background .15s; }
.form-control:focus, .form-select:focus { background-color: var(--surface); border-color: var(--brand-2); box-shadow: 0 0 0 .22rem rgba(var(--c2-rgb),.18); color: var(--text); }
.form-label { font-weight: 600; font-size: .86rem; color: var(--muted); }
.form-check-input:checked { background-color: var(--brand-2); border-color: var(--brand-2); }
.input-group-text { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); border-radius: 12px; }
.list-group-item { background: var(--surface); border-color: var(--border); color: var(--text); }
.modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.modal-header, .modal-footer { border-color: var(--border); }
.alert { border: 0; border-radius: 14px; box-shadow: var(--shadow); }
code { color: var(--brand-3); font-family: var(--mono); }
pre { color: var(--text) !important; background: var(--surface-2) !important; border: 1px solid var(--border); }

/* ====== Buttons ====== */
.btn { border-radius: 12px; font-weight: 600; padding: .5rem 1.05rem; transition: transform .15s, box-shadow .2s, background .2s, opacity .2s; }
.btn-sm { padding: .3rem .7rem; border-radius: 10px; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 6px 18px rgba(var(--c1-rgb),.35); background-size: 140% 100%; background-position: 0 0; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { background: var(--grad) !important; color: #fff; box-shadow: 0 10px 26px rgba(var(--c2-rgb),.45); transform: translateY(-1px); filter: brightness(1.05); }
.btn-primary:disabled { opacity: .65; }
.btn-outline-primary { color: var(--brand-2); border-color: var(--brand-2); }
.btn-outline-primary:hover { background: var(--grad); border-color: transparent; color: #fff; }
.btn-outline-secondary { color: var(--muted); border-color: var(--border); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); border: 0; box-shadow: 0 6px 16px rgba(16,185,129,.3); }

/* ====== Badges ====== */
.badge { font-weight: 600; border-radius: 999px; padding: .38em .75em; }
.badge.text-bg-success { background: rgba(16,185,129,.15) !important; color: #059669 !important; }
.badge.text-bg-warning { background: rgba(245,158,11,.18) !important; color: #b45309 !important; }
.badge.text-bg-danger { background: rgba(239,68,68,.15) !important; color: #dc2626 !important; }
.badge.text-bg-secondary { background: rgba(106,115,148,.16) !important; color: var(--muted) !important; }
.badge.text-bg-primary { background: rgba(var(--c1-rgb),.15) !important; color: var(--brand-2) !important; }
.badge.text-bg-info { background: rgba(var(--c1-rgb),.15) !important; color: var(--brand-2) !important; }
.badge.text-bg-dark { background: rgba(15,23,42,.92) !important; color: #fff !important; }
.badge.text-bg-light { background: var(--surface-2) !important; color: var(--text) !important; }
[data-bs-theme="dark"] .badge.text-bg-success { color: #34d399 !important; }
[data-bs-theme="dark"] .badge.text-bg-warning { color: #fbbf24 !important; }
[data-bs-theme="dark"] .badge.text-bg-danger { color: #f87171 !important; }
[data-bs-theme="dark"] .badge.text-bg-primary { color: var(--brand-1) !important; }
[data-bs-theme="dark"] .badge.text-bg-info { color: var(--brand-1) !important; }

/* ====== App shell ====== */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 272px; flex: 0 0 272px; background: linear-gradient(180deg, var(--side-1), var(--side-2)); color: #e7ded6; padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar::before { content: ''; position: absolute; inset: 0; background: radial-gradient(420px 220px at 0% 0%, rgba(var(--c1-rgb),.28), transparent 70%), radial-gradient(360px 260px at 100% 100%, rgba(var(--c3-rgb),.16), transparent 70%); pointer-events: none; }
.sidebar > * { position: relative; }
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; font-weight: 800; font-size: 1.2rem; padding: .25rem .5rem 1.2rem; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; font-size: 1.2rem; box-shadow: 0 8px 20px rgba(var(--c1-rgb),.45); color: #fff; }
.nav-sec { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #a8998c; margin: 1rem .6rem .4rem; font-weight: 700; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .62rem .85rem; border-radius: 12px; color: #e0d6cc; font-weight: 600; font-size: .95rem; transition: background .18s, color .18s, transform .18s; margin-bottom: 2px; }
.side-link i { font-size: 1.1rem; width: 1.3rem; text-align: center; opacity: .9; }
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link.active { background: var(--grad); color: #fff; box-shadow: 0 8px 22px rgba(var(--c1-rgb),.45); }
.side-link .badge { margin-inline-start: auto; background: var(--bad) !important; color: #fff !important; }
.user-card { margin-top: auto; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: .8rem; display: flex; align-items: center; gap: .7rem; color: #fff; }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; font-weight: 800; color: #fff; flex: 0 0 auto; }
.main { flex: 1; min-width: 0; padding: 1.25rem 1.5rem 2.5rem; }
.topbar { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: .4rem .95rem; font-weight: 700; box-shadow: var(--shadow); font-size: .92rem; }
.chip i { color: var(--brand-2); }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-grid; place-items: center; transition: transform .15s, box-shadow .2s; box-shadow: var(--shadow); }
.icon-btn:hover { transform: translateY(-1px); color: var(--brand-2); }
.mobile-bar { display: none; }
@media (max-width: 991.98px) {
  .shell { display: block; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; background: linear-gradient(90deg, var(--side-1), var(--side-2)); color: #fff; position: sticky; top: 0; z-index: 20; }
  /* the menu is an overlay fixed to the screen: it opens in view even when the page is scrolled down */
  .sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(86vw, 320px); flex: none; height: 100dvh; z-index: 1050; box-shadow: 0 0 60px rgba(0,0,0,.45); }
  .sidebar.collapsing { height: 100dvh !important; transition: none; }
  .side-backdrop { display: none; position: fixed; inset: 0; z-index: 1049; background: rgba(2,6,23,.55); backdrop-filter: blur(2px); }
  .sidebar.show + .side-backdrop { display: block; }
  .main { padding: 1rem; }
}

/* ====== Stats / dashboard ====== */
.stat-card { position: relative; overflow: hidden; padding: 1.1rem 1.2rem; transition: transform .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(var(--c1-rgb),.16); }
.stat-card::after { content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%; inset-inline-end: -40px; top: -40px; background: var(--tone-soft, var(--grad-soft)); }
.stat-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 1.3rem; background: var(--tone, var(--grad)); box-shadow: 0 8px 18px var(--tone-shadow, rgba(var(--c1-rgb),.35)); }
.tone-indigo { --tone: linear-gradient(135deg,var(--brand-1),var(--brand-2)); --tone-soft: rgba(var(--c1-rgb),.12); --tone-shadow: rgba(var(--c1-rgb),.4); }
.tone-green { --tone: linear-gradient(135deg,#10b981,#059669); --tone-soft: rgba(16,185,129,.12); --tone-shadow: rgba(16,185,129,.4); }
.tone-pink { --tone: linear-gradient(135deg,var(--accent),var(--brand-2)); --tone-soft: rgba(var(--c3-rgb),.13); --tone-shadow: rgba(var(--c3-rgb),.4); }
.tone-amber { --tone: linear-gradient(135deg,#f59e0b,#d97706); --tone-soft: rgba(245,158,11,.14); --tone-shadow: rgba(245,158,11,.4); }
.stat-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.bars div { flex: 1; background: var(--grad); border-radius: 8px 8px 3px 3px; min-height: 4px; opacity: .9; transition: opacity .15s, transform .15s; transform-origin: bottom; animation: grow .7s ease both; }
.bars div:hover { opacity: 1; transform: scaleY(1.04); }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ====== Shop ====== */
.product-card { overflow: hidden; transition: transform .2s, box-shadow .2s; }
.product-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(var(--c1-rgb),.18); }
.product-media { position: relative; height: 150px; background: var(--grad); display: grid; place-items: center; color: rgba(255,255,255,.9); font-size: 3rem; overflow: hidden; }
.product-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.product-card:hover .product-media img { transform: scale(1.06); }
.product-media .tag { position: absolute; top: 10px; inset-inline-start: 10px; }
.product-media .tag .badge { backdrop-filter: blur(6px); background: rgba(255,255,255,.85) !important; color: #4338ca !important; }
.price { font-size: 1.35rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cat-head { display: flex; align-items: center; gap: .75rem; margin: 1.6rem 0 .9rem; }
.cat-head h5 { margin: 0; font-weight: 800; }
.thumb { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; background: var(--grad-soft); display: inline-grid; place-items: center; color: var(--brand-2); border: 1px solid var(--border); flex: 0 0 auto; }
.img-preview { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; border: 1px solid var(--border); }
.page-title { font-weight: 800; letter-spacing: -.01em; }

/* ====== Auth ====== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.auth-hero { position: relative; overflow: hidden; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(145deg, var(--side-1) 0%, var(--side-2) 55%, var(--hero-2) 100%); }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .32; animation: float 14s ease-in-out infinite; }
.blob.b1 { width: 380px; height: 380px; background: var(--brand-1); top: -80px; inset-inline-start: -80px; }
.blob.b2 { width: 320px; height: 320px; background: var(--accent); bottom: -60px; inset-inline-end: -40px; animation-delay: -5s; }
.blob.b3 { width: 240px; height: 240px; background: var(--brand-2); top: 45%; inset-inline-start: 40%; opacity: .35; animation-delay: -9s; }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(40px,-30px) scale(1.08); } 66% { transform: translate(-30px,35px) scale(.94); } }
.grid-lines { position: absolute; inset: 0; 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 50% 50%, #000 20%, transparent 75%); }
.auth-hero > *:not(.blob):not(.grid-lines) { position: relative; z-index: 2; }
.hero-title { font-size: clamp(2rem, 3.4vw, 3.1rem); font-weight: 800; line-height: 1.2; letter-spacing: -.02em; }
.hero-title span { background: linear-gradient(90deg, var(--accent), var(--brand-1)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.feature { display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem; border-radius: 16px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(10px); animation: rise .8s ease both; }
.feature i { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.14); font-size: 1.15rem; }
.feature:nth-child(2) { animation-delay: .12s; } .feature:nth-child(3) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 2rem; position: relative; }
.auth-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border); border-radius: 26px; padding: 2.2rem; box-shadow: 0 30px 70px rgba(26,32,64,.14); animation: rise .7s ease both; }
.auth-card::before { content: ''; display: block; height: 5px; border-radius: 99px; background: var(--grad); margin: -2.2rem -2.2rem 1.8rem; border-radius: 26px 26px 0 0; }
.field { position: relative; margin-bottom: 1rem; }
.field > i.lead { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 14px; color: var(--muted); pointer-events: none; transition: color .15s; }
.field .form-control { padding-block: .8rem; padding-inline-start: 2.6rem; }
.field:focus-within > i.lead { color: var(--brand-2); }
.field .eye { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: 8px; border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 10px; }
.field .eye:hover { background: var(--surface-2); color: var(--brand-2); }
.auth-top { position: absolute; top: 1.2rem; inset-inline-end: 1.2rem; display: flex; gap: .5rem; }
.btn-lg-grad { padding: .85rem 1rem; font-size: 1.05rem; border-radius: 14px; }
@media (max-width: 991.98px) { .auth { grid-template-columns: 1fr; } .auth-hero { display: none; } .auth-side { min-height: 100vh; background: radial-gradient(600px 300px at 50% -10%, rgba(var(--c1-rgb),.14), transparent 70%); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ====== Tech details ====== */
.money, .stat-value, .price, pre, code, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.money small { font-size: .68em; opacity: .65; font-weight: 600; margin-inline-start: .15em; }
html[data-hide="1"] .money { font-size: 0 !important; }
html[data-hide="1"] .money::after { content: '****'; font-size: 1rem; letter-spacing: .12em; }
html[data-hide="1"] .stat-value .money::after { font-size: 1.35rem; }
html[data-hide="1"] .price .money::after { font-size: 1.15rem; }
.side-link.active { background: linear-gradient(135deg, rgba(var(--c1-rgb),.9), rgba(var(--c2-rgb),.95)); }
.stat-card, .product-card, .cat-card { border-top: 2px solid transparent; }
.stat-card:hover, .product-card:hover, .cat-card:hover { border-top-color: var(--brand-1); }

/* category cards */
.cat-card { display: block; color: var(--text); overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; height: 100%; }
.cat-card:hover { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(var(--c1-rgb),.16); color: var(--text); }
.cat-media { height: 120px; position: relative; display: grid; place-items: center; font-size: 2.6rem; color: rgba(255,255,255,.92);
  background: linear-gradient(135deg, var(--side-1), var(--hero-2)); overflow: hidden; }
.cat-media::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 22px 22px; }
.cat-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.cat-card:hover .cat-media img { transform: scale(1.06); }
.product-media { background: linear-gradient(135deg, var(--side-1), var(--hero-2)); }
.reorder-box { display: flex; align-items: center; gap: .4rem; }
.reorder-box input { width: 4.2rem; text-align: center; padding: .25rem .4rem; font-family: var(--mono); }
.search { max-width: 420px; }
.crumb { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; color: var(--muted); }
.crumb:hover { color: var(--brand-2); }

/* receipt modal + A6 print */
.rcpt-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,.65); backdrop-filter: blur(4px); z-index: 1080; display: grid; place-items: center; padding: 1rem; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.rcpt-modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.4); overflow: hidden; animation: rise .35s ease both; }
.rcpt-head { padding: 1rem 1.25rem; background: linear-gradient(135deg, #060c1b, #0b2a4a); color: #fff; display: flex; align-items: center; gap: .7rem; }
.rcpt-head .ok { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(16,185,129,.2); color: #34d399; font-size: 1.3rem; }
.rcpt-body { padding: 1.25rem; }
.rcpt-row { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--border); }
.rcpt-row span:first-child { color: var(--muted); font-weight: 600; }
.rcpt-codes { background: #050a16; color: #34d399; border-radius: 12px; padding: .8rem 1rem; font-family: var(--mono); direction: ltr; text-align: left; margin: .9rem 0; max-height: 180px; overflow: auto; user-select: all; word-break: break-all; }
.rcpt-codes div::before { content: '$ '; opacity: .5; }
.print-area { display: none; }
@media print {
  @page { size: A6 portrait; margin: 6mm; }
  html, body { background: #fff !important; }
  body * { visibility: hidden !important; }
  .print-area, .print-area * { visibility: visible !important; }
  .print-area { display: block !important; position: fixed; inset: 0; padding: 0; color: #000; font-family: var(--mono); font-size: 10pt; }
  .print-area h3 { font-size: 13pt; margin: 0 0 4mm; border-bottom: 1.5px solid #000; padding-bottom: 2mm; }
  .print-area .pl { display: flex; justify-content: space-between; gap: 6mm; margin: 1.6mm 0; }
  .print-area .pl b { font-weight: 700; text-align: end; white-space: pre-wrap; word-break: break-word; }
  .print-area .pc { margin: 3mm 0; padding: 2.5mm; border: 1.5px dashed #000; font-size: 11pt; font-weight: 700; word-break: break-all; direction: ltr; text-align: left; }
}

/* terminal widget on the login page */
.terminal { background: rgba(2,6,23,.72); border: 1px solid rgba(148,163,184,.2); border-radius: 14px; overflow: hidden; font-family: var(--mono); font-size: .85rem; max-width: 470px; backdrop-filter: blur(8px); box-shadow: 0 20px 50px rgba(0,0,0,.4); direction: ltr; text-align: left; }
.terminal .bar { display: flex; gap: 6px; padding: .6rem .8rem; background: rgba(148,163,184,.1); align-items: center; }
.terminal .bar i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.terminal .bar span { margin-inline-start: .6rem; color: #94a3b8; font-size: .75rem; }
.terminal .body { padding: .9rem 1rem 1.1rem; color: #cbd5e1; min-height: 148px; }
.terminal .ln { white-space: nowrap; overflow: hidden; width: 0; animation: type 1.6s steps(34) forwards; }
.terminal .ln:nth-child(1) { animation-delay: .3s; } .terminal .ln:nth-child(2) { animation-delay: 2.2s; } .terminal .ln:nth-child(3) { animation-delay: 4s; } .terminal .ln:nth-child(4) { animation-delay: 5.2s; } .terminal .ln:nth-child(5) { animation-delay: 6.4s; }
.terminal .ln.ok { color: #34d399; } .terminal .ln .p { color: #38bdf8; }
.terminal .cursor { display: inline-block; width: 8px; height: 1em; background: #34d399; vertical-align: -2px; animation: blink 1s steps(1) infinite; margin-inline-start: 2px; }
@keyframes type { from { width: 0; } to { width: 100%; } }
@keyframes blink { 50% { opacity: 0; } }

/* rules page */
.rules { white-space: pre-wrap; line-height: 1.9; font-size: 1rem; }

/* product picker (packages) */
.picker-list{max-height:340px;overflow:auto;border:1px solid var(--bs-border-color);border-radius:.6rem}
.picker-cat{position:sticky;top:0;background:var(--bs-tertiary-bg);padding:.3rem .75rem;font-size:.78rem;font-weight:700;letter-spacing:.04em;color:var(--bs-secondary-color)}
.picker-item{display:flex;gap:.6rem;align-items:center;padding:.4rem .75rem;cursor:pointer;border-top:1px solid var(--bs-border-color-translucent)}
.picker-item:hover{background:var(--bs-tertiary-bg)}
.code-box{background:var(--bs-tertiary-bg);font-family:'JetBrains Mono',monospace}

/* rate chips + stock ribbon */
.chip-rate { font-size: .8rem; text-decoration: none; color: var(--text); }
.chip-rate:hover { border-color: var(--brand-1); color: var(--text); }
.product-media .ribbon { position: absolute; top: 0; inset-inline-start: 0; z-index: 2; padding: .3rem 1.1rem .3rem .8rem; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #fff; clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%); box-shadow: 0 4px 14px rgba(0,0,0,.3); display: flex; gap: .4rem; align-items: center; }
[dir="rtl"] .product-media .ribbon { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); padding: .3rem .8rem .3rem 1.1rem; }
.ribbon.on { background: linear-gradient(135deg, #10b981, #059669); }
.ribbon.out { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.ribbon.req { background: linear-gradient(135deg, var(--brand-1), var(--brand-2)); }
.ribbon .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.3); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255,255,255,0); } }
.stock-count { font-family: var(--mono); font-weight: 800; }

/* palette picker */
.pal-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: .5rem; min-width: 190px; }
.pal-item { display: flex; align-items: center; gap: .6rem; width: 100%; background: none; border: 0; color: var(--text); padding: .45rem .55rem; border-radius: 10px; font-weight: 600; font-size: .88rem; }
.pal-item:hover, .pal-item.on { background: var(--surface-2); }
.pal-sw { width: 34px; height: 20px; border-radius: 999px; display: inline-block; flex: 0 0 auto; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }

/* ===== Laravel port additions ===== */
.pal-menu[hidden]{display:none}
.rcpt-backdrop[hidden]{display:none}
.ribbon.auto { background: linear-gradient(135deg, #8b5cf6, #6366f1); }

/* ----- orders that need attention ----- */
.attn-card { border-color: rgba(239,68,68,.55); box-shadow: 0 0 0 3px rgba(239,68,68,.10), var(--shadow); }
.attn-card h5 { color: #dc2626; }
.wait-card { border-color: rgba(245,158,11,.5); }
.table tr.row-attn > * { background: rgba(239,68,68,.10) !important; }
.table tr.row-attn > td:first-child { box-shadow: inset 4px 0 0 #ef4444; }
[dir="rtl"] .table tr.row-attn > td:first-child { box-shadow: inset -4px 0 0 #ef4444; }
.table tr.row-wait > * { background: rgba(245,158,11,.10) !important; }
[data-bs-theme="dark"] .attn-card h5 { color: #f87171; }

/* ====== Phone layout: calm, aligned cards and top bar ====== */
@media (max-width: 575.98px) {
  .main { padding: .85rem; }
  /* top bar: chips in tidy rows, buttons spread evenly on the last row */
  .topbar { display: grid; grid-template-columns: 1fr; gap: .55rem; margin-bottom: 1rem; }
  .topbar .chip { font-size: .92rem; padding: .7rem 1rem; gap: .5rem; justify-content: center; white-space: nowrap; min-width: 0; }
  .topbar > .ms-auto { width: 100%; margin: .15rem 0 0 !important; justify-content: space-between; }
  .topbar .icon-btn { width: 44px; height: 40px; }

  /* stat cards: icon + label on top, the figure underneath, one calm font */
  .stat-card { padding: .85rem .9rem; }
  .stat-card::after { width: 90px; height: 90px; inset-inline-end: -34px; top: -34px; }
  .stat-card > .d-flex { flex-direction: column; align-items: flex-start !important; gap: .55rem !important; }
  .stat-card > .d-flex > div:last-child { width: 100%; }
  .stat-icon { width: 34px; height: 34px; border-radius: 10px; font-size: 1rem; }
  .stat-label { font-size: .78rem; line-height: 1.3; margin-bottom: .25rem; }
  .stat-value { font-family: inherit; font-size: clamp(.9rem, 4.4vw, 1.2rem); font-weight: 800; line-height: 1.2; letter-spacing: -.02em; white-space: nowrap; }
  .stat-value .money { font-family: inherit; display: flex; flex-direction: column; align-items: flex-start; }
  .stat-value .money small { font-size: .68rem; margin: 0; opacity: .6; font-weight: 700; letter-spacing: .04em; }
  .stat-value > small { display: block; font-size: .72rem !important; margin-top: .1rem; }
  html[data-hide="1"] .stat-value .money::after { font-size: 1.2rem; }
}

/* ====== Flexy ====== */
.fx-ops { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.fx-op { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1.1rem .5rem; cursor: pointer; font-size: 1.05rem; border: 2px solid transparent; text-align: center; color: var(--text); }
.fx-op i { font-size: 1.8rem; color: var(--brand-2); }
.fx-op:hover:not(:disabled) { border-color: var(--brand-1); }
.fx-op.on { border-color: var(--brand-1); background: var(--surface-2, var(--surface)); }
.fx-op:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 575.98px) { .fx-op { padding: .9rem .25rem; font-size: .9rem; } .fx-op i { font-size: 1.4rem; } }
