/* TawfeerNet — white & violet, mobile-first. Shared by app.js (demo/pilot) and prod.js (production). */
@font-face {
  font-family: "Noto Sans Arabic";
  src: url("/fonts/noto-sans-arabic-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans Arabic";
  src: url("/fonts/noto-sans-arabic-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
:root {
  --bg: #f6f4fb;
  --surface: #ffffff;
  --surface-2: #faf8ff;
  --surface-3: #f1edfb;
  --line: #e6e1f2;
  --line-strong: #d6cfea;
  --text: #1d1530;
  --muted: #5f5778;
  --faint: #7d7596;
  --primary: #6d28d9;
  --primary-600: #7c3aed;
  --primary-700: #5b21b6;
  --primary-soft: #efe9fd;
  --primary-ring: rgba(124, 58, 237, .22);
  --primary-text: #5b21b6;
  --text-2: #3f3656;
  --glass: rgba(255, 255, 255, .94);
  --green: #15803d;
  --green-soft: #e3f6ea;
  --blue: #1d4ed8;
  --blue-soft: #e5edff;
  --yellow: #a15c07;
  --yellow-soft: #fdf1d8;
  --red: #c42b2b;
  --red-soft: #fde8e8;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(40, 20, 90, .06), 0 1px 1px rgba(40, 20, 90, .04);
  --shadow: 0 10px 30px rgba(60, 30, 130, .10);
  --shadow-lg: 0 24px 60px rgba(60, 30, 130, .22);
  --nav-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
  font-family: "Noto Sans Arabic", "Geeza Pro", Tahoma, "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.25em; }
code { direction: ltr; unicode-bidi: embed; background: var(--surface-3); border-radius: 6px; padding: 1px 6px; font-size: .85em; word-break: break-all; }
/* Solid, high-contrast ring (the 24% alpha ring was ~1.35:1, under the 3:1 UI minimum). */
:focus-visible { outline: 3px solid var(--primary-text); outline-offset: 2px; }

/* ------------------------------------------------------------ ribbon */
.demo-ribbon {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 14px; background: var(--primary-700); color: #efe9ff; font-size: .82rem; text-align: center;
}
.demo-ribbon strong { color: #fff; background: rgba(255,255,255,.16); padding: 1px 8px; border-radius: 99px; }

/* -------------------------------------------------------------- auth */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); }

/* Focused sign-in (selected concept B): concise, branded and viewport-fitted. */
.auth-login-page { width: 100%; height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: radial-gradient(ellipse at 96% 40%, color-mix(in srgb, var(--primary) 10%, transparent) 0, transparent 34%), var(--bg); }
.auth-login-header { height: 72px; min-height: 72px; padding: 0 clamp(18px, 5vw, 64px); display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.auth-login-header .brand { min-width: 0; font-size: 1.06rem; }
.auth-login-header .brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
.auth-header-actions { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.auth-header-actions .btn-icon { width: 38px; height: 38px; min-height: 38px; }
/* Auto margins centre the card but never push its top out of reach; the area
   scrolls only when the card truly does not fit (landscape, large system font). */
.auth-login-main { flex: 1; min-height: 0; display: grid; overflow-x: hidden; overflow-y: auto; padding: 20px; }
.auth-login-card { width: min(100%, 444px); margin: auto; padding: 30px 34px 24px; border: 1px solid var(--line); border-top: 4px solid var(--primary); border-radius: 20px; box-shadow: 0 20px 54px rgba(43, 25, 78, .11); }
.auth-login-heading { margin: 0 0 22px; }
.auth-eyebrow { color: var(--primary-text); font-size: .78rem; font-weight: 800; letter-spacing: .01em; }
.auth-login-heading h1 { margin: 5px 0 4px; font-size: 1.55rem; line-height: 1.35; letter-spacing: -.02em; }
.auth-login-heading p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.auth-login-fields { display: grid; gap: 14px; }
.auth-login-fields .field { gap: 6px; margin: 0; }
.auth-login-fields .field label { font-size: .83rem; font-weight: 700; }
.auth-login-fields .field input { min-height: 50px; border-radius: 11px; font-size: .96rem; }
.auth-login-fields .field input::placeholder { color: #a19aaa; }
.auth-login-fields .field input[type="email"] { direction: ltr; text-align: left; }
.auth-login-card .field-error { margin-top: 12px; }
.auth-login-card .field-error[hidden] { display: none; }
.auth-submit { width: 100%; min-height: 50px; margin-top: 18px; border-radius: 12px; font-size: .98rem; }
.auth-recovery-link { display: block; width: 100%; min-height: 42px; margin-top: 7px; padding: 7px 4px; border: 0; background: transparent; color: var(--primary-text); text-align: center; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; }
.auth-recovery-link:hover, .auth-login-footer a:hover { color: var(--primary-700); text-decoration: underline; }
.auth-login-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.auth-login-footer a, .auth-login-footer span { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; white-space: nowrap; }
.auth-login-footer svg.i { width: 15px; height: 15px; color: var(--primary-text); }
.auth-aside {
  position: relative; overflow: hidden; padding: clamp(34px, 6vw, 82px); display: flex; flex-direction: column; justify-content: center; color: #fff;
  background: radial-gradient(circle at 15% 10%, rgba(255,255,255,.18) 0, transparent 40%), linear-gradient(150deg, #7c3aed 0%, #5b21b6 55%, #3b0f8c 100%);
}
.auth-aside::after { content: ''; position: absolute; width: 360px; height: 360px; border-radius: 50%; left: -120px; bottom: -140px; background: rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1.2rem; font-weight: 800; }
.brand-mark { width: 42px; height: 42px; flex: 0 0 42px; border-radius: 13px; display: grid; place-items: center; overflow: hidden; background: #fff; box-shadow: 0 5px 14px rgba(32, 18, 76, .16); }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.auth-aside .brand-mark { background: #fff; box-shadow: 0 5px 14px rgba(12, 8, 41, .22); }
.brand small { display: block; color: var(--muted); font-size: .8rem; font-weight: 500; margin-top: 1px; }
.auth-aside .brand small { color: #ddd0ff; }
.hero-title { margin: 44px 0 14px; max-width: 620px; font-size: clamp(1.9rem, 4vw, 3.4rem); line-height: 1.2; }
.hero-title span { color: #e3d6ff; }
.hero-copy { max-width: 560px; line-height: 1.8; color: #e9e0ff; }
.safety-list { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 12px; color: #f1ebff; position: relative; z-index: 1; }
.safety-list li { display: flex; gap: 10px; align-items: center; }
.safety-list i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.18); font-style: normal; flex: none; }
.auth-panel { padding: clamp(20px, 5vw, 66px); display: flex; align-items: center; justify-content: center; }
.login-card { width: min(100%, 420px); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 28px 24px; }
.login-card h1 { margin: 0 0 6px; font-size: 1.5rem; }
.login-card p { color: var(--muted); line-height: 1.7; margin: 0 0 18px; }
.login-icon { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; margin-bottom: 14px; background: var(--primary-soft); color: var(--primary-text); }
.login-icon svg.i { width: 30px; height: 30px; }
.role-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 18px; background: var(--surface-3); padding: 5px; border-radius: 13px; }
.role-tabs button { border: 0; border-radius: 9px; color: var(--muted); padding: 10px; background: transparent; font-weight: 600; }
.role-tabs button.active { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-sm); }
@media (max-width: 600px) {
  .auth-login-header { height: 62px; min-height: 62px; padding-inline: 16px; }
  .auth-login-header .brand { gap: 9px; font-size: .94rem; }
  .auth-login-header .brand-mark { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
  .auth-header-actions { gap: 0; }
  .auth-header-actions > span { display: none; }
  .auth-header-actions .btn-icon { width: 36px; height: 36px; min-height: 36px; }
  .auth-login-main { padding: 14px; }
  .auth-login-card { padding: 24px 22px 19px; border-radius: 18px; }
  .auth-login-heading { margin-bottom: 18px; }
  .auth-login-heading h1 { font-size: 1.4rem; }
  .auth-login-fields { gap: 12px; }
  .auth-login-fields .field input { min-height: 48px; }
  .auth-submit { min-height: 48px; margin-top: 15px; }
  .auth-login-footer { margin-top: 11px; padding-top: 11px; }
}
@media (max-height: 680px) {
  .auth-login-header { height: 58px; min-height: 58px; }
  .auth-login-main { padding-block: 8px; }
  .auth-login-card { padding-block: 18px 16px; }
  .auth-login-heading { margin-bottom: 13px; }
  .auth-login-heading h1 { margin-block: 3px; font-size: 1.32rem; }
  .auth-login-heading p { font-size: .82rem; }
  .auth-login-fields { gap: 9px; }
  .auth-login-fields .field { gap: 4px; }
  .auth-login-fields .field input { min-height: 44px; }
  .auth-submit { min-height: 45px; margin-top: 11px; }
  .auth-recovery-link { min-height: 35px; margin-top: 3px; }
  .auth-login-footer { margin-top: 8px; padding-top: 8px; }
}

/* ------------------------------------------------------------- forms */
.field { display: grid; gap: 7px; margin: 14px 0; }
.field label { color: var(--text-2); font-size: .88rem; font-weight: 600; }
.field input, .field select, .field textarea, textarea.codes {
  width: 100%; min-height: 50px; border-radius: var(--radius-sm); padding: 12px 14px; border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; font-size: 1rem;
}
.field input:focus, .field select:focus, .field textarea:focus, textarea.codes:focus { border-color: var(--primary-600); box-shadow: 0 0 0 4px var(--primary-ring); }
.field input[readonly] { background: var(--surface-2); }
textarea.codes { direction: ltr; font-family: ui-monospace, Consolas, monospace; min-height: 180px; resize: vertical; }
.hint { color: var(--muted); font-size: .8rem; }
.help-credentials { margin-top: 16px; padding: 13px 14px; border-radius: var(--radius-sm); background: var(--primary-soft); color: var(--primary-text); font-size: .86rem; line-height: 1.8; }
.help-credentials.good { background: var(--green-soft); color: var(--green); }

/* ----------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  border: 1.5px solid transparent; border-radius: var(--radius-sm); padding: 10px 16px; color: var(--text); background: var(--surface-3);
  font-weight: 600; text-decoration: none; transition: transform .12s, background .15s, box-shadow .15s, opacity .15s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-700)); box-shadow: 0 8px 18px rgba(109, 40, 217, .28); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--primary-600), var(--primary)); }
.btn-secondary { border-color: var(--line-strong); background: var(--surface); color: var(--primary-text); }
.btn-danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); }
.btn-ghost { border-color: var(--line); color: var(--muted); background: transparent; }
.btn-success { color: #fff; background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 8px 18px rgba(109, 40, 217, .3); }
.btn-block { width: 100%; margin-top: 12px; }
.btn-lg { min-height: 58px; font-size: 1.1rem; border-radius: 15px; }
.btn-icon { width: 44px; padding: 0; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .85rem; }

/* ------------------------------------------------------------- shell */
.app-shell { min-height: 100vh; }
.topbar {
  height: 64px; position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 0 20px; background: var(--glass); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.topbar .brand { font-size: 1.02rem; }
.topbar .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
.user-area { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .88rem; min-width: 0; }
.user-name { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--text); }
.user-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary-600); box-shadow: 0 0 0 4px var(--primary-soft); flex: none; }
.main-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.sidebar { padding: 18px 14px; background: var(--surface); border-left: 1px solid var(--line); }
.nav-label { padding: 6px 12px; color: var(--faint); font-size: .8rem; font-weight: 700; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: right; padding: 12px 14px; margin: 3px 0;
  background: transparent; border: 0; border-radius: 12px; color: var(--text-2); font-weight: 600; position: relative;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-text); }
.nav-item .icon { width: 24px; display: grid; place-items: center; }
.nav-item .badge { margin-inline-start: auto; }
.bottom-nav { display: none; }
.content { min-width: 0; padding: clamp(16px, 3vw, 32px); max-width: 1320px; width: 100%; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 4px 0 22px; }
.page-header h1 { margin: 0; font-size: clamp(1.4rem, 2.5vw, 1.9rem); }
.page-header p { color: var(--muted); margin: 6px 0 0; line-height: 1.7; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--primary-text); background: none; border: 0; padding: 0; font-weight: 700; margin-bottom: 10px; }

/* ------------------------------------------------------ cards, stats */
.grid { display: grid; gap: 14px; }
.stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat { padding: 16px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; }
.stat-icon { grid-row: span 3; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.stat-icon.good { background: var(--primary-soft); color: var(--primary-text); }
.stat-icon.warn { background: var(--yellow-soft); color: var(--yellow); }
.stat-icon.bad { background: var(--red-soft); color: var(--red); }
.stat-label { color: var(--muted); font-size: .84rem; }
.stat-value { font-size: 1.45rem; font-weight: 800; line-height: 1.2; }
.stat-note { color: var(--faint); font-size: .82rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: 99px; padding: 8px 14px; font-weight: 600; font-size: .88rem; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.section { padding: 18px; }
.section h2 { font-size: 1.05rem; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.section h2 svg.i { color: var(--primary-text); }
.detail-layout { grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); align-items: start; }
.detail-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.detail-line strong { color: var(--text); }
.stock-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.stock-row:last-child, .detail-line:last-child { border-bottom: 0; }
.stock-name { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.cat-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--cat-color, var(--primary)); }

/* ------------------------------------------------------------ tables */
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; text-align: right; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
th { color: var(--muted); font-size: .82rem; background: var(--surface-2); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td .muted { font-size: .82rem; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.badge { display: inline-flex; gap: 5px; align-items: center; border-radius: 99px; padding: 4px 10px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.badge.good { color: var(--green); background: var(--green-soft); }
.badge.warn { color: var(--yellow); background: var(--yellow-soft); }
.badge.bad { color: var(--red); background: var(--red-soft); }
.badge.neutral { color: var(--primary-text); background: var(--primary-soft); }
.muted { color: var(--muted); }
.money { font-variant-numeric: tabular-nums; font-weight: 750; }
.ltr { direction: ltr; unicode-bidi: embed; }

/* --------------------------------------------------------------- POS */
.pos-wrap { max-width: 760px; margin: 0 auto; }
.pos-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.pos-head h1 { font-size: 1.35rem; }
.balance-card {
  position: relative; overflow: hidden; padding: 18px 20px; border-radius: 20px; min-width: 230px; color: #fff;
  background: radial-gradient(circle at 10% 0%, rgba(255,255,255,.22) 0, transparent 45%), linear-gradient(135deg, #7c3aed, #5b21b6);
  box-shadow: 0 14px 30px rgba(91, 33, 182, .28);
}
.balance-card small { color: #e6dcff; font-size: .85rem; }
.balance-card strong { display: block; margin-top: 2px; font-size: 1.7rem; }
.balance-card .balance-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: .82rem; color: #e6dcff; }
.pos-board { padding: clamp(16px, 4vw, 26px); }
.step-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 1.05rem; }
.step-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-size: .85rem; font-weight: 800; flex: none; }
.category-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 0 0 22px; }
.category {
  position: relative; min-height: 104px; text-align: center; padding: 14px 8px 12px; background: var(--surface); border: 2px solid var(--line);
  border-radius: 16px; color: var(--text); overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .12s;
}
.category::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--cat-color, var(--primary)); }
.category:hover:not(:disabled) { border-color: var(--primary-600); }
.category:active:not(:disabled) { transform: scale(.98); }
.category.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 4px var(--primary-ring); }
.category.selected::after { content: '✓'; position: absolute; top: 9px; left: 9px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .8rem; display: grid; place-items: center; }
.category.disabled { opacity: .45; cursor: not-allowed; background: var(--surface-2); }
.category-value { display: block; font-size: 1.55rem; font-weight: 850; line-height: 1.1; }
.category-value small { font-size: .8rem; font-weight: 600; color: var(--muted); margin-inline-start: 3px; }
.category-price { display: block; color: var(--muted); margin-top: 6px; font-size: .8rem; line-height: 1.5; }
.stock-pill { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 99px; background: var(--green-soft); color: var(--green); font-weight: 700; font-size: .8rem; }
.stock-pill.low { background: var(--yellow-soft); color: var(--yellow); }
.stock-pill.out { background: var(--red-soft); color: var(--red); }
.pos-form { max-width: 560px; margin: auto; }
.phone-wrap { position: relative; }
.phone-wrap .prefix { position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; direction: ltr; pointer-events: none; }
.phone-input { direction: ltr; text-align: center; letter-spacing: .1em; font-weight: 800; font-size: clamp(1.55rem, 6vw, 2rem) !important; min-height: 64px !important; padding: 12px 16px !important; }
.sale-preview { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; color: var(--text-2); margin: 12px 0 0; padding: 10px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 12px; font-size: .92rem; }
.warning-inline { min-height: 26px; margin-top: 8px; color: var(--yellow); font-size: .86rem; text-align: center; font-weight: 600; }
.sale-btn { width: 100%; min-height: 58px; margin-top: 6px; font-size: 1.12rem; border-radius: 15px; }
.pos-recent { margin-top: 16px; padding: 16px; }
.pos-recent h3 { display: flex; align-items: center; justify-content: space-between; font-size: 1rem; margin: 0 0 8px; }
.recent-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.recent-item:last-child { border-bottom: 0; }
.recent-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.recent-cat { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; flex: none; font-weight: 850; font-size: .95rem; color: var(--text); background: color-mix(in srgb, var(--cat-color, var(--primary)) 18%, var(--surface)); border: 2px solid color-mix(in srgb, var(--cat-color, var(--primary)) 60%, transparent); }
.recent-text { min-width: 0; }
.recent-text strong { display: block; direction: ltr; text-align: right; }
.recent-text span { color: var(--muted); font-size: .8rem; }

/* ------------------------------------------------- modal / bottom sheet */
.modal-backdrop { position: fixed; inset: 0; z-index: 60; padding: 18px; display: grid; place-items: center; background: rgba(29, 12, 64, .45); backdrop-filter: blur(4px); animation: fade .15s ease-out; }
.modal { width: min(100%, 470px); max-height: calc(100vh - 36px); overflow: auto; padding: 24px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal h2 { font-size: 1.25rem; margin: 0 0 6px; }
.modal p { color: var(--muted); line-height: 1.65; margin: 0 0 12px; }
.modal-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1 1 140px; }
.sheet-handle { display: none; }

/* Sale confirmation & success */
.confirm-icon, .done-icon { width: 76px; height: 76px; margin: 2px auto 12px; border-radius: 50%; display: grid; place-items: center; }
.confirm-icon { background: var(--primary-soft); color: var(--primary-text); }
.confirm-icon svg.i, .done-icon svg.i { width: 40px; height: 40px; }
.done-icon { background: var(--primary-soft); color: var(--primary-text); animation: pop .3s ease-out; }
.done-icon svg.i { stroke-width: 3; }
.confirm-title { text-align: center; }
.confirm-title h2 { margin: 0; }
.confirm-title p { margin: 4px 0 14px; }
.confirm-ticket { border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden; }
.confirm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px dashed var(--line-strong); }
.confirm-row:last-child { border-bottom: 0; }
.confirm-row > span { color: var(--muted); display: flex; align-items: center; gap: 8px; }
.confirm-row > span svg.i { color: var(--primary-text); }
.confirm-row strong { font-size: 1.05rem; }
.confirm-cat { display: inline-flex; align-items: baseline; gap: 4px; padding: 6px 14px; border-radius: 12px; background: var(--primary); color: #fff; font-size: 1.35rem !important; font-weight: 850; }
.confirm-cat small { font-size: .82rem; font-weight: 600; opacity: .9; }
.confirm-phone { direction: ltr; font-size: 1.45rem !important; letter-spacing: .08em; font-weight: 850; color: var(--primary-text); }
.confirm-warning { margin-top: 12px; padding: 11px 13px; border-radius: 12px; background: var(--yellow-soft); color: var(--yellow); font-weight: 600; font-size: .88rem; display: flex; gap: 8px; align-items: flex-start; }

/* Toasts */
.toast-stack { position: fixed; z-index: 100; top: 76px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 13px 15px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); line-height: 1.55; font-size: .9rem; border-inline-start: 5px solid var(--primary); animation: slide .2s ease-out; pointer-events: auto; }
.toast.success { border-inline-start-color: var(--primary-600); }
.toast.error { border-inline-start-color: var(--red); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty svg.i { width: 40px; height: 40px; color: var(--line-strong); display: block; margin: 0 auto 8px; }
.hidden { display: none !important; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
@keyframes slide { from { opacity: 0; transform: translateY(-8px); } }
@keyframes up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------- tablet & phone */
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { padding: 26px 20px 30px; }
  .hero-title { margin: 18px 0 6px; font-size: 1.6rem; }
  .safety-list { margin-top: 14px; gap: 8px; font-size: .88rem; }
  .auth-panel { padding: 0 14px 34px; margin-top: -14px; position: relative; z-index: 2; }
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .bottom-nav {
    display: flex; position: fixed; z-index: 30; inset: auto 0 0 0; height: calc(var(--nav-h) + var(--safe-b)); padding: 6px 6px var(--safe-b);
    background: var(--glass); backdrop-filter: blur(14px); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(60, 30, 130, .06);
  }
  .bottom-nav button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--faint); font-size: .8rem; font-weight: 700; border-radius: 12px; position: relative; }
  .bottom-nav button svg.i { width: 23px; height: 23px; }
  .bottom-nav button.active { color: var(--primary-text); }
  .bottom-nav button.active svg.i { background: var(--primary-soft); border-radius: 10px; padding: 3px 12px; width: 48px; height: 29px; }
  .bottom-nav .dot { position: absolute; top: 4px; left: calc(50% - 18px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: .62rem; display: grid; place-items: center; }
  .has-bottom-nav .content { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 22px); }
  .content { padding: 16px 14px 28px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; margin-bottom: 16px; }
  .page-header .toolbar .btn { flex: 1 1 auto; }
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { padding: 0 14px; height: 60px; }
  .topbar .brand small { display: none; }
  .toast-stack { top: 68px; }

  /* Tables become stacked cards on small screens */
  .table-card { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .table-card > .section { padding: 4px 2px 10px; }
  .table-scroll { overflow: visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 6px 14px; margin-bottom: 10px; }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); text-align: left; }
  table.stack td:last-child { border-bottom: 0; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; text-align: right; flex: none; }
  table.stack td[data-label=""]::before { display: none; }
  table.stack td.cell-title { display: block; text-align: right; font-size: 1rem; padding-top: 10px; }
  table.stack td.cell-title::before { display: none; }
  table.stack td.cell-actions { justify-content: flex-end; }
  table.stack td.cell-actions::before { display: none; }
  table.stack td.cell-wide { display: block; text-align: right; }
  table.stack td.cell-wide::before { display: block; margin-bottom: 4px; }
  table.stack tr.empty-row td { justify-content: center; }
  table.stack tr.empty-row td::before { display: none; }

  /* Modals become bottom sheets */
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal { width: 100%; max-width: 560px; max-height: 92vh; border-radius: 24px 24px 0 0; padding: 12px 18px calc(20px + var(--safe-b)); animation: up .22s ease-out; }
  .sheet-handle { display: block; width: 44px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 0 auto 14px; }
  .modal-actions { position: sticky; bottom: calc(-20px - var(--safe-b)); background: var(--surface); padding: 12px 0 4px; margin-top: 14px; }
}

@media (max-width: 560px) {
  .pos-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .pos-head h1 { display: none; }
  .balance-card { min-width: 0; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category { min-height: 96px; }
  .category:last-child:nth-child(odd) { grid-column: span 2; }
  .stats-grid { gap: 10px; }
  .stat { padding: 13px; grid-template-columns: 1fr; }
  .stat-icon { grid-row: auto; width: 38px; height: 38px; border-radius: 12px; margin-bottom: 4px; }
  .stat-value { font-size: 1.25rem; }
  .user-area .user-name { display: none; }
  .login-card { padding: 22px 18px; border-radius: 20px; }
}

/* Compact phone cards & ribbon */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.title-row .badge { display: none; }
@media (max-width: 900px) {
  table.stack td.is-empty { display: none; }
  table.stack td:has(> .hide-phone) { display: none; }
  .title-row .badge { display: inline-flex; }
  table.stack tr { padding: 4px 14px; }
  table.stack td { padding: 8px 0; }
}
@media (max-width: 560px) {
  .demo-ribbon span { display: none; }
  .demo-ribbon { padding: 5px 12px; }
}

/* Balance card as a button (opens the statement) */
button.balance-card { border: 0; text-align: right; font: inherit; width: auto; cursor: pointer; display: block; }
button.balance-card:active { transform: scale(.99); }
.statement-balance { margin-bottom: 14px; }
.statement-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Install card */
.install-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px; border-radius: 18px; background: var(--surface); border: 1.5px solid var(--primary-soft); box-shadow: var(--shadow-sm); }
.install-icon img { display: block; border-radius: 12px; }
.install-text { flex: 1; min-width: 0; }
.install-text strong { display: block; font-size: .95rem; }
.install-text span { color: var(--muted); font-size: .8rem; }
.install-actions { display: flex; gap: 6px; align-items: center; }
.install-steps { margin: 4px 0 0; padding: 0 22px 0 0; display: grid; gap: 10px; line-height: 1.7; }
.install-steps li::marker { color: var(--primary-text); font-weight: 800; }

/* Statement rows */
.day-label { margin: 14px 0 4px; padding: 4px 12px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-size: .8rem; font-weight: 700; display: inline-block; }
.day-label:first-of-type { margin-top: 2px; }
.ledger-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); }
.ledger-icon.sale { background: var(--primary-soft); color: var(--primary-text); }
.ledger-icon.topup { background: var(--primary-soft); color: var(--primary-text); }
.ledger-text { flex: 1; min-width: 0; }
.ledger-text strong { display: block; font-size: .95rem; }
.ledger-text span { display: block; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.ledger-text .ledger-time { font-size: .82rem; color: var(--faint); }
.ledger-amount { text-align: left; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger-amount.pos { color: var(--primary-text); }
.ledger-amount.neg { color: var(--text); }
.ledger-amount small { display: block; color: var(--faint); font-weight: 500; font-size: .8rem; }
@media (max-width: 560px) {
  .statement-stats .stat { grid-template-columns: auto 1fr; }
  .statement-stats .stat-icon { grid-row: span 3; }
}

/* ---------------------------------------------------------------- dark mode
   Default follows the OS (prefers-color-scheme). A manual choice from the
   topbar toggle sets data-theme="dark"|"light" on <html> and overrides it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #110d1c;
    --surface: #1b1630;
    --surface-2: #211b3a;
    --surface-3: #2a2346;
    --line: #372e58;
    --line-strong: #4a3f73;
    --text: #f5f2ff;
    --text-2: #ddd5f5;
    --muted: #bdb2dc;
    --faint: #9c91bd;
    --primary: #7c3aed;
    --primary-600: #8b5cf6;
    --primary-700: #6d28d9;
    --primary-soft: #2e2455;
    --primary-ring: rgba(167, 139, 250, .38);
    --primary-text: #c9b8ff;
    --green: #5ee08f;
    --green-soft: #133a24;
    --blue: #7fb3ff;
    --blue-soft: #182c52;
    --yellow: #fcc94d;
    --yellow-soft: #3b2c0a;
    --red: #ff8a8a;
    --red-soft: #3d1616;
    --glass: rgba(27, 22, 48, .94);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
    --shadow: 0 10px 30px rgba(0, 0, 0, .55);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #110d1c;
    --surface: #1b1630;
    --surface-2: #211b3a;
    --surface-3: #2a2346;
    --line: #372e58;
    --line-strong: #4a3f73;
    --text: #f5f2ff;
    --text-2: #ddd5f5;
    --muted: #bdb2dc;
    --faint: #9c91bd;
    --primary: #7c3aed;
    --primary-600: #8b5cf6;
    --primary-700: #6d28d9;
    --primary-soft: #2e2455;
    --primary-ring: rgba(167, 139, 250, .38);
    --primary-text: #c9b8ff;
    --green: #5ee08f;
    --green-soft: #133a24;
    --blue: #7fb3ff;
    --blue-soft: #182c52;
    --yellow: #fcc94d;
    --yellow-soft: #3b2c0a;
    --red: #ff8a8a;
    --red-soft: #3d1616;
    --glass: rgba(27, 22, 48, .94);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
    --shadow: 0 10px 30px rgba(0, 0, 0, .55);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .7);
}
.theme-toggle { position: relative; }
.theme-toggle svg.i { transition: transform .25s ease; }


/* ------------------------------------------------------ card import */
.import-step { margin: 4px 0 18px; }
.import-step .step-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-weight: 800; }
.cat-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.cat-pick { min-height: 58px; border-radius: 14px; font-size: 1.25rem; font-weight: 850; color: var(--text); border: 2px solid color-mix(in srgb, var(--cat-color) 55%, transparent); background: color-mix(in srgb, var(--cat-color) 12%, var(--surface)); }
.cat-pick small { font-size: .75rem; font-weight: 600; margin-inline-start: 3px; color: var(--text-2); }
.cat-pick.selected { background: var(--cat-color); border-color: var(--cat-color); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--cat-color) 40%, transparent); }
.cat-pick.selected small { color: #fff; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 22px 14px; border: 2px dashed var(--line-strong); border-radius: 16px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone:hover, .dropzone.drag, .dropzone:focus-within { border-color: var(--primary-600); background: var(--primary-soft); }
.dropzone.has-file { border-style: solid; border-color: color-mix(in srgb, var(--primary) 55%, transparent); }
.dropzone .dz-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.dropzone.has-file .dz-icon { background: var(--primary-soft); color: var(--primary-text); }
.dropzone span:not(.dz-icon) { color: var(--muted); font-size: .85rem; }
.import-summary { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.is-file { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.is-file b { word-break: break-all; }
.is-file .btn { margin-inline-start: auto; }
.is-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.is-grid > div { padding: 10px 6px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.is-grid strong { display: block; font-size: 1.4rem; line-height: 1.2; }
.is-grid span { font-size: .8rem; color: var(--muted); }
.is-grid .is-ok { background: var(--primary-soft); } .is-grid .is-ok strong { color: var(--primary-text); }
.is-grid .is-warn strong { color: var(--yellow); } .is-grid .is-bad strong { color: var(--red); }
.import-cols { margin-top: 10px; }
.import-cols .chip small { opacity: .75; }
.paste-box { margin-top: 12px; }
.paste-box summary { cursor: pointer; color: var(--primary-text); font-weight: 700; }
.paste-box textarea { margin: 10px 0 8px; }
.text-input { width: 100%; min-height: 48px; border-radius: 12px; padding: 10px 14px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text); }
.text-input:focus { outline: none; border-color: var(--primary-600); box-shadow: 0 0 0 4px var(--primary-ring); }
.progress { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 14px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--primary-600), var(--primary)); transition: width .3s; }
.progress-text { text-align: center; margin: 6px 0 0 !important; font-size: .88rem; }
.done-hint { text-align: center; color: var(--muted); margin: 10px 0 0 !important; font-size: .9rem; }
kbd { font: inherit; font-size: .72em; padding: 1px 6px; border-radius: 6px; border: 1px solid rgba(255,255,255,.4); opacity: .85; }
@media (max-width: 560px) { .cat-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); } kbd { display: none; } }

