/* =========================================================
   BRIIVO Sales Cloud — design system
   Matte Black + Dark Charcoal + White + Metallic Gold
   ========================================================= */
:root {
  --bg: #0A0A0A;
  --deep: #050505;
  --char: #111111;
  --card: #151515;
  --elev: #1B1B1B;
  --line: #292929;
  --line-soft: #1F1F1F;
  --gold: #B08D3C;
  --gold2: #C6A15B;
  --gold3: #D4B875;
  --gold-a: rgba(198, 161, 91, .10);
  --gold-line: rgba(198, 161, 91, .32);
  /* metallic gold: a restrained two-tone sheen, not a decorative gradient */
  --grad: linear-gradient(180deg, #C6A15B 0%, #B08D3C 100%);
  --text: #FFFFFF;
  --text2: #B8B8B8;
  --muted: #777777;
  --ok: #6FA383;
  --warn: #D9893B;
  --err: #D0645A;
  --r: 16px;
  --rs: 10px;
  --head: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --side: 248px;
  --top: 64px;
  --tab: 66px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 14.5px/1.5 var(--body);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  accent-color: #B08D3C;
}
/* keep native browser pieces on-brand (no default blue focus rings / white dropdowns / yellow autofill) */
:focus { outline: none; }
:focus-visible { outline: 2px solid rgba(176, 141, 60, .7); outline-offset: 2px; }
.input:focus-visible { outline: none; }
option, optgroup { background: #111111; color: #FFFFFF; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: #FFFFFF; caret-color: #FFFFFF;
  -webkit-box-shadow: 0 0 0 1000px #111111 inset; transition: background-color 9999s;
}
h1, h2, h3, h4 { font-family: var(--head); margin: 0; letter-spacing: -.01em; }
a { color: var(--gold2); text-decoration: none; }
a:hover { color: var(--gold3); }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
::selection { background: rgba(198, 161, 91, .35); }
* { scrollbar-width: thin; scrollbar-color: #2c2c2c transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2c2c2c; border-radius: 8px; }

.ico { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-lg { width: 22px; height: 22px; }

/* ---------- Brand ---------- */
.wordmark {
  font: 800 22px/1 var(--head); letter-spacing: .2em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font: 600 10.5px/1 var(--head); letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin-top: 7px; }

/* ---------- Boot ---------- */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; background: var(--deep); z-index: 50; }
.boot .wordmark { font-size: 30px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #2a2a2a; border-top-color: var(--gold2); animation: spin .8s linear infinite; margin-top: 22px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--deep);
  border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; z-index: 20;
}
.side-brand { padding: 24px 24px 22px; border-bottom: 1px solid var(--line-soft); }
.nav { padding: 14px 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 14px;
  border-radius: var(--rs); color: var(--text2); font: 600 14px var(--head); transition: background .15s, color .15s;
}
.nav a .ico { color: var(--muted); transition: color .15s; }
.nav a:hover { background: var(--char); color: var(--text); }
.nav a.active { background: var(--gold-a); color: var(--text); }
.nav a.active .ico { color: var(--gold2); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--elev); border: 1px solid var(--line); display: grid; place-items: center; font: 700 13px var(--head); color: var(--gold2); flex: none; }
.side-user { flex: 1; min-width: 0; }
.side-user b { display: block; font: 600 13.5px var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user span { font-size: 12px; color: var(--muted); }

.main { flex: 1; margin-left: var(--side); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15; height: var(--top); display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: rgba(10, 10, 10, .88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar h1 { font-size: 19px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .mob-brand { display: none; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; height: 40px; width: 300px; padding: 0 14px; border-radius: 999px;
  background: var(--char); border: 1px solid var(--line); color: var(--muted); cursor: pointer; font-size: 13.5px;
}
.search-trigger:hover { border-color: #3a3a3a; color: var(--text2); }
.search-trigger kbd { margin-left: auto; font: 600 11px var(--body); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.view { padding: 26px 28px 60px; flex: 1; min-width: 0; }

.tabbar { display: none; }

/* ---------- Page chrome ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--text2); }
.page-head h2 { font-size: 24px; font-weight: 800; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow { font: 700 11px var(--head); letter-spacing: .2em; text-transform: uppercase; color: var(--gold2); }
.section-title { font: 700 15px var(--head); margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); }
.text2 { color: var(--text2); }
.gold { color: var(--gold2); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.small { font-size: 12.5px; }
.strong { font-weight: 600; color: var(--text); }
.mt { margin-top: 18px; }
.mt-s { margin-top: 10px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h3 { font-size: 15px; }
.stat { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.stat .lbl { font: 600 11.5px var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .lbl .ico { width: 15px; height: 15px; color: var(--gold); }
.stat .val { font: 800 25px/1.15 var(--head); color: var(--gold2); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .val.white { color: var(--text); }
.stat .sub { font-size: 12.5px; color: var(--text2); }
.stat-link { cursor: pointer; transition: border-color .15s, background .15s; }
.stat-link:hover { border-color: #3a3a3a; background: #171717; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--char); color: var(--text);
  font: 700 13.5px var(--head); letter-spacing: .01em; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, filter .15s, transform .1s;
}
.btn:hover { background: var(--elev); border-color: #3a3a3a; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-gold { background: var(--grad); color: #0A0A0A; border-color: transparent; }
.btn-gold:hover { background: var(--grad); filter: brightness(1.07); border-color: transparent; }
.btn-line { border-color: var(--gold-line); background: rgba(255, 255, 255, .02); }
.btn-line:hover { border-color: var(--gold2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn-ghost:hover { background: var(--char); color: var(--text); border-color: transparent; }
.btn-danger { color: var(--err); border-color: rgba(208, 100, 90, .35); background: transparent; }
.btn-danger:hover { background: rgba(208, 100, 90, .08); border-color: var(--err); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 12.5px; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-xl { height: 64px; width: 100%; font: 800 17px var(--head); letter-spacing: .12em; text-transform: uppercase; border-radius: 12px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: transparent; border: 1px solid transparent; color: var(--text2); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--elev); color: var(--text); }
.icon-btn.bordered { border-color: var(--line); background: var(--char); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ico { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--err); }
.is-loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl-s { font: 600 12.5px var(--head); color: var(--text2); }
.field > label .req { color: var(--gold2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 13px; background: var(--char); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--rs); font: 400 14.5px var(--body); outline: none;
  transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none; min-width: 0;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 13px; resize: vertical; }
select.input { padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B8B8B8' stroke-width='2.4' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(176, 141, 60, .12); }
.input:invalid:not(:placeholder-shown):not(:focus) { border-color: rgba(208, 100, 90, .55); }
.input[readonly] { color: var(--text2); background: #0e0e0e; }
.input.sm { height: 36px; font-size: 13.5px; }
input[type=number].input { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=date].input::-webkit-calendar-picker-indicator, input[type=month].input::-webkit-calendar-picker-indicator { filter: invert(.75); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.g3f { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text2); user-select: none; }
.check input { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 6px; background: var(--char); display: grid; place-items: center; margin: 0; cursor: pointer; }
.check input:checked { background: var(--grad); border-color: transparent; }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2px solid #0A0A0A; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--rs) 0 0 var(--rs); }
.input-group .input + .input, .input-group .addon { border-radius: 0 var(--rs) var(--rs) 0; margin-left: -1px; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; background: var(--elev); border: 1px solid var(--line); color: var(--text2); font-size: 13px; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box .input { padding-left: 40px; }
.search-box .icon-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar select.input { width: auto; min-width: 150px; }

/* ---------- Segmented tabs / chips ---------- */
.seg { display: inline-flex; background: var(--char); border: 1px solid var(--line); border-radius: 999px; padding: 4px; gap: 2px; overflow-x: auto; max-width: 100%; }
.seg button { height: 34px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; color: var(--text2); font: 600 13px var(--head); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--elev); color: var(--text); box-shadow: inset 0 0 0 1px var(--gold-line); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 36px; padding: 0 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--char); color: var(--text2); font: 600 13px var(--head); cursor: pointer; white-space: nowrap; flex: none; }
.chip:hover { color: var(--text); border-color: #3a3a3a; }
.chip.on { color: var(--text); border-color: var(--gold2); background: var(--gold-a); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font: 700 11px var(--head); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; border: 1px solid transparent; }
.b-ok { color: var(--ok); background: rgba(111, 163, 131, .1); }
.b-warn { color: var(--warn); background: rgba(217, 137, 59, .1); }
.b-err { color: var(--err); background: rgba(208, 100, 90, .1); }
.b-gold { color: var(--gold3); background: var(--gold-a); }
.b-muted { color: var(--text2); background: #1e1e1e; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font: 700 11px var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--card); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #181818; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: #131313; }
.tbl .acts { text-align: right; white-space: nowrap; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.thumb { width: 40px; height: 40px; border-radius: 10px; background: var(--elev); border: 1px solid var(--line); display: grid; place-items: center; font: 800 13px var(--head); color: var(--gold2); overflow: hidden; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.prod-cell { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.more-row { padding: 14px; text-align: center; border-top: 1px solid var(--line-soft); }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--text2); }
.empty .e-ico { width: 54px; height: 54px; margin: 0 auto 14px; border-radius: 50%; background: var(--elev); border: 1px solid var(--line); display: grid; place-items: center; color: var(--gold2); }
.empty h4 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty p { margin: 0 0 16px; font-size: 13.5px; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .72); display: grid; place-items: center; padding: 20px; animation: fade .18s var(--ease); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9); animation: pop .22s var(--ease); }
.modal.lg { max-width: 820px; }
.modal.xl { max-width: 1040px; }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px 24px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { flex: 1; font-size: 17px; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 18px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 80; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 260px; max-width: 380px; display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; background: var(--elev); border: 1px solid var(--line); border-left: 3px solid var(--gold2); border-radius: 12px; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .9); animation: pop .25s var(--ease); font-size: 14px; }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
.toast .ico { color: var(--gold2); margin-top: 1px; }
.toast.err .ico { color: var(--err); }
.toast.warn .ico { color: var(--warn); }

/* ---------- Combo picker ---------- */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); background: var(--elev); border: 1px solid var(--line); border-radius: 12px; max-height: 300px; overflow-y: auto; box-shadow: 0 20px 44px -16px rgba(0, 0, 0, .95); padding: 6px; }
.combo-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.combo-item:hover, .combo-item.hl { background: #242424; }
.combo-item .ci-main { flex: 1; min-width: 0; }
.combo-item .ci-main b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-item .ci-main span { font-size: 12px; color: var(--muted); }
.combo-item .ci-side { font-size: 12.5px; color: var(--gold2); text-align: right; white-space: nowrap; }
.combo-empty { padding: 12px; color: var(--muted); font-size: 13px; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpis.kpis-fit { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpis-fit .stat .val { font-size: 22px; }
.tbl td.main-cell.cell-main { white-space: nowrap; }
.kpi-hero { grid-column: span 2; }
.kpi-hero .val { font-size: 34px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--body); }
.list-rows .lr { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.list-rows .lr:last-child { border-bottom: 0; }
.list-rows .lr:hover { background: #181818; }
.lr .lr-main { flex: 1; min-width: 0; }
.lr .lr-main b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr .lr-main span { font-size: 12.5px; color: var(--muted); }
.lr .lr-side { text-align: right; }
.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font: 600 12.5px var(--head); color: var(--text2); }
.flow a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--text2); background: var(--char); }
.flow a:hover { border-color: var(--gold-line); color: var(--text); }
.flow .ico { width: 14px; height: 14px; color: var(--muted); }

/* ---------- POS ---------- */
.view.pos-view { padding: 0; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 420px; grid-template-rows: minmax(0, 1fr); height: calc(100vh - var(--top)); height: calc(100dvh - var(--top)); }
.pos-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 20px 22px 0; }
.pos-top { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.pos-top .search-box .input { height: 50px; font-size: 15.5px; border-radius: 14px; }
.pos-top .icon-btn.bordered { width: 50px; height: 50px; border-radius: 14px; }
.doc-switch { margin-bottom: 12px; }
.prod-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; align-content: start; grid-auto-rows: max-content; padding: 4px 2px 22px; }
.ptile { position: relative; display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 12px; min-height: 150px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.ptile > * { flex-shrink: 0; }
.ptile:hover { border-color: var(--gold-line); background: #181818; }
.ptile:active { transform: scale(.98); }
.ptile .pt-img { width: 100%; height: 78px; border-radius: 10px; background: var(--elev); display: grid; place-items: center; overflow: hidden; font: 800 20px var(--head); color: var(--gold); letter-spacing: .06em; }
.ptile .pt-img img { width: 100%; height: 100%; object-fit: cover; }
.ptile .pt-name { font: 600 13.5px/1.3 var(--head); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ptile .pt-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.ptile .pt-price { font: 800 14.5px var(--head); color: var(--gold2); }
.ptile .pt-stock { font-size: 11.5px; color: var(--muted); }
.ptile .pt-stock.low { color: var(--warn); }
.ptile .pt-qty { position: absolute; top: 8px; right: 8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; background: var(--grad); color: #0A0A0A; font: 800 12px/26px var(--head); text-align: center; }
.cart { display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--line); min-height: 0; }
.cart-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.cart-head .row { flex-wrap: nowrap; }
.cart-lines { flex: 1; overflow-y: auto; padding: 6px 0; min-height: 80px; }
.cline { padding: 12px 18px; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
.cline .cl-name { font: 600 14px var(--head); overflow: hidden; text-overflow: ellipsis; }
.cline .cl-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cline .cl-meta button { background: none; border: 0; padding: 0; color: var(--text2); cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; font-size: 12.5px; }
.cline .cl-meta button:hover { color: var(--gold3); }
.cline .cl-total { font: 700 14.5px var(--head); text-align: right; }
.stepper { display: inline-flex; align-items: center; background: var(--char); border: 1px solid var(--line); border-radius: 999px; height: 40px; }
.stepper button { width: 40px; height: 38px; border: 0; background: transparent; color: var(--text); cursor: pointer; display: grid; place-items: center; border-radius: 999px; }
.stepper button:hover { background: var(--elev); }
.stepper input { width: 56px; height: 38px; border: 0; background: transparent; color: var(--text); text-align: center; font: 700 14.5px var(--head); outline: none; -moz-appearance: textfield; }
.cart-foot { border-top: 1px solid var(--line); padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 12px; background: #131313; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; font-size: 14px; color: var(--text2); }
.totals .t-grand { font: 800 24px var(--head); color: var(--text); padding-top: 6px; }
.totals .t-grand.v { color: var(--gold2); }
.pay-methods { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.pay-methods button { height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--char); color: var(--text2); font: 700 12px var(--head); cursor: pointer; padding: 0 4px; }
.pay-methods button.on { border-color: var(--gold2); color: var(--text); background: var(--gold-a); }
.cart-mini { display: none; }
.pos-cart-close { display: none; }

/* ---------- Repack ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; align-items: stretch; }
.step { position: relative; }
.step-no { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 800 13px var(--head); background: var(--elev); border: 1px solid var(--gold-line); color: var(--gold2); margin-bottom: 12px; }
.step h3 { font-size: 15px; margin-bottom: 14px; }
.avail { margin-top: 8px; font-size: 12.5px; color: var(--text2); }
.repack-sum { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.repack-eq { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font: 700 16px var(--head); }
.repack-eq .ico { color: var(--gold2); }

/* ---------- Profile ---------- */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head .avatar { width: 56px; height: 56px; font-size: 19px; }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }

/* ---------- Login ---------- */
.login { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 20px; background: var(--deep); overflow-y: auto; }
.login-card { width: 100%; max-width: 420px; text-align: center; }
.login-card .wordmark { font-size: 32px; }
.login-users { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 28px 0 22px; }
.login-user { padding: 16px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text); }
.login-user:hover { border-color: #3a3a3a; }
.login-user.on { border-color: var(--gold2); background: var(--gold-a); }
.login-user span { font-size: 11.5px; color: var(--muted); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 6px 0 18px; }
.pin-dots i { width: 13px; height: 13px; border-radius: 50%; border: 1px solid #444; }
.pin-dots i.f { background: var(--grad); border-color: transparent; }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.keypad button { height: 58px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font: 700 20px var(--head); cursor: pointer; color: var(--text); }
.keypad button:hover { background: var(--elev); }
.keypad button.k-fn { font-size: 13px; color: var(--text2); }
.login-hint { margin-top: 18px; font-size: 12.5px; color: var(--muted); }

/* ---------- Global search ---------- */
.gs-results { margin-top: 12px; max-height: 55vh; overflow-y: auto; }
.gs-group { font: 700 11px var(--head); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 12px 6px 6px; }

/* ---------- Document preview (screen) ---------- */
.doc-shell { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.paper-wrap { background: #1a1a1a; border: 1px solid var(--line); border-radius: var(--r); padding: 24px; overflow-x: auto; }
.paper { background: #fff; color: #111; margin: 0 auto; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8); }
.paper.a4 { width: 794px; min-height: 1000px; padding: 44px 48px; }
.paper.r80 { width: 302px; padding: 14px 10px; }
.paper.r58 { width: 219px; padding: 10px 6px; }
.doc-actions { display: flex; flex-direction: column; gap: 10px; position: sticky; top: calc(var(--top) + 20px); }

/* ---------- Invoice document (shared by screen preview + print) ---------- */
.inv { font: 12px/1.45 "Inter", Arial, sans-serif; color: #111; }
.inv * { box-sizing: border-box; }
.inv-top { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding: 22px 24px; background: #0A0A0A; color: #FFFFFF; border-bottom: 3px solid #B08D3C; border-radius: 6px 6px 0 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.inv-top .inv-logo-img { background: #FFFFFF; padding: 6px 10px; border-radius: 6px; }
.inv-logo-img { max-height: 64px; max-width: 200px; object-fit: contain; margin-bottom: 8px; }
.inv-biz .inv-wordmark { font: 800 22px/1 "Manrope", Arial, sans-serif; letter-spacing: .2em; color: #B08D3C; margin-bottom: 8px; }
.inv-biz b { font: 800 15px "Manrope", Arial, sans-serif; display: block; margin-bottom: 3px; color: #C6A15B; }
.inv-biz div { color: #B8B8B8; }
.inv-title { text-align: right; }
.inv-title h2 { font: 800 26px "Manrope", Arial, sans-serif; letter-spacing: .12em; color: #C6A15B; margin: 0 0 8px; }
.inv-title table td { padding: 1px 0 1px 14px; }
.inv-title table td:first-child { color: #9A9A9A; }
.inv-parties { display: flex; justify-content: space-between; gap: 24px; margin: 18px 0; }
.inv-parties h4 { font: 700 10px "Manrope", Arial, sans-serif; letter-spacing: .16em; color: #B08D3C; margin: 0 0 5px; text-transform: uppercase; }
.inv-parties b { font-size: 13px; }
.inv-items { width: 100%; border-collapse: collapse; margin-top: 6px; }
.inv-items th { background: #111; color: #fff; font: 700 10px "Manrope", Arial, sans-serif; letter-spacing: .1em; text-transform: uppercase; padding: 8px; text-align: left; }
.inv-items th.r, .inv-items td.r { text-align: right; }
.inv-items td { padding: 8px; border-bottom: 1px solid #e6e6e6; vertical-align: top; }
.inv-items td small { color: #777; }
.inv-bottom { display: flex; justify-content: space-between; gap: 24px; margin-top: 16px; align-items: flex-start; }
.inv-notes { flex: 1; color: #555; font-size: 11.5px; }
.inv-notes h4 { font: 700 10px "Manrope", Arial, sans-serif; letter-spacing: .16em; color: #B08D3C; margin: 0 0 5px; text-transform: uppercase; }
.inv-totals { width: 280px; border-collapse: collapse; }
.inv-totals td { padding: 5px 0; }
.inv-totals td.r { text-align: right; }
.inv-totals tr.grand td { border-top: 2px solid #111; font: 800 15px "Manrope", Arial, sans-serif; padding-top: 8px; color: #B08D3C; }
.inv-totals tr.bal td { font-weight: 700; color: #B08D3C; }
.inv-foot { margin-top: 30px; padding-top: 12px; border-top: 1px solid #e6e6e6; display: flex; justify-content: space-between; color: #888; font-size: 10.5px; }
.inv-foot b { color: #B08D3C; letter-spacing: .18em; }
/* Receipts */
.rc { font: 12px/1.35 "Courier New", ui-monospace, monospace; color: #000; }
.rc.w58 { font-size: 10.5px; }
.rc .c { text-align: center; }
.rc .rc-logo { max-width: 60%; max-height: 60px; margin: 0 auto 4px; object-fit: contain; }
.rc .rc-biz { font: 800 14px Arial, sans-serif; }
.rc.w58 .rc-biz { font-size: 12.5px; }
.rc hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.rc .rc-row { display: flex; justify-content: space-between; gap: 6px; }
.rc .rc-item { margin-bottom: 3px; }
.rc .rc-grand { font: 800 15px Arial, sans-serif; }
.rc.w58 .rc-grand { font-size: 13px; }
.rc .rc-foot { margin-top: 8px; }

#print-root { display: none; }
@media print {
  html, body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .pb { break-after: page; page-break-after: always; }
  .inv-items th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-sheet.r80 { width: 72mm; margin: 0 auto; }
  .print-sheet.r58 { width: 48mm; margin: 0 auto; }
  .print-sheet.rep { font: 11px/1.4 Arial, sans-serif; color: #000; }
}
.rep h2 { font: 800 18px Arial, sans-serif; margin: 0 0 4px; }
.rep table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.rep th, .rep td { border-bottom: 1px solid #ddd; padding: 5px 6px; text-align: left; font-size: 11px; }
.rep th { background: #f2f2f2; }

/* ---------- Scanner ---------- */
.scan-video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 4/3; object-fit: cover; }
.scan-frame { position: relative; }
.scan-frame::after { content: ""; position: absolute; left: 12%; right: 12%; top: 45%; height: 2px; background: var(--gold2); box-shadow: 0 0 12px var(--gold2); }

.settings-nav { display: flex; flex-direction: column; gap: 4px; }
.settings-nav button { text-align: left; height: 42px; padding: 0 14px; border-radius: 10px; border: 0; background: transparent; color: var(--text2); font: 600 14px var(--head); cursor: pointer; display: flex; align-items: center; gap: 10px; }
.settings-nav button:hover { background: var(--char); color: var(--text); }
.settings-nav button.on { background: var(--gold-a); color: var(--text); }
.settings-nav button.on .ico { color: var(--gold2); }
.logo-prev { width: 150px; height: 80px; border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; overflow: hidden; background: #fff; }
.logo-prev img { max-width: 90%; max-height: 90%; object-fit: contain; }
.img-prev { width: 88px; height: 88px; border-radius: 12px; border: 1px dashed var(--line); display: grid; place-items: center; overflow: hidden; background: var(--char); color: var(--muted); flex: none; }
.img-prev img { width: 100%; height: 100%; object-fit: cover; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--char); border: 1px solid var(--line); color: var(--text2); font-size: 13px; }
.note.gold { border-color: var(--gold-line); background: rgba(198, 161, 91, .05); }
.note.err { border-color: rgba(208, 100, 90, .4); }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }
.bar-track { height: 6px; border-radius: 6px; background: #222; overflow: hidden; }
.bar-fill { height: 100%; background: var(--grad); border-radius: 6px; }

/* ---------- Mobile menu sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .7); animation: fade .15s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--deep); border-top: 1px solid var(--line); border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .25s var(--ease); max-height: 85vh; overflow-y: auto; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: #333; margin: 4px auto 14px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-grid a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--text2); font: 600 12.5px var(--head); text-align: center; }
.sheet-grid a .ico { color: var(--gold2); width: 22px; height: 22px; }
.sheet-grid a.active { border-color: var(--gold2); color: var(--text); }
@keyframes up { from { transform: translateY(100%); } }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-hero { grid-column: span 3; }
  .pos { grid-template-columns: minmax(0, 1fr) 380px; }
}
@media (max-width: 1440px) {
  .paper-wrap .paper.a4 { zoom: .72; }
}
@media (min-width: 901px) and (max-width: 1180px) {
  /* tablets in landscape: icon-only sidebar leaves more room for work */
  :root { --side: 76px; }
  .side-brand { padding: 22px 0; text-align: center; }
  .side-brand .wordmark { font-size: 0; letter-spacing: 0; }
  .side-brand .wordmark::before { content: "B"; font-size: 26px; }
  .side-brand .brand-sub, .nav a span, .side-user { display: none; }
  .nav { padding: 12px 10px; }
  .nav a { justify-content: center; padding: 0; height: 46px; }
  .nav a.active::before { left: -10px; }
  .side-foot { flex-direction: column; padding: 12px 0; }
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-side { grid-template-columns: 1fr; }
  .doc-shell { grid-template-columns: 1fr; }
  .doc-actions { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .doc-actions .card, .doc-actions .divider { grid-column: 1 / -1; }
  .paper-wrap .paper.a4 { zoom: .8; }
}
@media (max-width: 900px) {
  :root { --top: 58px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--tab) + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar .mob-brand { display: block; }
  .topbar .mob-brand .wordmark { font-size: 17px; }
  .topbar h1 { font-size: 15px; color: var(--text2); font-weight: 600; text-align: center; }
  .search-trigger { width: 40px; padding: 0; justify-content: center; border-radius: 50%; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .view { padding: 18px 16px 40px; }
  .page-head h2 { font-size: 21px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tab) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(5, 5, 5, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line-soft);
  }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font: 600 10.5px var(--head); background: none; border: 0; cursor: pointer; position: relative; }
  .tabbar .ico { width: 21px; height: 21px; }
  .tabbar .active { color: var(--text); }
  .tabbar .active .ico { color: var(--gold2); }
  .tabbar .active::before { content: ""; position: absolute; top: 0; width: 26px; height: 2px; border-radius: 0 0 2px 2px; background: var(--grad); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi-hero { grid-column: span 2; }
  .kpis.kpis-fit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis-fit .stat .val { font-size: 18px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .stat .val { font-size: 21px; }
  .kpi-hero .val { font-size: 28px; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--tab) + 14px); }
  .toast { max-width: none; }
  /* POS on phones: product grid first, cart as full sheet */
  .pos { grid-template-columns: 1fr; height: calc(100dvh - var(--top) - var(--tab) - env(safe-area-inset-bottom)); }
  .pos-left { padding: 14px 14px 0; }
  .prod-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; padding-bottom: 90px; }
  .ptile .pt-img { height: 58px; }
  .cart { position: fixed; inset: 0; z-index: 50; border-left: 0; transform: translateY(100%); transition: transform .28s var(--ease); visibility: hidden; }
  .cart.open { transform: none; visibility: visible; }
  .pos-cart-close { display: inline-grid; }
  .cart-mini { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab) + 10px + env(safe-area-inset-bottom)); z-index: 25; height: 58px; border-radius: 16px; background: var(--grad); color: #0A0A0A; align-items: center; padding: 0 18px; gap: 12px; font: 800 15px var(--head); border: 0; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .9); cursor: pointer; }
  .cart-mini .cm-count { background: #0A0A0A; color: var(--gold3); border-radius: 999px; min-width: 28px; height: 28px; display: grid; place-items: center; font-size: 13px; padding: 0 8px; }
  .cart-mini .cm-total { margin-left: auto; }
}
@media (min-width: 700px) and (max-width: 900px) {
  /* Android tablets in portrait: keep cart visible beside products */
  .pos { grid-template-columns: minmax(0, 1fr) 340px; }
  .cart { position: static; transform: none; visibility: visible; border-left: 1px solid var(--line); }
  .cart-mini, .pos-cart-close { display: none; }
  .prod-grid { padding-bottom: 22px; }
}
@media (max-width: 700px) {
  .form-grid, .form-grid.g3f { grid-template-columns: 1fr; }
  .modal-wrap { padding: 0; align-items: end; }
  .modal, .modal.lg, .modal.xl, .modal.sm { max-width: none; border-radius: 20px 20px 0 0; max-height: 94dvh; }
  .modal-body { padding: 18px; }
  .modal-foot { padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .toolbar > * { flex: 1 1 auto; }
  .toolbar select.input { min-width: 0; }
  /* tables become stacked cards */
  .tbl.stack thead { display: none; }
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
  .tbl.stack td { padding: 3px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex: none; }
  .tbl.stack td.main-cell { display: block; text-align: left; padding-bottom: 6px; }
  .tbl.stack td.main-cell::before { display: none; }
  .tbl.stack td.acts { justify-content: flex-end; padding-top: 8px; }
  .tbl.stack td.acts::before { display: none; }
  .tbl.stack tfoot { display: block; }
  .tbl.stack tfoot tr { display: flex; justify-content: space-between; flex-wrap: wrap; }
  .tbl.stack tfoot td { display: inline; width: auto; }
  .paper-wrap { padding: 10px; }
  .paper-wrap .paper.a4 { zoom: .41; }
  .pay-methods { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-nav { flex-direction: row; overflow-x: auto; }
  .settings-nav button { flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
