/* ============================================================
   GO LABAN · BILLER BRO — styles
   Blue and green come straight from the Go Laban badge.
   The badge's dashed "stitch" ring is the one decorative motif:
   it appears on the live bill ticket and the active nav item only.
   ============================================================ */
:root {
  --blue: #0C4C9A;
  --blue-deep: #083A78;
  --blue-ink: #062B5A;
  --blue-wash: #E6EEF8;
  --green: #2BB51C;
  --green-deep: #1E8A12;
  --green-wash: #E5F6E2;
  --milk: #F2F6FB;
  --paper: #FFFFFF;
  --ink: #0F1D30;
  --ink-2: #4A5A70;
  --ink-3: #7D8BA0;
  --line: #D9E2EE;
  --line-2: #EBF0F6;
  --red: #C8322B;
  --red-wash: #FCEBEA;
  --amber: #B86E00;
  --amber-wash: #FFF3DD;
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 20px;
  --shadow: 0 1px 2px rgba(6, 43, 90, .06), 0 4px 16px rgba(6, 43, 90, .06);
  --head: "Bricolage Grotesque", "Figtree", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --rail: 232px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 var(--body);
  color: var(--ink);
  background: var(--milk);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--head); line-height: 1.15; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.muted { color: var(--ink-2); }
.fine { color: var(--ink-3); font-size: 13px; }
.num { text-align: right; white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(12, 76, 154, .35); outline-offset: 2px; }