/* ----------------------------------------------------- alert banner */
.alert-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 16px; border-radius: 14px; border: 1.5px solid; }
.alert-banner > svg.i { width: 26px; height: 26px; flex: none; }
.alert-banner div { flex: 1; min-width: 0; }
.alert-banner strong { display: block; }
.alert-banner span { display: block; font-size: .86rem; color: var(--text-2); margin-top: 2px; }
.alert-banner.bad { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 40%, transparent); color: var(--red); }
.alert-banner.info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 35%, transparent); color: var(--blue); }
.alert-banner strong { color: var(--text); }
@media (max-width: 560px) { .alert-banner { flex-wrap: wrap; } .alert-banner .btn { width: 100%; } }

.guide-link { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; color: var(--primary-text); font-weight: 700; text-decoration: none; }
.guide-link:hover { text-decoration: underline; }
a.btn-icon { text-decoration: none; color: inherit; }

/* =====================================================================
   IDENTITY LAYER — navy + blue-violet gradient + geometric lines, on white
   (inspired by the owner's reference: deep navy panels, indigo→violet
   accent, outlined chevrons/triangles, glass stat cards, bold headings)
   ===================================================================== */
:root {
  --ink: #151a2e;            /* deep navy panels */
  --ink-2: #1e2542;
  --ink-3: #2a3260;
  --accent-a: #5b6cff;       /* blue */
  --accent-b: #7c5cff;       /* violet */
  --accent-grad: linear-gradient(135deg, var(--accent-a) 0%, var(--accent-b) 100%);
  --primary: #5b5cf0;
  --primary-600: #6d6cf7;
  --primary-700: #4a45d8;
  --primary-soft: #eceeff;
  --primary-ring: rgba(91, 108, 255, .24);
  --primary-text: #4338ca;
  --bg: #f4f6fc;
  --surface-2: #f8f9ff;
  --surface-3: #eef0fb;
  --line: #e4e7f3;
  --line-strong: #d3d8ec;
  --text: #151a2e;
  --text-2: #353c5c;
  --muted: #5c6485;
  --faint: #656d8c;
  --glass: rgba(255, 255, 255, .9);
  --shadow-sm: 0 1px 2px rgba(21, 26, 46, .05), 0 2px 8px rgba(21, 26, 46, .04);
  --shadow: 0 12px 32px rgba(33, 40, 90, .10);
  --shadow-lg: 0 28px 70px rgba(21, 26, 46, .28);
  /* decorative line art (outlined chevrons + triangle), used on navy panels */
  --lines-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 400' preserveAspectRatio='xMidYMid slice'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.09' stroke-width='3'%3E%3Cpath d='M360 -40 L540 140 L360 320'/%3E%3Cpath d='M430 -80 L650 140 L430 360'/%3E%3Cpath d='M60 330 L190 120 L320 330 Z'/%3E%3Cpath d='M-40 60 C 80 10, 180 110, 300 60 S 520 10, 640 70' stroke-opacity='.06'/%3E%3C/g%3E%3C/svg%3E");
  /* very faint waves + chevrons on the white page */
  --lines-page: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 800' preserveAspectRatio='xMidYMid slice'%3E%3Cg fill='none' stroke='%235b6cff' stroke-width='2'%3E%3Cpath d='M-50 120 C 200 40, 380 200, 620 110 S 1000 30, 1260 130' stroke-opacity='.06'/%3E%3Cpath d='M-50 170 C 220 90, 400 250, 640 160 S 1020 80, 1260 180' stroke-opacity='.045'/%3E%3Cpath d='M-50 700 C 240 620, 420 760, 680 690 S 1040 610, 1260 700' stroke-opacity='.05'/%3E%3Cpath d='M960 260 L1100 400 L960 540' stroke-opacity='.05'/%3E%3C/g%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f13; --surface: #17181d; --surface-2: #1d1e24; --surface-3: #26272f;
    --line: #2e303a; --line-strong: #3d404a; --text: #f4f5f7; --text-2: #cfd2d9; --muted: #9a9ea9; --faint: #7c8090;
    --primary: #6366f2; --primary-600: #7c7ff8; --primary-700: #4f4cdd; --primary-soft: #23233a; --primary-text: #bcc0ff;
    --glass: rgba(15, 16, 20, .9);
    --lines-page: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 800' preserveAspectRatio='xMidYMid slice'%3E%3Cg fill='none' stroke='%23aeb3c2' stroke-width='2'%3E%3Cpath d='M-50 120 C 200 40, 380 200, 620 110 S 1000 30, 1260 130' stroke-opacity='.045'/%3E%3Cpath d='M-50 700 C 240 620, 420 760, 680 690 S 1040 610, 1260 700' stroke-opacity='.04'/%3E%3Cpath d='M960 260 L1100 400 L960 540' stroke-opacity='.04'/%3E%3C/g%3E%3C/svg%3E");
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f13; --surface: #17181d; --surface-2: #1d1e24; --surface-3: #26272f;
  --line: #2e303a; --line-strong: #3d404a; --text: #f4f5f7; --text-2: #cfd2d9; --muted: #9a9ea9; --faint: #7c8090;
  --primary: #6366f2; --primary-600: #7c7ff8; --primary-700: #4f4cdd; --primary-soft: #23233a; --primary-text: #bcc0ff;
  --glass: rgba(15, 16, 20, .9);
  --lines-page: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 800' preserveAspectRatio='xMidYMid slice'%3E%3Cg fill='none' stroke='%23aeb3c2' stroke-width='2'%3E%3Cpath d='M-50 120 C 200 40, 380 200, 620 110 S 1000 30, 1260 130' stroke-opacity='.045'/%3E%3Cpath d='M-50 700 C 240 620, 420 760, 680 690 S 1040 610, 1260 700' stroke-opacity='.04'/%3E%3Cpath d='M960 260 L1100 400 L960 540' stroke-opacity='.04'/%3E%3C/g%3E%3C/svg%3E");
}

