/* Dukkan Shop Manager — styles (light + dark, RTL + LTR, desktop → 360 px phones, print) */

:root {
  --font: "Segoe UI", Tahoma, "Noto Kufi Arabic", "Noto Sans Arabic", "Noto Naskh Arabic", system-ui, -apple-system, sans-serif;
  --bg: #f3f5f8; --surface: #ffffff; --surface-2: #f7f9fb; --surface-3: #edf1f5;
  --border: #e2e8f0; --border-strong: #cbd5e1;
  --text: #0f172a; --text-2: #334155; --muted: #64748b;
  --primary: #0f766e; --primary-600: #0c625b; --primary-soft: #e3f3f0; --ring: rgba(15, 118, 110, .22);
  --success: #15803d; --success-soft: #e5f5ea;
  --danger: #dc2626; --danger-soft: #fdeceb;
  --warn: #b45309; --warn-soft: #fdf1df;
  --info: #2563eb; --info-soft: #e8effd;
  --violet: #6d4fd8; --violet-soft: #efebfd;
  --amber: #d97706; --amber-soft: #fdf1df;
  --side-bg: #0f1b2d; --side-text: #c6d1e0; --side-muted: #7f8ea5; --side-active-bg: rgba(45, 212, 191, .14); --side-active: #5eead4;
  --topbar-bg: rgba(243, 245, 248, .86);
  --tip-bg: #0f172a; --tip-text: #f1f5f9;
  --ch-a: #93dcd2; --ch-b: #0f766e;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow: 0 6px 18px rgba(15, 23, 42, .08);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, .18);
  --radius: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1220; --surface: #111a2b; --surface-2: #152036; --surface-3: #1b2840;
  --border: #22314b; --border-strong: #31435f;
  --text: #e7edf6; --text-2: #c4d0e0; --muted: #8d9db4;
  --primary: #0d9488; --primary-600: #0f857a; --primary-soft: rgba(20, 184, 166, .14); --ring: rgba(45, 212, 191, .28);
  --success: #34d399; --success-soft: rgba(52, 211, 153, .12);
  --danger: #f87171; --danger-soft: rgba(248, 113, 113, .12);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .12);
  --info: #60a5fa; --info-soft: rgba(96, 165, 250, .13);
  --violet: #a78bfa; --violet-soft: rgba(167, 139, 250, .14);
  --amber: #fbbf24; --amber-soft: rgba(251, 191, 36, .12);
  --side-bg: #08101d;
  --topbar-bg: rgba(11, 18, 32, .86);
  --tip-bg: #e7edf6; --tip-text: #0f172a;
  --ch-a: #1f6b63; --ch-b: #2dd4bf;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 6px 18px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.55; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body.has-modal, body.sheet-open { overflow: hidden; }
h1, h2, h3, h4 { line-height: 1.3; }
a { color: var(--primary); }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.muted { color: var(--muted); }
.block { display: block; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warn { color: var(--warn) !important; }
.money { white-space: nowrap; }
.money small { font-size: .76em; font-weight: 600; opacity: .72; }
[hidden] { display: none !important; }
.only-mobile, .only-sm, .only-sm-block { display: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ───────── boot splash ───────── */
.splash { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.splash-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; font-weight: 600; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fatal { margin: 15vh auto; max-width: 440px; text-align: center; padding: 24px; }
.fatal .ic { width: 48px; height: 48px; color: var(--danger); }

/* ───────── shell ───────── */
.app { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 248px; flex: none; background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; gap: 6px; padding: 18px 12px; overflow-y: auto; z-index: 50; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 16px; color: #fff; text-decoration: none; }
.brand b { display: block; font-size: 21px; line-height: 1.15; letter-spacing: .01em; }
.brand small { display: block; font-size: 12px; color: var(--side-muted); font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--side-text); text-decoration: none; font-weight: 600; font-size: 14px; position: relative; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--side-active-bg); color: var(--side-active); }
.nav-item.active::before { content: ""; position: absolute; inset-inline-start: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 4px; background: var(--side-active); }
.nav-badge { margin-inline-start: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; background: #ef4444; color: #fff; line-height: 1; }
.nb-debt { background: #f59e0b; color: #241500; }
.sidebar-foot { margin-top: auto; padding-top: 12px; }
.shop-card { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .06); }
.shop-card b { display: block; color: #fff; font-size: 13.5px; }
.shop-card small { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--side-muted); }
.shop-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(45, 212, 191, .14); color: var(--side-active); flex: none; }
.net-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.net-dot.on { background: #34d399; } .net-dot.off { background: #fbbf24; }
.scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 28px; background: var(--topbar-bg); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 19px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.has-badge { position: relative; }
.dot-badge { position: absolute; top: 7px; inset-inline-end: 8px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px var(--bg); }
.view { padding: 22px 28px 48px; width: 100%; max-width: 1480px; margin: 0 auto; outline: none; }
.view-inner { display: flex; flex-direction: column; gap: 16px; }
.bottomnav { display: none; }

/* ───────── controls ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; color: var(--text); background: var(--surface); transition: background .15s, border-color .15s, box-shadow .15s, transform .06s; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(15, 118, 110, .3); }
.btn-primary:hover { background: var(--primary-600); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-ghost { background: transparent; border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn.danger { color: var(--danger); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: 12px; gap: 4px; border-radius: 8px; }
.btn-xs .ic { width: 14px; height: 14px; }
.btn-lg { height: 54px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; text-decoration: none; flex: none; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.outline { border-color: var(--border-strong); background: var(--surface); height: 40px; width: 40px; }
.icon-btn.danger { color: var(--danger); }
.icon-btn .ic { width: 19px; height: 19px; }
.link { color: var(--primary); font-weight: 700; font-size: 13px; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-align: start; }
.link-btn:hover { text-decoration: underline; }
td .link-btn { color: var(--text); }
td .link-btn:hover { color: var(--primary); }
kbd { font: 700 10.5px/1 ui-monospace, Consolas, monospace; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); }

.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.input::placeholder { color: var(--muted); opacity: .8; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
textarea.input { height: auto; padding: 9px 12px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; -webkit-appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; }
[dir="rtl"] select.input { background-position: left 12px center; padding-left: 32px; }
[dir="ltr"] select.input { background-position: right 12px center; padding-right: 32px; }
.input-sm { height: 32px; font-size: 13px; padding: 0 8px; border-radius: 8px; }
.input-lg { height: 50px; font-size: 20px; font-weight: 800; }
input[type="date"].input, input[type="datetime-local"].input { padding: 0 10px; }
.input-group { display: flex; align-items: stretch; min-width: 0; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; flex: 1; }
.addon { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-inline-start: 0; border-start-end-radius: 10px; border-end-end-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row .input { flex: 1; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid.one { grid-template-columns: 1fr; }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.field-label em { color: var(--danger); font-style: normal; }
.field-hint { color: var(--muted); font-size: 12px; line-height: 1.45; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 11px; padding: 3px; gap: 2px; border: 1px solid var(--border); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { height: 34px; padding: 0 14px; border: 0; background: transparent; border-radius: 8px; font: inherit; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; flex: none; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button .ic { width: 16px; height: 16px; }
.seg-full { display: flex; }
.seg-full button { flex: 1; }
.seg-xs { padding: 2px; border-radius: 8px; }
.seg-xs button { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.chip:hover { border-color: var(--border-strong); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--text-2); user-select: none; position: relative; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 38px; height: 22px; border-radius: 11px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + .switch-ui { background: var(--primary); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + .switch-ui::after { transform: translateX(-16px); }
.switch input:focus-visible + .switch-ui { box-shadow: 0 0 0 3px var(--ring); }
.field-switch { align-self: end; min-height: 40px; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: var(--surface-3); color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.mbadge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.mbadge .ic { width: 14px; height: 14px; }
.m-cash { background: rgba(15, 159, 138, .12); color: #0b7f6e; }
.m-instapay { background: rgba(109, 79, 216, .12); color: #5b3fc4; }
.m-vodafone { background: rgba(227, 52, 63, .1); color: #c4202c; }
.m-credit { background: rgba(217, 119, 6, .13); color: #a85d05; }
[data-theme="dark"] .m-cash { color: #5eead4; }
[data-theme="dark"] .m-instapay { color: #c4b5fd; }
[data-theme="dark"] .m-vodafone { color: #fca5a5; }
[data-theme="dark"] .m-credit { color: #fcd34d; }
.stock { display: inline-flex; min-width: 34px; justify-content: center; height: 24px; align-items: center; padding: 0 8px; border-radius: 7px; font-weight: 800; font-size: 12.5px; }
.stock-ok { background: var(--success-soft); color: var(--success); }
.stock-low { background: var(--warn-soft); color: var(--warn); }
.stock-out { background: var(--danger-soft); color: var(--danger); }

/* ───────── layout blocks ───────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; min-width: 0; }
.card.no-pad { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card-head h3 .ic { width: 18px; height: 18px; color: var(--primary); }
.card-head.padded { padding: 13px 18px; margin: 0; border-bottom: 1px solid var(--border); }
.card:not(.no-pad) > .table-wrap { margin: 0 -18px -18px; border-top: 1px solid var(--border); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-main { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-profile { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm); min-width: 0; position: relative; overflow: hidden; }
.kpi-top { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.kpi-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); flex: none; }
.kpi-ic .ic { width: 19px; height: 19px; }
.kpi-label { color: var(--muted); font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .delta { margin-inline-start: auto; }
.kpi-value { font-size: 26px; font-weight: 800; margin-top: 12px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.kpi-value-sm { font-size: 19px; }
.kpi-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-teal { --tone: var(--primary); --tone-soft: var(--primary-soft); }
.kpi-green { --tone: var(--success); --tone-soft: var(--success-soft); }
.kpi-violet { --tone: var(--violet); --tone-soft: var(--violet-soft); }
.kpi-amber { --tone: var(--amber); --tone-soft: var(--amber-soft); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 800; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.delta .ic { width: 12px; height: 12px; }
.delta.up { color: var(--success); background: var(--success-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.flat { color: var(--muted); background: var(--surface-3); }

.stat-strip { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.stat-strip > div { flex: 1 1 150px; padding: 12px 18px; display: flex; flex-direction: column; gap: 2px; border-inline-end: 1px solid var(--border); min-width: 0; }
.stat-strip > div:last-child { border-inline-end: 0; }
.stat-strip > div > span { font-size: 12px; color: var(--muted); font-weight: 700; }
.stat-strip b { font-size: 17px; font-weight: 800; white-space: nowrap; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px; }
.toolbar .search-box { flex: 1 1 260px; }
.toolbar > select.input { width: auto; min-width: 150px; flex: 0 0 auto; }
.toolbar-end { display: flex; gap: 8px; margin-inline-start: auto; flex-wrap: wrap; }
.search-box { position: relative; display: flex; align-items: center; min-width: 0; }
.search-box > .ic { position: absolute; inset-inline-start: 12px; color: var(--muted); pointer-events: none; width: 19px; height: 19px; }
.search-box .input { padding-inline-start: 40px; }
.search-box kbd { position: absolute; inset-inline-end: 10px; pointer-events: none; }
.search-box .input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.mini-field { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.mini-field .input { width: auto; height: 40px; }
.date-field { position: relative; display: inline-flex; align-items: center; min-width: 0; direction: ltr; }
.date-field .input { width: 150px; padding-left: 10px; padding-right: 38px; text-align: left; font-variant-numeric: tabular-nums; }
.field .date-field, .field .date-field .input { width: 100%; }
.date-field [data-pick] { position: absolute; right: 2px; width: 36px; height: 36px; color: var(--muted); }
.date-native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { font-size: 12px; font-weight: 800; color: var(--muted); text-align: start; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: end; white-space: nowrap; }
.table tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--border); }
.row-link { cursor: pointer; }
.is-void td { opacity: .55; }
.is-void td:first-child { opacity: 1; }
.actions-col { width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.row-actions .icon-btn { width: 34px; height: 34px; }
.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.prod-cell small { font-size: 11.5px; }
.more { padding: 12px; text-align: center; border-top: 1px solid var(--border); }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; opacity: .45; }
.empty h4 { margin: 8px 0 2px; color: var(--text-2); font-size: 14.5px; }
.empty p { margin: 0; font-size: 12.5px; }

.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mini-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.mini-list li:last-child { border-bottom: 0; }
.mini-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mini-main b { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-main small { color: var(--muted); font-size: 12px; }
.mini-main a { color: inherit; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-main a:hover b { color: var(--primary); }
.cat-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); flex: none; }
.cat-ic .ic { width: 18px; height: 18px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; flex: none; }
.avatar-lg { width: 58px; height: 58px; font-size: 23px; }

/* ───────── charts ───────── */
.chart { position: relative; min-height: 210px; }
.chart svg { display: block; overflow: visible; }
.ch-grid { stroke: var(--border); stroke-dasharray: 3 4; }
.ch-base { stroke: var(--border-strong); }
.ch-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); font-weight: 600; }
.ch-future { opacity: .45; }
.ch-bar { fill: var(--ch-a); }
.ch-bar2 { fill: var(--ch-b); }
.ch-zero { fill: var(--border-strong); }
.ch-tip { position: absolute; pointer-events: none; opacity: 0; transition: opacity .12s; background: var(--tip-bg); color: var(--tip-text); padding: 8px 11px; border-radius: 10px; font-size: 12px; box-shadow: var(--shadow); z-index: 5; min-width: 160px; line-height: 1.65; }
.ch-tip .muted { color: inherit; opacity: .7; }
.ch-tip .dot { margin-inline-end: 6px; vertical-align: -1px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dot-a { background: var(--ch-a); }
.dot-b { background: var(--ch-b); }
.donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.donut svg { flex: none; }
.ch-track { stroke: var(--surface-3); }
.ch-center { font-size: 22px; font-weight: 800; fill: var(--text); font-family: var(--font); }
.ch-center-sub { font-size: 12px; fill: var(--muted); font-family: var(--font); font-weight: 600; }
.legend-list { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 190px; display: flex; flex-direction: column; gap: 10px; }
.legend-list li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 8px; }
.legend-list .dot { border-radius: 50%; }
.lg-label { font-weight: 700; font-size: 13px; }
.lg-val { font-weight: 800; font-size: 13px; text-align: end; white-space: nowrap; }
.lg-val small { color: var(--muted); margin-inline-start: 6px; font-weight: 700; }
.lg-sub { grid-column: 2 / -1; color: var(--muted); font-size: 11.5px; }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.rank-top { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rank-n { width: 22px; height: 22px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; font-size: 11.5px; font-weight: 800; color: var(--muted); flex: none; }
.rank li:first-child .rank-n { background: var(--primary); color: #fff; }
.rank-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rank-val { font-weight: 800; white-space: nowrap; }
.rank-val small { color: var(--muted); font-weight: 700; margin-inline-start: 6px; }
.rank-bar { height: 6px; border-radius: 6px; background: var(--surface-3); margin-top: 6px; margin-inline-start: 30px; overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 6px; background: var(--primary); opacity: .85; }

/* ───────── POS ───────── */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 410px; gap: 16px; align-items: start; }
.pos-catalog { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pos-search { padding: 12px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 76px; z-index: 5; }
.pos-search::before { content: ""; position: absolute; inset-inline: -2px; top: -14px; height: 13px; background: var(--bg); }
.pos-search .input { height: 48px; font-size: 15px; border-radius: 12px; }
.pos-search .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.pos-search .chips::-webkit-scrollbar { display: none; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.pgrid > .empty { grid-column: 1 / -1; }
.ptile { display: flex; flex-direction: column; align-items: stretch; gap: 8px; text-align: start; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; font: inherit; color: var(--text); min-height: 136px; transition: transform .08s, border-color .15s, box-shadow .15s; position: relative; min-width: 0; }
.ptile:hover { border-color: var(--primary); box-shadow: 0 6px 16px rgba(15, 118, 110, .12); }
.ptile:active { transform: scale(.98); }
.ptile.in-cart { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.ptile.is-out { opacity: .5; cursor: not-allowed; }
.ptile.is-out:hover { border-color: var(--border); box-shadow: var(--shadow-sm); }
.ptile-top { display: flex; justify-content: space-between; align-items: flex-start; }
.ptile-qty { min-width: 26px; height: 26px; border-radius: 13px; background: var(--primary); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; padding: 0 7px; }
.ptile-name { font-weight: 700; font-size: 13.5px; line-height: 1.42; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.ptile-foot { display: flex; align-items: center; justify-content: space-between; gap: 4px 6px; flex-wrap: wrap; }
.ptile-foot b { font-size: 14.5px; font-weight: 800; }
.ptile-stock { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.ps-low { color: var(--warn); }
.ps-out { color: var(--danger); }

.pos-cart { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 92px); overflow-y: auto; padding: 16px; }
.cart-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cart-head h3 { margin: 0; font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.cart-head h3 .ic { color: var(--primary); }
.cart-head-actions { display: flex; gap: 6px; align-items: center; }
.cart-customer { display: flex; gap: 8px; }
.select-ic { position: relative; flex: 1; min-width: 0; }
.select-ic > .ic { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.select-ic .input { padding-inline-start: 36px; }
.cust-note { display: flex; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--warn); background: var(--warn-soft); padding: 8px 10px; border-radius: 9px; }
.cust-note .ic { width: 16px; height: 16px; }
.pos-cart > *:not(.cart-lines) { flex-shrink: 0; }
.cart-lines { display: flex; flex-direction: column; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); flex: 1 1 auto; min-height: 175px; overflow-y: auto; overscroll-behavior: contain; }
.cart-lines > .empty { padding: 20px 10px; }
/* scroll shadows: visible only when there is more to scroll */
.cart-lines { background: linear-gradient(var(--surface) 30%, transparent) top / 100% 28px no-repeat local, linear-gradient(transparent, var(--surface) 70%) bottom / 100% 28px no-repeat local, radial-gradient(farthest-side at 50% 0, rgba(15, 23, 42, .14), transparent) top / 100% 10px no-repeat scroll, radial-gradient(farthest-side at 50% 100%, rgba(15, 23, 42, .14), transparent) bottom / 100% 10px no-repeat scroll; background-color: var(--surface); }
.cline { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.cline:last-child { border-bottom: 0; }
.cline-name { font-weight: 700; font-size: 13.5px; line-height: 1.35; }
.cline-price { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cline-price .link-btn { font-size: 12px; font-weight: 700; }
.cline-total { text-align: end; display: flex; flex-direction: column; min-width: 78px; font-size: 13.5px; }
.cline-total small { font-size: 11.5px; }
.cline-rm { width: 30px; height: 30px; }
.cline-rm .ic { width: 16px; height: 16px; }
.cline-disc { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.cline-disc label { display: flex; gap: 4px; align-items: center; font-weight: 600; }
.cline-disc .ic { width: 15px; height: 15px; }
.cline-disc .input { width: 100px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; height: 34px; background: var(--surface); }
.qty button { width: 30px; height: 100%; border: 0; background: var(--surface-2); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.qty button:hover { background: var(--surface-3); }
.qty button .ic { width: 15px; height: 15px; }
.qty input { width: 38px; height: 100%; border: 0; text-align: center; font: inherit; font-weight: 800; background: var(--surface); color: var(--text); outline: none; padding: 0; }
.cart-summary { display: flex; flex-direction: column; gap: 8px; }
.sum-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13.5px; }
.sum-row > span:first-child { color: var(--muted); font-weight: 600; }
.sum-total { font-size: 21px; font-weight: 800; padding-top: 8px; border-top: 1px solid var(--border); }
.sum-total > span:first-child { color: var(--text); font-weight: 800; }
.disc-input { display: flex; gap: 6px; align-items: center; }
.disc-input .input { width: 92px; }
.pay-methods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pm { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; border-radius: 11px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; font-size: 12px; font-weight: 800; color: var(--text-2); white-space: nowrap; min-width: 0; }
.pm span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pm .ic { width: 20px; height: 20px; }
.pm:hover { border-color: var(--border-strong); }
.pm.active { border-color: var(--pm); background: var(--pm-soft); color: var(--pm); }
.pm-cash { --pm: #0f9f8a; --pm-soft: rgba(15, 159, 138, .1); }
.pm-instapay { --pm: #6d4fd8; --pm-soft: rgba(109, 79, 216, .1); }
.pm-vodafone { --pm: #e3343f; --pm-soft: rgba(227, 52, 63, .08); }
.pm-credit { --pm: #d97706; --pm-soft: rgba(217, 119, 6, .1); }
[data-theme="dark"] .pm-instapay { --pm: #a78bfa; }
[data-theme="dark"] .pm-vodafone { --pm: #f87171; }
[data-theme="dark"] .pm-credit { --pm: #fbbf24; }
[data-theme="dark"] .pm-cash { --pm: #2dd4bf; }
.pay-extra { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pay-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pay-row label { font-size: 12.5px; font-weight: 700; color: var(--text-2); flex: none; }
.pay-row > .input-group, .pay-row > .input { flex: 1; max-width: 62%; }
.pay-result { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; padding: 8px 11px; border-radius: 9px; background: var(--surface-2); }
.pay-result > span { color: var(--muted); font-weight: 600; }
.pay-result.small { font-size: 12.5px; }
.pay-warn { display: flex; gap: 8px; align-items: center; color: var(--warn); background: var(--warn-soft); padding: 10px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.quick-amounts { display: flex; gap: 6px; flex-wrap: wrap; }
.quick-amounts .chip { height: 30px; font-size: 12.5px; }
.pos-finish { gap: 10px; }
.pos-finish b { margin-inline-start: auto; font-size: 17px; }
.pos-finish kbd { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); color: #fff; }
.pos-cartbar { display: none; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }

/* ───────── modal, toast ───────── */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(2, 6, 23, .52); display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; transition: opacity .15s; }
.overlay.show { opacity: 1; }
.modal { background: var(--surface); color: var(--text); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; transform: translateY(8px) scale(.985); transition: transform .18s; border: 1px solid var(--border); }
.overlay.show .modal { transform: none; }
.modal-sm { max-width: 430px; }
.modal-lg { max-width: 900px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 800; }
.modal-body { padding: 18px; overflow: auto; flex: 1; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; flex-wrap: wrap; }
.me-auto { margin-inline-end: auto; }
.confirm-body { display: flex; gap: 14px; align-items: flex-start; }
.confirm-body p { margin: 4px 0 0; line-height: 1.65; }
.confirm-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--info-soft); color: var(--info); flex: none; }
.confirm-ic.danger { background: var(--danger-soft); color: var(--danger); }
#toast-root { position: fixed; z-index: 200; inset-inline: 0; bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--tip-bg); color: var(--tip-text); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 700; font-size: 13.5px; transform: translateY(12px); opacity: 0; transition: transform .2s, opacity .2s; max-width: 520px; }
.toast.show { transform: none; opacity: 1; }
.toast-success .ic { color: #10b981; }
.toast-error .ic { color: #ef4444; }
.toast-info .ic { color: #3b82f6; }

.success-banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--success-soft); margin-bottom: 14px; }
.success-banner > .ic { width: 30px; height: 30px; padding: 5px; border-radius: 50%; background: #16a34a; color: #fff; }
.success-banner b { display: block; font-size: 15px; color: var(--success); }
.success-banner span { font-size: 13px; color: var(--text-2); }
.inv-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.paper-wrap { background: var(--surface-3); border-radius: 12px; padding: 18px; overflow: hidden; display: flex; justify-content: center; }
.paper { background: #fff; color: #111; box-shadow: 0 2px 12px rgba(15, 23, 42, .16); border-radius: 3px; flex: none; }
.pay-head { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pay-head > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; min-width: 0; }
.pay-head span { font-size: 12px; color: var(--muted); font-weight: 700; }
.pay-head b { font-size: 15px; }
.si-head, .si-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 120px 38px; gap: 8px; align-items: center; }
.si-head { font-size: 12px; font-weight: 800; color: var(--muted); margin: 16px 0 6px; }
#si-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.si-total { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; text-align: end; }
.margin-box { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); font-size: 13px; }
.cat-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; }
.cat-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.cat-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }

/* ───────── customers ───────── */
.profile { display: flex; flex-direction: column; gap: 16px; }
.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-head h2 { margin: 0 0 2px; font-size: 19px; font-weight: 800; }
.profile-head .muted { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.profile-head .muted .ic { width: 15px; height: 15px; }
.profile-addr { font-size: 13px; color: var(--muted); }
.note-chip { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; background: var(--info-soft); color: var(--info); padding: 3px 9px; border-radius: 7px; }
.balance-box { border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.balance-box.owes { background: var(--danger-soft); color: var(--danger); }
.balance-box.clear { background: var(--success-soft); color: var(--success); }
.balance-box > span { font-size: 12.5px; font-weight: 800; }
.balance-box > b { font-size: 28px; font-weight: 800; }
.limit { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.limit-bar { height: 7px; border-radius: 7px; background: rgba(127, 127, 127, .18); overflow: hidden; }
.limit-bar span { display: block; height: 100%; background: var(--warn); border-radius: 7px; }
.limit-bar span.hot { background: var(--danger); }
.limit small { font-size: 12px; color: var(--text-2); }
.ledger td:nth-child(2) { min-width: 190px; }
@media (max-width: 640px) {
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tfoot { display: block; width: 100%; }
  .ledger tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
  .ledger tbody tr:last-child { border-bottom: 0; }
  .ledger td { padding: 0 !important; border: 0 !important; background: none !important; min-width: 0 !important; }
  .ledger .l-desc { order: 1; flex: 1 1 calc(100% - 130px); font-weight: 700; }
  .ledger .l-bal { order: 2; margin-inline-start: auto; }
  .ledger .l-date { order: 3; font-size: 12px; color: var(--muted); }
  .ledger .l-amt { order: 4; font-size: 12.5px; }
  .ledger .l-amt::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 600; }
  .ledger .l-act { order: 5; margin-inline-start: auto; width: auto; }
  .ledger .l-act .icon-btn { width: 30px; height: 30px; }
  .ledger .is-empty { display: none; }
  .ledger tfoot tr { background: var(--surface-2); }
}

/* ───────── settings & reports ───────── */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-preview { width: 66px; height: 66px; border-radius: 12px; border: 1px dashed var(--border-strong); display: grid; place-items: center; overflow: hidden; background: var(--surface-2); }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-row .field-hint { flex-basis: 100%; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); background: color-mix(in srgb, var(--danger) 5%, transparent); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.about-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.about-brand b { font-size: 17px; }
.about-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.about-list li { display: flex; gap: 10px; align-items: center; font-size: 13.5px; }
.about-list .ic { color: var(--primary); }
.rep-toolbar { justify-content: space-between; }
.rep-custom { display: flex; gap: 10px; flex-wrap: wrap; }
.rep-range { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.rep-range .ic { width: 16px; height: 16px; }

/* ───────── printable documents (screen preview + print) ───────── */
.rc { width: 80mm; padding: 5mm 4mm 7mm; font-family: Tahoma, "Segoe UI", Arial, sans-serif; font-size: 11.5px; line-height: 1.5; color: #000; background: #fff; }
.rc-center { text-align: center; }
.rc-logo { display: flex; justify-content: center; margin-bottom: 2mm; }
.rc-logo img { max-width: 38mm; max-height: 18mm; object-fit: contain; }
.rc-logo svg { width: 12mm; height: 12mm; }
.rc-shop { font-size: 15px; font-weight: 700; }
.rc-small { font-size: 10.5px; color: #333; }
.rc-hr { border-top: 1px dashed #000; margin: 2.2mm 0; }
.rc-title { font-weight: 700; font-size: 12.5px; margin-bottom: 1mm; }
.rc-row { display: flex; justify-content: space-between; gap: 3mm; }
.rc-row > span:last-child, .rc-row > b:last-child { text-align: end; }
.rc-items { width: 100%; border-collapse: collapse; font-size: 11px; }
.rc-items th { font-weight: 700; text-align: start; border-bottom: 1px solid #000; padding-bottom: 1mm; font-size: 10.5px; }
.rc-items td { padding: .5mm 0; vertical-align: top; }
.rc-items td.rc-item { font-weight: 700; padding-top: 1.6mm; }
.rc-sub td { color: #222; }
.rc-end { text-align: end !important; }
.rc-total { font-size: 15px; font-weight: 800; margin: 1mm 0; }
.rc-qr { margin: 1mm 0; display: flex; justify-content: center; }
.rc-qr svg { width: 24mm; height: 24mm; }
.rc-footer { font-size: 10.5px; margin-top: 1.5mm; }
.rc-sign { margin-top: 5mm; font-size: 10.5px; }
.rc-powered { font-size: 9px; color: #555; margin-top: 2.5mm; }
.rc .money small { opacity: 1; }

.a4 { width: 210mm; min-height: 297mm; padding: 15mm 15mm 12mm; font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-size: 12.5px; color: #111; background: #fff; display: flex; flex-direction: column; gap: 7mm; line-height: 1.5; }
.a4-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10mm; padding-bottom: 6mm; border-bottom: 2px solid #0f766e; }
.a4-brand { display: flex; gap: 4mm; align-items: center; }
.a4-logo img { max-width: 34mm; max-height: 20mm; object-fit: contain; }
.a4-logo svg { width: 16mm; height: 16mm; display: block; }
.a4-shop { font-size: 20px; font-weight: 800; }
.a4-muted { color: #555; font-size: 11.5px; }
.a4-titlebox { text-align: end; }
.a4-title { font-size: 22px; font-weight: 800; color: #0f766e; }
.a4-no { font-size: 14px; font-weight: 700; color: #333; }
.a4-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
.a4-meta > div { background: #f3f6f8; border-radius: 3mm; padding: 3mm 4mm; display: flex; flex-direction: column; }
.a4-meta span { font-size: 10.5px; color: #667; font-weight: 700; }
.a4-meta b { font-size: 13px; }
.a4-meta small { font-size: 11px; color: #555; }
.a4-table { width: 100%; border-collapse: collapse; }
.a4-table th { background: #0f766e; color: #fff; font-weight: 700; font-size: 11.5px; padding: 2.5mm 3mm; text-align: start; }
.a4-table td { padding: 2.4mm 3mm; border-bottom: 1px solid #e3e8ee; }
.a4-table tbody tr:nth-child(even) td { background: #f9fafb; }
.a4-table .a4-end { text-align: end; }
.a4-prod { font-weight: 600; }
.a4-empty { text-align: center; color: #777; padding: 8mm !important; }
.a4-bottom { display: flex; justify-content: space-between; gap: 10mm; align-items: flex-start; }
.a4-notes { flex: 1; font-size: 11.5px; color: #444; }
.a4-notes p { margin: 0 0 2mm; }
.a4-qr { display: flex; align-items: center; gap: 3mm; margin-bottom: 3mm; }
.a4-qr svg { width: 24mm; height: 24mm; flex: none; }
.a4-qr small { color: #666; max-width: 32mm; }
.a4-totals { width: 74mm; display: flex; flex-direction: column; }
.a4-totals > div { display: flex; justify-content: space-between; gap: 4mm; padding: 1.8mm 0; border-bottom: 1px dashed #d5dbe2; }
.a4-grand { font-size: 16px; font-weight: 800; color: #0f766e; border-bottom: 2px solid #0f766e !important; }
.a4-due { color: #b91c1c; font-weight: 700; }
.a4-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6mm; }
.a4-signs { display: flex; justify-content: space-between; gap: 20mm; }
.a4-signs div { flex: 1; border-top: 1px solid #999; padding-top: 2mm; text-align: center; color: #555; font-size: 11px; margin-top: 12mm; }
.a4-powered { text-align: center; font-size: 10px; color: #888; }
.a4 .money small { opacity: 1; }

#print-area { display: none; }
@media print {
  html, body { background: #fff !important; color: #000 !important; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  #print-area .a4 { width: auto; min-height: 0; padding: 0; }
  #print-area .rc { margin: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ───────── responsive ───────── */
@media (max-width: 1240px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > :last-child { grid-column: 1 / -1; }
  .pos { grid-template-columns: minmax(0, 1fr) 370px; }
}
@media (max-width: 1100px) {
  .kpis:not(.kpis-3) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .grid-profile { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .hide-md { display: none; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; height: auto; transform: translateX(100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); z-index: 90; }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .app.drawer-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .48); z-index: 85; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .only-mobile { display: inline-grid; }
  .bottomnav { display: flex; position: fixed; bottom: 0; inset-inline: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(15, 23, 42, .06); gap: 2px; }
  .bottomnav a, .bottomnav button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; color: var(--muted); text-decoration: none; font: inherit; font-size: 11px; font-weight: 700; background: none; border: 0; cursor: pointer; position: relative; }
  .bottomnav .ic { width: 22px; height: 22px; }
  .bottomnav .active { color: var(--primary); background: var(--primary-soft); }
  .bottomnav .nav-badge { position: absolute; top: 1px; inset-inline-start: calc(50% + 4px); margin: 0; height: 17px; min-width: 17px; font-size: 10px; padding: 0 4px; }
  .view { padding: 14px 14px 96px; }
  .topbar { padding: 8px 12px; min-height: 58px; gap: 6px; }
  .topbar-title h1 { font-size: 16.5px; }
  .pos { grid-template-columns: 1fr; }
  .pos-search { top: 66px; }
  .pos-cart { position: fixed; inset: 0; z-index: 95; max-height: none; border-radius: 0; border: 0; transform: translateY(105%); transition: transform .25s ease; padding: 14px 14px calc(16px + env(safe-area-inset-bottom)); visibility: hidden; }
  .pos.cart-open .pos-cart { transform: none; visibility: visible; }
  .pos-cartbar { display: flex; position: fixed; inset-inline: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 45; height: 54px; align-items: center; gap: 10px; padding: 0 16px; border-radius: 14px; border: 0; background: var(--primary); color: #fff; font: inherit; font-size: 14px; font-weight: 800; box-shadow: 0 10px 26px rgba(15, 118, 110, .38); cursor: pointer; }
  .pos-cartbar b { margin-inline-start: auto; font-size: 16px; }
  .pos-cartbar .badge { background: rgba(255, 255, 255, .22); color: #fff; }
  .pos-cartbar.bump { animation: bump .3s; }
  .view-pos .pgrid { padding-bottom: 72px; }
  #toast-root { bottom: 86px; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .hide-sm { display: none !important; }
  .only-sm { display: inline; }
  .only-sm-block { display: block; font-size: 11.5px; margin-top: 2px; }
  .table .mbadge .mb-t { display: none; }
  .table .mbadge { padding: 0 6px; }
  .prod-cell .cat-ic { display: none; }
  .prod-cell { gap: 8px; }
  .rep-name { min-width: 120px; }
  .card { padding: 14px; }
  .card:not(.no-pad) > .table-wrap { margin: 0 -14px -14px; }
  .card-head.padded { padding: 12px 14px; }
  .kpis { gap: 10px; }
  .kpi { padding: 12px 13px; }
  .kpi-value { font-size: 19px; margin-top: 8px; }
  .kpi-label { font-size: 12px; }
  .kpi-ic { display: none; }
  .kpi-label { white-space: normal; line-height: 1.3; }
  .kpis-3 { grid-template-columns: 1fr 1fr; }
  .kpis-3 > :last-child { grid-column: 1 / -1; }
  .grid-3 { grid-template-columns: 1fr; }
  .page-head .seg { flex: 1 1 100%; }
  .page-head .seg button { flex: 1; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .toolbar .search-box { flex-basis: 100%; }
  .toolbar > select.input { flex: 1 1 40%; min-width: 0; }
  .mini-field { flex: 1 1 40%; min-width: 0; }
  .mini-field .date-field, .mini-field .date-field .input { flex: 1; width: 100%; min-width: 0; }
  .toolbar-end { width: 100%; margin: 0; }
  .toolbar-end .btn { flex: 1; }
  .stat-strip > div { flex: 1 1 45%; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .stat-strip b { font-size: 15px; }
  .table th, .table td { padding: 10px 8px; }
  .table th:first-child, .table td:first-child { padding-inline-start: 14px; }
  .table th:last-child, .table td:last-child { padding-inline-end: 14px; }
  .prod-cell { min-width: 0; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ptile { min-height: 124px; padding: 10px; }
  .ptile-name { font-size: 13px; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal { max-width: none !important; border-radius: 18px 18px 0 0; max-height: 94vh; }
  .modal-foot { border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .si-head { display: none; }
  .si-row { grid-template-columns: 1fr 1fr 38px; }
  .si-row select { grid-column: 1 / -1; }
  .cat-form { grid-template-columns: 1fr; }
  .btn-grid { grid-template-columns: 1fr; }
  .lang-btn { padding: 0 9px; }
  .topbar-actions { gap: 2px; }
  .paper-wrap { padding: 10px; }
  .legend { gap: 10px; font-size: 12px; }
}
@media (max-width: 380px) {
  .kpis:not(.kpis-3) { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 17px; }
  .pm { font-size: 11px; }
}
