:root {
  --ink: #171a33; --ink-2: #232749; --ink-3: #2f3460;
  --fabric: #f5f6fa; --card: rgba(255,255,255,.86); --line: #e2e4ee; --text: #1c1f3a; --muted: #6a6f8c;
  --teal: #0fa38d; --teal-d: #0b8472; --teal-l: #dff5f1; --saffron: #f4b43a; --rose: #e5516b; --indigo: #4f5bd5;
  --r: 14px; --r-sm: 9px; --shadow: 0 1px 2px rgba(23,26,51,.05), 0 8px 24px -12px rgba(23,26,51,.14);
  --ease: cubic-bezier(.2,.8,.2,1);
  --f-display: 'Bricolage Grotesque', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --f-body: 'Figtree', 'IBM Plex Sans Arabic', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body { margin: 0; font: 400 15px/1.55 var(--f-body); color: var(--text); min-height: 100vh;
  background: radial-gradient(900px 520px at 85% -8%, rgba(15,163,141,.16), transparent 70%), radial-gradient(700px 480px at -5% 105%, rgba(244,180,58,.16), transparent 70%), radial-gradient(600px 400px at 60% 110%, rgba(79,91,213,.10), transparent 70%), var(--fabric); background-attachment: fixed; }
html[lang=ar] body { font-size: 16px; line-height: 1.7; }
#threads { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
#app { position: relative; z-index: 1; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; } h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
p { margin: 0; } a { color: inherit; }
.muted { color: var(--muted); } .small { font-size: 13px; } .mono { font-size: 13px; }
.grow { flex: 1; }
.ic { flex: none; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- buttons & fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: #fff; font-weight: 600; text-decoration: none; transition: transform .15s var(--ease), box-shadow .2s, background .2s, border-color .2s; }
.btn:hover:not(:disabled) { border-color: #c9ccdd; box-shadow: 0 4px 14px -6px rgba(23,26,51,.25); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--teal-d); border-color: var(--teal-d); box-shadow: 0 8px 20px -8px rgba(15,163,141,.7); }
.btn.block { width: 100%; height: 44px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; transition: background .2s, transform .15s; }
.icon-btn:hover { background: rgba(23,26,51,.07); } .icon-btn:active { transform: scale(.92); }
.link { background: none; border: 0; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; padding: 6px; }
.link:hover { color: var(--text); }
.field { display: grid; gap: 6px; margin-bottom: 14px; align-content: start; }   /* in a taller row (a field with a hint beside it) the label and input stay at the top instead of spreading apart */
.field > span { font-weight: 600; font-size: 13.5px; }
input:not([type=checkbox]), select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; font: inherit; color: var(--text); transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(15,163,141,.16); }
.hint { color: var(--muted); font-size: 12.5px; } .err { color: var(--rose); font-size: 12.5px; min-height: 0; } .err:empty { display: none; }
.form-error { color: #b4233f; background: #fdecef; border: 1px solid #f7c6d0; padding: 10px 12px; border-radius: var(--r-sm); margin-bottom: 14px; font-size: 14px; }
.form-error[hidden] { display: none; }
.check { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.branch-hint { display: block; margin: -4px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- login ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: flex; padding: 24px; } /* card uses margin:auto so a short screen scrolls instead of cutting off the top */
.login-card { margin: auto; width: min(420px, 100%); background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.7); border-radius: 22px; padding: 36px 32px 24px; box-shadow: 0 30px 60px -30px rgba(23,26,51,.35); animation: rise .7s var(--ease) both; }
.login-card h1 { margin-top: 22px; } .login-card .muted { margin: 4px 0 22px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px var(--f-display); }
.brand .logo { width: 34px; height: 34px; } .brand-lg .logo { width: 44px; height: 44px; } .brand-lg { font-size: 26px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; transition: all .2s; }
.chip:hover { border-color: var(--teal); background: var(--teal-l); }
.lang-switch { margin: 14px auto 0; display: flex; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 256px; background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%); color: #dfe2f5; display: flex; flex-direction: column; padding: 18px 14px; z-index: 30; transition: transform .3s var(--ease); }
.sidebar .brand { color: #fff; padding: 4px 8px 18px; }
.sidebar nav { flex: 1; overflow-y: auto; }
.nav-title { font-size: 12px; color: #8b90bd; padding: 14px 10px 6px; font-weight: 600; }
html[lang=ar] .nav-title { font-size: 13px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: #c4c8e6; font-weight: 500; transition: background .2s, color .2s, padding .25s var(--ease); }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; padding-inline-start: 15px; }
.nav-item.active { background: rgba(15,163,141,.18); color: #fff; }
.nav-item.active::before { content: ''; position: absolute; inset-inline-start: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--teal); animation: grow .35s var(--ease); }
html[dir=rtl] .nav-item.active::before { border-radius: 4px 0 0 4px; }
@keyframes grow { from { transform: scaleY(.2); opacity: 0; } to { transform: none; opacity: 1; } }
.badge-soon { margin-inline-start: auto; font-style: normal; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: rgba(244,180,58,.16); color: var(--saffron); }
.side-foot { display: flex; align-items: center; gap: 8px; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.me-text { display: grid; line-height: 1.25; min-width: 0; } .me-text strong { color: #fff; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .me-text small { color: #8b90bd; }
.side-foot .icon-btn { color: #c4c8e6; } .side-foot .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--teal), var(--indigo)); color: #fff; font: 700 15px var(--f-display); flex: none; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.content { margin-inline-start: 256px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 32px; background: rgba(245,246,250,.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid rgba(226,228,238,.8); }
.topbar h2 { font-size: 16px; font-weight: 600; color: var(--muted); }
.menu-btn { display: none; }
.pill { display: inline-flex; gap: 8px; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 13.5px; transition: border-color .2s, transform .15s; }
.pill:hover { border-color: var(--teal); } .pill:active { transform: scale(.96); }
main#main { padding: 28px 32px 56px; max-width: 1360px; width: 100%; margin-inline: auto; outline: none; }
main#main.enter { animation: fadeonly .3s var(--ease); }
@keyframes fadeonly { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.scrim { display: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .muted { margin-top: 4px; }

/* ---------- cards ---------- */
.card { background: var(--card); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.8); outline: 1px solid var(--line); outline-offset: -1px; border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 18px; }
.kpi { display: flex; gap: 16px; align-items: center; animation: rise .6s var(--ease) both; animation-delay: calc(var(--i) * 90ms); }
.kpi-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--teal-l); color: var(--teal-d); }
.kpi:nth-child(2) .kpi-ic { background: #fdf1d6; color: #a46d00; } .kpi:nth-child(3) .kpi-ic { background: #e6e8fb; color: var(--indigo); }
.kpi > div:last-child { min-width: 0; }
.kpi-num { font: 700 clamp(24px, 2.4vw, 34px)/1 var(--f-display); white-space: nowrap; letter-spacing: -.02em; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.feed, .phases { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.feed li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); } .feed li:last-child { border: 0; }
.feed li div { display: grid; line-height: 1.35; } .feed small { color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); margin-top: 7px; flex: none; box-shadow: 0 0 0 4px var(--teal-l); }
.ph { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.ph em { margin-inline-start: auto; font-style: normal; font-size: 12.5px; color: var(--muted); }
.ph-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #ecedf5; color: var(--muted); }
.ph.done .ph-dot { background: var(--teal); color: #fff; } .ph.done em { color: var(--teal-d); font-weight: 600; }
.ph.next .ph-dot { background: #fdf1d6; color: #a46d00; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(244,180,58,.5); } 50% { box-shadow: 0 0 0 7px rgba(244,180,58,0); } }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; margin: 14px 0 0; } .dl dt { color: var(--muted); } .dl dd { margin: 0; font-weight: 500; }

/* ---------- tables ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; overflow-y: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; font-size: 13px; color: var(--muted); font-weight: 600; padding: 12px 16px; background: rgba(245,246,250,.7); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { animation: fadeonly .35s var(--ease) both; animation-delay: calc(var(--i) * 35ms); transition: background .15s; }
tbody tr:hover { background: rgba(15,163,141,.05); } tbody tr:last-child td { border-bottom: 0; }
td.end { text-align: end; }
.who { display: flex; align-items: center; gap: 12px; } .who div { display: grid; line-height: 1.3; } .who small { color: var(--muted); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #ecedf5; font-size: 12.5px; font-weight: 600; }
.role-admin { background: #e6e8fb; color: #3640a8; } .role-manager { background: var(--teal-l); color: var(--teal-d); } .role-cashier { background: #fdf1d6; color: #8a5a00; } .role-stock_keeper { background: #fde7ec; color: #b4233f; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; } .status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.on::before { background: var(--teal); } .status.off::before { background: var(--rose); }
.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager .btn { height: 34px; }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: rgba(23,26,51,.06); border-radius: 11px; padding: 3px; margin-bottom: 16px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); transition: all .2s var(--ease); }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 2px 8px -2px rgba(23,26,51,.2); }
.card .seg { margin: 14px 0 0; }

/* ---------- empty / skeleton ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 72px 20px; color: var(--muted); }
.empty h3 { color: var(--text); margin: 4px 0 0; } .empty .btn { margin-top: 10px; } .empty p { max-width: 380px; }
.skeleton-page { display: grid; gap: 14px; }
.sk { height: 84px; border-radius: var(--r); background: linear-gradient(90deg, #eceef6 25%, #f6f7fb 50%, #eceef6 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; } .sk.wide { height: 240px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- drawer & toast ---------- */
.drawer-wrap { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(23,26,51,.4); opacity: 0; transition: opacity .25s; }
.drawer { position: absolute; inset-block: 0; inset-inline-end: 0; width: min(440px, 100%); background: #fff; padding: 24px; overflow-y: auto; transform: translateX(100%); transition: transform .3s var(--ease); box-shadow: -20px 0 50px -20px rgba(23,26,51,.35); }
html[dir=rtl] .drawer { transform: translateX(-100%); }
.drawer-wrap.open { pointer-events: auto; } .drawer-wrap.open .drawer-scrim { opacity: 1; } .drawer-wrap.open .drawer { transform: none; }
.drawer header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.drawer footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
#toasts { position: fixed; inset-block-end: 20px; inset-inline-end: 20px; z-index: 80; display: grid; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 14px 30px -10px rgba(23,26,51,.5); animation: rise .35s var(--ease); }
.toast.ok .ic { color: var(--teal); } .toast.err .ic { color: var(--saffron); } .toast.out { opacity: 0; transform: translateY(8px); transition: all .25s; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); } html[dir=rtl] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  .content { margin-inline-start: 0; } .menu-btn { display: inline-grid; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(23,26,51,.45); z-index: 25; opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar, main#main { padding-inline: 16px; }
  .kpis, .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 24px; }
}
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } .login-card { padding: 28px 20px 18px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; } }

/* ---------- Phase 2: catalog & inventory ---------- */
.head-actions { display: flex; gap: 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar select { width: auto; min-width: 150px; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; display: block; }
.search .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-inline-start: 38px; }
.check.inline { margin: 0 4px; white-space: nowrap; }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; font: inherit; color: var(--text); resize: vertical; }
textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(15,163,141,.16); }
th.num, td.num { text-align: end; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.pname { display: grid; line-height: 1.3; } .pname small { color: var(--muted); }
.qty { font-weight: 700; font-variant-numeric: tabular-nums; }
tr.dim td, li.dim { opacity: .55; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-inline-start: 6px; }
.badge.low { background: #fdf1d6; color: #8a5a00; } .badge.out { background: #fde7ec; color: #b4233f; }
.small-btn { height: 34px; padding: 0 12px; font-size: 13.5px; }
.tight { margin: -8px 0 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: start; }
.drawer.wide { width: min(760px, 100%); }
.drawer-body { padding: 0; }
.drawer footer { position: sticky; bottom: -24px; background: linear-gradient(180deg, rgba(255,255,255,0), #fff 30%); padding: 16px 0 4px; margin-top: 12px; }
.variants { margin: 10px 0 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: #fafbfd; }
.variants h4, .sect { margin: 0; font: 700 15px var(--f-display); } .sect { margin: 22px 0 8px; }
.variants .hint { margin-top: 2px; }
.gen { margin: 10px 0; } .gen summary { cursor: pointer; color: var(--teal-d); font-weight: 600; font-size: 13.5px; }
.gen-row { align-items: end; margin-top: 10px; } .gen-row .field { margin-bottom: 0; } .gen-row .btn { height: 42px; }
.vtable { width: 100%; min-width: 560px; margin-bottom: 10px; }
.vtable th { background: transparent; padding: 6px 6px; font-size: 12.5px; }
.vtable td { padding: 4px 6px; border: 0; vertical-align: top; }
.vtable input:not([type=checkbox]) { height: 36px; padding: 0 8px; }
.vtable input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--teal); margin-top: 9px; }
.vtable .qty { display: inline-block; padding-top: 8px; }
.vtable tbody tr { animation: none; } .vtable tbody tr:hover { background: transparent; }
.stock-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--teal-l); margin-bottom: 16px; }
.stock-head > div:first-child { display: grid; line-height: 1.35; }
.stock-now { display: grid; text-align: end; } .big { font: 700 34px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.timeline li > div { flex: 1; display: grid; line-height: 1.35; } .timeline small { color: var(--muted); }
.chg { min-width: 52px; text-align: center; padding: 3px 8px; border-radius: 8px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chg.up { background: var(--teal-l); color: var(--teal-d); } .chg.down { background: #fde7ec; color: #b4233f; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.plain { list-style: none; margin: 8px 0 0; padding: 0; }
.plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.plain li:last-child { border: 0; } .plain li > div:first-child { display: grid; line-height: 1.35; }
.low-q { display: flex; align-items: center; gap: 4px; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.inline-form { display: flex; gap: 10px; margin: 12px 0 8px; } .inline-form select { width: 130px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.kpi.warn .kpi-ic { background: #fdf1d6; color: #a46d00; } .kpi.warn .kpi-num { color: #8a5a00; }
.kpi:nth-child(2) .kpi-ic { background: #e6e8fb; color: var(--indigo); } .kpi:nth-child(3) .kpi-ic { background: #fdf1d6; color: #a46d00; }
.kpi:nth-child(4) .kpi-ic { background: #fde7ec; color: #b4233f; }
.phase-card { margin-top: 18px; }
.phase-strip { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 16px; }
.phase-strip .ph { padding: 4px 0; } .phase-strip .ph div { display: grid; line-height: 1.3; } .phase-strip .ph em { margin: 0; }
@media (max-width: 960px) { .grid-2.even { grid-template-columns: 1fr; } .row3 { grid-template-columns: 1fr; } .search { max-width: none; } }

/* ---------- Phase 3: purchasing ---------- */
.pill-status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: #ecedf5; color: #4a4f72; }
.pill-status.po-ordered { background: #e6e8fb; color: #3640a8; } .pill-status.po-partial { background: #fdf1d6; color: #8a5a00; }
.pill-status.po-received { background: var(--teal-l); color: var(--teal-d); } .pill-status.po-cancelled { background: #fde7ec; color: #b4233f; }
tr.clickable { cursor: pointer; } tr.clickable:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
.bar { height: 6px; width: 120px; border-radius: 999px; background: #e9ebf3; overflow: hidden; margin-bottom: 3px; } .bar i { display: block; height: 100%; background: var(--teal); border-radius: 999px; transition: width .5s var(--ease); }
.toolbar .tight-seg { margin: 0; }
.btn.danger { color: #b4233f; border-color: #f2c4cd; } .btn.danger:hover:not(:disabled) { background: #fdecef; border-color: #e9a3b1; }
.po-head { display: grid; gap: 10px; margin-bottom: 14px; }
.dl.compact { margin: 0; gap: 4px 18px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }
.lines td, .lines th { vertical-align: middle; } .lines input { width: 96px; text-align: end; } .lines .pname { min-width: 180px; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; width: min(320px, 100%); margin: 14px 0 0; margin-inline-start: auto; }
.totals dt { color: var(--muted); } .totals dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; }
.totals .grand { font: 700 17px var(--f-display); color: var(--text); padding-top: 6px; border-top: 1px solid var(--line); }
.receive-box { margin-top: 14px; padding: 14px; border: 1px dashed var(--teal); border-radius: var(--r); background: var(--teal-l); }
.receive-box .field { margin-bottom: 8px; }
.picker { position: relative; margin: 10px 0; } .search.wide { max-width: none; }
.results { position: absolute; z-index: 5; inset-inline: 0; top: 46px; list-style: none; margin: 0; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: 0 16px 36px -12px rgba(23,26,51,.3); max-height: 280px; overflow-y: auto; }
.results[hidden] { display: none; }
.results button { width: 100%; display: flex; justify-content: space-between; gap: 12px; align-items: center; text-align: start; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; }
.results button:hover, .results button:focus-visible { background: var(--teal-l); } .results button span:first-child { display: grid; line-height: 1.3; } .results small { color: var(--muted); }
.results .pad { padding: 10px; }
.vhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ================= Responsive pass =================
   Breakpoints: 1200 wide laptop, 960 tablet (sidebar becomes a drawer), 640 phone (tables become cards), 380 small phone.
   Rules: nothing may force the page wider than the screen; touch targets >= 40px; inputs 16px so iOS does not zoom. */
html, body { max-width: 100%; overflow-x: clip; }
.content, main#main, .card, .drawer, .field, .row2 > *, .row3 > *, .grid-2 > *, .kpis > * { min-width: 0; }
img, svg, canvas, video { max-width: 100%; }
.toolbar > * { min-width: 0; }
.toolbar select { flex: 0 1 180px; }
.seg button { white-space: nowrap; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { overflow-wrap: anywhere; }
.pname strong, .who strong { overflow-wrap: anywhere; }
td, th { overflow-wrap: anywhere; } th { overflow-wrap: normal; }
.topbar { padding-inline: max(32px, env(safe-area-inset-left)) max(32px, env(safe-area-inset-right)); padding-top: calc(14px + env(safe-area-inset-top)); }
.drawer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); max-width: 100vw; }
.drawer footer { bottom: calc(-24px - env(safe-area-inset-bottom)); }
#toasts { inset-inline-end: max(20px, env(safe-area-inset-right)); inset-block-end: max(20px, env(safe-area-inset-bottom)); max-width: calc(100vw - 40px); }
.stock-head { flex-wrap: wrap; }
.sidebar { height: 100vh; height: 100dvh; }

/* touch devices: comfortable targets, no iOS zoom on focus */
@media (pointer: coarse), (max-width: 960px) {
  .icon-btn { width: 40px; height: 40px; }
  .btn, .pill { min-height: 40px; }
  .small-btn { height: 40px; }
  .chip { min-height: 40px; padding: 0 14px; }
  .seg button { min-height: 38px; }
  .nav-item { padding-block: 11px; }
  .vtable input[type=checkbox], .check input { width: 22px; height: 22px; }
  input:not([type=checkbox]), select, textarea { font-size: 16px; }
  .vtable input:not([type=checkbox]) { height: 42px; }
}

@media (max-width: 1200px) {
  main#main { padding-inline: 24px; }
  .topbar { padding-inline: 24px; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  main#main { padding: 20px 16px 48px; }
  .topbar { padding-inline: 12px; gap: 8px; }
  .topbar h2 { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-head { align-items: stretch; }
  .head-actions { width: 100%; } .head-actions .btn { width: 100%; }
  .toolbar .search { flex: 1 1 100%; max-width: none; }
  .toolbar select { flex: 1 1 140px; }
  .drawer, .drawer.wide { width: 100%; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .drawer footer { bottom: calc(-18px - env(safe-area-inset-bottom)); }
  .variants { padding: 12px; }
  .phase-strip { grid-template-columns: 1fr 1fr; }
}

/* phones: tables become stacked cards, grids become single column */
@media (max-width: 640px) {
  .table-wrap { overflow: visible; }
  .vtable { min-width: 0; }
  .table-card table, .table-card tbody, .table-card tr, .table-card td { display: block; width: 100%; }
  .table-card thead, .vtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* stays available to screen readers */
  .table-card tr { padding: 12px 16px; border-bottom: 1px solid var(--line); animation: none; }
  .table-card tbody tr:last-child { border-bottom: 0; }
  .table-card td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 5px 0; border: 0; text-align: end; }
  .table-card td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: start; flex: none; max-width: 46%; }
  .table-card td:first-child { justify-content: flex-start; text-align: start; padding-bottom: 8px; }
  .table-card td:first-child::before, .table-card td[data-label=""]::before, .table-card td[colspan]::before { display: none; }
  .table-card td.end { justify-content: flex-end; padding-top: 8px; }
  .table-card td[colspan] { display: block; text-align: center; padding: 18px 0; }
  .bar { width: 100px; }

  /* editable grids inside drawers: one card per row, labels above fields */
  .vtable tbody, .vtable tr, .vtable td { display: block; width: 100%; }
  .vtable tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
  .vtable td { padding: 0; text-align: start; min-width: 0; }
  .vtable td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
  .vtable td[data-label=""]::before, .vtable td:first-child::before { display: none; }
  .vtable td:first-child, .vtable td.end { grid-column: 1 / -1; }
  .vtable td.end { text-align: end; }
  .lines input, .vtable input:not([type=checkbox]) { width: 100%; text-align: start; }
  .lines .pname { min-width: 0; }
  .vtable .num { text-align: start; }
  .receive-box .actions-row .btn { flex: 1 1 100%; }
  .actions-row .btn { flex: 1 1 140px; }
  .row2, .row3, .gen-row { grid-template-columns: 1fr; }
  .gen-row .btn { width: 100%; }
  .totals { width: 100%; }
  .stock-head { align-items: flex-start; }
  .kpi { padding: 16px; }
  .card { padding: 16px; }
  .table-card { padding: 0; }
  .phase-strip { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; } .dl dt { margin-top: 8px; }
  .inline-form { flex-wrap: wrap; } .inline-form select, .inline-form input { flex: 1 1 120px; width: auto; }
  .card-head { flex-wrap: wrap; }
  #toasts { inset-inline: 12px; max-width: none; } .toast { width: 100%; }
  .results { max-height: 220px; }
  .pager { justify-content: center; } .pager > span { order: -1; width: 100%; text-align: center; }
  .pager .btn { flex: 1; }
}
@media (max-width: 380px) {
  main#main { padding-inline: 12px; }
  h1 { font-size: 22px; }
  .login { padding: 12px; } .login-card { padding: 22px 16px 14px; border-radius: 18px; }
  .kpi-ic { width: 40px; height: 40px; } .kpi { gap: 12px; }
  .vtable tr { grid-template-columns: 1fr; }
  .seg button { padding: 7px 10px; font-size: 13px; }
}
/* short landscape screens: keep the sidebar usable and the login reachable */
@media (max-height: 480px) {
  .sidebar .brand { padding-bottom: 8px; } .nav-head { padding-top: 8px; } .nav-item { padding-block: 7px; }
  .login-card { padding-block: 20px 12px; } .login-card h1 { margin-top: 12px; }
  .topbar { padding-block: 6px; }
}
/* very wide screens: keep line lengths and the layout centred */
@media (min-width: 1700px) {
  main#main { max-width: 1500px; }
  body { font-size: 16px; }
}

/* ---- responsive refinements (after visual review) ---- */
@media (max-width: 640px) {
  .vtable td:first-child::before { display: block; }                 /* first field of an editable grid is a real field: keep its label */
  .vtable td[data-label=""]::before { display: none; }              /* ...but a product title needs none */
  .table-card td:first-child::before { display: none; }
  .toolbar select { flex: 1 1 calc(50% - 8px); min-width: 0; }      /* filters two per row */
  .toolbar .check.inline { flex: 1 1 100%; }
  .dl.compact { grid-template-columns: auto 1fr; gap: 6px 14px; } .dl.compact dt { margin-top: 0; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }              /* dashboard tiles two per row */
  .kpi { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .kpi-num { font-size: clamp(20px, 6vw, 26px); white-space: normal; overflow-wrap: anywhere; }
  .kpi .muted { font-size: 13px; line-height: 1.3; }
}
@media (max-width: 300px) { .kpis { grid-template-columns: 1fr; } .toolbar select { flex-basis: 100%; } }

.field[hidden] { display: none; }

/* ---------- Phase 4: branches and transfers ---------- */
.pill-status.tr-in_transit { background: #e6e8fb; color: #3640a8; } .pill-status.tr-received { background: var(--teal-l); color: var(--teal-d); }
.pill-status.tr-cancelled { background: #fde7ec; color: #b4233f; } .pill-status.tr-draft { background: #ecedf5; color: #4a4f72; }
.route { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 16px; } .route .arrow { color: var(--teal-d); display: inline-flex; } html[dir=rtl] .route .arrow { transform: scaleX(-1); }
.neg { color: #b4233f; font-weight: 700; } .lowq { color: #8a5a00; }
.warn-row td { background: #fff7f8; }
.section-gap { margin-top: 18px; }
.chips-line { margin: 4px 0 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.chg svg { display: block; }

/* ---------- Phase 5: point of sale, receipts, customers ---------- */
.pill-status.sale-completed { background: var(--teal-l); color: var(--teal-d); } .pill-status.sale-voided { background: #fde7ec; color: #b4233f; }
.sum-line { margin: 0 0 10px; } .date-f { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); } .date-f input { width: auto; height: 40px; }
.sales-big { margin: 6px 0 2px; } .empty.small { padding: 28px 12px; }
.kpis.small { grid-template-columns: 1fr 1fr; margin: 14px 0; }
.wide-card { grid-column: 1 / -1; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; align-items: start; }
.pos-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; } .pos-top select { width: auto; min-width: 180px; }
.pos-main .picker { margin: 0 0 14px; }
.pos-results { max-height: 360px; } .pos-results button { padding: 10px 12px; }
.r-main, .r-side { display: grid; line-height: 1.3; } .r-side { text-align: end; } .r-main small, .r-side small { color: var(--muted); } .r-side small.neg { color: #b4233f; }
.results button:disabled { opacity: .5; cursor: not-allowed; }
.cart-card { padding: 16px; } .cart { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: minmax(0, 1.6fr) auto 74px auto 96px 34px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border: 0; } .cl-main { display: grid; line-height: 1.3; min-width: 0; } .cl-main small { color: var(--muted); } .cl-main .err:empty { display: none; }
.cl-qty { display: inline-flex; align-items: center; gap: 2px; } .cl-qty input { width: 54px; text-align: center; padding: 0 4px; height: 38px; }
.cl-disc { display: grid; gap: 2px; font-size: 11.5px; color: var(--muted); } .cl-disc input { height: 36px; padding: 0 6px; }
.cl-price { text-align: end; font-variant-numeric: tabular-nums; } .cl-total { text-align: end; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos-side { position: sticky; top: 74px; display: grid; gap: 4px; padding: 16px; }
.side-sec { padding: 10px 0; border-bottom: 1px solid var(--line); } .side-sec:last-child { border: 0; padding-bottom: 0; } .side-sec h3 { font-size: 14px; margin: 0 0 8px; }
.cust-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--teal-l); border-radius: var(--r-sm); } .cust-chip div { display: grid; line-height: 1.3; }
.totals.full { width: 100%; margin: 0; } .totals dd.ok, .totals dt.ok { color: var(--teal-d); font-weight: 700; }
.pay-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.pay-rows { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.pay-rows li { display: grid; grid-template-columns: 82px minmax(0, 1fr) minmax(0, 1fr) 34px; gap: 8px; align-items: center; } .pay-rows .pm { font-weight: 600; font-size: 13px; }
.pay-rows input { height: 38px; padding: 0 8px; } .pay-rows .btn { height: 38px; padding: 0 8px; font-size: 12.5px; }
.btn.big { height: 52px; font-size: 16px; }
.receipt-wrap { background: #eceef5; padding: 16px; border-radius: var(--r); margin-bottom: 14px; display: flex; justify-content: center; overflow-x: auto; }
.receipt { width: 302px; max-width: 100%; background: #fff; color: #111; padding: 14px 12px; font: 12.5px/1.4 'Courier New', ui-monospace, monospace; box-shadow: 0 6px 20px -8px rgba(0,0,0,.35); }
.rc-head { text-align: center; } .rc-shop { display: block; font-size: 16px; } .rc-center { text-align: center; }
.rc-line { border-top: 1px dashed #777; margin: 7px 0; }
.rc-row { display: flex; justify-content: space-between; gap: 10px; } .rc-row span:last-child { text-align: end; white-space: nowrap; }
.rc-item { margin: 4px 0; } .rc-item small { color: #444; } .rc-total { font-weight: 700; font-size: 14px; }
.rc-foot { text-align: center; margin-top: 6px; } .rc-small { font-size: 10.5px; color: #555; } .rc-void { text-align: center; font-weight: 700; border: 1px solid #111; margin: 6px 0; padding: 2px; }
#printArea { display: none; }
@media print {
  @page { size: 80mm auto; margin: 0; }
  html, body { background: #fff !important; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  #printArea .receipt { width: 72mm; margin: 0 auto; padding: 3mm 2mm; box-shadow: none; font-size: 11.5px; page-break-after: always; }
}
@media (max-width: 1100px) { .pos { grid-template-columns: 1fr; } .pos-side { position: static; } }
@media (max-width: 640px) {
  .cart-line { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'main rm' 'qty total' 'disc price'; row-gap: 8px; }
  .cart-line .cl-main { grid-area: main; } .cart-line .icon-btn[data-rm] { grid-area: rm; } .cart-line .cl-qty { grid-area: qty; } .cart-line .cl-total { grid-area: total; }
  .cart-line .cl-disc { grid-area: disc; grid-template-columns: auto 80px; align-items: center; } .cart-line .cl-price { grid-area: price; }
  .cl-qty input { height: 42px; } .pay-rows li { grid-template-columns: 70px minmax(0, 1fr) 34px; } .pay-rows .ref, .pay-rows .btn[data-exact] { grid-column: 1 / -1; grid-row: 2; }
  .pay-rows li .pm { grid-row: 1; } .date-f { flex: 1 1 140px; } .date-f input { flex: 1; width: 100%; }
  .pos-top select { width: 100%; }
}

/* date filters: label above the field, shrinkable, never wider than the screen */
.date-f { display: grid; gap: 2px; flex: 1 1 150px; min-width: 0; max-width: 220px; }
.date-f input { width: 100%; min-width: 0; }
@media (max-width: 640px) { .date-f { max-width: none; flex: 1 1 calc(50% - 8px); } }

/* ---------- sidebar: collapsible groups with a tree line ---------- */
.nav-head { display: flex; align-items: center; width: 100%; gap: 8px; background: none; border: 0; color: #8b90bd; font: 600 12px var(--f-body, inherit); padding: 12px 10px 6px; cursor: pointer; text-align: start; border-radius: 8px; }
html[lang=ar] .nav-head { font-size: 13px; }
.nav-head:hover { color: #fff; }
.nav-head .chev { margin-inline-start: auto; width: 14px; height: 14px; transition: transform .25s var(--ease); flex: none; }
.nav-group.closed .nav-head .chev { transform: rotate(-90deg); }
html[dir=rtl] .nav-group.closed .nav-head .chev { transform: rotate(90deg); }
.nav-sub { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .28s var(--ease); margin-inline-start: 16px; }
.nav-group.closed .nav-sub { grid-template-rows: 0fr; }
.nav-sub > div { overflow: hidden; min-height: 0; padding-inline-start: 16px; }
.nav-sub .nav-item { position: relative; margin: 0; border-radius: 10px; }
.nav-sub .nav-item::before { content: ''; position: absolute; inset-inline-start: -16px; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.2); border-radius: 0; animation: none; height: auto; }
.nav-sub .nav-item:last-child::before { bottom: 50%; }
.nav-sub .nav-item::after { content: ''; position: absolute; inset-inline-start: -16px; top: 50%; width: 11px; height: 1px; background: rgba(255,255,255,.2); transition: background .2s, width .2s; }
.nav-sub .nav-item:hover::after { background: var(--teal); width: 13px; }
.nav-sub .nav-item.active::after { background: var(--teal); width: 13px; height: 2px; }
.nav-sub .nav-item.active { background: rgba(15,163,141,.18); }
html[dir=rtl] .nav-sub .nav-item.active::before { border-radius: 0; }
.nav-group.closed .nav-sub a { visibility: hidden; }
/* menu scrollbar: a slim floating pill that fades in while scrolling or hovering, and swells when grabbed */
.sidebar nav { margin-inline-end: -6px; padding-inline-end: 6px; }
.sidebar nav::-webkit-scrollbar { width: 12px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; margin-block: 6px; }
.sidebar nav::-webkit-scrollbar-thumb { border-radius: 999px; border: 4px solid transparent; background-clip: padding-box; background-color: transparent; transition: background-color .35s var(--ease), border-width .2s var(--ease); }
.sidebar nav:hover::-webkit-scrollbar-thumb, .sidebar nav.scrolling::-webkit-scrollbar-thumb { background-color: rgba(15,163,141,.75); }
.sidebar nav::-webkit-scrollbar-thumb:hover { background-color: #F4B43A; border-width: 2px; }
.sidebar nav::-webkit-scrollbar-thumb:active { background-color: #F4B43A; border-width: 1px; }
@supports not selector(::-webkit-scrollbar) {
  .sidebar nav { scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color .4s; }
  .sidebar nav:hover, .sidebar nav.scrolling { scrollbar-color: var(--teal) transparent; }
}
@media (prefers-reduced-motion: reduce) { .nav-sub { transition: none; } }

/* ---------- dashboard tiles ---------- */
.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1240px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpis .kpi { flex-wrap: wrap; gap: 12px 14px; padding: 18px; }
.kpis .kpi > div:last-child { flex: 1 1 110px; }
.kpis .kpi .kpi-num { white-space: normal; overflow-wrap: anywhere; font-size: clamp(22px, 2.1vw, 30px); }
@media (max-width: 300px) { .kpis { grid-template-columns: 1fr; } }

/* ---------- pagination footer ---------- */
.pager { gap: 10px 18px; }
.pager .rows-per { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; }
.pager .rows-per select { height: 34px; width: auto; min-width: 68px; padding: 0 28px 0 10px; }
.pager-info { margin-inline-end: auto; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pager-nav { display: inline-flex; align-items: center; gap: 10px; }
.pager-page { font-size: 13.5px; white-space: nowrap; }

/* ---------- selecting and deleting rows ---------- */
th.sel, td.sel { width: 44px; padding-inline-end: 0; }
td.sel input, th.sel input, .check-cell input { width: 18px; height: 18px; accent-color: var(--teal); cursor: pointer; }
tr.picked { background: rgba(15,163,141,.08); }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; background: #eaf7f4; border-bottom: 1px solid #cfeae4; animation: fadeonly .2s var(--ease); }
.bulk-bar[hidden] { display: none; }
.bulk-bar .btn { height: 34px; }
.bulk-bar .grow { flex: 1; }
.icon-btn.danger { color: #b4233f; } .icon-btn.danger:hover { background: #fdecef; }
td.end { white-space: nowrap; } td.end .icon-btn + .icon-btn { margin-inline-start: 2px; }

.modal-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(23,26,51,.45); animation: fadeonly .2s var(--ease); }
.modal { position: relative; width: min(440px, 100%); max-height: 90vh; overflow-y: auto; background: #fff; border-radius: 18px; padding: 22px; box-shadow: 0 30px 70px -20px rgba(23,26,51,.5); animation: rise .25s var(--ease); }
.modal h3 { margin: 0 0 8px; overflow-wrap: anywhere; }
.modal-body { white-space: pre-line; overflow-wrap: anywhere; margin: 0 0 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .table-card tr { position: relative; }
  .table-card td.sel { position: absolute; top: 12px; inset-inline-end: 14px; width: auto; padding: 0; display: block; z-index: 1; }
  .table-card td.sel + td { justify-content: flex-start; text-align: start; padding-bottom: 8px; padding-inline-end: 36px; }
  .table-card td.sel + td::before { display: none; }
  .pager { flex-direction: column; align-items: stretch; }
  .pager-info { margin: 0; text-align: center; order: 3; }
  .pager .rows-per { justify-content: space-between; }
  .pager-nav { justify-content: space-between; }
  .bulk-bar .btn { flex: 1 1 auto; }
  .modal-actions .btn { flex: 1 1 100%; }
}

/* ---------- two-step verification ---------- */
.mfa-qr { display: grid; place-items: center; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; margin: 12px 0; }
.mfa-qr svg, .mfa-qr img { width: 200px; height: 200px; max-width: 100%; display: block; }
.mfa-key { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .08em; word-break: break-all; background: #f1f2f8; padding: 8px 10px; border-radius: 8px; user-select: all; }
.code-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.code-grid code { font: 600 14px ui-monospace, Menlo, Consolas, monospace; background: #f1f2f8; padding: 8px 10px; border-radius: 8px; text-align: center; user-select: all; }
.mfa-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mfa-row .grow { flex: 1 1 220px; min-width: 0; }
input.otp { letter-spacing: .35em; text-align: center; font-size: 20px; font-variant-numeric: tabular-nums; }
.status.on.mfa { margin-inline-start: 6px; }

/* ---------- barcodes and labels ---------- */
.labels-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.labels-grid h3 { margin: 0 0 12px; font-size: 16px; }
.labels-find > .seg { margin-bottom: 12px; } .wide-search { display: flex; width: 100%; max-width: none; margin-bottom: 12px; } .wide-search input { width: 100%; }
.inline-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin-bottom: 12px; border-radius: var(--r-sm); background: #fff6e0; border: 1px solid #f1d9a0; font-size: 14px; }
.lb-table .lb-actions { white-space: nowrap; } .lb-actions .btn, .lb-actions .icon-btn { margin-inline-start: 4px; }
.lb-table td.mono { font-size: 13px; letter-spacing: .02em; }
/* Finder results: one card per item instead of table columns, so the name gets the whole width of its own line.
   name                                  (one line, full width)
   variant · SKU                  on hand
   barcode                [Add] [Copies = stock] [edit]            */
.lb-table, .lb-table tbody { display: block; width: 100%; }
.lb-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.lb-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name name" "var qty" "code act"; gap: 3px 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lb-table tbody tr:last-child { border-bottom: 0; }
.lb-table tbody td { display: block; width: auto; padding: 0; border: 0; text-align: start; min-width: 0; }
.lb-table tbody td::before { display: none; }
.lb-table td.lb-prod, .lb-table td.lb-prod .pname { display: contents; }
.lb-table .pname strong { grid-area: name; display: block; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.lb-table .pname small { grid-area: var; display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-table td.mono { grid-area: code; font-size: 13.5px; white-space: nowrap; align-self: center; }
.lb-table td.num { grid-area: qty; text-align: end; white-space: nowrap; color: var(--muted); font-size: 13px; }
.lb-table td.num::before { display: inline; content: attr(data-label) ": "; font-weight: 400; }
.lb-table td.num { font-weight: 700; color: var(--text, inherit); }
.lb-table td.lb-actions { grid-area: act; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; padding-top: 6px; }
.lb-table td.lb-actions > * { margin: 0; }
.lb-table td[colspan] { grid-column: 1 / -1; grid-area: auto; text-align: center; padding: 18px 0; }
.lb-table tbody tr:has(td[colspan]) { display: block; }
@media (max-width: 420px) { .lb-table tbody tr { grid-template-areas: "name name" "var qty" "code code" "act act"; } .lb-table td.lb-actions { justify-content: flex-start; } }
.labels-queue { position: sticky; top: 86px; }
.queue-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; } .queue-head h3 { margin-bottom: 8px; }
.queue-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; max-height: 260px; overflow-y: auto; overflow-x: hidden; }
.queue-list li { display: grid; grid-template-columns: minmax(0, 1fr) 84px 36px; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); }
.q-main { display: grid; min-width: 0; } .q-main strong, .q-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-copies input { width: 100%; height: 38px; text-align: center; }
.queue-empty { padding: 18px 4px; text-align: center; }
.label-opts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.checks { border: 0; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; } .checks legend { font-weight: 600; font-size: 13.5px; padding: 0 0 6px; }
.checks label { display: flex; align-items: center; gap: 8px; }
.label-preview { margin: 4px 0 16px; display: grid; gap: 8px; }
.preview-stage { min-height: 30px; padding: 14px; border-radius: var(--r-sm); background: repeating-linear-gradient(45deg, #eef0f6, #eef0f6 8px, #f6f7fb 8px, #f6f7fb 16px); display: flex; justify-content: center; overflow: hidden; }
.preview-stage:empty { display: none; }
.queue-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; } .plain-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.vtable input.mono { min-width: 130px; }

/* the label itself (screen preview and print share these rules) */
.lbl { box-sizing: border-box; background: #fff; color: #000; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 1.6mm 2mm; font-family: Arial, 'Segoe UI', Tahoma, sans-serif; border: 1px solid #d9dce8; }
.lbl-top { padding-left: 3mm; }
.lbl-name { font-size: 7.5pt; font-weight: 700; line-height: 1.12; max-height: 2.3em; overflow: hidden; }
.lbl-var { font-size: 6.5pt; line-height: 1.15; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbl-bars { flex: 1 1 auto; min-height: 0; display: flex; margin-top: .6mm; } .lbl-bars svg { width: 100%; height: 100%; display: block; }
.lbl-code { text-align: center; font-size: 6.5pt; letter-spacing: .08em; font-family: 'Consolas', monospace; line-height: 1.15; }
.lbl-price { text-align: center; font-size: 10pt; font-weight: 800; line-height: 1.15; }
.sz-50x30 .lbl, .sz-50x30.preview-stage .lbl { width: 50mm; height: 30mm; } .sz-40x25 .lbl { width: 40mm; height: 25mm; } .sz-60x40 .lbl { width: 60mm; height: 40mm; }
.sz-a4 .lbl { width: 70mm; height: 37mm; }
.sz-40x25 .lbl-name { font-size: 6.5pt; } .sz-40x25 .lbl-var, .sz-40x25 .lbl-code { font-size: 5.5pt; } .sz-40x25 .lbl-price { font-size: 8.5pt; }
.sz-60x40 .lbl-name { font-size: 9pt; } .sz-60x40 .lbl-price { font-size: 12pt; }
.label-sheet.sz-a4 { display: grid; grid-template-columns: repeat(3, 70mm); }
.preview-stage .lbl { box-shadow: 0 2px 8px rgba(23,26,51,.15); max-width: 100%; }
@media print {
  #printArea .label-sheet .lbl { border: 0; page-break-inside: avoid; break-inside: avoid; }
  #printArea .label-sheet:not(.sz-a4) .lbl { page-break-after: always; break-after: page; }
  #printArea .label-sheet.sz-a4 { width: 210mm; }
}
@media (max-width: 1100px) { .labels-grid { grid-template-columns: 1fr; } .labels-queue { position: static; } }
@media (max-width: 640px) {
  .label-opts { grid-template-columns: 1fr; } .queue-actions .btn { flex: 1 1 140px; }
  .lb-actions { display: flex; flex-wrap: wrap; gap: 6px; } .lb-actions .btn, .lb-actions .icon-btn { margin: 0; }
  .preview-stage { padding: 10px; }
}

/* ---------- reports, dashboard trend, backup ---------- */
.trend { display: flex; align-items: flex-end; gap: clamp(3px, 1vw, 10px); height: 150px; padding: 8px 2px 0; }
.tbar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.tbar i { display: block; width: 100%; max-width: 34px; height: var(--h); min-height: 3px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--teal), #0b7f6e); transform-origin: bottom; animation: growbar .6s var(--ease) both; transition: filter .2s; }
.tbar:hover i { filter: brightness(1.15); }
.tbar span { font-size: 11px; color: var(--muted); line-height: 1; }
@keyframes growbar { from { transform: scaleY(.05); opacity: .3; } to { transform: none; opacity: 1; } }
.rp-chart { height: 130px; padding: 14px 14px 4px; border-bottom: 1px solid var(--line); }
.report-bar { align-items: flex-end; } .inline-field { margin: 0; } .inline-field select { height: 42px; }
.report-kpis { margin: 4px 0 18px; } .report-kpis .kpi-num { font-size: clamp(18px, 2.2vw, 26px); overflow-wrap: anywhere; }
@media (min-width: 1240px) { .report-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.rp-tabs { max-width: 100%; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; } .rp-tabs::-webkit-scrollbar { display: none; } .rp-tabs button { white-space: nowrap; }
.rp-sub:empty { display: none; }
.rp-table tfoot td { font-weight: 700; background: #f4f6fb; border-top: 2px solid var(--line); }
.backup-list li { gap: 10px; flex-wrap: wrap; } .bk-main { display: grid; min-width: 0; flex: 1 1 220px; } .bk-main strong { overflow: hidden; text-overflow: ellipsis; }
.bk-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rpt { font-family: Arial, 'Segoe UI', Tahoma, sans-serif; color: #000; } .rpt h1 { font-size: 18pt; margin: 0 0 2mm; } .rpt h2 { font-size: 12pt; margin: 0 0 1mm; font-weight: 600; } .rpt p { margin: 0 0 4mm; font-size: 9pt; color: #444; }
.rpt table { width: 100%; border-collapse: collapse; font-size: 8.5pt; } .rpt th, .rpt td { border-bottom: 1px solid #ccc; padding: 1.4mm 2mm; text-align: start; } .rpt th { background: #eee; } .rpt .num { text-align: end; }
.rpt tfoot td { font-weight: 700; border-top: 2px solid #000; }
@media print { #printArea .rpt { width: 100%; } #printArea .rpt .table-wrap { overflow: visible; } #printArea .rpt td::before { content: none !important; } #printArea .rpt tr { break-inside: avoid; } }
@media (max-width: 640px) { .trend { height: 120px; } .tbar span { font-size: 9px; } .bk-actions { width: 100%; } }
#rpBody.busy { opacity: .55; transition: opacity .2s; pointer-events: none; }

.checks-list .chk { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.checks-list .chk-ic { flex: 0 0 auto; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #e3f5ef; color: #0b7f6e; }
.checks-list .chk.bad { border-color: #f1b8c2; background: #fff5f7; } .checks-list .chk.bad .chk-ic { background: #fbdce2; color: #b4233f; }
.checks-list .chk.warn { border-color: #f1d9a0; background: #fffaf0; } .checks-list .chk.warn .chk-ic { background: #fbeccb; color: #9a6a00; }
.checks-list { display: grid; gap: 8px; } .block { display: block; }
.sy-summary { margin: 6px 0 12px; padding: 8px 12px; border-radius: var(--r-sm); font-weight: 600; } .sy-summary.good { background: #e3f5ef; color: #0b7f6e; } .sy-summary.warn { background: #fff5f7; color: #b4233f; }

/* ---- Phase 9: import, promotions, sharing, tax invoice ---- */
.pill-status.pr-running { background: var(--teal-l); color: var(--teal-d); } .pill-status.pr-scheduled { background: #fdf1d6; color: #8a5a00; }
.pill-status.pr-ended, .pill-status.pr-off { background: #ecedf5; color: #6a6f8c; }
.pr-hint { margin: -6px 0 12px; max-width: 70ch; }
.promo-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--teal-d); font-weight: 600; } .promo-tag.soft { color: var(--muted); font-weight: 500; }
.rc-promo { font-size: 10.5px; opacity: .8; }
.badge.ok-badge { background: var(--teal-l); color: var(--teal-d); } .badge.block, .err.block { display: block; margin-inline-start: 0; }
.file-btn { cursor: pointer; } .file-btn:focus-within { outline: 2px solid var(--indigo); outline-offset: 2px; }
.im-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.im-card { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; display: grid; background: #fff; } .im-card b { font-size: 20px; } .im-card span { color: var(--muted); font-size: 12.5px; }
tr.bad-row td { background: #fff7f9; }
.actions-row { flex-wrap: wrap; }
/* A4 tax invoice */
.inv { font-family: Arial, 'Segoe UI', Tahoma, sans-serif; color: #000; background: #fff; max-width: 190mm; margin: 0 auto; font-size: 10pt; }
.inv-head { display: flex; justify-content: space-between; gap: 12mm; border-bottom: 2px solid #000; padding-bottom: 4mm; margin-bottom: 4mm; } .inv-head h1 { font-size: 18pt; margin: 0 0 1mm; } .inv-title { text-align: end; } .inv-title h2 { font-size: 15pt; margin: 0 0 1mm; letter-spacing: .04em; }
.inv-void { color: #b4233f; font-weight: 700; border: 1px solid #b4233f; display: inline-block; padding: 0 2mm; margin-top: 1mm; }
.inv-to { margin-bottom: 5mm; } .inv-to h3 { font-size: 9pt; text-transform: uppercase; color: #555; margin: 0 0 1mm; }
.inv-lines { width: 100%; border-collapse: collapse; } .inv-lines th, .inv-lines td { border-bottom: 1px solid #ccc; padding: 1.6mm 2mm; text-align: start; vertical-align: top; } .inv-lines th { background: #eee; font-size: 9pt; } .inv-lines .num { text-align: end; }
.inv-sku { display: block; color: #666; font-size: 8pt; }
.inv-totals { display: grid; grid-template-columns: 1fr auto; gap: 1mm 8mm; width: 78mm; margin: 5mm 0 4mm; margin-inline-start: auto; } .inv-totals dt { color: #333; } .inv-totals dd { margin: 0; text-align: end; }
.inv-totals .inv-grand { font-weight: 700; font-size: 12pt; border-top: 2px solid #000; padding-top: 1.5mm; }
.inv-pay, .inv-foot { color: #333; margin: 2mm 0; } .inv-foot { text-align: center; margin-top: 8mm; }
@media print { #printArea .inv { max-width: none; width: 100%; } #printArea .inv-lines tr { break-inside: avoid; } }

/* Dashboard and report tiles: the number scales with its tile (icon beside it on wide tiles, above it on phones) and never wraps */
.kpis .kpi { container-type: inline-size; }
.kpis .kpi .kpi-num, .report-kpis .kpi-num { white-space: nowrap; overflow-wrap: normal; font-size: clamp(15px, calc((100cqw - 70px) / 8), 28px); }
@media (max-width: 640px) { .kpis .kpi .kpi-num, .report-kpis .kpi-num { font-size: clamp(15px, calc(100cqw / 8.5), 26px); } }
/* Four tiles across with the sidebar open leaves each one narrow: put the icon above the number so the number can be large */
@media (min-width: 1240px) and (max-width: 1560px) {
  .kpis .kpi { flex-direction: column; align-items: flex-start; flex-wrap: nowrap; gap: 10px; }
  .kpis .kpi > div:last-child { flex: 0 0 auto; width: 100%; }
  .kpis .kpi .kpi-num { font-size: clamp(15px, calc(100cqw / 8.5), 28px); }
}

/* POS cart: when the cart card itself is narrow (laptop with the menu open), stack each line instead of squeezing the name */
.cart-card { container-type: inline-size; }
@container (max-width: 640px) {
  .cart-line { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'main rm' 'qty total' 'disc price'; row-gap: 8px; }
  .cart-line .cl-main { grid-area: main; } .cart-line .icon-btn[data-rm] { grid-area: rm; } .cart-line .cl-qty { grid-area: qty; } .cart-line .cl-total { grid-area: total; }
  .cart-line .cl-disc { grid-area: disc; grid-template-columns: auto 80px; align-items: center; } .cart-line .cl-price { grid-area: price; }
}

/* ---- Tutorial ---- */
.tu-video { display: grid; gap: 12px; margin-bottom: 16px; } .tu-video video { width: 100%; max-height: 70vh; border-radius: var(--r-sm); background: #0e1126; display: block; }
.tu-cycle { margin-bottom: 8px; } .tu-chips { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tu-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 14px 4px 6px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; transition: border-color .2s, transform .15s; }
.tu-chip:hover { border-color: var(--teal); } .tu-chip:active { transform: scale(.97); }
.tu-chip b, .tu-stage-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--teal); color: #fff; font-size: 13px; flex: none; }
.tu-stage { margin-top: 26px; scroll-margin-top: 16px; } .tu-stage > header { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; } .tu-stage > header h2 { margin: 0; font-size: 20px; } .tu-stage > header p { margin: 2px 0 0; }
.tu-stage-n { width: 36px; height: 36px; font-size: 16px; }
.tu-step { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); gap: 20px; align-items: center; margin-bottom: 14px; }
.tu-text h3 { margin: 4px 0 6px; font-size: 17px; } .tu-text p { margin: 0 0 8px; line-height: 1.55; } .tu-num { color: var(--teal-d); font-weight: 700; font-size: 12.5px; letter-spacing: .02em; }
.tu-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px !important; } .tu-who { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.tu-shot { padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: #fff; cursor: zoom-in; display: block; min-width: 0; }
.tu-shot img { width: 100%; height: auto; display: block; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .3s var(--ease); } .tu-shot:hover img { transform: scale(1.015); }
.tu-big { width: 100%; height: auto; display: block; border-radius: var(--r-sm); border: 1px solid var(--line); }
@media (max-width: 980px) { .tu-step { grid-template-columns: 1fr; gap: 12px; } .tu-shot { order: -1; } }
@media (max-width: 640px) { .tu-chip span { font-size: 13.5px; } #helpLink span { display: none; } }

/* ---- Per-user permissions ---- */
.perm { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; margin: 6px 0 12px; min-width: 0; } .perm legend { font-weight: 700; padding: 0 6px; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px 18px; margin: 10px 0; } .perm-group h4 { margin: 0 0 6px; font-size: 13.5px; color: var(--muted); }
.perm-group .check { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; line-height: 1.35; } .perm-group .check input { margin-top: 3px; flex: none; }
.perm-admin { margin: 6px 0 12px; } .tag.perm-tag { background: #fdf1d6; color: #8a5a00; }

/* Top bar on the narrowest phones: the menu button never shrinks, the Tutorial and language buttons stay compact */
.menu-btn, .topbar .pill { flex: none; }
@media (max-width: 380px) { .topbar .pill { padding-inline: 10px; } }
/* Label queue: the second line may wrap, so a long barcode in Arabic is not pushed outside the screen */
.q-main small { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; }

/* Buttons never break their label onto two lines. When a row is too narrow the buttons wrap to the next line instead of being squeezed. */
.btn, .pill, .chip, .seg button { white-space: nowrap; }
.btn { flex-shrink: 0; }
.head-actions { flex-wrap: wrap; align-items: center; }
.card-head { flex-wrap: wrap; row-gap: 10px; }
.card-head > div:first-child:not(:only-child) { flex: 1 1 260px; min-width: 0; }
.card-head > .head-actions, .card-head > .btn { flex: 0 0 auto; }
.inline-form { flex-wrap: wrap; align-items: center; }
/* Small buttons are a little bigger and roomier */
.small-btn { height: 38px; padding: 0 16px; font-size: 14px; }
@media (max-width: 640px) { .small-btn { height: 40px; } .head-actions .btn { flex: 1 1 auto; } }
/* A customer's purchases: amount, then the buttons; they wrap under the amount on a narrow panel */
.drawer .plain li { flex-wrap: wrap; row-gap: 6px; } .low-q { flex-wrap: wrap; justify-content: flex-end; }
/* Status pills, role tags and badges stay on one line; a table that gets wide scrolls inside its own frame instead */
.tag, .badge, .pill-status, .status, .badge-soon { white-space: nowrap; }
/* Form footers on a phone: the buttons share the width and wrap to a second row instead of leaving the screen */
.drawer footer { flex-wrap: wrap; }
@media (max-width: 640px) { .drawer footer .btn { flex: 1 1 auto; } }
/* Rows with a name on one side and a badge and amount on the other: on a narrow screen the right side drops under the name */
.plain li { flex-wrap: wrap; row-gap: 4px; } .plain li > div:first-child { min-width: 0; flex: 1 1 140px; }
.po-head > div:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.po-head .badge { margin-inline-start: 0; }

/* A status and its side note (for example "Refunded EGP 100") may drop to a second line instead of sticking out on a phone. */
.pill-wrap { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 0; max-width: 100%; justify-content: inherit; }