/* Page: white base with soft light and faint waves */
body {
  background:
    radial-gradient(900px 480px at 100% -8%, rgba(91, 108, 255, .10), transparent 62%),
    radial-gradient(700px 420px at -10% 108%, rgba(124, 92, 255, .08), transparent 60%),
    var(--lines-page) center / cover fixed no-repeat,
    var(--bg);
  background-attachment: fixed;
}
h1, h2, h3, .page-header h1 { letter-spacing: -.01em; }
.page-header h1 { font-weight: 850; }

/* Navy ribbon with a dotted pill, like the reference badge */
.demo-ribbon { background: var(--ink); color: #c9cff2; border-bottom: 1px solid rgba(255,255,255,.06); }
.demo-ribbon strong { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); color: #fff; padding: 2px 12px 2px 10px; display: inline-flex; align-items: center; gap: 7px; }
.demo-ribbon strong::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-a); box-shadow: 0 0 0 3px rgba(91,108,255,.3); }

/* Brand mark + primary actions in the blue→violet gradient */
.brand-mark { background: var(--accent-grad); box-shadow: 0 8px 22px rgba(91, 108, 255, .38); }
/* Same blue-to-violet identity, a shade deeper so white text meets 4.5:1 (was 4.17). */
.btn-primary { background: linear-gradient(135deg, #5363f7 0%, #7254f7 100%); box-shadow: 0 10px 22px rgba(91, 108, 255, .32); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #4f5ff5, #6c4cf5); }
.chip.active, .step-num { background: var(--accent-grad); border-color: transparent; }
.nav-item.active { background: var(--primary-soft); color: var(--primary-text); box-shadow: inset -3px 0 0 var(--accent-a); }
.bottom-nav button.active svg.i { background: var(--primary-soft); }

/* Login: navy hero with outlined chevrons and a two-tone gradient headline */
.auth-aside {
  background: var(--lines-light) center / cover no-repeat, radial-gradient(700px 500px at 0% 100%, rgba(91,108,255,.35), transparent 60%), var(--ink) !important;
}
.auth-aside::after { display: none; }
.hero-title { font-weight: 900; line-height: 1.12; }
.hero-title span { background: linear-gradient(90deg, #7c8cff, #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.safety-list i { background: rgba(91,108,255,.22); border: 1px solid rgba(124,140,255,.35); }
.login-card { border-radius: 24px; box-shadow: var(--shadow); }
.login-icon { background: var(--accent-grad); color: #fff; box-shadow: 0 10px 24px rgba(91,108,255,.35); }

/* Cards and stat tiles: white glass with gradient icon tiles */
.card { border-radius: 18px; box-shadow: var(--shadow-sm); }
.stat-icon { background: var(--accent-grad); color: #fff; box-shadow: 0 8px 18px rgba(91, 108, 255, .3); }
.stat-icon.good { background: linear-gradient(135deg, #8b5cf6, #6d28d9); color: #fff; box-shadow: 0 8px 18px rgba(109, 40, 217, .3); }
.stat-icon.warn { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; box-shadow: 0 8px 18px rgba(217,119,6,.25); }
.stat-icon.bad { background: linear-gradient(135deg, #f87171, #dc2626); color: #fff; box-shadow: 0 8px 18px rgba(220,38,38,.25); }
.stat-value { font-weight: 900; font-size: 1.6rem; }

/* Confirmation / success sheets */
.confirm-icon { background: var(--accent-grad); color: #fff; box-shadow: 0 12px 26px rgba(91,108,255,.35); }
.confirm-phone { color: var(--primary-text); }
.modal { border-radius: 26px; }
.modal-backdrop { background: rgba(16, 20, 42, .55); }

/* Alerts, drop zone, pickers pick up the accent */
.dropzone .dz-icon { background: var(--accent-grad); color: #fff; }
.dropzone:hover, .dropzone.drag, .dropzone:focus-within { border-color: var(--accent-a); }
.progress > div { background: var(--accent-grad); }
.install-card { border-color: var(--primary-soft); }
.toast { border-inline-start-color: var(--accent-a); }

/* Guide pages: navy hero like the reference */
.g-hero { background: var(--lines-light) center / cover no-repeat, radial-gradient(700px 400px at 0% 100%, rgba(91,108,255,.35), transparent 60%), var(--ink) !important; }
.g-hero h1 { font-weight: 900; }
.g-sec > h2 .n { background: var(--accent-grad); color: #fff; }

@media (prefers-reduced-motion: no-preference) {
  .btn-primary, .cat-tile, .stat, .card { transition: transform .15s ease, box-shadow .15s ease; }
  .stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
}


/* ------------------------------------------------ saved numbers & favorites */
.phone-field { position: relative; }
.pos-compact .phone-field .phone-input { padding-inline: 16px 54px !important; }
.fav-name-tag { position: absolute; inset-inline-start: 12px; top: -11px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 11px; border-radius: 99px; font-size: .78rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, #f43f5e, #e11d48); box-shadow: 0 4px 10px rgba(225,29,72,.3); z-index: 2; }
.fav-name-tag svg.i { width: 13px; height: 13px; }
.suggest { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 25; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 6px; display: grid; gap: 2px; animation: pop .14s ease-out; }
.sg-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 12px; background: transparent; text-align: right; color: var(--text); }
.sg-item:hover, .sg-item:focus-visible { background: var(--primary-soft); }
.sg-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: none; }
.sg-ic.fav { background: #ffe4ea; color: #e11d48; }
.sg-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sg-text strong { font-size: .92rem; }
.sg-text span { font-size: 1rem; letter-spacing: .06em; color: var(--text-2); text-align: right; }
.sg-text span b { color: var(--primary-text); }
.sg-count { font-size: .76rem; color: var(--muted); background: var(--surface-3); padding: 2px 8px; border-radius: 99px; white-space: nowrap; }

.fav-page .page-header h1 { display: flex; align-items: center; gap: 8px; color: var(--text); }
.fav-page .page-header h1 svg.i { color: #e11d48; }
.fav-search { margin: 0 0 12px; }
.fav-list { display: grid; gap: 10px; }
.fav-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }
.fav-card[hidden], .suggest[hidden], .fav-name-tag[hidden] { display: none; }
.fav-avatar { width: 48px; height: 48px; border-radius: 16px; flex: none; display: grid; place-items: center; font-weight: 900; font-size: 1.3rem; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 85% 62%), hsl(calc(var(--h) + 30) 80% 55%)); box-shadow: 0 6px 14px hsl(var(--h) 70% 50% / .3); }
.fav-avatar.muted-av { background: var(--surface-3); color: var(--muted); box-shadow: none; }
.fav-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fav-info strong { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-info span { color: var(--text-2); letter-spacing: .05em; text-align: right; }
.fav-info small { color: var(--muted); font-size: .8rem; }
.fav-actions { display: flex; gap: 6px; align-items: center; }
.fav-empty { display: grid; justify-items: center; gap: 6px; padding: 28px 16px; text-align: center; color: var(--muted); }
.fav-empty svg.i { width: 42px; height: 42px; color: #f43f5e; }
.fav-empty strong { color: var(--text); }
.fav-sub { display: flex; align-items: center; gap: 8px; font-size: 1rem; margin: 22px 0 10px; color: var(--text-2); }
.fav-privacy { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: .82rem; margin: 18px 0 8px; }
.fav-icon { background: linear-gradient(135deg, #f43f5e, #e11d48) !important; box-shadow: 0 12px 26px rgba(225,29,72,.3) !important; }
.fav-phone-big { text-align: center; font-size: 1.6rem; font-weight: 900; letter-spacing: .08em; color: var(--primary-text); margin: 4px 0 6px; }
.fav-remove { width: 100%; margin-top: 8px; color: var(--red); border-color: transparent; }
@media (max-width: 560px) { .fav-actions .btn-sm:not(.btn-icon) { padding: 6px 10px; } }

/* favorites menu from the heart */
.suggest.fav-menu { padding: 0; overflow: hidden; gap: 0; }
.fm-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: linear-gradient(135deg, #fff1f4, var(--surface)); border-bottom: 1px solid var(--line); }
.fm-head svg.i { color: #e11d48; }
.fm-head span { margin-inline-start: auto; font-size: .78rem; color: var(--muted); }
.fm-list { max-height: min(46vh, 330px); overflow-y: auto; padding: 6px; display: grid; gap: 2px; overscroll-behavior: contain; }
.fm-avatar { width: 34px; height: 34px; border-radius: 11px; flex: none; display: grid; place-items: center; font-weight: 900; color: #fff; background: linear-gradient(135deg, hsl(var(--h) 85% 62%), hsl(calc(var(--h) + 30) 80% 55%)); }
.sg-item.current { background: var(--primary-soft); }
.fm-empty { margin: 0; padding: 14px; color: var(--muted); font-size: .9rem; text-align: center; }
.fm-foot { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border-top: 1px solid var(--line); background: var(--surface-2); }
.fm-action { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--primary-text); font-weight: 700; font-size: .85rem; }
.fm-action:hover, .fm-action:focus-visible { background: var(--primary-soft); }
.sg-item:focus-visible { outline: 2px solid var(--accent-a); outline-offset: -2px; }
.confirm-name { color: #e11d48; font-weight: 800; }
.fav-backup { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding: 12px 14px; }
.fav-backup > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 200px; flex: 1; }
.fav-backup strong { display: flex; align-items: center; gap: 6px; }
.fav-backup span { color: var(--muted); font-size: .82rem; }
.fav-backup-actions { display: flex; gap: 6px; }
.fav-backup-actions label { cursor: pointer; }
:root[data-theme="dark"] .fm-head { background: linear-gradient(135deg, #3a1a2c, var(--surface)); }

/* =====================================================================
   POS 2.0 — professional / futuristic sale screen redesign
   (number-first flexible flow, contacts + favorites, operations,
   universal popup close, refined tiles & fields)
   ===================================================================== */

/* Number row: the field grows, the favorites heart sits outside beside it */
.phone-row { display: flex; align-items: stretch; gap: 8px; }
.phone-row .phone-field { flex: 1 1 auto; min-width: 0; }
.pos-compact .phone-row .phone-input { width: 100%; }

/* Contacts icon INSIDE the field (opens the phone's contacts) */
.contacts-btn { position: absolute; inset-inline-end: 7px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--surface-3); color: var(--primary-text); display: grid; place-items: center; transition: background .15s, color .15s, transform .12s; }
.contacts-btn svg.i { width: 19px; height: 19px; }
.contacts-btn:hover { background: var(--primary-soft); }
.contacts-btn:active { transform: translateY(-50%) scale(.92); }

/* Favorites heart OUTSIDE, with a small square count badge */
.fav-open { position: relative; flex: none; width: 50px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--faint); display: grid; place-items: center; transition: border-color .15s, color .15s, background .15s, transform .12s; }
.fav-open svg.i { width: 22px; height: 22px; }
.fav-open:hover { border-color: #f43f5e; color: #e11d48; }
.fav-open:active { transform: scale(.95); }
.fav-open.on { color: #fff; border-color: transparent; background: linear-gradient(135deg, #f43f5e, #e11d48); box-shadow: 0 6px 15px rgba(225,29,72,.3); }
.fav-open-badge { position: absolute; top: -6px; inset-inline-start: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 6px; background: var(--accent-grad); color: #fff; font-size: .68rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 3px 8px rgba(91,108,255,.4); border: 2px solid var(--surface); }
.fav-open-badge[hidden] { display: none; }

/* Recent operations header + "show all" link */
.pos-recent h3 { display: flex; align-items: center; }
.pos-recent h3 span:first-child { font-weight: 800; }
.pos-recent-tools { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.recent-more { border: 0; background: var(--primary-soft); color: var(--primary-text); font-weight: 800; font-size: .78rem; padding: 5px 11px; border-radius: 99px; white-space: nowrap; }
.recent-more:hover { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); }
.reload-btn { width: 34px; min-height: 34px; }
.reload-btn svg.i { width: 18px; height: 18px; }
.recent-item strong.ltr { direction: ltr; text-align: right; letter-spacing: .04em; }

/* ---------- Smart inline errors (red, on the field / operation) ---------- */
.field-error { display: flex; gap: 9px; align-items: flex-start; margin-top: 10px; padding: 10px 13px; border-radius: 12px; background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 42%, transparent); animation: slide .18s ease-out; }
.field-error[hidden] { display: none; }
.field-error .fe-ic { flex: none; display: grid; place-items: center; color: var(--red); margin-top: 1px; }
.field-error .fe-ic svg.i { width: 20px; height: 20px; }
.field-error .fe-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.field-error .fe-text strong { color: var(--red); font-size: .92rem; }
.field-error .fe-text span { color: var(--text-2); font-size: .82rem; line-height: 1.55; }
.field-error.modal-error { margin: 12px 0 0; }
.has-error { border-color: var(--red) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 24%, transparent) !important; }
.category-grid.has-error { outline: 2px dashed color-mix(in srgb, var(--red) 55%, transparent); outline-offset: 4px; border-radius: 12px; }

/* Universal popup close (✕) — always at the physical top-LEFT corner */
.modal { position: relative; }
.modal-close { position: absolute; top: 12px; left: 12px; right: auto; z-index: 3; width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); display: grid; place-items: center; transition: background .15s, color .15s, transform .12s; }
.modal-close svg.i { width: 20px; height: 20px; stroke-width: 2.4; }
.modal-close:hover:not(:disabled) { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.modal-close:active:not(:disabled) { transform: scale(.9); }
.modal-close:disabled { opacity: .35; cursor: not-allowed; }
.modal .confirm-title { padding-inline: 34px; }
.modal > h2 { padding-left: 52px; padding-right: 4px; }
/* Centered popups (e.g. favorites) open from the middle, not the bottom */
@media (max-width: 900px) {
  .modal-backdrop.centered { place-items: center; padding: 18px; }
  .modal-backdrop.centered .modal { width: 100%; max-width: 440px; max-height: min(82vh, 640px); border-radius: 22px; padding: 16px 18px 18px; animation: pop .18s ease-out; }
  .modal-backdrop.centered .sheet-handle { display: none; }
  .modal-backdrop.centered .modal-actions { position: static; background: transparent; }
}

/* ---------- Favorites popup (professional bottom sheet) ---------- */
.fmx-modal { display: flex; flex-direction: column; }
/* The ✕ renders at the inline-start (top-right in RTL): headers keep that corner free. */
.fmx-head { display: flex; align-items: center; gap: 12px; padding: 4px 30px 12px; padding-inline-start: 48px; }
.fmx-head .confirm-icon { width: 52px; height: 52px; margin: 0; }
.fmx-head .confirm-icon svg.i { width: 28px; height: 28px; }
.fmx-head h2 { margin: 0; font-size: 1.2rem; }
.fmx-head p { margin: 2px 0 0; font-size: .84rem; }
.fmx-search { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; }
.fmx-search .text-input { flex: 1; }
.fmx-add { flex: none; width: 46px; height: 46px; border-radius: 13px; border: 0; background: var(--accent-grad); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 18px rgba(91,108,255,.32); }
.fmx-add svg.i { width: 22px; height: 22px; stroke-width: 2.4; }
.fmx-add:active { transform: scale(.93); }
.search-ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; display: grid; place-items: center; }
.search-ic svg.i { width: 18px; height: 18px; }
.fmx-search, .fav-search { position: relative; }
.text-input.has-ic { padding-inline-start: 40px; }
.fmx-list { display: grid; gap: 8px; overflow-y: auto; max-height: min(50vh, 420px); padding: 2px; margin: -2px; overscroll-behavior: contain; }
.fmx-item { display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.fmx-item.current { border-color: var(--primary-600); box-shadow: 0 0 0 3px var(--primary-ring); }
.fmx-item[hidden] { display: none; }
.fmx-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; border: 0; background: transparent; text-align: right; padding: 6px 8px; border-radius: 12px; color: var(--text); }
.fmx-main:hover { background: var(--primary-soft); }
.fmx-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fmx-text strong { font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmx-text span { color: var(--text-2); letter-spacing: .05em; text-align: right; font-size: .92rem; }
.fmx-edit { flex: none; color: var(--muted); }
.fmx-empty { display: grid; justify-items: center; gap: 6px; padding: 26px 16px; text-align: center; color: var(--muted); }
.fmx-empty svg.i { width: 40px; height: 40px; color: #f43f5e; }
.fmx-empty strong { color: var(--text); }
.fmx-foot { margin-top: 12px; display: flex; justify-content: center; }

/* ---------- Notifications bell + panel ---------- */
.bell-btn { position: relative; }
.bell-btn.has-unread { color: #e11d48; }
.bell-badge { position: absolute; top: 1px; inset-inline-start: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: linear-gradient(135deg, #f43f5e, #e11d48); color: #fff; font-size: .64rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(225,29,72,.5); border: 2px solid var(--glass); pointer-events: none; }
/* in-field clear button (while typing a number) */
.field-btn.is-clear { background: var(--surface-3); color: var(--muted); }
.field-btn.is-clear:hover { background: var(--red-soft); color: var(--red); }
.ntf-modal { display: flex; flex-direction: column; }
.ntf-head { display: flex; align-items: center; gap: 12px; padding: 4px 30px 12px; padding-inline-start: 48px; }
.ntf-head .confirm-icon { width: 52px; height: 52px; margin: 0; background: var(--accent-grad); }
.ntf-icon svg.i { width: 26px; height: 26px; }
.ntf-head h2 { margin: 0; font-size: 1.2rem; }
.ntf-head p { margin: 2px 0 0; font-size: .84rem; }
.ntf-list { display: grid; gap: 8px; overflow-y: auto; max-height: min(56vh, 460px); padding: 2px; margin: -2px 0; overscroll-behavior: contain; }
.ntf-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.ntf-item.unread { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.ntf-ic { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.ntf-item.k-good .ntf-ic { background: var(--primary-soft); color: var(--primary-text); }
.ntf-item.k-bad .ntf-ic { background: var(--red-soft); color: var(--red); }
.ntf-item.k-warn .ntf-ic { background: var(--yellow-soft); color: var(--yellow); }
.ntf-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ntf-txt strong { font-size: .95rem; }
.ntf-txt span { color: var(--text-2); font-size: .84rem; line-height: 1.5; }
.ntf-txt time { color: var(--faint); font-size: .75rem; margin-top: 2px; }
.ntf-empty { display: grid; justify-items: center; gap: 6px; padding: 26px 16px; text-align: center; color: var(--muted); }
.ntf-empty svg.i { width: 40px; height: 40px; color: var(--accent-a); }
.ntf-empty strong { color: var(--text); }
.ntf-foot { margin-top: 12px; display: flex; justify-content: center; }

/* ---------- Operations page ---------- */
.ops-page .page-header h1 { display: flex; align-items: center; gap: 8px; }
.ops-page .page-header h1 svg.i { color: var(--primary-text); }
.ops-list { display: grid; gap: 4px; }
.op-group { margin-bottom: 6px; }
.op-group[hidden] { display: none; }
.op-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow-sm); margin-bottom: 8px; }
.op-row[hidden] { display: none; }
.op-cat { flex: none; min-width: 52px; height: 46px; padding: 0 8px; border-radius: 13px; display: inline-flex; align-items: baseline; justify-content: center; gap: 2px; font-weight: 900; font-size: 1.02rem; color: #fff; background: var(--cat-color, var(--primary)); box-shadow: 0 5px 12px color-mix(in srgb, var(--cat-color) 40%, transparent); }
.op-cat small { font-size: .62rem; font-weight: 700; opacity: .9; }
.op-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.op-info strong { font-size: 1rem; letter-spacing: .05em; }
.op-info span { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .8rem; }
.op-info span svg.i { width: 13px; height: 13px; }

@media (max-width: 900px) {
  .modal-close { top: 10px; }
  .op-row { padding: 10px; gap: 10px; }
}

/* Dark-mode nudges for the new surfaces */
:root[data-theme="dark"] .contacts-btn,
:root[data-theme="dark"] .recent-more { background: var(--surface-3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .contacts-btn, :root:not([data-theme="light"]) .recent-more { background: var(--surface-3); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fm-head { background: linear-gradient(135deg, #3a1a2c, var(--surface)); } }

/* Touch devices: prevent sticky :hover after tap */
@media (hover: none) {
  .btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #5363f7 0%, #7254f7 100%); }
  .nav-item:hover { background: transparent; }
  .category:hover:not(:disabled) { border-color: var(--line); }
  .dropzone:hover { border-color: var(--line); background: var(--surface); }
  .guide-link:hover { text-decoration: none; }
  .stat:hover { transform: none; box-shadow: none; }
  .sg-item:hover { background: transparent; }
  .fm-action:hover { background: transparent; }
  .contacts-btn:hover { background: transparent; }
  .fav-open:hover { border-color: transparent; color: inherit; }
  .recent-more:hover { background: transparent; }
  .modal-close:hover:not(:disabled) { background: transparent; color: inherit; border-color: transparent; }
  .fmx-main:hover { background: transparent; }
  .field-btn.is-clear:hover { background: transparent; color: inherit; }
}

/* =====================================================================
   PREMIUM RETAILER POS — wallet-app feel (phone first)
   Category tiles, big number field, ticket-style sheets, animated success,
   balance privacy, top-ups tab and smooth section / sheet transitions.
   ===================================================================== */
:root { --mono: ui-monospace, "SF Mono", "Roboto Mono", "Cascadia Mono", Consolas, monospace; --ease-out: cubic-bezier(.22, 1, .36, 1); --ease-spring: cubic-bezier(.34, 1.56, .64, 1); }

/* Section change: soft fade + rise (only when the section actually changes) */
.view-enter { animation: viewIn .32s var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Balance strip (violet, with privacy eye) ---------- */
.balance-strip {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 12px; margin: 0 0 14px;
  border-radius: 22px; color: #fff;
  background: radial-gradient(260px 140px at 100% 0%, rgba(255,255,255,.24), transparent 70%), radial-gradient(220px 160px at 0% 120%, rgba(56,189,248,.28), transparent 70%), linear-gradient(135deg, #8b5cf6 0%, #6d28d9 52%, #4c1d95 100%);
  box-shadow: 0 16px 34px rgba(76, 29, 149, .32), inset 0 1px 0 rgba(255,255,255,.18);
}
.balance-strip::after { content: ''; position: absolute; width: 180px; height: 180px; border-radius: 50%; left: -60px; top: -90px; border: 26px solid rgba(255,255,255,.06); pointer-events: none; }
.bs-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.balance-strip .bs-label { display: flex; align-items: center; gap: 6px; font-size: .84rem; font-weight: 600; color: rgba(255,255,255,.82); }
.balance-strip .bs-label svg.i { width: 17px; height: 17px; }
.bs-amount { font-size: 1.75rem; font-weight: 900; line-height: 1.2; letter-spacing: -.01em; white-space: nowrap; }
.bs-amount small { font-size: .8rem; font-weight: 600; opacity: .85; }
.secret { font-variant-numeric: tabular-nums; }
.eye-btn { position: relative; z-index: 1; flex: none; width: 42px; height: 42px; border-radius: 13px; border: 1px solid rgba(255,255,255,.26); background: rgba(255,255,255,.14); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); transition: background .2s, transform .12s; }
.eye-btn svg.i { width: 21px; height: 21px; }
.eye-btn:active { transform: scale(.92); }
.balance-strip .bs-link { position: relative; z-index: 1; flex: none; border: 0; border-radius: 13px; padding: 0 12px; height: 42px; background: rgba(255,255,255,.14); color: #fff; font-weight: 700; font-size: .82rem; white-space: nowrap; transition: background .2s, transform .12s; }
.balance-strip .bs-link:active { transform: scale(.95); }

/* ---------- Sale board ---------- */
.pos-compact .pos-board { padding: 16px 14px 16px; border-radius: 24px; }
.pos-compact .step-title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 1.08rem; font-weight: 850; color: var(--text); letter-spacing: 0; }
.pos-compact .step-title svg.i { width: 22px; height: 22px; color: var(--primary); }
.pos-compact .step-title.step-num-title { margin-top: 22px; }
.pos-compact .pos-form { max-width: none; }

/* Category buttons — compact: icon, value and currency on one line */
.pos-compact .category-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 0; }
.cat-tile {
  position: relative; overflow: hidden; min-height: 66px; padding: 8px 10px; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 5px;
  text-align: center; color: var(--text); border-radius: 14px; border: 1.5px solid color-mix(in srgb, var(--cat-color) 30%, var(--line));
  background: color-mix(in srgb, var(--cat-color) 8%, var(--surface));
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease-out), box-shadow .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
}
.cat-tile::before { display: none; }
.cat-tile.selected::after { content: none; }
.cat-ic { flex: none; display: grid; place-items: center; color: color-mix(in srgb, var(--cat-color) 85%, var(--text)); transition: color .2s; }
.cat-ic svg.i { width: 15px; height: 15px; stroke-width: 2.2; }
.cat-tile .category-value { display: flex; align-items: baseline; gap: 2px; font-size: 1.25rem; font-weight: 850; line-height: 1; letter-spacing: -.01em; white-space: nowrap; color: var(--text); font-variant-numeric: tabular-nums; }
.cat-tile .category-value small { font-size: .62rem; font-weight: 700; color: var(--muted); margin: 0; letter-spacing: 0; }
.cat-check { position: absolute; top: 4px; left: 4px; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; color: var(--cat-color); background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transform: scale(0); transition: transform .26s var(--ease-spring); }
.cat-check svg.i { width: 10px; height: 10px; stroke-width: 3.4; }
.pos-compact .cat-tile:hover:not(:disabled) { border-color: color-mix(in srgb, var(--cat-color) 60%, var(--line)); }
.pos-compact .cat-tile:active:not(:disabled) { transform: scale(.96); }
/* Selected: filled with the category colour (darker end keeps white text readable) */
.pos-compact .cat-tile.selected, .pos-compact .cat-tile.selected:hover:not(:disabled) {
  border-color: var(--cat-color); transform: scale(1.03); color: #fff;
  background: linear-gradient(135deg, var(--cat-color), color-mix(in srgb, var(--cat-color) 76%, #000));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color) 24%, transparent), 0 8px 18px color-mix(in srgb, var(--cat-color) 32%, transparent);
}
.pos-compact .cat-tile.selected:active:not(:disabled) { transform: scale(.99); }
.cat-tile.selected .cat-check { transform: scale(1); }
.cat-tile.selected .cat-ic, .cat-tile.selected .category-value { color: #fff; text-shadow: 0 1px 1px rgba(0, 0, 0, .18); }
.cat-tile.selected .category-value small { color: rgba(255, 255, 255, .88); }
.pos-compact .cat-tile.sold-out { opacity: .5; filter: grayscale(.7); cursor: not-allowed; box-shadow: none; border-style: dashed;
  background: repeating-linear-gradient(-45deg, transparent 0 8px, color-mix(in srgb, var(--line) 45%, transparent) 8px 9px), var(--surface-2); }
.pos-compact .cat-tile.sold-out .category-value { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--red) 60%, transparent); }
.category-grid.has-error { outline-offset: 6px; border-radius: 22px; }

/* Phone number — second most important element */
.phone-row { gap: 10px; }
.pos-compact .phone-input {
  width: 100%; min-height: 50px !important; padding: 7px 10px 7px 46px !important; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font-family: var(--mono); font-size: clamp(1.15rem, 5.2vw, 1.4rem) !important; font-weight: 800; letter-spacing: .06em; text-align: center; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
/* The input is LTR and the contacts/clear button sits on its physical left. */
.pos-compact .phone-field .phone-input { padding: 7px 10px 7px 46px !important; }
.pos-compact .phone-input::placeholder { color: var(--faint); opacity: .75; font-weight: 600; font-family: inherit; letter-spacing: 0; font-size: .98rem; }
.pos-compact .phone-input:focus { border-color: var(--primary-600); background: var(--surface); box-shadow: 0 0 0 4px var(--primary-ring), 0 6px 16px rgba(91,108,255,.12); }
.pos-compact .contacts-btn { width: 34px; height: 34px; border-radius: 10px; inset-inline-end: 7px; }
.pos-compact .contacts-btn svg.i { width: 18px; height: 18px; }
.pos-compact .fav-open { width: 50px; border-radius: 14px; border-width: 1.5px; }
.pos-compact .fav-open svg.i { width: 21px; height: 21px; }
.fav-name-tag { top: -12px; }

/* Preview: face value only */
.pos-compact .sale-preview { min-height: 0; margin-top: 12px; padding: 9px 14px; display: flex; align-items: center; justify-content: center; gap: 6px; border-radius: 14px; border: 1.5px dashed var(--line-strong); background: var(--surface-2); color: var(--muted); font-size: .92rem; font-weight: 600; transition: background .2s, border-color .2s, color .2s; }
.pos-compact .sale-preview svg.i { width: 19px; height: 19px; }
.pos-compact .sale-preview.has-cat { border-style: solid; border-color: color-mix(in srgb, var(--cat-color) 40%, transparent); background: color-mix(in srgb, var(--cat-color) 9%, var(--surface)); color: var(--text); }
.pos-compact .sale-preview.has-cat svg.i { color: var(--cat-color); }
.pos-compact .sale-preview b { font-size: 1.12rem; font-weight: 900; }
.pos-compact .warning-inline { min-height: 0; margin-top: 8px; font-size: .84rem; }
.pos-compact .warning-inline:empty { display: none; }

/* Sell button: always enabled, fixed label "تنفيذ البيع" */
.pos-compact .sale-btn {
  width: 100%; min-height: 50px; padding: 8px 16px; margin-top: 10px; border-radius: 14px; font-size: 1.05rem; font-weight: 850; letter-spacing: 0;
  color: #fff; border: 0; background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 10px 22px rgba(109, 40, 217, .28);
  transition: box-shadow .2s, transform .12s, filter .2s;
}
.pos-compact .sale-btn svg.i { width: 19px; height: 19px; }
.pos-compact .sale-btn:active { transform: scale(.98); }
.pos-compact .sale-btn:hover { filter: brightness(1.06); }

/* ---------- Recent operations (last 5, mini cards) ---------- */
.pos-compact .pos-recent { margin-top: 14px; padding: 14px; border-radius: 22px; }
.pos-compact .pos-recent h3 { margin: 0 0 10px; font-size: 1.02rem; }
.pos-compact .recent-list { display: grid; gap: 8px; }
.pos-compact .recent-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); font-size: .9rem; }
.pos-compact .recent-item:last-child { border-bottom: 1px solid var(--line); }
.pos-compact .recent-cat { width: 50px; height: 42px; border: 0; border-radius: 12px; font-size: .95rem; font-weight: 900; color: #fff; background: linear-gradient(135deg, color-mix(in srgb, var(--cat-color) 78%, #fff), var(--cat-color)); box-shadow: 0 5px 12px color-mix(in srgb, var(--cat-color) 32%, transparent); }
.pos-compact .recent-text { flex: 1; min-width: 0; }
.pos-compact .recent-text strong { font-family: var(--mono); font-size: 1rem; letter-spacing: .04em; }
.pos-compact .recent-text span { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: .78rem; }
.pos-compact .recent-text span svg.i { width: 13px; height: 13px; }
.recent-empty { display: grid; justify-items: center; gap: 4px; padding: 22px 12px 16px; text-align: center; color: var(--muted); font-size: .88rem; }
.recent-empty strong { color: var(--text); font-size: 1rem; }
.re-ic { width: 58px; height: 58px; margin-bottom: 6px; border-radius: 18px; display: grid; place-items: center; color: #fff; background: var(--accent-grad); box-shadow: 0 12px 24px rgba(91,108,255,.3); }
.re-ic svg.i { width: 30px; height: 30px; }

/* ---------- Sheets: fade backdrop, slide up on phones ---------- */
.modal-backdrop { animation: fade .22s ease-out; }
.modal { animation: pop .26s var(--ease-out); }
.modal-backdrop.still, .modal-backdrop.still .modal, .modal-backdrop.still .done-icon, .modal-backdrop.still .done-icon::after, .modal-backdrop.still .done-check path { animation: none !important; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@media (max-width: 900px) {
  .modal-backdrop:not(.centered) .modal { animation: sheetUp .38s var(--ease-out); }
}

/* Ticket (confirm + success) */
.sale-sheet .confirm-title p { margin-bottom: 12px; }
.sale-hero-icon { width: 78px; height: 78px; color: #fff !important; background: linear-gradient(135deg, color-mix(in srgb, var(--cat-color) 75%, #fff), var(--cat-color)) !important; box-shadow: 0 14px 30px color-mix(in srgb, var(--cat-color) 38%, transparent) !important; }
.sale-hero-icon svg.i { width: 42px; height: 42px; }
.ticket { position: relative; border-radius: 18px; background: var(--surface-2); border: 1.5px solid var(--line); border-top: 3px dashed color-mix(in srgb, var(--cat-color) 55%, var(--line)); border-bottom: 3px dashed color-mix(in srgb, var(--cat-color) 55%, var(--line)); }
.ticket-cat { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 14px 14px; }
.cat-badge-lg { display: inline-flex; align-items: baseline; gap: 5px; padding: 8px 24px; border-radius: 16px; color: #fff; font-size: 2.3rem; font-weight: 900; line-height: 1.1; letter-spacing: -.02em; background: linear-gradient(135deg, color-mix(in srgb, var(--cat-color) 75%, #fff), var(--cat-color)); box-shadow: 0 10px 22px color-mix(in srgb, var(--cat-color) 36%, transparent); }
.cat-badge-lg small { font-size: .9rem; font-weight: 700; opacity: .9; letter-spacing: 0; }
.ticket-cat-label { color: var(--muted); font-size: .86rem; font-weight: 600; }
.ticket-cut { position: relative; height: 0; margin: 0 16px; border-top: 2px dashed var(--line-strong); }
.ticket-cut::before, .ticket-cut::after { content: ''; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line); }
.ticket-cut::before { right: -28px; border-left-color: transparent; border-bottom-color: transparent; transform: rotate(45deg); }
.ticket-cut::after { left: -28px; border-right-color: transparent; border-top-color: transparent; transform: rotate(45deg); }
.ticket-phone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px; }
.ticket-phone > span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .86rem; font-weight: 600; }
.ticket-phone > span svg.i { width: 17px; height: 17px; color: var(--primary-text); }
.ticket .confirm-phone { font-family: var(--mono); font-size: 2rem !important; font-weight: 900; letter-spacing: .06em; color: var(--text); }
.ticket .confirm-name { display: inline-flex; align-items: center; gap: 5px; font-style: normal; font-size: .9rem; }
.ticket .confirm-name svg.i { width: 15px; height: 15px; }
.ticket-rows .confirm-row { padding: 12px 16px; }
.ticket-rows .confirm-row > span { font-size: .9rem; }
.ticket-rows .confirm-row strong { font-size: 1.08rem; }
.confirm-go { min-height: 62px !important; font-size: 1.15rem !important; font-weight: 850; }
.confirm-go.is-busy:disabled { opacity: 1; cursor: progress; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: spin 1.4s linear infinite !important; } }

/* Success: animated check + auto-close bar */
.done-sheet .done-icon { position: relative; width: 96px; height: 96px; color: #fff; background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 16px 34px rgba(109,40,217,.36); animation: donePop .5s var(--ease-spring); }
.done-sheet .done-icon::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid rgba(139,92,246,.45); opacity: 0; animation: ring 1.3s ease-out .35s; }
.done-sheet .done-check { width: 52px !important; height: 52px !important; stroke-width: 3.2 !important; }
.done-check path { stroke-dasharray: 24; stroke-dashoffset: 0; animation: draw .45s .28s ease-out both; }
@keyframes draw { from { stroke-dashoffset: 24; } }
@keyframes donePop { from { transform: scale(.4); opacity: 0; } }
@keyframes ring { from { transform: scale(.85); opacity: .9; } to { transform: scale(1.35); opacity: 0; } }
.new-sale-btn { min-height: 62px !important; font-size: 1.15rem !important; font-weight: 850; }
.done-timer { height: 5px; margin-top: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.done-timer > div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6d28d9, #a78bfa); transform-origin: right center; animation-name: timerShrink; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes timerShrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Bottom navigation ---------- */
@media (max-width: 900px) {
  .bottom-nav { height: calc(70px + var(--safe-b)); padding: 6px 4px var(--safe-b); }
  .bottom-nav button { gap: 4px; font-size: .74rem; padding-bottom: 6px; transition: color .2s ease; }
  .bottom-nav button svg.i, .bottom-nav button.active svg.i { width: 26px; height: 26px; padding: 0; background: none; border-radius: 0; transition: transform .28s var(--ease-spring), color .2s ease; }
  .bottom-nav button.active { color: var(--primary); }
  .bottom-nav button.active svg.i { transform: translateY(-2px) scale(1.08); }
  .bottom-nav button::after { content: ''; position: absolute; bottom: 2px; left: 50%; width: 18px; height: 4px; margin-left: -9px; border-radius: 99px; background: var(--accent-grad); transform: scaleX(0); transition: transform .28s var(--ease-spring); }
  .bottom-nav button.active::after { transform: scaleX(1); }
  .bottom-nav button:active svg.i { transform: scale(.9); }
  .has-bottom-nav .content { padding-bottom: calc(70px + var(--safe-b) + 22px); }
}

/* ---------- Account (statement) ---------- */
.acct-page .page-header h1, .topups-page .page-header h1 { display: flex; align-items: center; gap: 8px; }
.acct-page .page-header h1 svg.i, .topups-page .page-header h1 svg.i { color: var(--primary-text); }
.balance-card.statement-balance {
  padding: 20px 20px 18px; margin-bottom: 14px; border-radius: 24px; color: #fff; min-width: 0;
  background: radial-gradient(320px 180px at 100% 0%, rgba(255,255,255,.26), transparent 70%), radial-gradient(260px 200px at 0% 120%, rgba(56,189,248,.3), transparent 70%), linear-gradient(135deg, #8b5cf6 0%, #6d28d9 50%, #3b0f8c 100%);
  box-shadow: 0 22px 44px rgba(76, 29, 149, .36), inset 0 1px 0 rgba(255,255,255,.2);
}
.balance-card.statement-balance::after { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; left: -70px; bottom: -120px; border: 30px solid rgba(255,255,255,.07); pointer-events: none; }
.bc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.balance-card small { color: rgba(255,255,255,.82); display: inline-flex; align-items: center; gap: 6px; }
.balance-card strong { font-size: 2.2rem; font-weight: 900; letter-spacing: -.01em; margin-top: 4px; }
.balance-card strong small { font-size: .9rem; font-weight: 600; }
.balance-card .balance-meta { color: rgba(255,255,255,.78); }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 8px; }
.list-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.08rem; }
.list-head h2 svg.i { color: var(--primary-text); }
.ledger-list { display: grid; gap: 8px; }
.ledger-list .day-label { justify-self: start; margin: 8px 0 0; }
.ledger-list .ledger-card { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }
.ledger-card .ledger-icon { width: 46px; height: 46px; border-radius: 15px; color: #fff; background: linear-gradient(135deg, #94a3b8, #64748b); }
.ledger-card .ledger-icon.sale { background: var(--accent-grad); color: #fff; }
.ledger-card .ledger-icon.topup { background: linear-gradient(135deg, #a78bfa, #7c3aed); color: #fff; }
.ledger-card .ledger-icon.info { background: linear-gradient(135deg, #60a5fa, #2563eb); color: #fff; }
.ledger-card .ledger-time { display: flex; align-items: center; gap: 4px; }
.ledger-card .ledger-time svg.i { width: 13px; height: 13px; }
.ledger-card .ledger-amount { font-size: 1.08rem; }

/* ---------- Top-ups ---------- */
.topup-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; margin-bottom: 14px; border-radius: 24px; color: #fff;
  background: radial-gradient(300px 160px at 100% 0%, rgba(255,255,255,.24), transparent 70%), linear-gradient(135deg, #8b5cf6 0%, #6d28d9 55%, #3b0f8c 100%); box-shadow: 0 18px 38px rgba(76, 29, 149, .32); }
.topup-hero small { color: rgba(255,255,255,.85); font-size: .84rem; }
.topup-hero strong { display: block; font-size: 1.9rem; font-weight: 900; line-height: 1.2; }
.topup-hero strong small { font-size: .85rem; font-weight: 600; }
.topup-count { flex: none; padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.18); font-weight: 800; font-size: .85rem; }
.topup-list { display: grid; gap: 10px; }
.topup-card { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }
.topup-ic { flex: none; width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #a78bfa, #7c3aed); box-shadow: 0 8px 18px rgba(109,40,217,.26); }
.topup-ic svg.i { width: 24px; height: 24px; stroke-width: 2.4; }
.topup-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.topup-text strong { font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topup-text span { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: .8rem; }
.topup-text span svg.i { width: 13px; height: 13px; }
.topup-amount { text-align: left; white-space: nowrap; }
.topup-amount b { display: block; color: var(--primary-text); font-size: 1.2rem; font-weight: 900; }
.topup-amount small { color: var(--faint); font-size: .76rem; }

/* Operations: gradient category badge */
.op-cat { background: linear-gradient(135deg, color-mix(in srgb, var(--cat-color) 78%, #fff), var(--cat-color)); }
.op-info strong { font-family: var(--mono); }

/* Phones / small tablets: 3 category buttons per row (6-track grid, each spans 2).
   A last row of two spreads over the width (span 3 each); a single one takes the row. */
@media (max-width: 699px) {
  .pos-compact .category-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .pos-compact .cat-tile { grid-column: span 2; }
  .pos-compact .cat-tile:nth-child(3n+1):nth-last-child(2), .pos-compact .cat-tile:nth-child(3n+2):last-child { grid-column: span 3; }
  .pos-compact .cat-tile:nth-child(3n+1):last-child { grid-column: 1 / -1; }
}

/* Phones */
@media (max-width: 560px) {
  .cat-tile { min-height: 56px; padding: 6px 8px; }
  .bs-amount { font-size: 1.55rem; }
  .balance-strip .bs-link { padding: 0 10px; font-size: .78rem; }
  .ticket .confirm-phone { font-size: 1.8rem !important; }
}
@media (max-width: 360px) {
  .cat-tile { padding: 6px; gap: 4px; }
  .cat-tile .category-value { font-size: 1.1rem; }
  .balance-strip .bs-link { padding: 0 8px; font-size: .74rem; }
}

/* Dark mode: recent cards sit on the card surface */
:root[data-theme="dark"] .pos-compact .recent-item { background: var(--surface); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pos-compact .recent-item { background: var(--surface); } }

/* Touch: no sticky hover on tiles */
@media (hover: none) {
  .pos-compact .cat-tile:hover:not(:disabled) { border-color: color-mix(in srgb, var(--cat-color) 30%, var(--line)); }
  .pos-compact .cat-tile.selected:hover:not(:disabled) { border-color: var(--cat-color); }
}

/* ---------- Tappable rows (open the operation receipt) ---------- */
.tap-card { width: 100%; font: inherit; color: inherit; text-align: right; cursor: pointer; -webkit-appearance: none; appearance: none; transition: transform .12s, box-shadow .15s, border-color .15s; }
.tap-card:active { transform: scale(.985); }
.tap-card:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.op-row.tap-card, .recent-item.tap-card, .ledger-card.tap-card, .topup-card.tap-card { display: flex; }
@media (hover: none) { .tap-card:hover { border-color: var(--line); } }

/* ---------- Operation receipt (screenshot-ready voucher) ---------- */
.receipt-modal { max-width: 400px !important; padding: 16px 18px 18px !important; border-radius: 22px !important; }
.receipt-modal .sheet-handle { display: none !important; }
.modal-backdrop.centered .modal.receipt-modal { max-height: 92vh; animation: fade .18s ease-out; }
.receipt-modal .modal-actions { position: static !important; background: transparent !important; margin-top: 16px; padding: 0; }
.receipt { position: relative; margin: 0; padding: 2px 0 0; color: var(--text); background: none; border: 0; border-radius: 0; box-shadow: none; }
/* Keep the corner with the ✕ (inline-start) free. */
.rc-head { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; padding-inline-start: 46px; border-bottom: 2px dashed var(--line-strong); }
.rc-logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #8b5cf6, #6d28d9); box-shadow: 0 8px 18px rgba(109,40,217,.3); flex: none; }
.rc-logo svg.i { width: 22px; height: 22px; }
.rc-head strong { display: block; font-size: 1.05rem; font-weight: 900; }
.rc-head small { display: block; color: var(--muted); font-size: .82rem; }
.rc-title { margin: 14px 0 4px !important; text-align: center; font-size: 1.2rem; font-weight: 900; color: var(--text); padding: 0 !important; }
.rc-hero { display: flex; justify-content: center; padding: 8px 0 14px; }
.rc-amount { font-size: 2rem; font-weight: 900; color: var(--primary-text); font-variant-numeric: tabular-nums; }
.rc-amount small { font-size: .9rem; font-weight: 700; }
.rc-rows { border-top: 2px dashed var(--line-strong); border-bottom: 2px dashed var(--line-strong); padding: 6px 0; }
.rc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 2px; font-size: .9rem; }
.rc-row + .rc-row { border-top: 1px solid var(--line); }
.rc-row > span { color: var(--muted); flex: none; }
.rc-row > strong { font-weight: 800; text-align: left; min-width: 0; overflow-wrap: anywhere; }
.rc-mono { font-family: var(--mono); letter-spacing: .03em; }
.rc-phone { font-size: 1.2rem; color: var(--text); }
.rc-ref { font-size: .8rem; color: var(--muted); font-weight: 700 !important; }
.rc-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.rc-foot svg.i { width: 15px; height: 15px; color: var(--primary-text); }
.receipt .cat-badge-lg { font-size: 1.9rem; padding: 6px 20px; }
.rc-hero { padding: 4px 0 12px; }

/* ---------- Operations: balance after each sale ---------- */
.op-info .op-bal { color: var(--text-2); font-size: .78rem; }
.op-info .op-bal:empty { display: none; }
.op-info .op-bal b { font-weight: 800; }
.op-bal-wait { font-style: normal; color: var(--faint); }

/* ---------- Notifications: full screen ---------- */
.modal-backdrop.fullscreen { padding: 0; place-items: stretch; }
.modal-backdrop.fullscreen .modal.ntf-modal {
  width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; margin: 0;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(16px + var(--safe-b)); display: flex; flex-direction: column;
}
.modal-backdrop.fullscreen .ntf-head, .modal-backdrop.fullscreen .ntf-tabs, .modal-backdrop.fullscreen .ntf-list { width: 100%; max-width: 720px; margin-inline: auto; }
.modal-backdrop.fullscreen .ntf-list { flex: 1; max-height: none; align-content: start; }
.ntf-item.tap-card { display: flex; align-items: flex-start; }
.ntf-go { margin-inline-start: auto; align-self: center; color: var(--faint); font-size: 1.4rem; line-height: 1; }

/* ---------- Notification tabs + time to the second ---------- */
.ntf-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 14px; background: var(--surface-3); }
.ntf-tab { flex: 1 1 0; min-width: 0; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font: inherit; font-size: .9rem; font-weight: 800; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; }
.ntf-tab svg.i { width: 17px; height: 17px; flex: none; }
.ntf-tab span:not(.ntf-count) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ntf-tab.active { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-sm); }
.ntf-count { flex: none; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; display: inline-grid; place-items: center; font-size: .7rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, #f43f5e, #e11d48); }
.ntf-when { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; margin-top: 4px; font-size: .76rem; color: var(--faint); }
.ntf-when time { display: inline-flex; align-items: center; gap: 4px; margin: 0; color: var(--text-2); font-size: .76rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ntf-when time svg.i { width: 13px; height: 13px; }
.ntf-when em { font-style: normal; }

/* ---------- Smart SMS Template Card & Locked-Chip Editor ---------- */
.sms-tpl-card {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 18px 20px; margin-bottom: 14px;
}
.sms-tpl-info { flex: 1 1 300px; min-width: 0; display: grid; gap: 6px; }
.sms-tpl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sms-tpl-head h2 { margin: 0; font-size: 1.06rem; display: inline-flex; align-items: center; gap: 8px; }
.sms-tpl-head h2 svg.i { color: var(--primary-text); }
.sms-tpl-info p { margin: 0; font-size: .88rem; line-height: 1.65; }
.sms-tpl-side { flex: 0 1 360px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.sms-tpl-side .sms-bubble { flex: 1 1 220px; }

.sms-bubble {
  padding: 11px 14px; border-radius: 15px 15px 4px 15px;
  background: var(--surface-2); border: 1.5px solid var(--line-strong);
  font-size: .9rem; line-height: 1.65; color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.sms-bubble-line { min-height: 1.55em; white-space: pre-wrap; word-break: break-word; }
.sms-bubble-line + .sms-bubble-line { border-top: 1px dashed color-mix(in srgb, var(--line-strong) 65%, transparent); padding-top: 2px; margin-top: 2px; }
.sms-bubble-empty { color: var(--red); font-size: .82rem; font-weight: 700; }
.tpl-sample {
  display: inline-block; padding: 0 6px; margin: 0 1px; border-radius: 6px;
  font-weight: 800; font-size: .85em; background: var(--primary-soft); color: var(--primary-text);
}
.tpl-sample-code { font-family: ui-monospace, Consolas, monospace; letter-spacing: .03em; background: var(--blue-soft); color: var(--blue); }
.tpl-sample-value { background: var(--green-soft); color: var(--green); }
.tpl-sample-retailer { background: var(--primary-soft); color: var(--primary-text); }

.modal.sms-tpl-modal { width: min(100%, 640px); max-width: 640px; }
.tpl-modal-head { padding-inline-start: 42px; margin-bottom: 12px; }
.tpl-modal-head h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 1.2rem; }
.tpl-head-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex: none; }
.tpl-modal-head p { margin: 0; font-size: .86rem; line-height: 1.6; }

.tpl-presets-bar { margin-bottom: 12px; }
.tpl-presets-label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.tpl-presets-bar .chips { margin-bottom: 0; padding-bottom: 4px; }
.tpl-presets-bar .chip { padding: 6px 12px; font-size: .82rem; }

.tpl-lines-wrap { display: grid; gap: 10px; }
.tpl-line-box {
  padding: 11px 12px; border-radius: 14px; background: var(--surface-2);
  border: 1.5px solid var(--line); display: grid; gap: 8px;
}
.tpl-line-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tpl-line-title { display: inline-flex; align-items: center; gap: 8px; }
.tpl-line-badge {
  padding: 2px 9px; border-radius: 99px; background: var(--primary-soft);
  color: var(--primary-text); font-size: .76rem; font-weight: 800;
}
.tpl-line-title small { color: var(--muted); font-size: .78rem; font-weight: 600; }
.tpl-line-actions { display: inline-flex; gap: 5px; }
.tpl-mini-btn {
  display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 3px 9px;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text-2); font-size: .75rem; font-weight: 700;
}
.tpl-mini-btn svg.i { width: 13px; height: 13px; }
.tpl-mini-btn:hover:not(:disabled) { border-color: var(--primary-600); color: var(--primary-text); }
.tpl-mini-btn:disabled { opacity: .4; cursor: not-allowed; }

.tpl-segments { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.tpl-input {
  flex: 1 1 92px; min-width: 80px; min-height: 40px; padding: 7px 10px;
  border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--surface);
  color: var(--text); font-size: .92rem; outline: none; transition: border-color .15s, box-shadow .15s;
}
.tpl-input-full { flex: 1 1 100%; }
.tpl-input::placeholder { color: var(--faint); font-size: .8rem; }
.tpl-input:focus { border-color: var(--primary-600); box-shadow: 0 0 0 3px var(--primary-ring); }
.tpl-input.has-error { border-color: var(--red) !important; background: var(--red-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }

.tpl-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  padding: 4px 7px 4px 9px; border-radius: 11px; font-size: .84rem; font-weight: 800;
  border: 1.5px solid color-mix(in srgb, var(--primary) 35%, var(--line));
  background: var(--primary-soft); color: var(--primary-text); user-select: none;
}
.tpl-chip-code { background: var(--blue-soft); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 35%, var(--line)); }
.tpl-chip-value { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.tpl-chip-lock { display: inline-grid; place-items: center; opacity: .85; }
.tpl-chip-lock svg.i { width: 14px; height: 14px; vertical-align: 0; }
.tpl-chip-name { white-space: nowrap; }
.tpl-chip-controls { display: inline-flex; gap: 3px; margin-inline-start: 2px; }
.tpl-chip-btn {
  width: 24px; height: 24px; padding: 0; border-radius: 6px;
  border: 1px solid color-mix(in srgb, currentColor 28%, transparent);
  background: var(--surface); color: inherit; font-size: .7rem; font-weight: 900;
  display: inline-grid; place-items: center; line-height: 1;
}
.tpl-chip-btn:hover:not(:disabled) { background: currentColor; color: var(--surface); }
.tpl-chip-btn:disabled { opacity: .32; cursor: not-allowed; }

.tpl-preview-panel {
  margin-top: 12px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 9px;
}
.tpl-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .84rem; font-weight: 700; color: var(--text-2); }
.tpl-preview-head span { display: inline-flex; align-items: center; gap: 6px; }
.tpl-preview-head svg.i { color: var(--primary-text); width: 16px; height: 16px; }

.tpl-meter { display: grid; gap: 5px; }
.tpl-meter-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--muted); }
.tpl-meter.good .tpl-meter-top strong { color: var(--green); }
.tpl-meter.warn .tpl-meter-top strong { color: var(--yellow); }
.tpl-meter.bad .tpl-meter-top strong { color: var(--red); }
.tpl-meter-bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.tpl-meter-bar > div { height: 100%; border-radius: inherit; transition: width .18s ease, background .18s ease; background: var(--green); }
.tpl-meter.warn .tpl-meter-bar > div { background: var(--yellow); }
.tpl-meter.bad .tpl-meter-bar > div { background: var(--red); }

.tpl-status {
  margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  display: flex; align-items: flex-start; gap: 9px; font-size: .85rem; line-height: 1.55;
}
.tpl-status svg.i { width: 19px; height: 19px; flex: none; margin-top: 2px; }
.tpl-status strong { display: block; font-weight: 800; }
.tpl-status span { display: block; font-weight: 500; }
.tpl-status.good { background: var(--green-soft); color: var(--green); }
.tpl-status.warn { background: var(--yellow-soft); color: var(--yellow); }
.tpl-status.bad { background: var(--red-soft); color: var(--red); }
.tpl-modal-actions .btn-lg { min-height: 50px; font-size: 1rem; }

@media (max-width: 640px) {
  .sms-tpl-side { flex: 1 1 100%; justify-content: stretch; }
  .sms-tpl-side .btn { width: 100%; }
  .tpl-modal-head { padding-inline-start: 0; padding-top: 4px; }
  .tpl-segments { gap: 6px; }
  .tpl-input { min-width: 72px; font-size: .9rem; }
}


/* ---------- Focused settings workspace + recovery flow ---------- */
.settings-modal {
  width: min(94vw, 900px); max-width: 900px; max-height: min(88vh, 800px); padding: 0;
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line);
}
.settings-head {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  min-height: 116px; padding: 22px 28px 20px; padding-left: 72px;
  border-bottom: 1px solid var(--line); background: radial-gradient(circle at 0 0, var(--primary-soft), transparent 45%), var(--surface);
}
.settings-head h2 { margin: 3px 0 2px; font-size: clamp(1.25rem, 2vw, 1.65rem); letter-spacing: -.025em; }
.settings-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.settings-eyebrow { color: var(--primary-text); font-size: .76rem; font-weight: 800; letter-spacing: .02em; }
.settings-layout { min-height: 0; flex: 1; display: grid; grid-template-columns: 236px minmax(0, 1fr); overflow: hidden; }
.settings-nav { display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; overflow-y: auto; background: var(--surface-2); border-inline-end: 1px solid var(--line); }
.settings-tab {
  position: relative; width: 100%; min-width: 0; display: grid; grid-template-columns: 38px minmax(0,1fr) 18px;
  align-items: center; gap: 10px; padding: 11px 10px; text-align: start; border: 1px solid transparent;
  border-radius: 13px; color: var(--text-2); background: transparent; transition: background .16s, border-color .16s, color .16s, transform .16s;
}
.settings-tab:hover { background: var(--surface); border-color: var(--line); }
.settings-tab.active { background: var(--surface); border-color: color-mix(in srgb, var(--primary) 26%, var(--line)); color: var(--primary-text); box-shadow: var(--shadow-sm); }
.settings-tab:active { transform: scale(.985); }
.settings-tab-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-3); color: var(--muted); }
.settings-tab.active .settings-tab-icon { background: var(--primary-soft); color: var(--primary-text); }
.settings-tab-copy { min-width: 0; display: grid; gap: 2px; }
.settings-tab-copy strong { font-size: .89rem; }
.settings-tab-copy small { color: var(--muted); font-size: .72rem; line-height: 1.4; }
.settings-tab-arrow { color: var(--primary); transform: rotate(180deg); }
.settings-content { min-width: 0; min-height: 0; padding: clamp(18px, 3vw, 32px); overflow-y: auto; overscroll-behavior: contain; }
.settings-panel-head { display: flex; align-items: center; gap: 13px; margin: 0 0 22px; }
.settings-panel-icon { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 15px; background: var(--primary-soft); color: var(--primary-text); }
.settings-panel-icon svg.i { width: 22px; height: 22px; }
.settings-panel-head h3 { margin: 0; font-size: 1.15rem; }
.settings-panel-head p { margin: 3px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.settings-form { width: min(100%, 600px); }
.settings-form .field { margin: 16px 0; }
.settings-form .field input, .settings-form .field select { max-width: 100%; }
.settings-form-actions { display: flex; justify-content: flex-start; margin-top: 20px; }
.settings-form-actions .btn { min-width: 190px; }
.settings-note { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--text-2); background: var(--surface-2); font-size: .84rem; line-height: 1.7; }
.settings-note svg.i { flex: none; margin-top: 3px; color: var(--primary); }
.settings-note.warning { border-color: color-mix(in srgb, var(--yellow) 25%, var(--line)); background: var(--yellow-soft); color: #70420c; }
:root[data-theme="dark"] .settings-note.warning { color: #f7dfaa; }
.settings-toggle-list { display: grid; gap: 9px; }
.settings-switch-row { position: relative; display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: border-color .16s, background .16s, box-shadow .16s; }
.settings-switch-row:hover { border-color: var(--line-strong); background: var(--surface-2); }
.settings-switch-row:focus-within { outline: 3px solid var(--primary-ring); outline-offset: 2px; }
.settings-switch-row > span { min-width: 0; display: grid; gap: 3px; }
.settings-switch-row strong { font-size: .9rem; }
.settings-switch-row small { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.settings-switch-row input[type="checkbox"] { width: 22px; height: 22px; flex: none; margin-inline-start: auto; accent-color: var(--primary); }
.settings-switch-row i { display: none; }
.settings-pin-fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.settings-pin-fields[hidden] { display: none; }
.settings-error { margin: 14px 0 0; }
.settings-error[hidden] { display: none; }
.recovery-modal {
  width: min(100%, 520px); max-width: 520px; max-height: min(88vh, 760px); overflow-y: auto;
  padding: 26px clamp(18px, 4vw, 34px) 22px; border: 1px solid var(--line);
}
.recovery-topline { position: relative; min-height: 52px; display: flex; align-items: flex-start; }
.recovery-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; background: var(--primary-soft); color: var(--primary-text); }
.recovery-icon svg.i { width: 23px; height: 23px; }
.recovery-topline .modal-close { top: 0; }
.recovery-heading { margin: 12px 0 18px; }
.recovery-heading h2 { margin: 4px 0 6px; font-size: clamp(1.35rem, 4vw, 1.7rem); }
.recovery-heading p { margin: 0; max-width: 42ch; color: var(--muted); font-size: .91rem; line-height: 1.7; }
.recovery-steps { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.recovery-steps span { min-width: 0; display: flex; align-items: center; gap: 7px; color: var(--muted); }
.recovery-steps span.current { color: var(--primary-text); font-weight: 800; }
.recovery-steps span.done { color: var(--green); }
.recovery-steps i { width: 25px; height: 25px; flex: none; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); font-size: .74rem; font-style: normal; }
.recovery-steps .current i { border-color: var(--primary); background: var(--primary); color: #fff; }
.recovery-steps .done i { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.recovery-steps i svg.i { width: 14px; height: 14px; }
.recovery-steps b { font-size: .76rem; white-space: nowrap; }
.recovery-steps em { height: 1px; flex: 1; min-width: 12px; background: var(--line-strong); }
.recovery-fields .field { margin: 15px 0; }
.recovery-fields .field input { min-height: 52px; }
.recovery-fields .field input[name="code"] { text-align: center; direction: ltr; letter-spacing: .28em; font-size: 1.25rem; font-weight: 800; }
.recovery-password-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.recovery-notice { display: flex; align-items: flex-start; gap: 9px; margin: 0 0 15px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--green) 25%, var(--line)); border-radius: 13px; background: var(--green-soft); color: var(--green); font-size: .84rem; line-height: 1.6; }
.recovery-notice svg.i { flex: none; margin-top: 2px; }
.recovery-field-error { margin: 8px 0 0; padding: 9px 11px; }
.recovery-field-error .fe-text strong { font-size: .84rem; }
.recovery-field-error .fe-text span { font-size: .77rem; }
.recovery-actions { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 18px; }
.recovery-actions .btn { width: 100%; min-height: 50px; }
.recovery-actions .btn-ghost { border-color: transparent; }
.recovery-footnote { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 14px 0 0 !important; color: var(--muted); font-size: .76rem !important; }
.recovery-footnote svg.i { color: var(--primary); }

@media (max-width: 900px) {
  .modal-backdrop.centered .settings-modal { width: min(96vw, 820px); max-width: 820px; max-height: min(90dvh, 760px); padding: 0; border-radius: 22px; }
  .settings-head { min-height: 102px; padding: 18px 22px; padding-left: 66px; }
  .settings-layout { grid-template-columns: 190px minmax(0,1fr); }
  .settings-nav { padding: 12px 10px; }
  .settings-content { padding: 22px; }
  .modal-backdrop.centered .recovery-modal { width: min(94vw, 520px); max-width: 520px; max-height: min(88dvh, 720px); padding: 23px 24px 20px; border-radius: 22px; }
}
@media (max-width: 600px) {
  .modal-backdrop.centered .settings-modal { width: 100%; max-width: none; height: min(92dvh, 820px); max-height: none; border-radius: 22px 22px 0 0; align-self: end; }
  .settings-head { min-height: 92px; padding: 14px 16px; padding-left: 62px; }
  .settings-head p { font-size: .79rem; }
  .settings-layout { display: flex; flex-direction: column; }
  .settings-nav { flex: none; flex-direction: row; gap: 7px; padding: 10px 12px; overflow-x: auto; overflow-y: hidden; border-inline-end: 0; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
  .settings-tab { width: auto; min-width: 116px; display: flex; justify-content: center; gap: 7px; padding: 8px 10px; border-radius: 11px; }
  .settings-tab-icon { width: 28px; height: 28px; border-radius: 9px; }
  .settings-tab-copy small, .settings-tab-arrow { display: none; }
  .settings-tab-copy strong { font-size: .78rem; white-space: nowrap; }
  .settings-content { flex: 1; padding: 17px 16px calc(20px + var(--safe-b)); }
  .settings-panel-head { gap: 10px; margin-bottom: 16px; }
  .settings-panel-icon { width: 40px; height: 40px; border-radius: 13px; }
  .settings-form .field { margin: 13px 0; }
  .settings-form-actions { position: sticky; bottom: -17px; margin-inline: -16px; padding: 12px 16px calc(8px + var(--safe-b)); background: var(--surface); }
  .settings-form-actions .btn { width: 100%; }
  .settings-pin-fields { grid-template-columns: 1fr; gap: 0; }
  .modal-backdrop.centered .recovery-modal { width: min(100%, 520px); max-width: 520px; max-height: calc(100dvh - 10px); padding: 14px 16px calc(12px + var(--safe-b)); border-radius: 20px 20px 0 0; align-self: end; overflow-x: hidden; overflow-y: auto; }
  .recovery-topline { min-height: 36px; }
  .recovery-icon { width: 36px; height: 36px; border-radius: 12px; }
  .recovery-icon svg.i { width: 19px; height: 19px; }
  .recovery-heading { margin: 6px 0 10px; }
  .recovery-heading h2 { font-size: 1.28rem; margin: 3px 0 4px; }
  .recovery-heading p { font-size: .8rem; line-height: 1.45; }
  .recovery-steps { gap: 7px; margin-bottom: 10px; padding: 8px 9px; }
  .recovery-steps b { font-size: .68rem; }
  .recovery-steps i { width: 22px; height: 22px; }
  .recovery-fields .field { gap: 5px; margin: 8px 0; }
  .recovery-fields .field label { font-size: .78rem; }
  .recovery-fields .field input { min-height: 43px; padding-block: 9px; }
  .recovery-fields .field input[name="code"] { font-size: 1.05rem; }
  .recovery-password-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .recovery-notice { margin-bottom: 9px; padding: 8px 10px; font-size: .76rem; line-height: 1.45; }
  .recovery-actions { gap: 6px; margin-top: 10px; }
  .recovery-actions .btn { min-height: 43px; padding: 8px 10px; font-size: .85rem; }
  .recovery-footnote { display: none; }
}
@media (max-width: 360px) {
  .settings-tab { min-width: 100px; padding-inline: 7px; }
  .settings-tab-copy strong { font-size: .71rem; }
  .settings-head h2 { font-size: 1.15rem; }
  .settings-content { padding-inline: 12px; }
  .recovery-steps b { white-space: normal; line-height: 1.25; }
}
@media (max-width: 600px) and (max-height: 700px) {
  .modal-backdrop.centered .recovery-modal { padding: 9px 13px calc(7px + var(--safe-b)); }
  .recovery-topline { min-height: 30px; }
  .recovery-icon { width: 30px; height: 30px; border-radius: 10px; }
  .recovery-topline .modal-close { width: 30px; height: 30px; min-height: 30px; }
  .recovery-heading { margin: 2px 0 6px; }
  .recovery-heading h2 { margin: 2px 0; font-size: 1.14rem; }
  .recovery-heading p { font-size: .72rem; line-height: 1.32; }
  .recovery-steps { gap: 5px; margin-bottom: 6px; padding: 6px 7px; }
  .recovery-steps b { font-size: .62rem; }
  .recovery-steps i { width: 19px; height: 19px; font-size: .66rem; }
  .recovery-notice { gap: 6px; margin-bottom: 6px; padding: 6px 8px; font-size: .68rem; line-height: 1.3; }
  .recovery-fields .field { gap: 4px; margin: 5px 0; }
  .recovery-fields .field label { font-size: .72rem; }
  .recovery-fields .field input { min-height: 38px; padding: 6px 9px; }
  .recovery-fields .field input[name="code"] { font-size: .98rem; }
  .recovery-fields .field:has(input[readonly]) { grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 8px; margin-block: 4px; }
  .recovery-fields .field:has(input[readonly]) label { white-space: nowrap; }
  .recovery-fields .field:has(input[readonly]) input { min-height: 34px; padding: 4px 8px; }
  .recovery-fields .hint { font-size: .67rem; line-height: 1.25; }
  .recovery-password-grid { gap: 7px; }
  .recovery-actions { gap: 5px; margin-top: 7px; }
  .recovery-actions .btn { min-height: 38px; padding: 6px 8px; font-size: .78rem; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .settings-note.warning { color: #f7dfaa; }
}

/* =====================================================================
   Visual refresh 2026-10 — admin and retailer app screens only.
   Same identity (indigo→violet accent, Noto Sans Arabic, logo); every rule
   is scoped to .app-shell / .env-strip, so the approved login screens are
   untouched. Colours come from the theme tokens, so day and night follow.
   ===================================================================== */
:root {
  --rf-radius: 20px;
  --rf-card-shadow: 0 1px 2px rgba(21, 26, 46, .04), 0 10px 28px -14px rgba(33, 40, 90, .22);
  --rf-card-shadow-hover: 0 2px 4px rgba(21, 26, 46, .05), 0 18px 38px -16px rgba(33, 40, 90, .30);
  --rf-tint-a: color-mix(in srgb, var(--accent-a) 13%, transparent);
  --rf-tint-b: color-mix(in srgb, var(--accent-b) 15%, transparent);
}
:root[data-theme="dark"] {
  --rf-card-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 30px -16px rgba(0, 0, 0, .7);
  --rf-card-shadow-hover: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 40px -18px rgba(0, 0, 0, .8);
  --rf-tint-a: color-mix(in srgb, var(--accent-a) 16%, transparent);
  --rf-tint-b: color-mix(in srgb, var(--accent-b) 14%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --rf-card-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 30px -16px rgba(0, 0, 0, .7);
    --rf-card-shadow-hover: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 40px -18px rgba(0, 0, 0, .8);
  }
}

/* Page: a soft brand glow behind the header instead of a flat grey field */
.app-shell {
  background:
    radial-gradient(1100px 380px at 88% -120px, var(--rf-tint-b), transparent 62%),
    radial-gradient(900px 340px at 0% -140px, var(--rf-tint-a), transparent 60%),
    var(--bg);
}

/* Admin environment strip: slim and quiet (replaces the dark banner) */
.env-strip {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 30px; padding: 4px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); color: var(--muted); font-size: .78rem; line-height: 1.4;
}
.env-pill { display: inline-flex; align-items: center; gap: 7px; padding: 2px 10px; border-radius: 99px; font-weight: 800; color: var(--green); background: var(--green-soft); }
.env-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }
.env-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .env-note { display: none; } }

/* Top bar: one-line brand, light icon buttons grouped in a soft pill */
.app-shell .topbar { height: 62px; padding: 0 clamp(12px, 3vw, 24px); border-bottom-color: color-mix(in srgb, var(--line) 70%, transparent); box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset; }
.app-shell .topbar .brand { gap: 10px; min-width: 0; }
.app-shell .topbar .brand > div:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1.05rem; letter-spacing: -.01em; }
.app-shell .topbar .brand-mark { width: 38px; height: 38px; flex-basis: 38px; border-radius: 12px; }
.app-shell .user-area { gap: 2px; padding: 3px; border-radius: 16px; background: color-mix(in srgb, var(--surface-3) 70%, transparent); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.app-shell .user-area .user-dot, .app-shell .user-area .user-name { margin-inline: 8px 4px; }
.app-shell .user-area .btn-icon { width: 40px; height: 40px; min-height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--text-2); box-shadow: none; }
.app-shell .user-area .btn-icon:hover { background: var(--surface); color: var(--primary-text); box-shadow: var(--shadow-sm); }
@media (max-width: 480px) {
  .app-shell .topbar { height: 58px; }
  .app-shell .topbar .brand small { display: none; }
  /* The full name must stay readable (admin: «لوحة تحكم توفير نت»): wrap to two lines instead of cutting it. */
  .app-shell .topbar .brand > div:last-child { font-size: .95rem; white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }
  .app-shell .user-area .user-dot { display: none; }
  .app-shell .user-area .btn-icon { width: 38px; height: 38px; min-height: 38px; }
}

/* Cards: rounder, layered shadow, quieter border */
.app-shell .card { border-radius: var(--rf-radius); border-color: color-mix(in srgb, var(--line) 75%, transparent); box-shadow: var(--rf-card-shadow); }

/* Page headers: accent bar and stronger title */
.app-shell .page-header { position: relative; padding-inline-start: 16px; }
.app-shell .page-header::before { content: ''; position: absolute; inset-inline-start: 0; top: 6px; bottom: 6px; width: 4px; border-radius: 4px; background: var(--accent-grad); }
.app-shell .page-header h1 { display: flex; align-items: center; gap: 10px; letter-spacing: -.02em; }
.app-shell .page-header h1 svg.i { width: 26px; height: 26px; padding: 5px; border-radius: 10px; color: #fff; background: var(--accent-grad); box-shadow: 0 6px 14px rgba(91, 108, 255, .3); }

/* Summary tiles: a coloured top edge per kind and a bigger number */
.app-shell .stat { position: relative; overflow: hidden; padding: 18px; transition: transform .18s var(--ease-out), box-shadow .2s ease; }
.app-shell .stat::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent-grad); opacity: .9; }
.app-shell .stat:has(.stat-icon.good)::before { background: linear-gradient(90deg, #8b5cf6, #6d28d9); }
.app-shell .stat:has(.stat-icon.warn)::before { background: linear-gradient(90deg, #f59e0b, #d97706); }
.app-shell .stat:has(.stat-icon.bad)::before { background: linear-gradient(90deg, #f87171, #dc2626); }
.app-shell .stat-value { font-size: 1.7rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
@media (hover: hover) { .app-shell .stat:hover { transform: translateY(-2px); box-shadow: var(--rf-card-shadow-hover); } }

/* Admin sidebar: a calm panel with a filled active pill */
.app-shell .sidebar { background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface-2) 80%, var(--surface))); border-left-color: color-mix(in srgb, var(--line) 70%, transparent); }
.app-shell .nav-item { border-radius: 14px; font-weight: 700; color: var(--text-2); transition: background .15s ease, color .15s ease, box-shadow .2s ease; }
.app-shell .nav-item:hover { background: var(--surface-3); color: var(--text); }
.app-shell .nav-item.active { background: var(--accent-grad); color: #fff; box-shadow: 0 10px 22px -8px rgba(91, 108, 255, .55); }
.app-shell .nav-item.active .icon, .app-shell .nav-item.active svg.i { color: #fff; }

/* Tables: tinted header, hover row, airy cells (desktop; phones keep stacked cards) */
@media (min-width: 901px) {
  .app-shell .table-card thead th { background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 800; letter-spacing: .01em; border-bottom: 1px solid var(--line); }
  .app-shell .table-card tbody tr { transition: background .15s ease; }
  .app-shell .table-card tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
  .app-shell .table-card td, .app-shell .table-card th { padding-block: 14px; }
}

/* Chips: the active period is a filled pill */
.app-shell .chip { border-color: color-mix(in srgb, var(--line) 85%, transparent); box-shadow: var(--shadow-sm); }
.app-shell .chip.active { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -8px rgba(91, 108, 255, .6); }

/* --- Point of sale ------------------------------------------------------ */
/* Category tiles: original compact layout; white surface, soft shadow, and a deeper selected fill */
.app-shell .pos-compact .cat-tile { background: var(--surface); box-shadow: var(--rf-card-shadow); border-radius: 16px; }
.app-shell .pos-compact .cat-tile:hover:not(:disabled) { border-color: color-mix(in srgb, var(--cat-color) 55%, var(--line)); transform: translateY(-1px); }
.app-shell .pos-compact .cat-tile.selected, .app-shell .pos-compact .cat-tile.selected:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.02); border-color: transparent;
  /* Darker stops than before so white text stays readable on every category colour */
  background: linear-gradient(135deg, color-mix(in srgb, var(--cat-color) 86%, #000), color-mix(in srgb, var(--cat-color) 62%, #000));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cat-color) 26%, transparent), 0 14px 26px -12px color-mix(in srgb, var(--cat-color) 70%, transparent);
}

/* Customer number and the helper line under it */
.app-shell .pos-compact .sale-preview { border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-radius: 16px; background: var(--surface-2); }
.app-shell .pos-compact .sale-preview.has-cat { border-color: color-mix(in srgb, var(--cat-color) 35%, var(--line)); background: color-mix(in srgb, var(--cat-color) 7%, var(--surface)); color: var(--text); }

/* The sell button: taller, with a soft glow */
.app-shell .pos-compact .sale-btn { min-height: 60px; border-radius: 18px; font-size: 1.15rem; letter-spacing: -.01em; box-shadow: 0 16px 30px -14px rgba(91, 108, 255, .75), 0 1px 0 rgba(255, 255, 255, .25) inset; }

/* Balance card: a little more depth */
.app-shell .balance-card { border-radius: 24px; box-shadow: 0 22px 44px -22px rgba(76, 52, 200, .75); }

/* Bottom navigation: a floating rounded bar */
@media (max-width: 900px) {
  .app-shell .bottom-nav {
    inset: auto 10px calc(8px + var(--safe-b)) 10px; height: var(--nav-h); padding: 6px; border-radius: 22px;
    border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
    box-shadow: 0 18px 40px -16px rgba(33, 40, 90, .35), 0 1px 0 rgba(255, 255, 255, .5) inset;
  }
  .app-shell .bottom-nav button { border-radius: 16px; }
  .app-shell .bottom-nav button.active svg.i { background: var(--accent-grad); color: #fff; box-shadow: 0 8px 16px -6px rgba(91, 108, 255, .7); }
  .app-shell.has-bottom-nav .content { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 36px); }
}
@media (prefers-reduced-motion: reduce) {
  .app-shell .stat, .app-shell .pos-compact .cat-tile { transition: none; }
  .app-shell .stat:hover, .app-shell .pos-compact .cat-tile:hover:not(:disabled) { transform: none; }
}

/* =====================================================================
   Retailer phone UI (2026-10): lighter top bar, greeting, settings identity,
   quieter success sheet. Retailer-only selectors; the admin portal is untouched.
   ===================================================================== */

/* Top bar: logo + «توفير نت» + alerts only */
.app-shell .topbar-lite .user-area { padding: 0; gap: 0; background: none; border: 0; }
.app-shell .topbar-lite .user-area .btn-icon { width: 44px; height: 44px; min-height: 44px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); background: var(--surface); box-shadow: var(--shadow-sm); }
.app-shell .topbar-lite .brand > div:last-child { font-size: 1.12rem; font-weight: 850; }

/* Greeting at the top of the sale page */
.pos-greeting { margin: 2px 6px 12px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; font-size: 1.12rem; color: var(--muted); line-height: 1.5; }
.pos-greeting strong { color: var(--text); font-weight: 850; font-size: 1.22rem; min-width: 0; overflow-wrap: anywhere; }

/* Settings: who is signed in + appearance / guide / sign-out */
.settings-identity { display: grid; gap: 12px; margin: 0 20px 14px; padding: 14px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--line); }
.si-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.si-avatar { flex: none; width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: #fff; background: var(--accent-grad); box-shadow: 0 8px 18px -8px rgba(91, 108, 255, .7); }
.si-avatar svg.i { width: 24px; height: 24px; }
.si-text { display: grid; gap: 2px; min-width: 0; }
.si-text strong { font-size: 1.05rem; font-weight: 850; overflow-wrap: anywhere; }
.si-phone { color: var(--muted); font-size: .88rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.si-phone small { font-size: .8rem; }
.si-phone bdi { font-weight: 700; color: var(--text-2); letter-spacing: .03em; }
.si-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.si-actions .btn { justify-content: center; text-decoration: none; min-width: 0; padding-inline: 10px; }
.si-actions .btn-danger { grid-column: 1 / -1; }
@media (max-width: 640px) { .settings-identity { margin: 0 14px 10px; } }

/* Success sheet: «بيع جديد» is the only big button; favourites is a small centred link */
.done-fav-row { display: flex; justify-content: center; margin: 8px 0 0; }
.done-fav { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 8px 14px; border-radius: 99px; color: var(--primary-text); font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; min-height: 40px; }
.done-fav svg.i { width: 16px; height: 16px; }
.done-fav:hover { background: var(--primary-soft); }
.done-actions { display: block; margin-top: 12px; }
.done-actions .new-sale-btn { width: 100%; }

/* Windows: the close button is always at the physical LEFT edge (RTL layout is unchanged) */
.modal .modal-close, .settings-head .modal-close, .recovery-topline .modal-close { left: 12px; right: auto; }
.settings-head { position: relative; }

/* =====================================================================
   Retailer: top bar actions, remembered number, session window, calmer settings.
   Everything is scoped to the retailer's markup (.topbar-lite, .is-retailer,
   .session-modal); the admin settings and top bar keep their own rules.
   ===================================================================== */

/* Top bar: bell + theme + sign-out, 42px touch targets, no crowding at 320px */
.app-shell .topbar-lite .user-area { gap: 8px; }
.app-shell .topbar-lite .user-area .btn-icon { width: 42px; height: 42px; min-height: 42px; border-radius: 13px; flex: none; }
.app-shell .topbar-lite .brand { min-width: 0; }
@media (max-width: 360px) {
  .app-shell .topbar-lite { padding-inline: 10px; gap: 6px; }
  .app-shell .topbar-lite .user-area { gap: 6px; }
  .app-shell .topbar-lite .user-area .btn-icon { width: 38px; height: 38px; min-height: 38px; }
  .app-shell .topbar-lite .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .app-shell .topbar-lite .brand > div:last-child { font-size: 1rem; }
}

/* Remembered sign-in number */
.auth-forget-phone { align-self: flex-start; margin-top: 4px; border: 0; background: none; padding: 6px 2px; min-height: 32px; color: var(--primary-text); font: inherit; font-size: .8rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Session expired window */
.modal:focus { outline: none; }
.modal-backdrop.centered .session-modal { width: min(92vw, 400px); max-width: 400px; padding: 26px 22px 20px; border-radius: 24px; text-align: center; display: flex; flex-direction: column; align-items: stretch; align-self: center; height: auto; max-height: 92dvh; overflow-y: auto; }
.session-icon { width: 58px; height: 58px; margin: 0 auto 8px; border-radius: 19px; display: grid; place-items: center; color: #fff; background: var(--accent-grad); box-shadow: 0 14px 28px -10px rgba(91, 108, 255, .7); }
.session-icon svg.i { width: 28px; height: 28px; }
.session-modal h2, .session-modal > h2 { margin: 6px 0 4px; padding: 0; font-size: 1.3rem; letter-spacing: -.01em; text-align: center; }
.session-modal p { margin: 0; color: var(--muted); line-height: 1.75; font-size: .92rem; }
.session-modal .session-who { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 0; color: var(--text); font-weight: 800; }
.session-modal .session-who svg.i { width: 18px; height: 18px; color: var(--primary-text); }
.session-modal .field { margin: 16px 0 0; text-align: start; }
.session-modal .field input { min-height: 54px; font-size: 1.15rem; text-align: center; letter-spacing: .3em; }
.session-modal .field input.has-error { border-color: var(--red); }
.session-modal .field-error { margin-top: 10px; text-align: start; }
.session-modal .session-go { width: 100%; margin-top: 16px; }
.session-modal .session-out { width: 100%; margin-top: 6px; color: var(--muted); }

/* Settings (retailer): ONE scroll area, no inner scrollbars, no horizontal tab strip */
.modal-backdrop.centered .settings-modal.is-retailer {
  display: block; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  width: min(94vw, 860px); max-width: 860px; height: auto; max-height: min(90dvh, 860px); border-radius: 24px;
}
.is-retailer .settings-head { position: sticky; top: 0; z-index: 5; min-height: 0; padding: 16px 20px 14px; padding-left: 70px; background: var(--surface); }
.is-retailer .settings-head h2 { margin: 2px 0 0; font-size: 1.35rem; }
.is-retailer .settings-head p { display: none; }
.is-retailer .settings-identity { margin: 16px 20px 0; }
.is-retailer .si-actions .btn-danger { grid-column: auto; }
.is-retailer .settings-layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); align-items: start; min-height: 0; overflow: visible; margin-top: 14px; }
.is-retailer .settings-nav { position: sticky; top: 76px; padding: 8px 12px 20px 8px; overflow: visible; background: transparent; border: 0; }
.is-retailer .settings-content { overflow: visible; padding: 8px 24px 30px; }
.is-retailer .settings-form { width: 100%; max-width: 560px; }
.is-retailer .settings-form .field { margin: 18px 0; }
.is-retailer .settings-form .field input, .is-retailer .settings-form .field select { min-height: 52px; font-size: 1rem; }
.is-retailer .settings-form-actions { position: static; margin: 22px 0 0; padding: 0; background: none; }
.is-retailer .settings-form-actions .btn { min-width: 220px; min-height: 52px; }
.is-retailer .settings-switch-row { min-height: 56px; }

@media (max-width: 700px) {
  .modal-backdrop.centered .settings-modal.is-retailer { width: 100%; max-width: none; height: 94dvh; max-height: none; border-radius: 24px 24px 0 0; align-self: end; }
  .is-retailer .settings-head { padding: 14px 16px 12px; padding-left: 62px; }
  .is-retailer .settings-identity { margin: 14px 14px 0; }
  .is-retailer .settings-layout { display: block; margin-top: 12px; }
  .is-retailer .settings-nav { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 14px; }
  .is-retailer .settings-tab { width: auto; min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: 8px; padding: 10px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; min-height: 52px; }
  .is-retailer .settings-tab.active { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 34%, var(--line)); }
  .is-retailer .settings-tab-copy small, .is-retailer .settings-tab-arrow { display: none; }
  .is-retailer .settings-tab-copy strong { white-space: normal; font-size: .85rem; line-height: 1.35; }
  .is-retailer .settings-tab-icon { width: 30px; height: 30px; flex: none; }
  .is-retailer .settings-content { padding: 16px 16px calc(30px + var(--safe-b)); margin-top: 14px; border-top: 1px solid var(--line); }
  .is-retailer .settings-form-actions .btn { width: 100%; min-width: 0; }
  .is-retailer .settings-pin-fields { grid-template-columns: 1fr; gap: 0; }
}

/* ---------------------------------------- admin operations: alerts, reports, accounts
   Used by the admin screens only; the retailer app does not render these classes. */
.alert-banner.warn { background: var(--yellow-soft); border-color: color-mix(in srgb, var(--yellow) 40%, transparent); color: var(--yellow); }
.alert-banner > .btn { flex: none; }
/* A control the signed-in admin role cannot use is hidden (the server refuses it anyway). */
.content [data-action][hidden], .modal [data-action][hidden] { display: none !important; }
.role-note { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 9px 12px; border-radius: 12px; background: var(--surface-3); color: var(--text-2); font-size: .86rem; }
.role-note .i { width: 18px; height: 18px; flex: none; }
.admin-more-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.admin-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; padding: 14px 16px; margin-bottom: 14px; }
.admin-filters .field { margin: 0; }
.admin-roles-help { margin-bottom: 14px; }
.admin-roles-help ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.admin-roles-help li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-report .money { white-space: nowrap; }
@media (max-width: 600px) { .admin-filters { grid-template-columns: 1fr; } }

/* ------------------------------------------------ first paint, before the app arrives */
.boot-splash { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg); color: var(--muted); font-weight: 600; }
.boot-ring { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary-600); animation: boot-spin .9s linear infinite; }
@keyframes boot-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .boot-ring { animation-duration: 3s; } }

/* ------------------------------------------------ customer messages (offers phone, admin only) */
.customers-tools { margin-bottom: 14px; }
.customers-tools .toolbar { flex-wrap: wrap; }
.customers-tools p { margin: 10px 0 0; font-size: .86rem; }
.customers-tools label.btn { cursor: pointer; }
.customer-pick { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.customer-pick input { width: 20px; height: 20px; flex: none; accent-color: var(--primary-600); }
.selection-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.selection-bar > span { margin-inline-end: auto; }
.campaign-progress { display: grid; gap: 6px; min-width: 160px; }
.campaign-progress .progress { margin-top: 0; height: 8px; }
.campaign-modal fieldset { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.campaign-modal legend { font-weight: 700; margin-bottom: 6px; }
.radio-row { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.radio-row input { width: 18px; height: 18px; accent-color: var(--primary-600); }
.campaign-modal textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.campaign-text-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: .84rem; }
.campaign-preview { display: grid; gap: 6px; margin: 10px 0; }
.sms-bubble { background: var(--primary-soft); color: var(--text); border-radius: 16px 16px 4px 16px; padding: 12px 14px; line-height: 1.75; white-space: normal; overflow-wrap: anywhere; margin: 8px 0; }
.campaign-settings { margin-top: 14px; }
.campaign-settings-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.campaign-setup { margin-bottom: 14px; }
.campaign-setup .toolbar { margin-top: 12px; flex-wrap: wrap; }
.campaign-detail-table { max-height: 50vh; overflow: auto; }
.alert-banner.good { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 40%, transparent); color: var(--green); }
.speed-test { margin-bottom: 14px; }
.speed-test .chips { margin-top: 6px; }
.speed-result { display: grid; gap: 10px; margin: 10px 0; }
.speed-stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.speed-stats > div { display: grid; gap: 4px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.speed-stats strong { font-size: 1.1rem; }
.speed-result-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.speed-result-form .field { margin: 0; flex: 1 1 220px; }
