/*
 * KSA Billing — Sales App (PWA) kit, plan.md §6 MP / Phase 7.
 * Phone 360–767: bottom tabs · Tablet 768+: dark icon rail + wider panes. Touch targets ≥ 44 px.
 * Forms: bottom sheets on phones, side drawers on tablets. Numbers: tabular, LTR inside Arabic.
 */
:root {
    --m-brand: #0F766E; --m-brand-d: #115E59; --m-brand-rgb: 15, 118, 110; --m-tint: #E6F4F2; --m-tint2: #F0FAF8; --m-tint-line: #CDEAE5; --m-mint: #CCFBF1;
    --m-ink: #0F172A; --m-text: #1E293B; --m-text2: #3B4452; --m-muted: #5B6474; --m-faint: #94A3B8;
    --m-line: #E3E7EC; --m-line2: #D5DBE2; --m-soft: #EEF1F4; --m-field: #F1F4F6; --m-ground: #F5F7F9; --m-surface: #FFFFFF;
    --m-green: #067647; --m-green-bg: #DCFAE6; --m-blue: #1D4ED8; --m-blue-bg: #E0EAFF; --m-amber: #92400E; --m-amber-bg: #FEF3C7;
    --m-red: #B42318; --m-red-bg: #FEE4E2; --m-rail: #0F172A;
    --m-on-brand: #FFFFFF; --m-on-ink: #FFFFFF; --m-hero: #0F766E; --m-raise: #F8FAFB; --m-on-mint: #115E59;   /* themes: App\Support\AppTheme */
    --m-tabs-h: 72px; --m-rail-w: 84px; --m-r: 12px; --m-r-card: 16px; --m-r-sheet: 22px;
    --m-shadow: 0 1px 2px rgba(15, 23, 42, .05); --m-shadow-lg: 0 10px 30px rgba(15, 23, 42, .10);
    --m-font: 'Inter', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
}
html[dir=rtl] { --m-font: 'Tajawal', 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body.m-body { margin: 0; min-height: 100dvh; background: var(--m-ground); color: var(--m-text); font-family: var(--m-font); font-size: 15px; line-height: 1.45; overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--m-brand); }
[x-cloak] { display: none !important; }
.m-n, .m-money { font-variant-numeric: tabular-nums; }
.m-ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.m-ar { font-family: 'Tajawal', var(--m-font); }
.m-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.m-muted { color: var(--m-muted); }
.m-flip { display: inline-block; }
html[dir=rtl] .m-flip { transform: scaleX(-1); }
.ti { line-height: 1; }