/* ---------- Buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: #b8c6d8; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-deep); }
.btn.go { background: var(--green); border-color: var(--green); color: #fff; }
.btn.go:hover { background: var(--green-deep); }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.big { min-height: 50px; font-size: 16px; padding: 0 22px; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .i { width: 18px; height: 18px; }
.iconbtn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--r-s); border: 1px solid var(--line); background: var(--paper); cursor: pointer; }

label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, select, textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--paper); font-size: 15px; font-weight: 500; color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(12, 76, 154, .15); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.form-section h3 { margin-bottom: 2px; }
.form-error { color: var(--red); font-size: 14px; font-weight: 600; min-height: 1em; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.check input { width: 18px; min-height: 18px; height: 18px; }

/* ---------- Sign in ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 600px at 50% -10%, #1a5fb3 0%, var(--blue) 40%, var(--blue-ink) 100%); }
.login-card { width: min(400px, 100%); background: var(--paper); border-radius: var(--r-l); padding: 32px 28px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); text-align: center; }
.login-badge { width: 112px; height: 112px; margin: -88px auto 12px; border-radius: 50%; background: var(--paper); padding: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.login-badge img { width: 100%; height: 100%; display: block; }
.login h1 { font-size: 24px; }
.login form { display: grid; gap: 14px; margin: 22px 0 14px; text-align: left; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100%; }
.rail { position: sticky; top: 0; height: 100vh; background: var(--blue); color: #fff; display: flex; flex-direction: column; padding: 18px 12px 14px; overflow-y: auto; }
.rail-brand { padding: 4px 8px 6px; }
.rail-brand img { width: 150px; display: block; }
.rail-branch { margin: 6px 8px 16px; font-size: 13px; color: rgba(255, 255, 255, .78); line-height: 1.35; }
.rail-branch b { display: block; color: #fff; font-size: 14px; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: rgba(255, 255, 255, .85); text-decoration: none; font-weight: 600; border: 1.5px solid transparent;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.on { background: rgba(255, 255, 255, .12); color: #fff; border: 1.5px dashed rgba(255, 255, 255, .7); }
.nav .badge { margin-left: auto; background: var(--green); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 7px; line-height: 20px; }
.rail-foot { margin-top: auto; padding-top: 16px; display: grid; gap: 2px; }
.who { padding: 8px 12px; font-size: 13px; color: rgba(255, 255, 255, .75); }
.who b { color: #fff; display: block; font-size: 14px; }
.rail-link { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: none; border: 0; color: rgba(255, 255, 255, .8); cursor: pointer; border-radius: 8px; text-align: left; font-size: 14px; }
.rail-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.ver { padding: 6px 12px 0; font-size: 11px; color: rgba(255, 255, 255, .5); }
.mbar, .tabbar { display: none; }

.view { padding: 28px 32px 48px; min-width: 0; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); }
.panel + .panel, .grid + .panel, .panel + .grid { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.panel-body { padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters label { min-width: 150px; }

/* figures */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-m); background: var(--paper); margin-bottom: 16px; }
.fig { padding: 16px 18px; }
.fig + .fig { border-left: 1px solid var(--line-2); }
.fig span { display: block; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.fig b { display: block; font: 800 26px/1.2 var(--head); margin-top: 4px; letter-spacing: -.02em; }
.fig small { color: var(--ink-3); font-size: 12px; }
.fig.lead { background: var(--blue); color: #fff; border-radius: var(--r-m) 0 0 var(--r-m); }
.fig.lead span, .fig.lead small { color: rgba(255, 255, 255, .8); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: #F7FAFD; }
td .sub { display: block; color: var(--ink-3); font-size: 12.5px; }
tfoot td { font-weight: 700; border-top: 1px solid var(--line); }
.empty { padding: 40px 16px; text-align: center; color: var(--ink-2); }
.empty .btn { margin-top: 12px; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.tag.blue { background: var(--blue-wash); color: var(--blue); }
.tag.green { background: var(--green-wash); color: var(--green-deep); }
.tag.amber { background: var(--amber-wash); color: var(--amber); }
.tag.red { background: var(--red-wash); color: var(--red); }
.low { color: var(--red); font-weight: 700; }

.seg { display: inline-flex; padding: 3px; background: var(--line-2); border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: var(--paper); color: var(--blue); box-shadow: 0 1px 3px rgba(6, 43, 90, .15); }

/* trend bars */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 160px; padding: 8px 4px 0; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; font-size: 12px; color: var(--ink-3); }
.bar i { display: block; width: 100%; max-width: 44px; background: var(--blue-wash); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.bar.today i { background: var(--blue); }
.bar em { font-style: normal; font-weight: 700; color: var(--ink-2); font-size: 11.5px; }

/* ---------- Billing ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.pos > section { min-width: 0; }
.pos-top { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.pos-top .search { flex: 1; min-width: 200px; position: relative; }
.pos-top .search .i { position: absolute; left: 12px; top: 11px; color: var(--ink-3); }
.pos-top .search input { padding-left: 40px; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.cats button { border: 1px solid var(--line); background: var(--paper); border-radius: 99px; padding: 6px 14px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--ink-2); }
.cats button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile {
  position: relative; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: var(--r-m);
  padding: 14px 14px 12px; cursor: pointer; min-height: 112px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .12s, transform .06s;
}
.tile:hover { border-color: var(--blue); }
.tile:active { transform: scale(.98); }
.tile .nm { font-weight: 700; line-height: 1.25; }
.tile .pr { margin-top: auto; font: 800 18px var(--head); color: var(--blue); }
.tile .st { font-size: 12px; color: var(--ink-3); }
.tile .st.low { color: var(--red); }
.tile.out { opacity: .45; cursor: not-allowed; }
.tile .qty { position: absolute; top: -8px; right: -8px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 99px; background: var(--green); color: #fff; font-weight: 800; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(30, 138, 18, .4); }
.tile.in { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }

.ticket {
  position: sticky; top: 20px; background: var(--paper); border-radius: var(--r-l);
  box-shadow: var(--shadow); padding: 10px; max-height: calc(100vh - 40px); display: flex;
}
.ticket-in {
  border: 2px dashed #9DB8DA; border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 14px; width: 100%; min-height: 0;
}
.ticket-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ticket .cust { display: grid; gap: 8px; }
.ticket .cust-more { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lines { overflow-y: auto; min-height: 60px; flex: 1; margin: 0 -6px; padding: 0 6px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto 78px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.line .ln { min-width: 0; }
.line:last-child { border-bottom: 0; }
.line .nm { font-weight: 700; }
.line .meta { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.line .meta input { width: 76px; min-height: 30px; padding: 2px 8px; font-size: 13px; }
.line .amt { font-weight: 800; text-align: right; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 30px; height: 34px; border: 0; background: var(--line-2); cursor: pointer; display: grid; place-items: center; }
.stepper input { width: 44px; min-height: 34px; height: 34px; border: 0; border-radius: 0; text-align: center; padding: 0; font-weight: 800; }
.ticket-empty { text-align: center; color: var(--ink-3); padding: 28px 8px; }
.ticket-total { display: flex; align-items: baseline; justify-content: space-between; border-top: 2px solid var(--ink); padding-top: 12px; }
.ticket-total span { font-weight: 700; color: var(--ink-2); }
.ticket-total b { font: 800 34px/1 var(--head); letter-spacing: -.02em; }
.ticket-sub { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-3); margin-top: -8px; }
.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.modes button { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; min-height: 38px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.modes button.on { border-color: var(--blue); background: var(--blue-wash); color: var(--blue); }
.modes button:disabled { opacity: .35; cursor: not-allowed; }
.pos-mobilebar { display: none; }

/* doc line editor (transfers, stock in, returns) */
.doc-lines td { padding: 6px 8px; }
.doc-lines input, .doc-lines select { min-height: 38px; }
.doc-lines .q { width: 100px; }
.doc-lines .rt { width: 110px; }

/* branches */
.branches { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.branch { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.branch.main { border-color: var(--blue); }
.branch .code { font: 800 13px var(--head); color: var(--blue); background: var(--blue-wash); padding: 2px 8px; border-radius: 6px; }
.branch .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.branch dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 13.5px; }
.branch dt { color: var(--ink-3); }
.branch dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.branch .acts { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(6, 26, 52, .45); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .12s ease-out; }
.modal { background: var(--paper); border-radius: var(--r-l); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); animation: rise .16s ease-out; }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.secret { font: 800 22px var(--head); background: var(--green-wash); color: var(--green-deep); border: 2px dashed var(--green); border-radius: 12px; padding: 12px; text-align: center; margin: 12px 0; user-select: all; letter-spacing: .02em; }
.done { text-align: center; padding: 10px 0 4px; }
.done .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; margin: 0 auto 12px; }
.done .tick .i { width: 34px; height: 34px; stroke-width: 2.6; }
.done b { font: 800 30px var(--head); display: block; margin-top: 6px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; margin-bottom: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green-deep); }
.busy { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 90; overflow: hidden; }
.busy span { display: block; height: 100%; width: 40%; background: var(--green); animation: slide 1s infinite ease-in-out; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.skel { color: var(--ink-3); padding: 40px 0; text-align: center; }

/* ---------- Tablet & phone ---------- */
@media (max-width: 1180px) {
  .pos { grid-template-columns: minmax(0, 1fr) 340px; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fig:nth-child(3) { border-left: 0; }
  .fig:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .fig.lead { border-radius: var(--r-m) 0 0 0; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .mbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--blue); color: #fff; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px 16px; }
  .mbar img { height: 30px; }
  .mbar span { font-size: 13px; color: rgba(255, 255, 255, .85); margin-left: auto; text-align: right; line-height: 1.2; }
  .mbar-more { background: none; border: 0; color: #fff; width: 40px; height: 40px; display: grid; place-items: center; }
  .view { padding: 18px 16px calc(96px + var(--safe-b)); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--paper); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); }
  .tabbar a { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--ink-3); text-decoration: none; padding: 4px 0; border-radius: 10px; position: relative; }
  .tabbar a.on { color: var(--blue); }
  .tabbar a.on .i { background: var(--blue-wash); border-radius: 99px; width: 44px; padding: 2px 0; height: 24px; }
  .tabbar .badge { position: absolute; top: 0; right: calc(50% - 22px); background: var(--green); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 5px; line-height: 16px; }
  h1 { font-size: 24px; }
  .pos { grid-template-columns: 1fr; }
  .ticket { position: static; max-height: none; }
  .pos.has-items .pos-mobilebar { display: flex; }
  .pos-mobilebar { position: fixed; left: 12px; right: 12px; bottom: calc(72px + var(--safe-b)); z-index: 25; background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 10px 10px 16px; align-items: center; gap: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
  .pos-mobilebar b { font: 800 22px var(--head); }
  .pos-mobilebar span { font-size: 13px; opacity: .8; }
  .pos-mobilebar .btn { margin-left: auto; }
  .grid.two { grid-template-columns: 1fr; }
  .modal-back { place-items: end center; padding: 0; }
  .modal, .modal.wide { width: 100%; border-radius: var(--r-l) var(--r-l) 0 0; max-height: 92vh; padding-bottom: var(--safe-b); }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fig b { font-size: 21px; }
  .fig { padding: 12px 14px; }
  .hide-sm { display: none; }
  td, th { padding: 9px 8px; }
  .filters label { min-width: calc(50% - 5px); flex: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* v1.23 refresh button */
.js-refresh.spin svg { animation: glspin .8s linear infinite; }
.js-refresh:disabled { opacity: .7; cursor: default; }
@keyframes glspin { to { transform: rotate(360deg); } }