/* ------------------------------------------------------------------ shell: rail (tablet) + view + tabs (phone) */
.m-shell { display: flex; min-height: 100dvh; }
.m-view { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.m-rail { display: none; }
.m-tabs { position: fixed; inset-inline: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around; align-items: flex-start;
    height: calc(var(--m-tabs-h) + env(safe-area-inset-bottom)); padding: 8px 4px env(safe-area-inset-bottom); background: var(--m-surface); border-top: 1px solid var(--m-line); }
.m-tab { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 60px; min-height: 48px; padding-top: 2px; color: var(--m-muted); font-size: 11px; font-weight: 600; text-decoration: none; }
.m-tab i { font-size: 24px; }
.m-tab.is-on { color: var(--m-brand); }
.m-tab.is-main { color: var(--m-ink); }
.m-tab.is-main span.m-tab-fab { width: 54px; height: 54px; margin-top: -28px; border-radius: 18px; background: var(--m-brand); color: var(--m-on-brand); display: grid; place-items: center; box-shadow: 0 6px 16px rgba(var(--m-brand-rgb), .35); }
.m-tab.is-main span.m-tab-fab i { font-size: 26px; }
body.has-tabs .m-view { padding-bottom: calc(var(--m-tabs-h) + env(safe-area-inset-bottom)); }

@media (min-width: 768px) {
    .m-tabs { display: none; }
    body.has-tabs .m-view { padding-bottom: 0; }
    .m-rail { display: flex; flex-direction: column; align-items: center; gap: 6px; position: sticky; top: 0; height: 100dvh; width: var(--m-rail-w); flex: 0 0 var(--m-rail-w);
        padding: 14px 0 calc(14px + env(safe-area-inset-bottom)); background: var(--m-rail); z-index: 40; overflow-y: auto; scrollbar-width: none; }
    .m-rail::-webkit-scrollbar { display: none; }
    .m-rail-logo { margin-bottom: 10px; }
    .m-rail a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 64px; min-height: 58px; border-radius: 14px; color: #94A3B8;
        text-decoration: none; font-size: 10.5px; font-weight: 600; text-align: center; line-height: 1.15; transition: background .15s, color .15s; }
    .m-rail a i { font-size: 23px; }
    .m-rail a:hover { background: rgba(255, 255, 255, .06); color: #E2E8F0; }
    .m-rail a.is-on { background: var(--m-brand); color: var(--m-on-brand); }
    .m-rail .m-rail-end { margin-top: auto; }
}

/* ------------------------------------------------------------------ page: app bar · content · sticky action bar */
.m-page { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 100%; }
.m-bar { position: sticky; top: 0; z-index: 30; background: var(--m-surface); border-bottom: 1px solid var(--m-line); padding: calc(6px + env(safe-area-inset-top)) 8px 8px; }
.m-bar-row { display: flex; align-items: center; gap: 4px; min-height: 48px; }
.m-bar-title { flex: 1; min-width: 0; padding-inline: 6px; }
.m-bar-title h1 { margin: 0; font-size: 17px; font-weight: 700; color: var(--m-ink); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-bar-title p { margin: 0; font-size: 12px; color: var(--m-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-bar.is-big .m-bar-title h1 { font-size: 22px; }
.m-bar-extra { display: flex; flex-direction: column; gap: 10px; padding: 4px 8px 4px; }
.m-ib { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: none; color: var(--m-ink); text-decoration: none; position: relative; }
.m-ib i { font-size: 22px; }
.m-ib:hover { background: var(--m-soft); }
.m-ib.is-solid { background: var(--m-brand); color: var(--m-on-brand); }
.m-ib.is-tint { background: var(--m-tint); color: var(--m-brand); }
.m-ib .m-badge-dot { position: absolute; top: 8px; inset-inline-end: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #F59E0B; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.m-content { flex: 1 1 auto; width: 100%; max-width: 1180px; margin-inline: auto; padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.m-content.is-narrow { max-width: 720px; }
.m-actionbar { position: sticky; bottom: 0; z-index: 25; background: var(--m-surface); border-top: 1px solid var(--m-line); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(15, 23, 42, .06); }
body.has-tabs .m-actionbar { bottom: calc(var(--m-tabs-h) + env(safe-area-inset-bottom)); padding-bottom: 12px; }
.m-actionbar-in { max-width: 1180px; margin-inline: auto; display: flex; flex-direction: column; gap: 8px; }
.m-actionbar-row { display: flex; gap: 10px; align-items: center; }
.m-actionbar-note { font-size: 12px; color: var(--m-muted); text-align: center; }
@media (min-width: 768px) {
    .m-bar { padding: 14px 20px 12px; }
    .m-bar-row { gap: 8px; }
    .m-bar-title h1 { font-size: 20px; }
    .m-bar.is-big .m-bar-title h1 { font-size: 24px; }
    .m-bar-extra { padding: 6px 6px 2px; }
    .m-content { padding: 20px 24px 28px; gap: 16px; }
    .m-actionbar { padding: 14px 24px; }
    body.has-tabs .m-actionbar { bottom: 0; padding-bottom: 14px; }
}

/* ------------------------------------------------------------------ buttons */
.m-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--m-line2);
    background: var(--m-surface); color: var(--m-ink); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; }
.m-btn i { font-size: 20px; }
.m-btn:hover { background: var(--m-ground); }
.m-btn:disabled, .m-btn.is-disabled { opacity: .5; pointer-events: none; }
.m-btn.is-primary { background: var(--m-brand); border-color: var(--m-brand); color: var(--m-on-brand); }
.m-btn.is-primary:hover { background: var(--m-brand-d); }
.m-btn.is-dark { background: var(--m-ink); border-color: var(--m-ink); color: var(--m-on-ink); }
.m-btn.is-tint { background: var(--m-tint); border-color: transparent; color: var(--m-brand-d); font-weight: 700; }
.m-btn.is-danger { color: var(--m-red); border-color: #FECDCA; }
.m-btn.is-ghost { border-color: transparent; background: none; }
.m-btn.is-lg { min-height: 56px; font-size: 16px; font-weight: 700; border-radius: 16px; }
.m-btn.is-sm { min-height: 40px; padding: 0 12px; font-size: 13px; border-radius: 12px; }
.m-btn.is-block { width: 100%; }
.m-btn.is-split { justify-content: space-between; padding: 0 18px; }
.m-btn.is-split .m-money { font-size: 18px; }
.m-btn .spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: m-spin .7s linear infinite; }
@keyframes m-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ cards, rows, chips */
.m-card { background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-r-card); }
.m-card.is-pad { padding: 14px 16px; }
.m-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.m-h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--m-ink); }
.m-h2 small { font-weight: 500; color: var(--m-muted); font-size: 13px; }
.m-link { font-size: 13px; font-weight: 600; color: var(--m-brand); text-decoration: none; background: none; border: 0; padding: 0; }
.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 900px) { .m-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
@media (min-width: 1400px) { .m-grid-2.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.m-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-r-card); text-decoration: none; color: inherit; text-align: start; width: 100%; }
button.m-row:hover, a.m-row:hover { border-color: var(--m-line2); box-shadow: var(--m-shadow); }
.m-row-main { flex: 1 1 auto; min-width: 0; }
.m-row-title { font-weight: 600; font-size: 14px; color: var(--m-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-row-sub { font-size: 12px; color: var(--m-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-row-end { text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.m-row-amt { font-weight: 700; font-size: 14px; color: var(--m-ink); font-variant-numeric: tabular-nums; }
.m-rows { background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-r-card); overflow: hidden; }
.m-rows > .m-row { border: 0; border-radius: 0; border-bottom: 1px solid var(--m-soft); }
.m-rows > .m-row:last-child { border-bottom: 0; }
.m-av { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--m-blue-bg); color: var(--m-blue); }
.m-av.is-sq { border-radius: 12px; }
.m-av.is-lg { width: 52px; height: 52px; flex-basis: 52px; border-radius: 12px; }
.m-av i { font-size: 21px; }
.m-av img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.tone-0 { background: #FDF2E9; color: #9A3412; } .tone-1 { background: #E0EAFF; color: #1D4ED8; } .tone-2 { background: #FCE7F3; color: #9D174D; }
.tone-3 { background: #DCFAE6; color: #067647; } .tone-4 { background: #FEF3C7; color: #92400E; } .tone-5 { background: #E0F2FE; color: #075985; }
.tone-6 { background: #EDE9FE; color: #5B21B6; } .tone-brand { background: var(--m-tint); color: var(--m-brand); } .tone-slate { background: var(--m-soft); color: var(--m-text2); }
.m-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--m-soft); color: var(--m-text2); }
.m-chip i { font-size: 13px; }
.m-chip.is-green { background: var(--m-green-bg); color: var(--m-green); } .m-chip.is-blue { background: var(--m-blue-bg); color: var(--m-blue); }
.m-chip.is-amber { background: var(--m-amber-bg); color: var(--m-amber); } .m-chip.is-red { background: var(--m-red-bg); color: var(--m-red); }
.m-chip.is-brand { background: var(--m-tint); color: var(--m-brand-d); }
.m-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; flex: none; }

/* filter chips (scroll sideways on phones) */
.m-fchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 1px; margin: 0 -1px; }
.m-fchips::-webkit-scrollbar { display: none; }
.m-fc { height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--m-line2); background: var(--m-surface); font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--m-text2); display: inline-flex; align-items: center; gap: 6px; flex: none; }
.m-fc.is-on { background: var(--m-ink); border-color: var(--m-ink); color: var(--m-on-ink); }
.m-fc.is-warn { color: var(--m-red); border-color: #FECDCA; }
.m-fc.is-warn.is-on { background: var(--m-red); border-color: var(--m-red); color: var(--m-on-ink); }
.m-fc b { font-weight: 700; }

/* segmented control */
.m-seg { display: flex; background: var(--m-soft); border-radius: 12px; padding: 4px; gap: 2px; }
.m-seg button, .m-seg label { flex: 1 1 0; min-height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 600; font-size: 13.5px; color: var(--m-muted);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 10px; white-space: nowrap; cursor: pointer; margin: 0; }
.m-seg .is-on { background: var(--m-surface); color: var(--m-ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.m-seg.is-sm button, .m-seg.is-sm label { min-height: 34px; font-size: 13px; }
.m-seg input { position: absolute; opacity: 0; pointer-events: none; }

/* stats */
.m-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.m-stat { background: var(--m-ground); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.m-stat span { display: block; font-size: 11px; color: var(--m-muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-stat b { display: block; font-size: 17px; font-weight: 700; color: var(--m-ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-stat.is-red { background: #FEF2F2; } .m-stat.is-red span, .m-stat.is-red b { color: var(--m-red); }
.m-stat.is-green b { color: var(--m-green); }
.m-stat.is-card { background: var(--m-surface); border: 1px solid var(--m-line); }

/* notes / banners */
.m-note { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--m-line); background: var(--m-surface); font-size: 13px; color: var(--m-text2); }
.m-note > i { font-size: 22px; flex: none; }
.m-note-main { flex: 1; min-width: 0; }
.m-note-main b { display: block; font-size: 14px; }
.m-note.is-amber { background: #FFFBEB; border-color: #FDE68A; color: #78350F; } .m-note.is-amber > i { color: #B45309; }
.m-note.is-blue { background: #EEF4FF; border-color: #C7D7FE; color: #1E3A8A; } .m-note.is-blue > i { color: var(--m-blue); }
.m-note.is-red { background: #FEF3F2; border-color: #FECDCA; color: #7A271A; } .m-note.is-red > i { color: var(--m-red); }
.m-note.is-green { background: #ECFDF3; border-color: #ABEFC6; color: #054F31; } .m-note.is-green > i { color: var(--m-green); }

/* empty */
.m-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 20px; color: var(--m-muted); }
.m-empty-ico { width: 64px; height: 64px; border-radius: 20px; background: var(--m-tint); color: var(--m-brand); display: grid; place-items: center; }
.m-empty-ico i { font-size: 30px; }
.m-empty b { font-size: 16px; color: var(--m-ink); }
.m-empty p { margin: 0; font-size: 13px; max-width: 320px; }

/* ------------------------------------------------------------------ forms */
.m-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.m-label { font-size: 13px; font-weight: 600; color: var(--m-text2); }
.m-label .m-req { color: var(--m-red); margin-inline-start: 2px; }
.m-input, .m-select, .m-textarea { width: 100%; min-height: 48px; border: 1px solid var(--m-line2); border-radius: 12px; padding: 0 14px; font-size: 15px; background: var(--m-surface); color: var(--m-ink); outline: 0; transition: border-color .15s, box-shadow .15s; }
.m-textarea { padding: 12px 14px; min-height: 88px; resize: vertical; }
.m-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235B6474' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; padding-inline-end: 38px; }
html[dir=rtl] .m-select { background-position: left 14px center; }
.m-input:focus, .m-select:focus, .m-textarea:focus { border-color: var(--m-brand); box-shadow: 0 0 0 3px rgba(var(--m-brand-rgb), .14); }
.m-input.is-big { min-height: 64px; border: 2px solid var(--m-brand); border-radius: 14px; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.m-input.is-invalid, .m-select.is-invalid, .m-textarea.is-invalid { border-color: #F04438; }
.m-error { font-size: 12.5px; color: var(--m-red); font-weight: 600; display: flex; align-items: center; gap: 4px; }
.m-hint { font-size: 12px; color: var(--m-muted); }
.m-search { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 6px 0 14px; border-radius: 14px; background: var(--m-field); border: 1px solid transparent; }
html[dir=rtl] .m-search { padding: 0 14px 0 6px; }
.m-search:focus-within { background: var(--m-surface); border-color: var(--m-brand); }
.m-search > i { font-size: 20px; color: var(--m-muted); }
.m-search input { flex: 1; min-width: 0; height: 46px; border: 0; background: transparent; outline: 0; font-size: 15px; color: var(--m-ink); }
.m-search input::-webkit-search-cancel-button { display: none; }
.m-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; margin: 0; }
.m-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.m-switch { direction: ltr; width: 52px; height: 32px; flex: 0 0 52px; border-radius: 999px; background: var(--m-line2); padding: 3px; transition: background .15s; display: flex; }
.m-switch::after { content: ""; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .2); transition: transform .15s; }
.m-toggle input:checked + .m-switch { background: var(--m-brand); }
.m-toggle input:checked + .m-switch::after { transform: translateX(20px); }
.m-toggle input:focus-visible + .m-switch { box-shadow: 0 0 0 3px rgba(var(--m-brand-rgb), .25); }
.m-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-drop { display: flex; align-items: center; gap: 12px; padding: 14px; border: 2px dashed #B6C0CC; border-radius: 16px; background: var(--m-surface); cursor: pointer; margin: 0; text-align: start; }
.m-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.m-drop.is-done { border-style: solid; border-color: var(--m-tint-line); background: var(--m-tint2); }
.m-drop-ico { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--m-field); color: var(--m-text2); display: grid; place-items: center; overflow: hidden; }
.m-drop-ico i { font-size: 22px; }
.m-drop-ico img { width: 100%; height: 100%; object-fit: cover; }

/* tile pickers (categories, payment methods, quick amounts) */
.m-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.m-tiles.is-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.m-tiles.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 768px) { .m-tiles.is-wide { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.m-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 72px; padding: 8px 4px; border-radius: 14px; border: 1px solid var(--m-line2);
    background: var(--m-surface); font-size: 12px; font-weight: 600; color: var(--m-text2); text-align: center; line-height: 1.2; position: relative; margin: 0; cursor: pointer; }
.m-tile i { font-size: 22px; }
.m-tile.is-on { border: 2px solid var(--m-brand); background: var(--m-tint); color: var(--m-brand-d); }
.m-tile input { position: absolute; opacity: 0; pointer-events: none; }
.m-amts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.m-amts button { min-height: 44px; border-radius: 12px; border: 1px solid var(--m-line2); background: var(--m-surface); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.m-amts button.is-on { border-color: var(--m-brand); color: var(--m-brand); }

/* stepper */
.m-step { display: inline-flex; align-items: center; border: 1px solid var(--m-line2); border-radius: 12px; background: var(--m-surface); flex: none; }
.m-step button { width: 44px; height: 44px; border: 0; background: none; display: grid; place-items: center; border-radius: 11px; color: var(--m-ink); }
.m-step button:last-child { color: var(--m-brand); }
.m-step button i { font-size: 20px; }
.m-step input { width: 52px; height: 42px; border: 0; text-align: center; font-weight: 700; font-size: 15px; background: transparent; outline: 0; font-variant-numeric: tabular-nums; padding: 0; }
.m-step input:focus { background: var(--m-tint2); }
.m-pill { min-height: 44px; padding: 0 10px; border: 1px solid var(--m-line2); border-radius: 12px; background: var(--m-surface); font-size: 13px; font-weight: 600; color: var(--m-text2); }
select.m-pill { appearance: none; padding: 0 12px; text-align: center; }

/* ------------------------------------------------------------------ scan bar + camera */
.m-scan { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 6px 0 14px; border: 2px solid var(--m-brand); border-radius: 16px; background: var(--m-surface); }
html[dir=rtl] .m-scan { padding: 0 14px 0 6px; }
.m-scan > i { font-size: 22px; color: var(--m-brand); }
.m-scan input { flex: 1; min-width: 0; height: 50px; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--m-ink); }
.m-scan .m-scan-cam { min-height: 44px; padding: 0 12px; border-radius: 12px; border: 0; background: var(--m-brand); color: var(--m-on-brand); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.m-scan .m-scan-cam i { font-size: 18px; }
.m-scan .m-scan-go { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--m-tint); color: var(--m-brand); display: grid; place-items: center; }
.m-scan kbd { font-family: inherit; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--m-soft); color: var(--m-text2); }
.m-scan.is-soft { border: 1px solid transparent; background: var(--m-field); min-height: 50px; }
.m-scan.is-soft:focus-within { border-color: var(--m-brand); background: var(--m-surface); }
.m-scan.is-soft > i { color: var(--m-muted); }
@media (max-width: 767.98px) { .m-scan kbd { display: none; } }
.m-finder { position: relative; }
.m-finder-list { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 35; background: var(--m-surface); border: 1px solid var(--m-line); border-radius: 16px; box-shadow: var(--m-shadow-lg); max-height: min(60dvh, 420px); overflow-y: auto; padding: 6px; }
.m-finder-list button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 0; border-radius: 12px; background: none; text-align: start; min-height: 56px; }
.m-finder-list button:hover { background: var(--m-ground); }
.m-finder-empty { padding: 14px; text-align: center; font-size: 13px; color: var(--m-muted); }
.k-cam { position: fixed; inset: 0; z-index: 1100; background: rgba(15, 23, 42, .78); display: flex; align-items: flex-end; justify-content: center; }
.k-cam-card { width: min(560px, 100%); background: var(--m-surface); border-radius: var(--m-r-sheet) var(--m-r-sheet) 0 0; overflow: hidden; padding-bottom: env(safe-area-inset-bottom); }
@media (min-width: 768px) { .k-cam { align-items: center; } .k-cam-card { border-radius: var(--m-r-sheet); } }
.k-cam-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.k-cam-head h2 { margin: 0; font-size: 17px; font-weight: 700; color: var(--m-ink); }
.k-cam-head p { margin: 0; font-size: 12.5px; color: var(--m-muted); }
.k-cam-head > div { flex: 1; min-width: 0; }
.k-cam-view { position: relative; background: #000; min-height: 280px; }
.k-cam-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: #fff; font-size: 14px; padding: 20px; text-align: center; }
.k-cam-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 12px; color: var(--m-muted); }

/* ------------------------------------------------------------------ sheet: bottom on phones, side drawer on tablets */
.m-sheet-wrap { position: fixed; inset: 0; z-index: 1050; }
.m-sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.m-sheet { position: absolute; inset-inline: 0; bottom: 0; max-height: 94dvh; display: flex; flex-direction: column; background: var(--m-surface); border-radius: var(--m-r-sheet) var(--m-r-sheet) 0 0;
    box-shadow: 0 -10px 40px rgba(15, 23, 42, .18); transition: transform .22s ease; }
.m-sheet.is-off { transform: translateY(100%); }
.m-sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--m-line2); margin: 10px auto 0; flex: none; }
.m-sheet-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 12px 20px; flex: none; }
html[dir=rtl] .m-sheet-head { padding: 10px 20px 12px 16px; }
.m-sheet-head > div { flex: 1; min-width: 0; }
.m-sheet-head h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--m-ink); }
.m-sheet-head p { margin: 2px 0 0; font-size: 13px; color: var(--m-muted); }
.m-sheet-head .m-ib { background: var(--m-field); }
.m-sheet-body { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 16px; position: relative; }
.m-sheet-foot { flex: none; padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--m-line); display: flex; flex-direction: column; gap: 8px; background: var(--m-surface); }
@media (min-width: 768px) {
    .m-sheet { inset-inline: auto 0; top: 0; bottom: 0; width: min(520px, 100vw); max-height: none; border-radius: 0; box-shadow: -20px 0 50px rgba(15, 23, 42, .18); }
    html[dir=rtl] .m-sheet { inset-inline: 0 auto; }
    .m-sheet.is-off { transform: translateX(100%); }
    html[dir=rtl] .m-sheet.is-off { transform: translateX(-100%); }
    .m-sheet.is-wide { width: min(720px, 100vw); }
    .m-sheet-grab { display: none; }
    .m-sheet-head { padding: 18px 20px 14px 24px; border-bottom: 1px solid var(--m-line); margin-bottom: 14px; }
    html[dir=rtl] .m-sheet-head { padding: 18px 24px 14px 20px; }
    .m-sheet-body { padding: 0 24px 24px; }
    .m-sheet-foot { padding: 14px 24px calc(14px + env(safe-area-inset-bottom)); }
}
body.m-lock { overflow: hidden; }
.m-loading { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .6); }
.m-loading .spinner { width: 26px; height: 26px; border: 3px solid var(--m-brand); border-inline-end-color: transparent; border-radius: 50%; animation: m-spin .7s linear infinite; }

/* summary rows (totals, day close) */
.m-sum { display: flex; flex-direction: column; }
.m-sum > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--m-soft); font-size: 14px; }
.m-sum > div:last-child { border-bottom: 0; }
.m-sum dt { margin: 0; color: var(--m-text2); font-weight: 500; }
.m-sum dd { margin: 0; font-weight: 600; color: var(--m-ink); font-variant-numeric: tabular-nums; text-align: end; }
.m-sum .is-in dd { color: var(--m-green); } .m-sum .is-out dd { color: var(--m-red); }
.m-sum .is-total dt { font-weight: 700; color: var(--m-ink); } .m-sum .is-total dd { font-size: 18px; font-weight: 700; }
.m-sum.is-tight > div { padding: 5px 0; border: 0; }
.m-due { background: var(--m-tint2); border: 1px solid var(--m-tint-line); border-radius: 16px; padding: 14px 16px; }
.m-due-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.m-due-top span { font-size: 13px; color: var(--m-brand-d); font-weight: 600; }
.m-due-top b { font-size: 30px; font-weight: 700; color: var(--m-ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.m-due-sub { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--m-text2); margin-top: 8px; font-variant-numeric: tabular-nums; }
.m-change { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--m-ground); }
.m-change span { font-size: 15px; font-weight: 600; color: var(--m-text2); }
.m-change b { font-size: 22px; font-weight: 700; color: var(--m-green); font-variant-numeric: tabular-nums; }
.m-change.is-due b { color: var(--m-amber); }

/* ------------------------------------------------------------------ toasts, offline banner, install */
.m-toasts { position: fixed; z-index: 1200; inset-inline: 12px; top: calc(12px + env(safe-area-inset-top)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.m-toast { pointer-events: auto; max-width: 520px; width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--m-ink); color: var(--m-on-ink); font-size: 14px; font-weight: 500; box-shadow: var(--m-shadow-lg); }
.m-toast i { font-size: 20px; flex: none; margin-top: 1px; }
.m-toast.is-success i { color: #4ADE80; } .m-toast.is-warning i { color: #FBBF24; } .m-toast.is-danger i { color: #F87171; } .m-toast.is-info i { color: #93C5FD; }
.m-offline { position: fixed; z-index: 1150; inset-inline: 0; top: 0; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; background: #B45309; color: #fff; font-size: 13px; font-weight: 600; text-align: center; }
.m-offline i { margin-inline-end: 6px; }

/* ------------------------------------------------------------------ login */
.m-login { min-height: 100dvh; background: var(--m-hero); display: flex; flex-direction: column; }
.m-login-top { padding: calc(28px + env(safe-area-inset-top)) 24px 32px; color: #fff; display: flex; flex-direction: column; gap: 22px; width: 100%; max-width: 560px; margin-inline: auto; }
.m-login-brand { display: flex; align-items: center; justify-content: space-between; }
.m-login-brand > div { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.m-login-lang { height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .45); background: transparent; color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; display: inline-flex; align-items: center; }
.m-login-hi h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.m-login-hi p { margin: 6px 0 0; font-size: 15px; color: var(--m-mint); }
.m-login-body { flex: 1; background: var(--m-ground); border-radius: 28px 28px 0 0; padding: 24px 24px calc(20px + env(safe-area-inset-bottom)); }
.m-login-in { width: 100%; max-width: 420px; margin-inline: auto; display: flex; flex-direction: column; gap: 20px; min-height: 100%; }
.m-pin-dots { display: flex; justify-content: center; gap: 16px; min-height: 18px; }
.m-pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--m-faint); }
.m-pin-dots span.is-on { background: var(--m-brand); border-color: var(--m-brand); }
.m-pin-dots.is-shake { animation: m-shake .35s; }
@keyframes m-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.m-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.m-key { height: 62px; border: 0; border-radius: 16px; background: var(--m-surface); font-size: 24px; font-weight: 600; color: var(--m-ink); box-shadow: 0 1px 0 var(--m-line); display: grid; place-items: center; }
.m-key:active { background: var(--m-tint); }
.m-key.is-flat { background: transparent; box-shadow: none; }
.m-key.is-go { background: var(--m-brand); color: var(--m-on-brand); box-shadow: none; }
.m-key.is-go:disabled { background: var(--m-line2); }
.m-key i { font-size: 26px; }
.m-login-foot { margin-top: auto; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.m-secure { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--m-muted); }
.m-secure i { color: var(--m-green); font-size: 16px; }
.m-login-tablet { display: none; }
@media (min-width: 900px) {
    .m-login { flex-direction: row; }
    .m-login-top { flex: 1 1 50%; max-width: none; justify-content: center; padding: 48px 64px; }
    .m-login-top .m-login-hi h1 { font-size: 40px; }
    .m-login-tablet { display: block; font-size: 15px; color: var(--m-mint); max-width: 420px; line-height: 1.6; }
    .m-login-body { flex: 1 1 50%; border-radius: 28px 0 0 28px; display: flex; align-items: center; padding: 48px; }
    html[dir=rtl] .m-login-body { border-radius: 0 28px 28px 0; }
    .m-login-in { min-height: 0; }
    .m-login-foot { margin-top: 12px; }
}

/* ------------------------------------------------------------------ home */
.m-hero { background: var(--m-hero); color: #fff; padding: calc(16px + env(safe-area-inset-top)) 20px 76px; }
.m-hero-in { max-width: 1180px; margin-inline: auto; }
.m-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.m-hero-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.m-hero-who .m-av { background: var(--m-mint); color: var(--m-on-mint); width: 42px; height: 42px; }
.m-hero-who small { display: block; font-size: 13px; color: var(--m-mint); }
.m-hero-who b { display: block; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-hero .m-ib { background: rgba(255, 255, 255, .14); color: #fff; }
.m-hero-sep { width: 1px; align-self: stretch; margin: 8px 2px; background: rgba(255, 255, 255, .28); }
.m-hero-out { display: contents; }
.m-hero-out .m-ib { background: rgba(255, 255, 255, .95); color: var(--m-red); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); transition: transform .12s, background .15s; }
.m-hero-out .m-ib:hover { background: #fff; }
.m-hero-out .m-ib:active { transform: scale(.94); }
html[data-m-mode=dark] .m-hero-out .m-ib { background: var(--m-red-bg); color: var(--m-red); box-shadow: none; }
.m-hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.m-hero-tags > span { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; background: rgba(255, 255, 255, .14); font-size: 12px; font-weight: 600; }
.m-hero-tags i { font-size: 15px; }
.m-hero-tags .m-dot { background: #4ADE80; }
.m-hero-tags .m-dot.is-off { background: #FBBF24; }
.m-today { margin: -60px 16px 0; background: var(--m-surface); border-radius: 20px; padding: 18px; box-shadow: 0 8px 24px rgba(15, 23, 42, .08); display: flex; flex-direction: column; gap: 14px; position: relative; z-index: 2; }
.m-today-big { font-size: 30px; font-weight: 700; color: var(--m-ink); letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.m-today-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--m-soft); padding-top: 12px; }
.m-today-cols > div { min-width: 0; }
.m-today-cols > div + div { border-inline-start: 1px solid var(--m-soft); padding-inline-start: 12px; }
.m-today-cols span { display: block; font-size: 12px; color: var(--m-muted); }
.m-today-cols b { display: block; font-size: 15px; font-weight: 700; color: var(--m-ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-qa { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.m-qa a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px; border-radius: 16px; background: var(--m-surface); border: 1px solid var(--m-line); font-size: 12px; font-weight: 600; color: var(--m-ink); text-decoration: none; text-align: center; line-height: 1.2; }
.m-qa a span { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.m-qa a span i { font-size: 22px; }
.m-home-grid { display: flex; flex-direction: column; gap: 16px; }
.m-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.m-kpi { background: var(--m-surface); border: 1px solid var(--m-line); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.m-kpi span { font-size: 12px; font-weight: 600; color: var(--m-muted); }
.m-kpi b { font-size: 22px; font-weight: 700; color: var(--m-ink); letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-kpi small { font-size: 12px; font-weight: 600; color: var(--m-muted); }
.m-kpi small.is-green { color: var(--m-green); } .m-kpi small.is-red { color: var(--m-red); }
.m-bars { display: flex; align-items: flex-end; gap: 8px; height: 190px; border-bottom: 1px solid var(--m-line); padding: 0 4px; }
.m-bars > div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; }
.m-bars i { display: block; border-radius: 5px 5px 0 0; background: rgba(var(--m-brand-rgb), .4); }
.m-bars i + i { border-radius: 0; background: var(--m-brand); }
.m-bars-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--m-muted); padding: 0 4px; font-variant-numeric: tabular-nums; }
.m-legend { display: flex; gap: 14px; font-size: 12px; color: var(--m-text2); flex-wrap: wrap; }
.m-legend span { display: inline-flex; align-items: center; gap: 6px; }
.m-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--m-brand); }
.m-legend span.is-light::before { background: rgba(var(--m-brand-rgb), .4); }
.m-alerts { display: flex; flex-direction: column; gap: 8px; }
.m-alert { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--m-ground); text-decoration: none; color: inherit; }
.m-alert .m-dot { margin-top: 6px; }
.m-alert b { display: block; font-size: 13px; font-weight: 600; color: var(--m-ink); }
.m-alert small { display: block; font-size: 12px; color: var(--m-text2); }
.m-alert.is-red { background: #FEF3F2; } .m-alert.is-red .m-dot { color: var(--m-red); }
.m-alert.is-amber { background: #FFFBEB; } .m-alert.is-amber .m-dot { color: #B45309; }
.m-alert.is-blue { background: #EEF4FF; } .m-alert.is-blue .m-dot { color: var(--m-blue); }
.m-alert.is-slate .m-dot { color: var(--m-muted); }
@media (min-width: 768px) {
    .m-hero { padding: 22px 28px 84px; }
    .m-today { margin: -64px auto 0; width: calc(100% - 48px); max-width: 1132px; padding: 20px 24px; }
    .m-today-cols { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .m-qa { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .m-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .m-home-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
    .m-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------ sale: cart lines + tablet POS */
.m-pos { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.m-pos-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.m-pos-side { display: none; }
.m-cust { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--m-line); border-radius: 14px; background: var(--m-raise); text-align: start; width: 100%; }
.m-cust .m-av { width: 40px; height: 40px; flex-basis: 40px; }
.m-cust b { display: block; font-weight: 600; font-size: 14px; color: var(--m-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-cust small { display: block; font-size: 12px; color: var(--m-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.m-cust > span:nth-child(2) { flex: 1; min-width: 0; }
.m-cust-change { font-size: 13px; font-weight: 600; color: var(--m-brand); flex: none; }
.m-type-row { display: flex; gap: 8px; align-items: center; }
.m-type-row .m-seg { flex: 1 1 0; min-width: 0; }
.m-type-row select { flex: 1 1 0; min-width: 0; width: auto; padding-inline-end: 34px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-cart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--m-muted); }
.m-cart-head b { color: var(--m-ink); }
.m-line { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--m-surface); border: 1px solid var(--m-line); border-radius: 16px; transition: background .4s, border-color .4s; }
.m-line.is-flash { background: var(--m-tint2); border-color: var(--m-tint-line); }
.m-line.is-short { border-color: #FECDCA; }
.m-line-top { display: flex; gap: 12px; align-items: flex-start; }
.m-line-top .m-av { width: 44px; height: 44px; flex-basis: 44px; border-radius: 10px; font-size: 13px; }
.m-line-name { flex: 1; min-width: 0; }
.m-line-name b { display: block; font-weight: 600; font-size: 14px; color: var(--m-ink); line-height: 1.3; }
.m-line-name small { display: block; font-size: 12px; color: var(--m-muted); }
.m-line-name small.is-warn { color: var(--m-red); font-weight: 600; }
.m-line-total { font-weight: 700; font-size: 15px; color: var(--m-ink); font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; padding-top: 1px; }
.m-line-total small { display: block; font-size: 11px; font-weight: 600; color: var(--m-muted); }
.m-line-ctl { display: flex; align-items: center; gap: 8px; }
/* phones / tablet portrait: remove (×) sits in the top corner next to the total, so the price gets the room below */
.m-line-top .m-line-del { width: 36px; height: 36px; flex-basis: 36px; margin-top: -6px; margin-inline: -4px -6px; }
.m-line-top .m-line-del i { font-size: 18px; }
.m-line-ctl .m-pill { flex: none; }
/* the Arabic name lines up under the English one on English screens */
html[dir=ltr] .m-line-name small.m-ar { text-align: left; }
.m-line-ctl .m-price { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; min-height: 44px; border: 1px solid var(--m-line2); border-radius: 12px; background: var(--m-surface); padding: 0 10px; gap: 4px; }
.m-line-ctl .m-price span { font-size: 13px; color: var(--m-muted); }
.m-line-ctl .m-price input { flex: 1; min-width: 0; width: 100%; height: 42px; border: 0; outline: 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; background: transparent; color: var(--m-ink); }
.m-line-ctl .m-price.is-locked { background: var(--m-ground); }
.m-line-del { width: 44px; height: 44px; flex: none; border: 0; border-radius: 12px; background: none; color: var(--m-faint); display: grid; place-items: center; }
.m-line-del:hover { color: var(--m-red); background: #FEF3F2; }
.m-line-del i { font-size: 20px; }
@media (max-width: 767.98px) {      /* phones: a slimmer stepper leaves the price room for 5-digit amounts */
    .m-line-ctl .m-step button { width: 40px; }
    .m-line-ctl .m-step input { width: 40px; }
}
@media (max-width: 379.98px) {      /* small phones (SE, mini) */
    .m-line-ctl { gap: 6px; }
    .m-line-ctl .m-step button { width: 34px; }
    .m-line-ctl .m-step input { width: 34px; }
    .m-line-ctl .m-pill { padding: 0 8px; }
    .m-line-ctl .m-price { padding: 0 8px; gap: 2px; }
    .m-type-row .m-seg button { font-size: 12.5px; }
}
.m-pos-foot-sums { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--m-muted); font-variant-numeric: tabular-nums; }
.m-pos-paybar { display: flex; gap: 10px; }
.m-pos-paybar .m-btn.is-icon { width: 56px; padding: 0; flex: none; }
.m-sq-btn { width: 56px; min-height: 56px; flex: none; border-radius: 14px; border: 1px solid var(--m-line2); background: var(--m-surface); display: grid; place-items: center; color: var(--m-ink); position: relative; }
.m-sq-btn i { font-size: 22px; }
.m-sq-btn.is-on { border-color: var(--m-brand); color: var(--m-brand); background: var(--m-tint); }
@media (min-width: 1024px) {
    .m-pos { flex-direction: row; align-items: stretch; }
    .m-pos-main .m-actionbar { display: none; }
    .m-pos-side { display: flex; flex-direction: column; gap: 14px; width: 380px; flex: 0 0 380px; background: var(--m-surface); border-inline-start: 1px solid var(--m-line);
        padding: 18px 20px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; }
    .m-pos-side .m-grand { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 1px dashed var(--m-line2); }
    .m-pos-side .m-grand span { font-weight: 700; color: var(--m-ink); }
    .m-pos-side .m-grand b { font-size: 30px; font-weight: 700; color: var(--m-ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
    .m-pos-side-end { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
    .m-lines.is-table .m-line { flex-direction: row; align-items: center; gap: 12px; padding: 10px 14px; }
    .m-lines.is-table .m-line-top { flex: 1 1 auto; min-width: 0; align-items: center; }
    .m-lines.is-table .m-line-top .m-line-total { order: 3; width: 110px; flex: none; }
    .m-lines.is-table .m-line-ctl { flex: none; }
    .m-lines.is-table .m-line-ctl .m-price { width: 120px; flex: none; }
}
@media (min-width: 1280px) { .m-pos-side { width: 420px; flex-basis: 420px; } }

/* success */
.m-done-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding-top: 8px; }
.m-done-ico { width: 72px; height: 72px; border-radius: 50%; background: var(--m-green-bg); color: var(--m-green); display: grid; place-items: center; }
.m-done-ico i { font-size: 38px; }
.m-done-ico.is-blue { background: var(--m-blue-bg); color: var(--m-blue); }
.m-done-head h1 { margin: 0; font-size: 22px; font-weight: 700; color: var(--m-ink); }
.m-qr { display: flex; gap: 16px; align-items: center; }
.m-qr img, .m-qr .m-qr-ph { width: 116px; height: 116px; flex: none; border-radius: 12px; border: 1px solid var(--m-line); background: #fff; padding: 6px; }
.m-qr .m-qr-ph { display: grid; place-items: center; color: var(--m-muted); font-size: 12px; font-weight: 700; text-align: center; border-style: dashed; }
.m-acts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.m-acts a, .m-acts button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; border: 1px solid var(--m-line); background: var(--m-surface);
    font-size: 12px; font-weight: 600; color: var(--m-ink); text-decoration: none; text-align: center; min-height: 72px; justify-content: center; }
.m-acts i { font-size: 22px; }
.m-acts .is-wa { color: var(--m-green); }
.m-acts .is-on { border: 2px solid var(--m-brand); background: var(--m-tint); color: var(--m-brand-d); }
@media (min-width: 900px) { .m-done { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; } .m-done-head { grid-column: 1 / -1; } }

/* more */
.m-group { background: var(--m-surface); border: 1px solid var(--m-line); border-radius: 18px; padding: 10px 8px 6px; }
.m-group h2 { margin: 0; font-size: 12px; font-weight: 700; color: var(--m-muted); text-transform: uppercase; letter-spacing: .05em; padding: 0 8px 4px; }
html[dir=rtl] .m-group h2 { letter-spacing: 0; }
.m-group-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.m-group-grid a, .m-group-grid button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px; border-radius: 14px; text-decoration: none; font-size: 11.5px;
    font-weight: 600; color: var(--m-ink); text-align: center; line-height: 1.25; border: 0; background: none; }
.m-group-grid a:hover, .m-group-grid button:hover { background: var(--m-ground); }
.m-group-grid span { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.m-group-grid span i { font-size: 22px; }
@media (min-width: 768px) { .m-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }

/* stock rows */
.m-qty-big { font-size: 17px; font-weight: 700; color: var(--m-ink); font-variant-numeric: tabular-nums; }
.m-qty-big.is-low { color: var(--m-red); }

/* ------------------------------------------------------------------ utilities */
.d-block { display: block; }
.min-w-0 { min-width: 0; }
.m-kbd { font-family: inherit; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--m-soft); color: var(--m-text2); }
.m-btn.is-primary .m-kbd { background: rgba(255, 255, 255, .2); color: var(--m-on-brand); }
.m-acts-off { display: none; }
@media (max-width: 767.98px) { .d-none-phone { display: none !important; } }
@media (min-width: 768px) { .d-phone-only { display: none !important; } }

/* tablet landscape: each cart line is one table row — item | qty | pack | price | total | remove */
@media (min-width: 1024px) {
    .m-lines.is-table .m-line { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto 112px 96px 44px; align-items: center; gap: 12px; padding: 10px 14px; }
    .m-lines.is-table .m-line-top, .m-lines.is-table .m-line-ctl { display: contents; }
    .m-lines.is-table .m-line-top .m-av { grid-column: 1; }
    .m-lines.is-table .m-line-name { grid-column: 2; }
    .m-lines.is-table .m-step { grid-column: 3; }
    .m-lines.is-table .m-pill { grid-column: 4; }
    .m-lines.is-table .m-price { grid-column: 5; width: auto !important; }
    .m-lines.is-table .m-line-total { grid-column: 6; width: auto !important; }
    .m-lines.is-table .m-line-del { grid-column: 7; width: 44px; height: 44px; margin: 0; }
    .m-lines.is-table .m-line-name small.m-ar { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
@media (min-width: 1024px) { .m-lines.is-table .m-line > * > *, .m-lines.is-table .m-line-top > *, .m-lines.is-table .m-line-ctl > * { grid-row: 1; } }
@media (min-width: 1024px) and (max-width: 1279.98px) { .m-lines.is-table .m-line { grid-template-columns: minmax(0, 1fr) auto auto 104px 88px 40px; } .m-lines.is-table .m-line-top .m-av { display: none; } .m-lines.is-table .m-line-name { grid-column: 1; } .m-lines.is-table .m-step { grid-column: 2; } .m-lines.is-table .m-pill { grid-column: 3; } .m-lines.is-table .m-price { grid-column: 4; } .m-lines.is-table .m-line-total { grid-column: 5; } .m-lines.is-table .m-line-del { grid-column: 6; } }
@media (min-width: 1024px) { .m-lines.is-table .m-line { grid-template-columns: 44px minmax(0, 1fr) 132px 72px 136px 104px 44px; } .m-lines.is-table .m-step button { width: 40px; } .m-lines.is-table .m-step input { width: 48px; } .m-lines.is-table .m-step { justify-self: start; } .m-lines.is-table .m-pill { width: 100%; } }
@media (min-width: 1024px) and (max-width: 1279.98px) { .m-lines.is-table .m-line { grid-template-columns: minmax(0, 1fr) 124px 64px 128px 96px 40px; } .m-lines.is-table .m-step input { width: 40px; } }

/* ------------------------------------------------------------------ purchase entry (design "Purchase entry") */
.m-input.is-sm, .m-select.is-sm { min-height: 44px; border-radius: 10px; padding: 0 10px; font-size: 14px; font-weight: 600; }
.m-seg.is-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.m-seg.is-grid button { min-height: 42px; }
.m-pu-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.m-pu-head > .m-field:last-child { grid-column: 1 / -1; }
.m-pu-head .m-label, .m-pf > span:first-child { font-size: 11.5px; font-weight: 600; color: var(--m-muted); }
.m-pu-head .m-seg { padding: 3px; }
@media (min-width: 560px) { .m-pu-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 200px; } .m-pu-head > .m-field:last-child { grid-column: auto; } }
.m-pline { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: var(--m-surface); border: 1px solid var(--m-line); border-radius: 16px; transition: background .4s, border-color .4s; }
.m-pline.is-flash { background: var(--m-tint2); border-color: var(--m-tint-line); }
.m-pline-top { display: flex; gap: 8px; align-items: flex-start; }
.m-pline-top .m-line-del { margin: -8px -6px 0 0; }
html[dir=rtl] .m-pline-top .m-line-del { margin: -8px 0 0 -6px; }
.m-pline-ctl { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: end; }
.m-pline-ctl .m-pf:first-child { grid-column: 1 / -1; }
.m-pline-ctl .m-pf:not(:first-child) { grid-column: span 3; }
.m-pline-ctl:has(.is-unit) .m-pf:not(:first-child) { grid-column: span 2; }
@media (min-width: 560px) {
    .m-pline-ctl { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); }
    .m-pline-ctl:has(.is-unit) { grid-template-columns: minmax(0, 1.6fr) minmax(0, .9fr) minmax(0, 1fr) minmax(0, 1fr); }
    .m-pline-ctl .m-pf:first-child, .m-pline-ctl .m-pf:not(:first-child), .m-pline-ctl:has(.is-unit) .m-pf:not(:first-child) { grid-column: auto; }
}
.m-pf { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; }
.m-pf .m-step { display: flex; width: 100%; }
.m-pf .m-step input { flex: 1; min-width: 0; width: 100%; height: 42px; border: 0; outline: 0; text-align: center; font-size: 15px; font-weight: 700; background: transparent; color: var(--m-ink); font-variant-numeric: tabular-nums; }
.m-pf .m-step button { width: 38px; flex: none; }
.m-pf .m-pill { width: 100%; }
.m-pf .m-input { text-align: end; font-variant-numeric: tabular-nums; }
.m-pu-pay .m-btn { flex: none; padding: 0 16px; }
.m-pu-pay .m-btn.is-primary { flex: 1 1 auto; min-width: 0; }
.m-pu-pay .m-btn.is-primary .m-money { white-space: nowrap; }
@media (max-width: 379.98px) { .m-pu-pay .m-sq-btn { display: none; } }
/* tablet landscape: one row per line — item | qty | pack | free | cost | total | remove */
@media (min-width: 1024px) {
    .m-plines .m-pline { display: grid; grid-template-columns: minmax(0, 1fr) 150px 84px 84px 104px 96px 44px; gap: 10px; align-items: center; padding: 10px 12px; }
    .m-plines .m-pline-top, .m-plines .m-pline-ctl { display: contents; }
    .m-plines .m-line-name { grid-column: 1; grid-row: 1; }
    .m-plines .m-pf { grid-row: 1; }
    .m-plines .m-pf:first-child { grid-column: 2; }
    .m-plines .m-pf.is-unit { grid-column: 3; }
    .m-plines .m-pf.is-free { grid-column: 4; }
    .m-plines .m-pf.is-cost { grid-column: 5; }
    .m-plines .m-line-total { grid-column: 6; grid-row: 1; }
    .m-plines .m-pline-top .m-line-del { grid-column: 7; grid-row: 1; margin: 0; }
    .m-plines .m-pline > .m-two, .m-plines .m-pline > .m-error { grid-column: 1 / -1; }
    .m-plines .m-pf > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .m-plines-head { display: grid; grid-template-columns: minmax(0, 1fr) 150px 84px 84px 104px 96px 44px; gap: 10px; padding: 0 12px; font-size: 11.5px; font-weight: 700; color: var(--m-muted); text-transform: uppercase; letter-spacing: .04em; }
    html[dir=rtl] .m-plines-head { letter-spacing: 0; }
    .m-plines-head span:nth-child(n+2) { text-align: center; }
    .m-plines-head span:nth-child(5), .m-plines-head span:nth-child(6) { text-align: end; }
}
@media (max-width: 1023.98px) { .m-plines-head { display: none; } }
@media (min-width: 1024px) and (max-width: 1279.98px) {
    .m-plines .m-pline, .m-plines-head { grid-template-columns: minmax(0, 1fr) 120px 66px 62px 84px 84px 36px; gap: 6px; }
    .m-plines .m-pf .m-step button { width: 34px; }
    .m-plines .m-pf .m-input, .m-plines .m-pf .m-pill { padding: 0 8px; }
}

/* ------------------------------------------------------------------ dark themes (html[data-m-mode=dark]; colours from AppTheme) */
html[data-m-mode=dark] { color-scheme: dark; }
html[data-m-mode=dark] .tone-0 { background: rgba(251, 146, 60, .16); color: #FDBA74; }
html[data-m-mode=dark] .tone-1 { background: rgba(96, 165, 250, .16); color: #93C5FD; }
html[data-m-mode=dark] .tone-2 { background: rgba(244, 114, 182, .16); color: #F9A8D4; }
html[data-m-mode=dark] .tone-3 { background: rgba(74, 222, 128, .14); color: #86EFAC; }
html[data-m-mode=dark] .tone-4 { background: rgba(251, 191, 36, .14); color: #FCD34D; }
html[data-m-mode=dark] .tone-5 { background: rgba(56, 189, 248, .14); color: #7DD3FC; }
html[data-m-mode=dark] .tone-6 { background: rgba(167, 139, 250, .16); color: #C4B5FD; }
html[data-m-mode=dark] .m-note.is-amber { background: var(--m-amber-bg); border-color: rgba(251, 191, 36, .3); color: #FDE68A; } html[data-m-mode=dark] .m-note.is-amber > i { color: var(--m-amber); }
html[data-m-mode=dark] .m-note.is-blue { background: var(--m-blue-bg); border-color: rgba(96, 165, 250, .3); color: #BFDBFE; }
html[data-m-mode=dark] .m-note.is-red { background: var(--m-red-bg); border-color: rgba(248, 113, 113, .3); color: #FECACA; }
html[data-m-mode=dark] .m-note.is-green { background: var(--m-green-bg); border-color: rgba(74, 222, 128, .3); color: #BBF7D0; }
html[data-m-mode=dark] .m-alert.is-red, html[data-m-mode=dark] .m-stat.is-red, html[data-m-mode=dark] .m-line-del:hover { background: var(--m-red-bg); }
html[data-m-mode=dark] .m-alert.is-amber { background: var(--m-amber-bg); } html[data-m-mode=dark] .m-alert.is-amber .m-dot { color: var(--m-amber); }
html[data-m-mode=dark] .m-alert.is-blue { background: var(--m-blue-bg); }
html[data-m-mode=dark] .m-line.is-short, html[data-m-mode=dark] .m-btn.is-danger, html[data-m-mode=dark] .m-fc.is-warn { border-color: rgba(248, 113, 113, .4); }
html[data-m-mode=dark] .m-drop { border-color: var(--m-line2); }
html[data-m-mode=dark] .m-today { box-shadow: var(--m-shadow-lg); }
html[data-m-mode=dark] .m-key { box-shadow: 0 1px 0 var(--m-line2); }
html[data-m-mode=dark] .m-ib .m-badge-dot { color: #1F1300; }

/* ------------------------------------------------------------------ theme switcher (More, Home, rail) */
.m-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.m-theme { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 6px 8px; border-radius: 14px; border: 1px solid var(--m-line); background: var(--m-surface);
    font-size: 12px; font-weight: 600; color: var(--m-ink); text-align: center; line-height: 1.2; min-height: 44px; }
.m-theme.is-on { border: 2px solid var(--m-brand); padding: 9px 5px 7px; }
.m-theme-sw { width: 100%; height: 44px; border-radius: 10px; position: relative; overflow: hidden; border: 1px solid rgba(15, 23, 42, .08); }
.m-theme-sw::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 16px; background: var(--sw-bar); }
.m-theme-sw::after { content: ""; position: absolute; inset-inline-end: 8px; bottom: 7px; width: 22px; height: 14px; border-radius: 5px; background: var(--sw-accent); }
.m-theme-sw.is-light { background: #F5F7F9; } .m-theme-sw.is-dark { background: #0B1220; }
.m-theme-sw i { position: absolute; inset-inline-start: 8px; bottom: 9px; width: 34px; height: 6px; border-radius: 3px; background: rgba(148, 163, 184, .55); }
.m-theme .ti { font-size: 14px; color: var(--m-brand); }
.m-rail .m-rail-theme { width: 44px; min-height: 44px; border-radius: 12px; margin-bottom: 4px; border: 0; background: transparent; color: #94A3B8; display: grid; place-items: center; }
.m-rail .m-rail-theme:hover { background: rgba(255, 255, 255, .06); color: #E2E8F0; }
.m-rail .m-rail-theme i { font-size: 21px; }

/* ---------- offline order screen (/app/offline-order) — Phase 9 ---------- */
.mo-body { min-height: 100vh; background: var(--m-ground); padding-bottom: 150px; }
.mo-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
    background: var(--m-hero); color: var(--m-on-brand); box-shadow: var(--m-shadow); }
.mo-back { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: inherit; background: rgba(255, 255, 255, .14); font-size: 20px; text-decoration: none; }
.mo-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mo-title b { font-size: 17px; }
.mo-title small { font-size: 12px; font-weight: 600; opacity: .9; display: inline-flex; align-items: center; gap: 5px; }
.mo-title small::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #FBBF24; }
.mo-title small.is-on::before { background: #4ADE80; }
.mo-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border-radius: 999px; border: 0; background: rgba(255, 255, 255, .16); color: inherit; font-weight: 700; }
.mo-chip.has { background: #FBBF24; color: #422006; }
.mo-main { max-width: 720px; margin: 0 auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.mo-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: var(--m-tint); color: var(--m-brand-d); font-size: 13px; font-weight: 600; }
.mo-note i { font-size: 18px; }
.mo-note.is-warn { background: var(--m-amber-bg, #FEF3C7); color: var(--m-amber, #92400E); }
.mo-customer { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--m-line); background: var(--m-surface); color: var(--m-ink); text-align: start; }
.mo-customer > i:first-child { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--m-mint); color: var(--m-on-mint); font-size: 20px; flex-shrink: 0; }
.mo-customer span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mo-customer small { color: var(--m-muted); font-size: 12.5px; }
.mo-find { position: relative; }
.mo-find i { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--m-muted); }
.mo-find .m-input { padding-inline-start: 44px; min-height: 52px; font-size: 16px; }
.mo-results { list-style: none; margin: -4px 0 0; padding: 6px; border-radius: 14px; border: 1px solid var(--m-line); background: var(--m-surface); box-shadow: var(--m-shadow-lg); max-height: 50vh; overflow: auto; }
.mo-results button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: none; color: var(--m-ink); text-align: start; }
.mo-results button:hover, .mo-results button:focus { background: var(--m-tint2); }
.mo-results span:first-child { display: flex; flex-direction: column; min-width: 0; }
.mo-results small { color: var(--m-muted); font-size: 12px; }
.mo-none { padding: 14px; color: var(--m-muted); text-align: center; list-style: none; }
.mo-cart { display: flex; flex-direction: column; gap: 10px; }
.mo-cart-head { font-size: 13px; color: var(--m-muted); padding: 0 4px; }
.mo-empty { text-align: center; padding: 28px 16px; border: 1.5px dashed var(--m-line2); border-radius: 16px; color: var(--m-muted); }
.mo-empty i { font-size: 34px; display: block; margin-bottom: 6px; color: var(--m-faint); }
.mo-empty p { margin: 0; }
.mo-line { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--m-line); background: var(--m-surface); display: flex; flex-direction: column; gap: 8px; }
.mo-line.is-warn { border-color: var(--m-amber, #F59E0B); }
.mo-line-top { display: flex; justify-content: space-between; gap: 10px; }
.mo-line-top span { display: flex; flex-direction: column; min-width: 0; color: var(--m-ink); }
.mo-line-top small { color: var(--m-muted); font-size: 12px; }
.mo-line-row { display: flex; align-items: center; gap: 10px; }
.mo-line-row > b { margin-inline-start: auto; font-size: 16px; color: var(--m-ink); }
.mo-step { display: inline-flex; align-items: center; border: 1px solid var(--m-line2); border-radius: 12px; overflow: hidden; }
.mo-step button { width: 40px; height: 42px; border: 0; background: var(--m-field); color: var(--m-ink); font-size: 18px; }
.mo-step input { width: 54px; height: 42px; border: 0; text-align: center; font-weight: 700; font-size: 16px; background: var(--m-surface); color: var(--m-ink); }
.mo-price { display: inline-flex; align-items: center; gap: 4px; color: var(--m-muted); margin: 0; }
.mo-price input { width: 84px; height: 42px; border: 1px solid var(--m-line2); border-radius: 12px; padding: 0 8px; text-align: end; font-weight: 600; background: var(--m-surface); color: var(--m-ink); }
.mo-warn { display: flex; gap: 5px; align-items: center; color: var(--m-amber, #B45309); font-weight: 600; font-size: 12.5px; }
.mo-x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--m-soft); color: var(--m-muted); display: grid; place-items: center; flex-shrink: 0; }
.mo-outbox { margin-top: 6px; padding: 14px; border-radius: 16px; border: 1px solid var(--m-line); background: var(--m-surface); }
.mo-outbox-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.mo-outbox-head h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; color: var(--m-ink); }
.mo-outbox ul { list-style: none; margin: 0; padding: 0; }
.mo-outbox li:not(.mo-none) { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--m-soft); }
.mo-q-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--m-amber-bg, #FEF3C7); color: var(--m-amber, #B45309); flex-shrink: 0; }
.is-error .mo-q-ico { background: var(--m-red-bg, #FEE2E2); color: var(--m-red, #B91C1C); }
.is-done .mo-q-ico { background: var(--m-green-bg, #DCFCE7); color: var(--m-green, #15803D); }
.mo-q-main { flex: 1; display: flex; flex-direction: column; min-width: 0; color: var(--m-ink); }
.mo-q-main small { color: var(--m-muted); font-size: 12px; }
.is-error .mo-q-main small { color: var(--m-red, #B91C1C); }
.mo-outbox .is-history { opacity: .85; }
.mo-data { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--m-line2); font-size: 12.5px; color: var(--m-muted); }
.mo-pay { position: fixed; inset-inline: 0; bottom: 0; z-index: 25; display: flex; flex-direction: column; gap: 10px; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--m-surface); border-top: 1px solid var(--m-line); box-shadow: 0 -8px 24px rgba(15, 23, 42, .08); }
.mo-pay > * { max-width: 688px; width: 100%; margin: 0 auto; }
.mo-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mo-seg label { margin: 0; }
.mo-seg input { position: absolute; opacity: 0; pointer-events: none; }
.mo-seg span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; border-radius: 12px; border: 1px solid var(--m-line2); color: var(--m-text); font-weight: 600; font-size: 14px; }
.mo-seg input:checked + span { background: var(--m-tint); border-color: var(--m-brand); color: var(--m-brand-d); }
.mo-save { width: 100%; }
.mo-save .m-money { margin-inline-start: auto; font-size: 18px; }
.mo-sheet { position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-end; justify-content: center; }
.mo-sheet[hidden] { display: none; }
.mo-sheet-panel { width: 100%; max-width: 640px; max-height: 85vh; display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 20px 20px 0 0; background: var(--m-surface); }
.mo-sheet-head { display: flex; align-items: center; justify-content: space-between; color: var(--m-ink); font-size: 16px; }
.mo-clist { list-style: none; margin: 0; padding: 0; overflow: auto; }
.mo-clist button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 6px; border: 0; border-bottom: 1px solid var(--m-soft); background: none; color: var(--m-ink); text-align: start; }
.mo-clist button > i { font-size: 20px; color: var(--m-muted); }
.mo-clist span:not(.m-money) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mo-clist small { color: var(--m-muted); font-size: 12px; }
.mo-toast { position: fixed; inset-inline: 16px; bottom: 150px; z-index: 50; max-width: 520px; margin: 0 auto; padding: 12px 16px; border-radius: 14px; background: var(--m-ink); color: var(--m-on-ink); font-weight: 600; box-shadow: var(--m-shadow-lg); }
.mo-toast.is-warn { background: #92400E; color: #fff; }
.mo-toast[hidden] { display: none; }
@media (min-width: 900px) { .mo-sheet { align-items: center; } .mo-sheet-panel { border-radius: 20px; } }
.m-offline-go { margin-inline-start: 10px; color: inherit; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.mo-body [hidden] { display: none !important; }

/* Home quick actions on phones: one sideways-scrolling row (4 tiles in view), arrows to move — tablets keep the grid */
.m-qa-wrap { position: relative; }
.m-qa-arrow { display: none; }
@media (max-width: 767.98px) {
    .m-qa { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; -webkit-overflow-scrolling: touch;
        margin-inline: -16px; padding: 2px 16px 4px; scroll-padding-inline: 16px; }
    .m-qa::-webkit-scrollbar { display: none; }
    .m-qa a { flex: 0 0 calc((100% - 30px) / 4); min-width: 76px; scroll-snap-align: start; }
    .m-qa-arrow { display: grid; place-items: center; position: absolute; top: 50%; z-index: 2; width: 34px; height: 34px; margin-top: -17px; border-radius: 50%;
        border: 1px solid var(--m-line2); background: var(--m-surface); color: var(--m-ink); box-shadow: 0 4px 14px rgba(15, 23, 42, .18); font-size: 18px; }
    .m-qa-arrow.is-next { inset-inline-end: -8px; }
    .m-qa-arrow.is-prev { inset-inline-start: -8px; }
    .m-qa-arrow:active { transform: scale(.94); }
}

/* camera scanner: read / not-a-product message over the video (ksa-scanner.js) */
.k-cam-msg { position: absolute; inset-inline: 12px; bottom: 12px; z-index: 5; display: flex; justify-content: center; pointer-events: none; }
.k-cam-msg > span { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 9px 14px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
    background: rgba(15, 23, 42, .82); color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.k-cam-msg .is-miss { background: rgba(180, 35, 24, .9); }
.k-cam-msg .is-ok { background: rgba(21, 128, 61, .92); }
.k-cam-msg i { font-size: 18px; flex: none; }
.k-cam-msg b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
.k-spin { animation: kCamSpin .8s linear infinite; }
@keyframes kCamSpin { to { transform: rotate(360deg); } }

/* camera scanner: live picture + aiming frame (ksa-scanner.js reads only the area inside the frame) */
.k-cam-video { position: relative; width: 100%; overflow: hidden; line-height: 0; }
.k-cam-video video.k-cam-feed { width: 100% !important; height: auto; max-height: 62vh; object-fit: contain; display: block; background: #000; }
.k-cam-frame { position: absolute; left: 5%; right: 5%; top: 27.5%; bottom: 27.5%; border-radius: 10px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .38); pointer-events: none; }
.k-cam-frame i { position: absolute; width: 26px; height: 26px; border: 4px solid #fff; }
.k-cam-frame i:nth-child(1) { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.k-cam-frame i:nth-child(2) { top: -2px; right: -2px; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.k-cam-frame i:nth-child(3) { bottom: -2px; left: -2px; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.k-cam-frame i:nth-child(4) { bottom: -2px; right: -2px; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.k-cam-frame b { position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; border-radius: 2px; background: #EF4444; box-shadow: 0 0 10px rgba(239, 68, 68, .9); animation: kCamLine 1.8s ease-in-out infinite; }
@keyframes kCamLine { 0%, 100% { transform: translateY(-38px); opacity: .55; } 50% { transform: translateY(38px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .k-cam-frame b { animation: none; } }

/* ===================================================================== SPA shell + shimmer (layouts/mobile, x-m.skeleton) */
body:not(.has-tabs) .m-tabs { display: none; }
.m-skel { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.m-skel > div:not(.m-skel-bar) { display: flex; flex-direction: column; gap: 12px; }
.m-skel i { display: block; font-style: normal; }
.m-skel-l, .m-skel-c, .m-skel-box {
    background: linear-gradient(90deg, var(--m-soft) 0%, var(--m-soft) 35%, color-mix(in srgb, var(--m-soft) 45%, var(--m-surface)) 50%, var(--m-soft) 65%, var(--m-soft) 100%);
    background-size: 300% 100%; animation: mSkel 1.25s ease-in-out infinite;
}
html[dir=rtl] .m-skel-l, html[dir=rtl] .m-skel-c, html[dir=rtl] .m-skel-box { animation-direction: reverse; }
@keyframes mSkel { from { background-position: 100% 0; } to { background-position: 0 0; } }
.m-skel-l { height: 11px; border-radius: 6px; }
.m-skel-c { border-radius: 50%; flex: none; }
.m-skel-box { width: 100%; border-radius: 12px; }
.m-skel-l.is-h16 { height: 16px; } .m-skel-l.is-h20 { height: 20px; } .m-skel-l.is-h28 { height: 28px; border-radius: 8px; }
.m-skel .is-w15 { width: 15%; } .m-skel .is-w20 { width: 20%; } .m-skel .is-w25 { width: 25%; } .m-skel .is-w30 { width: 30%; } .m-skel .is-w35 { width: 35%; } .m-skel .is-w40 { width: 40%; }
.m-skel .is-w45 { width: 45%; } .m-skel .is-w50 { width: 50%; } .m-skel .is-w55 { width: 55%; } .m-skel .is-w60 { width: 60%; } .m-skel .is-w70 { width: 70%; } .m-skel .is-w80 { width: 80%; }
.m-skel-c.is-32 { width: 32px; height: 32px; } .m-skel-c.is-40 { width: 40px; height: 40px; } .m-skel-c.is-44 { width: 44px; height: 44px; border-radius: 12px; } .m-skel-c.is-64 { width: 64px; height: 64px; }
.m-skel-box.is-h44 { height: 44px; } .m-skel-box.is-h48 { height: 48px; } .m-skel-box.is-h52 { height: 52px; } .m-skel-box.is-btn { border-radius: 14px; }
.m-skel-l.is-chip { width: 74px; height: 32px; border-radius: 999px; flex: none; }
.m-skel-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-r-card); }
.m-skel-list { display: flex; flex-direction: column; gap: 8px; }
.m-skel-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.m-skel-card, .m-skel-hero { display: flex; flex-direction: column; gap: 12px; padding: 16px; background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-r-card); }
.m-skel-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 12px; border-top: 1px solid var(--m-line); }
.m-skel-kpis > div, .m-skel-field { display: flex; flex-direction: column; gap: 8px; }
.m-skel-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.m-skel-tile { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 8px; background: var(--m-surface); border: 1px solid var(--m-line); border-radius: var(--m-r-card); }
.m-skel-tiles.is-plain .m-skel-tile { border: 0; padding: 6px 4px; }
.m-skel-tile .m-skel-l { margin-inline: auto; }
.m-skel-chips { display: flex; gap: 8px; overflow: hidden; }
.m-skel-pair { display: flex; justify-content: space-between; gap: 12px; }
.m-skel-center { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0; }
.m-skel-center .m-skel-l { margin-inline: auto; }
.m-skel-bar { display: flex; align-items: center; gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 12px; background: var(--m-surface); border-bottom: 1px solid var(--m-line); }
.m-skel-body { padding: 14px 16px 20px; width: 100%; max-width: 1180px; margin-inline: auto; }
@media (min-width: 768px) {
    .m-skel-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .m-skel-body { padding: 20px 24px 28px; }
}
/* the SPA navigation overlay: covers the content area only — the rail and the tabs stay visible */
.m-skel-view { position: fixed; z-index: 35; top: 0; bottom: 0; inset-inline: 0; overflow: hidden; background: var(--m-ground); animation: mSkelIn .15s ease-out; }
body.has-tabs .m-skel-view { bottom: calc(var(--m-tabs-h) + env(safe-area-inset-bottom)); }
@media (min-width: 768px) {
    .m-skel-view { inset-inline-start: var(--m-rail-w); }
    body.has-tabs .m-skel-view { bottom: 0; }
}
@keyframes mSkelIn { from { opacity: 0; } to { opacity: 1; } }
/* in-page: rows appended under a list while "Load more" fetches */
.m-skel.is-more { margin-top: 8px; }
.m-finder-list .m-skel { padding: 4px; }
.m-finder-list .m-skel-list { gap: 2px; }
.m-finder-list .m-skel-row { border: 0; padding: 8px 10px; min-height: 56px; }
@media (prefers-reduced-motion: reduce) {
    .m-skel-l, .m-skel-c, .m-skel-box { animation: none; }
    .m-skel-view { animation: none; }
}

/* ---------------------------------------------------------------- install the app (More ▸ Install app / Add to Home Screen) */
.m-install { display: flex; flex-direction: column; gap: 14px; }
.m-install-app { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--m-line); border-radius: 16px; background: var(--m-soft); }
.m-install-app img { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 2px 8px rgba(15, 23, 42, .12); flex-shrink: 0; }
.m-install-app b { display: block; color: var(--m-ink); font-size: 15px; }
.m-install-app small { color: var(--m-muted); font-size: 12px; }
.m-install-h { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 14px; color: var(--m-ink); }
.m-steps { list-style: none; counter-reset: step; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.m-steps li { counter-increment: step; display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--m-text2); line-height: 1.45; }
.m-steps li::before { content: counter(step); flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    background: var(--m-brand); color: #fff; font-size: 12px; font-weight: 700; }

/* item history sheet (New sale / Purchase entry) */
.m-hist { display: flex; flex-direction: column; gap: 14px; }
.m-hist-basis { margin: 0; }
.m-hist .m-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.m-hist .m-kpi b { font-size: 19px; }
.m-hist .m-kpi small { white-space: normal; overflow-wrap: anywhere; font-weight: 500; }
.m-hist-margin.is-green { background: var(--m-green-bg); border-color: transparent; } .m-hist-margin.is-green b { color: var(--m-green); }
.m-hist-margin.is-amber { background: var(--m-amber-bg); border-color: transparent; } .m-hist-margin.is-amber b { color: var(--m-amber); }
.m-hist-margin.is-red { background: var(--m-red-bg); border-color: transparent; } .m-hist-margin.is-red b { color: var(--m-red); }
.m-hist-h { margin-block-end: 8px; flex-wrap: wrap; }
.m-hist-h .m-h2 { display: flex; align-items: center; gap: 6px; } .m-hist-h .m-h2 i { color: var(--m-brand); }
.m-hist-h .m-seg { min-width: 200px; }
.m-hist .m-row { align-items: flex-start; }
.m-hist .m-row-sub { white-space: normal; }
.m-hist .m-hint { margin: 6px 0 0; }
.m-hist-none { margin: 0; padding: 14px; border: 1px dashed var(--m-line2); border-radius: 14px; color: var(--m-muted); text-align: center; font-size: 13px; }
.m-line-hist { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--m-brand); font-size: 12px; font-weight: 600; }
