/* Sna Billing — dark "cosmic tech" theme matching the Sna Innovations website */
:root {
  --void: #050508; --void-2: #0a0a12;
  --surface: rgba(16, 16, 28, .78); --surface-solid: #10101c; --surface-2: rgba(255,255,255,.035); --surface-3: rgba(255,255,255,.06);
  --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.16);
  --text-1: #f4f4fb; --text-2: #b9b9c9; --text-3: #7d7d92;
  --violet: #8b5cf6; --violet-2: #a855f7; --blue: #3b82f6; --cyan: #22d3ee; --magenta: #ec4899;
  --good: #34d399; --warn: #fbbf24; --bad: #fb7185;
  --grad: linear-gradient(120deg, var(--blue) 0%, var(--violet) 45%, var(--magenta) 100%);
  --grad-2: linear-gradient(120deg, var(--cyan) 0%, var(--violet-2) 100%);
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--void); color: var(--text-1); font: 14px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; color-scheme: dark; }
::selection { background: var(--violet); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,.35); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
a { color: var(--cyan); text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.02em; margin: 0; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.sm { font-size: 12px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.warn { color: var(--warn) !important; }
.ok { color: var(--good) !important; }
.bad { color: var(--bad) !important; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.glass { background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }

/* background */
#bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; transition: opacity 1.2s var(--ease); }
.bg-veil { position: fixed; inset: 0; z-index: 0; pointer-events: none; transition: background 1.2s var(--ease);
  background: radial-gradient(1200px 700px at 80% -10%, rgba(139,92,246,.18), transparent 60%), radial-gradient(900px 600px at -10% 110%, rgba(34,211,238,.10), transparent 60%); }
#bg-canvas:not(.ready) { opacity: 0 !important; }
body.in-app #bg-canvas { opacity: .55; }
body.in-app .bg-veil { background: linear-gradient(90deg, rgba(5,5,8,.92) 0%, rgba(5,5,8,.80) 55%, rgba(5,5,8,.55) 100%); }

/* custom cursor: js/cursor.js (shared with the website; injects its own styles) */

/* splash — same as website loader */
.splash { position: fixed; inset: 0; z-index: 1000; background: var(--void); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: opacity .8s var(--ease), visibility .8s; }
.splash img { height: 96px; width: auto; animation: splashIn 1s var(--ease) backwards; }
.splash-bar { width: 200px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.splash-bar span { display: block; height: 100%; width: 0; background: var(--grad); animation: splashBar 1.1s var(--ease) forwards; }
.splash-text { font-family: var(--font-display); letter-spacing: .32em; text-transform: uppercase; font-size: 11px; color: var(--text-3); animation: splashIn 1s .2s var(--ease) backwards; }
.splash.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes splashBar { to { width: 100%; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes splashIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* login */
.login { position: relative; z-index: 2; min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 32px 16px; }
.lg-shell { display: grid; grid-template-columns: 1.05fr 1fr; width: 100%; max-width: 920px; min-height: 520px; border-radius: 28px; overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,.55), 0 0 0 1px rgba(139,92,246,.12); animation: rise 1s .15s var(--ease) backwards; }
/* brand side: logo in a glowing orb with slowly turning orbit rings */
.lg-brand { position: relative; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 25% 20%, rgba(59,130,246,.14), transparent 55%), radial-gradient(circle at 80% 85%, rgba(236,72,153,.12), transparent 55%),
    linear-gradient(150deg, #08080f 0%, #0d0b1f 50%, #120a18 100%); border-right: 1px solid var(--line); }
.lg-orb { position: absolute; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(139,92,246,.22), rgba(139,92,246,0) 68%); animation: lgPulse 5s ease-in-out infinite; }
.lg-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.1); }
.lg-ring::after { content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 14px var(--cyan); }
.lg-ring.r1 { width: 250px; height: 250px; animation: lgSpin 14s linear infinite; }
.lg-ring.r2 { width: 360px; height: 360px; border-style: dashed; border-color: rgba(255,255,255,.07); animation: lgSpin 26s linear infinite reverse; }
.lg-ring.r2::after { background: var(--magenta); box-shadow: 0 0 14px var(--magenta); }
.lg-ring.r3 { width: 480px; height: 480px; border-color: rgba(255,255,255,.045); animation: lgSpin 40s linear infinite; }
.lg-ring.r3::after { background: var(--violet); box-shadow: 0 0 14px var(--violet); }
.lg-brand .login-logo { position: relative; width: min(64%, 240px); height: auto; margin: 0; filter: drop-shadow(0 10px 30px rgba(0,0,0,.5)); }
@keyframes lgSpin { to { transform: rotate(360deg); } }
@keyframes lgPulse { 0%, 100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.12); opacity: 1; } }
/* form side */
.lg-form { display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: clamp(28px, 5vw, 52px); background: rgba(12,12,22,.72); }
.lg-form h2 { font-size: 26px; margin: 0 0 6px; }
.lg-mini { display: none; height: 54px; align-self: center; margin-bottom: 8px; }
.lg-in { position: relative; display: block; }
.lg-in > svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--text-3); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; pointer-events: none; transition: stroke .15s; }
.lg-in:focus-within > svg { stroke: var(--violet); }
.lg-in input { padding: 13px 14px 13px 42px; border-radius: 12px; }
.pw-wrap input { padding-right: 64px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--text-3); font: 500 12px var(--font-body); padding: 6px 8px; cursor: pointer; border-radius: 8px; }
.pw-eye:hover { color: #fff; background: rgba(255,255,255,.06); }
.caps { font-size: 12px; color: var(--warn); margin-top: -8px; }
.lg-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: -2px; }
.lg-row .btn.link { padding: 0; }
.lg-check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--text-2); user-select: none; }
.lg-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.lg-box { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-strong); background: rgba(255,255,255,.04); display: grid; place-items: center; transition: .18s var(--ease); }
.lg-box::after { content: ""; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); margin-top: -2px; transition: transform .18s var(--ease); }
.lg-check input:checked + .lg-box { background: var(--grad); border-color: transparent; box-shadow: 0 4px 14px rgba(139,92,246,.4); }
.lg-check input:checked + .lg-box::after { transform: rotate(45deg) scale(1); }
.lg-check input:focus-visible + .lg-box { box-shadow: 0 0 0 3px rgba(139,92,246,.35); }
.lg-go { padding: 13px; font-size: 15px; margin-top: 4px; }
@media (max-width: 760px) {
  .lg-shell { grid-template-columns: 1fr; min-height: 0; max-width: 420px; }
  .lg-brand { display: none; }
  .lg-mini { display: block; }
}

/* photo crop screen */
.crop-ov { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 16px; background: rgba(5,5,8,.72); animation: splashIn .2s backwards; }
.crop-card { width: 100%; max-width: 380px; border-radius: 22px; padding: 24px; background: rgba(16,16,28,.97); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.crop-card h2 { margin: 0 0 4px; font-size: 20px; }
.crop-stage { position: relative; width: 100%; max-width: 300px; aspect-ratio: 1; margin: 16px auto 14px; border-radius: 16px; overflow: hidden; background: #000; touch-action: none; }
.crop-stage canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.crop-stage canvas.grab { cursor: grabbing; }
.crop-mask { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 999px rgba(5,5,8,.62); outline: 2px dashed rgba(255,255,255,.7); outline-offset: -1px; }
.crop-zoom { display: flex; align-items: center; gap: 8px; }
.crop-zoom input { flex: 1; padding: 0; accent-color: var(--violet); background: none; border: 0; box-shadow: none; }
.crop-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.eyebrow { font-family: var(--font-display); font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--cyan); margin-bottom: 18px; }
.login-hero h1 { font-size: clamp(36px, 5vw, 64px); line-height: 1.02; font-weight: 700; }
.login-hero p { color: var(--text-2); font-size: 17px; max-width: 520px; margin-top: 22px; line-height: 1.6; }
.login-card { border-radius: 22px; padding: 34px; display: grid; gap: 14px; animation: rise 1s .3s var(--ease) backwards; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-card h2 { font-size: 24px; margin: 0; }
.login-card .muted { margin: -6px 0 6px; }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
.config-msg { position: relative; z-index: 5; max-width: 520px; margin: 18vh auto; padding: 28px; border-radius: var(--radius); }

/* app shell */
#app { position: relative; z-index: 2; display: flex; min-height: 100vh; animation: fadeIn .8s var(--ease) backwards; } /* opacity only: a transform here would break position: fixed (bottom bar, sheets) on phones */
.side { width: 248px; flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  background: rgba(8, 8, 14, .72); border-right: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.side-brand { padding: 26px 24px 18px; }
.side-brand img { height: 44px; }
.side-brand a { display: inline-block; }
#nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-3); padding: 16px 12px 6px; }
#nav a { position: relative; display: flex; align-items: center; gap: 12px; color: var(--text-2); padding: 10px 12px; border-radius: 10px; font-weight: 500; transition: .2s var(--ease); }
#nav a i { font-style: normal; width: 16px; text-align: center; color: var(--text-3); transition: .2s; }
#nav a:hover { background: var(--surface-3); color: var(--text-1); }
#nav a.on { background: linear-gradient(90deg, rgba(139,92,246,.22), rgba(59,130,246,.06)); color: #fff; }
#nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--grad); }
#nav a.on i { color: var(--cyan); }
.side-foot { padding: 16px 18px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.me { display: flex; gap: 10px; align-items: center; min-width: 0; }
.me b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me span:not(.avatar) { font-size: 11.5px; color: var(--text-3); text-transform: capitalize; }
.avatar { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font: 600 13px var(--font-display); background: var(--grad); color: #fff; }
main { flex: 1; min-width: 0; padding: 34px clamp(18px, 3vw, 44px) 80px; }
main > * { animation: rise .6s var(--ease) backwards; }
main > *:nth-child(2) { animation-delay: .04s; } main > *:nth-child(3) { animation-delay: .08s; } main > *:nth-child(4) { animation-delay: .12s; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.head .sub { color: var(--text-3); margin-top: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.empty { text-align: center; color: var(--text-3); padding: 36px !important; }
.hint { background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.25); color: #fde68a; padding: 11px 15px; border-radius: 12px; margin-bottom: 14px; font-size: 13px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-1);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; font: 500 13.5px var(--font-body); white-space: nowrap; transition: .2s var(--ease); }
.btn:hover { border-color: rgba(139,92,246,.6); background: rgba(139,92,246,.12); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 24px rgba(139,92,246,.28); }
.btn.primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: rgba(251,113,133,.6); background: rgba(251,113,133,.1); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.link { background: none; border: none; color: var(--text-3); padding: 0; justify-self: center; }
.btn.link:hover { color: var(--text-1); }
.btn.block { width: 100%; padding: 12px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: wait; transform: none; }

/* forms */
label { display: grid; gap: 6px; font-size: 12px; color: var(--text-3); font-weight: 500; letter-spacing: .02em; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13.5px; }
input, select, textarea { font: 14px var(--font-body); color: var(--text-1); background: rgba(255,255,255,.04); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 10px 12px; width: 100%; transition: .15s; }
input::placeholder, textarea::placeholder { color: #5d5d70; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,.22); background: rgba(255,255,255,.06); }
select option { background: var(--surface-solid); }
textarea { resize: vertical; }
label.check input { width: 16px; height: 16px; accent-color: var(--violet); }
.form { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); } .g6 { grid-template-columns: repeat(6, 1fr); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span4 { grid-column: span 4; } .span6 { grid-column: span 6; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; color: inherit;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: .25s var(--ease); }
a.stat:hover { border-color: rgba(139,92,246,.45); transform: translateY(-2px); }
.stat::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--grad); opacity: .7; }
.stat span { display: block; font-size: 12px; color: var(--text-3); letter-spacing: .03em; }
.stat b { display: block; margin-top: 6px; font: 600 25px var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* tables */
.tablewrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.grid th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); padding: 13px 16px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: rgba(255,255,255,.02); }
table.grid th.num { text-align: right; }
table.grid td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tr.click { cursor: pointer; }
table.grid tbody tr { transition: background .15s; }
table.grid tbody tr:hover td { background: rgba(139,92,246,.06); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { margin-left: 4px; }
.pill { display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 99px; font-weight: 600; letter-spacing: .02em; background: var(--surface-3); color: var(--text-2); vertical-align: middle; }
.s-Paid { background: rgba(52,211,153,.12); color: var(--good); }
.s-Partial { background: rgba(251,191,36,.12); color: var(--warn); }
.s-Unpaid { background: rgba(251,113,133,.12); color: var(--bad); }
.t-Bill { background: rgba(139,92,246,.18); color: #c4b5fd; }
.t-PI { background: rgba(34,211,238,.12); color: var(--cyan); }
.t-Challan { background: rgba(251,191,36,.12); color: var(--warn); }
.t-PO { background: rgba(52,211,153,.13); color: var(--good); }
.pill.latest { background: rgba(255,255,255,.06); color: var(--text-2); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); font-weight: 500; }
.s-Pending { background: rgba(251,191,36,.12); color: var(--warn); }
.s-Delivered { background: rgba(34,211,238,.12); color: var(--cyan); }
.s-Overdue { background: rgba(244,63,94,.16); color: #fda4af; box-shadow: inset 0 0 0 1px rgba(244,63,94,.35); }
.s-Open { background: rgba(96,165,250,.13); color: #93c5fd; }
.s-Partly-received { background: rgba(251,191,36,.12); color: var(--warn); }
.s-Received { background: rgba(52,211,153,.12); color: var(--good); }
.t-CN { background: rgba(251,113,133,.13); color: #fda4af; }

/* ---------- payments / goods-received panels on a document's page ---------- */
.paypanel .card-head h2 { display: flex; align-items: center; gap: 10px; }
.pay-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pay-sum > div { padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid var(--line); display: grid; gap: 3px; }
.pay-sum span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.pay-sum b { font: 600 17px var(--font-display); }
.pay-sum em { font-style: normal; justify-self: start; }
.pay-table td, .pay-table th { font-size: 13px; }
.pay-table tfoot td { border-top: 1px solid var(--line-strong); color: var(--text-1); }

/* linked documents (quotation ⇄ PI ⇄ invoice) */
.links-card .card-head { flex-wrap: wrap; gap: 4px 12px; }
.link-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.link-slot { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line-strong); background: rgba(255,255,255,.02); }
.link-slot.on { border-style: solid; border-color: rgba(34,211,238,.3); background: linear-gradient(150deg, rgba(34,211,238,.07), rgba(139,92,246,.05)); }
.ls-type { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: 4px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.link-slot.on .ls-type { background: rgba(34,211,238,.15); color: var(--cyan); }
.ls-main { display: grid; gap: 2px; min-width: 0; }
.ls-main a { color: var(--text-1); text-decoration: none; }
.ls-main a:hover b { color: var(--cyan); }
.ls-main em { font-style: normal; font-size: 12px; color: var(--text-3); }
.ls-main em.warn { color: var(--warn); }
.ls-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.lp-list { display: grid; gap: 6px; max-height: 52vh; overflow: auto; margin-top: 10px; }
.lp-item { display: flex; justify-content: space-between; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-1); cursor: pointer; font: inherit; }
.lp-item:hover:not(:disabled) { border-color: rgba(34,211,238,.45); background: rgba(34,211,238,.06); }
.lp-item:disabled { opacity: .55; cursor: not-allowed; }
.lp-item span { display: grid; gap: 2px; min-width: 0; }
.lp-item em { font-style: normal; font-size: 12px; color: var(--text-3); }
.lp-item em.warn { color: var(--warn); }
.lp-amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.lp-step { display: grid; gap: 8px; margin-top: 10px; }
.lp-step.hidden, .lp-list.hidden, .search.hidden { display: none; }
.lp-step p { margin: 0 0 4px; color: var(--text-2); }

/* advance / payments received, in the document form */
.adv-box { margin-top: 16px; padding: 14px; border-radius: 14px; border: 1px solid rgba(52,211,153,.25); background: linear-gradient(160deg, rgba(52,211,153,.06), rgba(34,211,238,.03)); display: grid; gap: 10px; }
.adv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.adv-head b { display: block; font: 600 15px var(--font-display); color: var(--text-1); }
.adv-head em { font-style: normal; font-size: 12px; color: var(--text-3); }
/* one small card per part payment: date + amount on top, mode + reference below */
.adv-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 34px; gap: 8px; align-items: end; padding: 10px; border-radius: 10px; background: rgba(0,0,0,.22); border: 1px solid var(--line); }
.adv-row label { display: grid; gap: 3px; margin: 0; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); min-width: 0; }
.adv-row input, .adv-row select { width: 100%; min-width: 0; padding: 8px 10px; font-size: 13px; letter-spacing: 0; text-transform: none; }
.adv-row input[data-k=amount] { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.adv-row .adv-ref { grid-column: 2 / 4; }
.adv-del { width: 34px; height: 36px; padding: 0; color: var(--bad); }
.adv-note { grid-column: 1 / -1; margin-top: -2px; font-size: 11.5px; color: var(--text-3); }
#advRows { display: grid; gap: 8px; }
.adv-none { margin: 0; }
.adv-sum { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.adv-sum:empty { display: none; }
.adv-sum > div:not(.adv-over):not(.adv-full) { display: flex; align-items: baseline; gap: 8px; }
.adv-sum span { font-size: 12px; color: var(--text-3); }
.adv-sum b { font: 600 16px var(--font-display); font-variant-numeric: tabular-nums; }
.adv-over { font-size: 12.5px; color: var(--warn); }
.adv-full { font-size: 12.5px; color: var(--good); font-weight: 600; }
.adv-print { font-size: 12.5px; }
.adv-linked { margin: 0 0 12px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; color: var(--text-2); background: rgba(34,211,238,.06); border: 1px solid rgba(34,211,238,.22); }
.adv-box .adv-linked { margin: 0; }
.adv-linked a { color: var(--cyan); font-weight: 600; }
.tot-ed .grand.bal td { font-size: 17px; color: var(--good); padding-top: 8px; }
.sub-h { font: 600 13px var(--font-display); color: var(--text-2); margin: 16px 0 8px; }
.rcpt-list { display: grid; gap: 6px; }
.rcpt { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.03); border: 1px solid var(--line); font-size: 13px; }
.rcpt > span:first-of-type { flex: 1; min-width: 180px; color: var(--text-2); }
.pay-quick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rcv-table input { max-width: 110px; margin-left: auto; }
.rcv-table .check { font-size: 12.5px; }

/* ---------- collections ---------- */
.aging { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.age { --c: var(--cyan); position: relative; overflow: hidden; display: grid; gap: 4px; text-align: left; padding: 14px 16px 18px; border-radius: 16px; cursor: pointer; font: inherit; color: var(--text-1);
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 10%, rgba(255,255,255,.03)), rgba(255,255,255,.015)); border: 1px solid rgba(255,255,255,.07); transition: .2s var(--ease); }
.age span { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--c) 60%, #fff); }
.age b { font: 700 19px var(--font-display); }
.age em { font-style: normal; font-size: 12px; color: var(--text-3); }
.age i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--c); box-shadow: 0 0 10px var(--c); }
.age:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.age.on { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 12px 28px -14px var(--c); }
.debtors { display: grid; gap: 6px; }
.debtors .card-head { margin-bottom: 6px; }
.debtor { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; background: rgba(255,255,255,.02); color: var(--text-1); font: inherit; cursor: pointer; }
.debtor:hover { border-color: var(--line-strong); background: rgba(255,255,255,.04); }
.debtor em { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-style: normal; font: 600 15px var(--font-display); color: var(--warn); }
@media (max-width: 860px) { .aging { grid-template-columns: repeat(2, minmax(0, 1fr)); } .aging .age:first-child { grid-column: 1 / -1; } }
.s-Invoiced { background: rgba(52,211,153,.12); color: var(--good); }
/* delivery challan: on-screen signature pad */
.sig-pad-wrap { position: relative; border: 1px dashed var(--line-strong); border-radius: 12px; background: #fff; overflow: hidden; }
.sig-pad { display: block; width: 100%; aspect-ratio: 3 / 1; touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #9aa0b4; font-size: 15px; letter-spacing: .1em; pointer-events: none; }
.sig-pad-wrap::after { content: ""; position: absolute; left: 6%; right: 6%; bottom: 22%; border-bottom: 1px solid #d5d8e4; pointer-events: none; }
.sig-tools { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 10px; }
input.bad-input { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(251,113,133,.15); }
.sugg-l.bad { color: var(--bad); text-transform: none; letter-spacing: 0; font-size: 12.5px; flex-basis: 100%; }
.t-Quotation { background: rgba(59,130,246,.14); color: #93c5fd; }
.r-admin { background: rgba(236,72,153,.14); color: #f9a8d4; }
.by { font-size: 12px; color: var(--text-3); }
.by b { color: var(--text-2); font-weight: 500; }

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters input[type=search], .filters .search { max-width: 340px; }
.filters select { width: auto; }
.search { position: relative; flex: 1; min-width: 220px; }
.search input { padding-left: 38px; }
.search::before { content: ""; position: absolute; left: 13px; top: 50%; width: 12px; height: 12px; margin-top: -8px; border: 2px solid var(--text-3); border-radius: 50%; }
.search::after { content: ""; position: absolute; left: 25px; top: 50%; width: 6px; height: 2px; margin-top: 4px; background: var(--text-3); transform: rotate(45deg); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); padding: 6px 13px; border-radius: 99px; cursor: pointer; font: 500 12.5px var(--font-body); transition: .15s; }
.chip:hover { color: #fff; border-color: rgba(139,92,246,.5); }
.chip.on { background: var(--grad); color: #fff; border-color: transparent; }
.chip em { font-style: normal; opacity: .65; margin-left: 4px; }
.chip-ic { font-style: normal; color: var(--c, var(--violet)); margin-right: 6px; font-size: 12px; display: inline-flex; vertical-align: -2px; }
.cp-badge svg { font-size: 14px; } .cp-gicon svg { font-size: 12px; } .cp-tab i { display: inline-flex; font-size: 12px; }
.chip.on .chip-ic { color: #fff; }

/* Inventory — category navigator: quiet glass, colour only as an accent */
.catnav { position: relative; margin-bottom: 18px; padding: 18px 18px 14px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,.07);
  background: linear-gradient(180deg, rgba(20,20,34,.78), rgba(11,11,20,.82));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 30px 60px -40px rgba(0,0,0,.95); }
.catnav::before { content: ""; position: absolute; top: -1px; left: 24px; right: 24px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent); }
.catnav-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.catnav-heading h3 { font: 600 15px var(--font-display); letter-spacing: -.01em; color: var(--text-1); margin: 0 0 2px; }
.catnav-heading span { font-size: 12px; color: var(--text-3); }
.catnav-tools { display: flex; align-items: center; gap: 8px; }
.catnav-search { position: relative; display: flex; align-items: center; color: var(--text-3); }
.catnav-search svg { position: absolute; left: 11px; pointer-events: none; }
.catnav-search input { width: 190px; height: 32px; padding: 0 12px 0 32px; border-radius: 10px; font: 12.5px var(--font-body); color: var(--text-1);
  background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); transition: border-color .2s, background .2s, width .3s var(--ease); }
.catnav-search input::placeholder { color: var(--text-3); }
.catnav-search input:focus { outline: none; width: 220px; border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.05); }
.catnav-sort { display: flex; padding: 3px; border-radius: 10px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.07); }
.catnav-sort button { border: 0; background: transparent; color: var(--text-3); font: 500 11.5px var(--font-body); padding: 5px 10px; border-radius: 7px; cursor: pointer; transition: .2s; }
.catnav-sort button:hover { color: var(--text-1); }
.catnav-sort button.on { color: var(--text-1); background: rgba(255,255,255,.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }

.catnav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 8px; padding: 2px; }
@keyframes catcell-pop { from { opacity: 0; transform: scale(.4); } }
.catnav.can-fold:not(.open) .catnav-grid { max-height: 126px; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent); mask-image: linear-gradient(180deg, #000 82%, transparent); }

.catcell { --c: #7c3aed; position: relative; overflow: hidden; isolation: isolate; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 0 11px;
  height: 56px; padding: 0 12px 0 10px; border-radius: 14px; cursor: pointer; text-align: left; font: inherit; color: var(--text-2);
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.012));
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  transition: background .3s, border-color .3s, transform .3s var(--ease), box-shadow .35s; }
/* faint colour wash that blooms from the icon on hover / select */
.catcell::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .35s;
  background: radial-gradient(140px 70px at 26px 50%, color-mix(in srgb, var(--c) 26%, transparent), transparent 70%); }
/* glossy filled icon tile in the category colour */
.catcell-ic { position: relative; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; color: #fff;
  background: linear-gradient(150deg, color-mix(in oklch, var(--c), #fff 18%) 0%, var(--c) 45%, color-mix(in oklch, var(--c), #0b0620 38%) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -1px 0 rgba(0,0,0,.25), 0 6px 16px -6px color-mix(in srgb, var(--c) 85%, transparent);
  transition: transform .35s var(--ease), box-shadow .35s; }
.catcell-ic::after { content: ""; position: absolute; inset: 1px 1px 50% 1px; border-radius: 9px 9px 14px 14px / 9px 9px 6px 6px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0)); }
.catcell-ic svg { position: relative; z-index: 1; stroke-width: 2; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.catcell-txt { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.catcell-name { font: 600 13px/1.2 var(--font-body); color: #ececf6; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catcell-n { font-size: 11px; color: #8b8ba3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.catcell-n i { font-style: normal; margin: 0 5px; opacity: .5; }
.catcell-check { display: none; width: 18px; height: 18px; border-radius: 50%; place-items: center; font-size: 11px; color: #fff;
  background: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent), 0 4px 10px -2px color-mix(in srgb, var(--c) 80%, transparent); }
/* hairline at the bottom = this category's share of all products */
.catcell-bar { position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px; background: rgba(255,255,255,.04); overflow: hidden; }
.catcell-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p); border-radius: 2px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 40%, transparent), var(--c)); box-shadow: 0 0 8px var(--c); opacity: .75; transition: opacity .3s; }

.catcell:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 38%, rgba(255,255,255,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 16px 32px -20px color-mix(in srgb, var(--c) 90%, transparent); }
.catcell:hover::before { opacity: .8; }
.catcell:hover .catcell-ic { transform: scale(1.06); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), inset 0 -1px 0 rgba(0,0,0,.25), 0 8px 22px -6px var(--c); }
.catcell:hover .catcell-name { color: #fff; }
.catcell:hover .catcell-bar::after { opacity: 1; }
.catcell:focus-visible { outline: 2px solid color-mix(in srgb, var(--c) 70%, #fff); outline-offset: 2px; }
.catcell:active { transform: scale(.985); }

.catcell.on { border-color: color-mix(in srgb, var(--c) 75%, transparent);
  background: linear-gradient(120deg, color-mix(in srgb, var(--c) 22%, rgba(14,14,26,.9)), color-mix(in srgb, var(--c) 6%, rgba(14,14,26,.9)) 70%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent), 0 18px 36px -18px color-mix(in srgb, var(--c) 95%, transparent); }
.catcell.on::before { opacity: 1; }
.catcell.on .catcell-name { color: #fff; }
.catcell.on .catcell-n { color: color-mix(in srgb, var(--c) 35%, #fff); }
.catcell.on .catcell-check { display: grid; animation: catcell-pop .35s var(--ease); }
.catcell.on .catcell-bar::after { opacity: 1; }
.catcell.all .catcell-ic { background: linear-gradient(150deg, #60a5fa 0%, #7c3aed 50%, #db2777 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 16px -6px rgba(124,58,237,.9); }

.catnav-empty { padding: 18px 4px 6px; font-size: 12.5px; color: var(--text-3); }
.catnav-more { display: flex; align-items: center; gap: 6px; margin: 10px auto 0; padding: 6px 12px; border: 0; border-radius: 99px; cursor: pointer;
  background: transparent; color: var(--text-3); font: 500 12px var(--font-body); transition: color .2s, background .2s; }
.catnav-more:hover { color: var(--text-1); background: rgba(255,255,255,.04); }
.catnav-more svg { transition: transform .3s var(--ease); }
.catnav.open .catnav-more svg { transform: rotate(180deg); }

/* table cell */
.cat-pill { --c: var(--violet); display: inline-flex; align-items: center; gap: 7px; max-width: 220px; padding: 3px 11px 3px 4px; border-radius: 99px;
  font-size: 12px; font-weight: 500; color: #dcdce8; white-space: nowrap; vertical-align: middle;
  background: rgba(255,255,255,.035); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
.cat-pill i { flex: none; width: 20px; height: 20px; border-radius: 99px; display: grid; place-items: center; font-style: normal; font-size: 11px; color: #fff;
  background: linear-gradient(150deg, color-mix(in oklch, var(--c), #fff 15%), var(--c) 50%, color-mix(in oklch, var(--c), #0b0620 35%)); box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 3px 8px -3px var(--c); }@media (max-width: 640px) { .catnav-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } .catnav-search input, .catnav-search input:focus { width: 150px; } .catnav-tools { width: 100%; justify-content: space-between; } }
.adj { display: flex; gap: 4px; align-items: center; }
.adj input { width: 72px; padding: 5px 8px; }
.stockbar { width: 70px; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 6px; margin-left: auto; }
.stockbar span { display: block; height: 100%; background: var(--grad-2); border-radius: 4px; }

/* editor */
.items-ed td { padding: 8px 6px; vertical-align: top; }
.items-ed input, .items-ed select, .items-ed textarea { padding: 8px 9px; font-size: 13.5px; }
.items-ed textarea { margin-top: 6px; font-size: 12.5px; }
.items-ed .lt { padding-top: 16px; font-weight: 600; }
.w-xs { width: 70px; } .w-sm { width: 90px; } .w-md { width: 118px; }
.stock { font-size: 11.5px; color: var(--good); display: inline-block; margin-top: 4px; }
.stock.warn { color: var(--warn); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.split > .card { margin-bottom: 0; }
.tot-ed { width: 100%; margin: 14px 0 10px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tot-ed td { padding: 7px 0; border-bottom: 1px dashed var(--line); color: var(--text-2); }
.tot-ed .grand td { font: 600 20px var(--font-display); color: #fff; border-bottom: none; padding-top: 12px; }
#addItem { margin-top: 12px; }
.items-ed select.domain { margin-top: 6px; font-size: 12.5px; }

/* HSN/SAC suggestion chips */
.hs-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.hs { display: inline-flex; align-items: baseline; gap: 4px; max-width: 100%; border: 1px dashed rgba(34,211,238,.45); background: rgba(34,211,238,.06); color: var(--text-1);
  border-radius: 8px; padding: 4px 9px; font: 12px var(--font-body); cursor: pointer; transition: .15s; text-align: left; white-space: nowrap; min-width: 0; }
.hs:hover { border-style: solid; background: rgba(34,211,238,.14); }
.hs b { color: var(--cyan); font-weight: 600; }
.hs span { color: var(--text-3); margin-left: 4px; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* Toggle switches */
.switch { position: relative; display: flex; align-items: center; gap: 14px; cursor: pointer; color: var(--text-1); font-size: 14px; font-weight: 400; letter-spacing: 0; padding: 4px 0; }
.switch input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sw { flex: none; position: relative; width: 44px; height: 24px; border-radius: 99px; background: rgba(255,255,255,.08); border: 1px solid var(--line-strong); transition: .25s var(--ease); }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-3); transition: .25s var(--ease); }
.switch input:checked + .sw { background: var(--grad); border-color: transparent; box-shadow: 0 4px 14px rgba(139,92,246,.35); }
.switch input:checked + .sw::after { left: 23px; background: #fff; }
.switch input:focus-visible + .sw { box-shadow: 0 0 0 3px rgba(139,92,246,.35); }
.sw-text { display: grid; gap: 2px; flex: 1; }
.sw-text b { font-weight: 600; font-size: 14px; color: var(--text-1); }
.sw-text em { font-style: normal; font-size: 12.5px; color: var(--text-3); }
.pay-sep { height: 1px; background: var(--line); margin: 18px 0; }
.sig-prev { height: 54px; width: auto; padding: 4px 10px; border-radius: 10px; background: #fff; opacity: .25; filter: grayscale(1); transition: .25s var(--ease); }
.sig-prev.on { opacity: 1; filter: none; box-shadow: 0 6px 20px rgba(0,0,0,.35); }

/* Payment terms editor */
#ptBox { margin-top: 14px; padding: 16px; border-radius: 14px; background: rgba(255,255,255,.025); border: 1px solid var(--line); }
.pt-row { display: grid; grid-template-columns: minmax(120px, 1fr) 110px minmax(180px, 2fr) 130px 36px; gap: 10px; align-items: center; margin-bottom: 8px; }
.pt-head { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); margin-bottom: 6px; }
.pt-pct { position: relative; }
.pt-pct input { padding-right: 28px; text-align: right; }
.pt-pct span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; }
.pt-amt { font-weight: 600; color: var(--text-1); }
.pt-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.pt-meter { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 200px; }
.pt-bar { flex: 1; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.pt-bar span { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--grad-2); transition: width .3s var(--ease); }
.pt-bar span.full { background: linear-gradient(90deg, #10b981, var(--good)); }
.pt-meter b { font: 600 13px var(--font-display); white-space: nowrap; }
.pt-msg { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }

/* Admin-only menu items */
body:not(.is-admin) .admin-only { display: none !important; }

/* One-click suggestion chips */
.sugg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.sugg-l { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); margin-right: 4px; }
.sg { border: 1px dashed var(--line-strong); background: transparent; color: var(--text-2); border-radius: 99px; padding: 5px 12px;
  font: 12.5px var(--font-body); cursor: pointer; transition: .15s var(--ease); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg:hover { color: #fff; border-style: solid; border-color: rgba(139,92,246,.6); background: rgba(139,92,246,.1); }
.sg.on { border-style: solid; border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.1); color: var(--good); }
#ptPresets { margin: 12px 0 0 58px; }
#termSugg, #custSugg, .sugg.inrow { padding: 10px 12px; margin-top: 8px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid var(--line); animation: splashIn .18s var(--ease) backwards; }
#custSugg { margin-top: 0; }
.pt-row .sugg.inrow { grid-column: 1 / -1; margin: 0 0 6px; }
.sg.act { border-style: solid; border-color: rgba(139,92,246,.7); background: rgba(139,92,246,.16); color: #fff; }
.sg small { font-size: 11.5px; opacity: .6; margin-left: 4px; }
.sg mark { background: none; color: var(--cyan); font-weight: 600; }
.sg.on mark { color: inherit; }

/* Focus-only suggestion list (payment term stage / when to pay) */
.pt-row { position: relative; }
.fsug { position: absolute; z-index: 20; display: grid; max-height: 260px; overflow-y: auto; padding: 6px; border-radius: 12px; background: rgba(14,14,24,.98);
  border: 1px solid var(--line-strong); box-shadow: 0 18px 50px rgba(0,0,0,.55); animation: splashIn .15s var(--ease) backwards; }
.fsug-h { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 6px 10px 4px; }
.fsug button { display: grid; gap: 1px; text-align: left; border: 0; background: transparent; color: var(--text-1); font: 13px var(--font-body); padding: 8px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.fsug button em { font-style: normal; font-size: 11.5px; color: var(--text-3); }
.fsug button:hover { background: linear-gradient(90deg, rgba(139,92,246,.18), rgba(255,255,255,.02)); }

/* Customer type-ahead */
.cust-tip { margin: -6px 0 14px; }
label.ac { position: relative; }
.ac-box { position: absolute; left: 0; top: calc(100% + 6px); z-index: 30; width: max(100%, 380px); max-width: min(520px, 90vw); padding: 6px; border-radius: 14px;
  background: rgba(14,14,24,.98); border: 1px solid var(--line-strong); box-shadow: 0 22px 60px rgba(0,0,0,.6); animation: splashIn .15s var(--ease) backwards;
  letter-spacing: 0; text-transform: none; font-weight: 400; }
.ac-box::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; border-radius: 14px 14px 0 0; background: var(--grad); opacity: .8; }
.ac-h { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px 6px; }
.ac-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text-1); font: inherit;
  padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.ac-item.act, .ac-item:hover { background: linear-gradient(90deg, rgba(139,92,246,.2), rgba(255,255,255,.02)); }
.ac-av { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font: 600 12px var(--font-display); color: #fff; background: var(--grad); }
.ac-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.ac-main b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-main em { font-style: normal; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-main mark { background: none; color: var(--cyan); font-weight: 600; }
.ac-use { flex: none; font-size: 12px; color: var(--text-3); padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); }
.ac-item.act .ac-use { color: #fff; border-color: transparent; background: var(--grad); }
.ac-empty { padding: 12px 12px; font-size: 12.5px; color: var(--text-3); }
.cust-linked { font-size: 12.5px; color: var(--good); background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); padding: 4px 10px; border-radius: 99px; }
#custLink { display: flex; align-items: center; gap: 6px; }

/* Fill from an existing document */
.fill-from { background: radial-gradient(600px 200px at 100% 0%, rgba(139,92,246,.12), transparent 70%), var(--surface); }
.ff-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ff-bar .search { max-width: 360px; }
.ff-list { display: grid; gap: 6px; margin-top: 12px; }
.ff-item { display: grid; grid-template-columns: 170px 1fr auto 96px; gap: 14px; align-items: center; text-align: left; padding: 10px 14px; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,.025); border: 1px solid var(--line); color: var(--text-1); font: inherit; transition: .15s var(--ease); }
.ff-item:hover { border-color: rgba(139,92,246,.5); background: rgba(139,92,246,.08); }
.ff-item.on { border-color: rgba(52,211,153,.45); background: rgba(52,211,153,.06); }
.ff-no, .ff-cust { display: grid; gap: 1px; min-width: 0; }
.ff-no em, .ff-cust em { font-style: normal; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-cust { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.ff-go { justify-self: end; font-size: 12.5px; color: var(--cyan); }
.ff-item.on .ff-go { color: var(--good); }
@media (max-width: 860px) { .ff-item { grid-template-columns: 1fr auto; } .ff-cust, .ff-go { grid-column: 1 / -1; justify-self: start; } }
#eNumHint { font-weight: 400; letter-spacing: 0; }

/* Bank account picker (editor) */
.bank-pick { display: grid; gap: 12px; }
.bank-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.bank-opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  background: rgba(255,255,255,.03); border: 1px solid var(--line-strong); color: var(--text-1); font: inherit; transition: .2s var(--ease); }
.bank-opt:hover { border-color: rgba(139,92,246,.5); }
.bank-opt.on { border-color: transparent; background: linear-gradient(rgba(16,16,28,.95), rgba(16,16,28,.95)) padding-box, var(--grad) border-box; border: 1px solid transparent; box-shadow: 0 8px 24px rgba(139,92,246,.18); }
.bo-radio { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); transition: .2s; }
.bank-opt.on .bo-radio { border: 5px solid var(--violet); }
.bo-main { flex: 1; display: grid; gap: 2px; min-width: 0; }
.bo-main b { font-size: 14px; }
.bo-main em { font-style: normal; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Bank account cards (settings) */
.bank-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.bank-card { position: relative; overflow: hidden; padding: 18px; border-radius: 16px; border: 1px solid var(--line-strong);
  background: radial-gradient(400px 160px at 100% 0%, rgba(59,130,246,.14), transparent 70%), rgba(255,255,255,.03); }
.bank-card.def { border-color: rgba(52,211,153,.35); }
.bc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bc-top b { font: 600 15px var(--font-display); }
.bc-no { font: 600 20px var(--font-display); letter-spacing: .08em; margin: 12px 0 8px; font-variant-numeric: tabular-nums; }
.bc-meta { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.bc-note { margin-top: 8px; font-size: 12px; color: var(--text-3); font-style: italic; }
.bc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }

/* Segmented control (QR mode) */
.qr-mode { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--line-strong); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--text-2); padding: 8px 14px; border-radius: 9px; font: 500 13px var(--font-body); cursor: pointer; transition: .2s var(--ease); }
.seg button:hover:not(:disabled) { color: #fff; background: rgba(255,255,255,.05); }
.seg button.on { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(139,92,246,.3); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }

@media (max-width: 860px) {
  .pt-row { grid-template-columns: 1fr 90px 36px; }
  .pt-row > :nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
  .pt-row .pt-amt { grid-column: 1 / -1; grid-row: 3; text-align: left; }
  .pt-head { display: none; }
}

/* Category picker */
.cp { position: relative; display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(255,255,255,.04); transition: .15s; }
.cp:hover { border-color: rgba(139,92,246,.45); }
.cp.open, .cp:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,.22); background: rgba(255,255,255,.06); }
.cp input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding-left: 4px; padding-right: 4px; min-width: 0; }
.cp-badge { --c: var(--text-3); flex: none; width: 26px; height: 26px; margin-left: 7px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-style: normal;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent); transition: .2s; }
.cp-chev { flex: none; display: grid; place-items: center; width: 34px; height: 34px; margin-right: 2px; border: 0; background: none; color: var(--text-3); cursor: pointer; border-radius: 8px; transition: .2s var(--ease); }
.cp-chev:hover { color: var(--text-1); }
.cp.open .cp-chev { transform: rotate(180deg); color: var(--violet); }

.cp-panel { position: fixed; z-index: 80; display: flex; flex-direction: column; overflow: hidden; border-radius: 16px;
  background: rgba(14,14,24,.97); border: 1px solid var(--line-strong); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 24px 70px rgba(0,0,0,.6), 0 0 0 1px rgba(139,92,246,.08), inset 0 1px 0 rgba(255,255,255,.04);
  opacity: 0; transform: translateY(-6px) scale(.985); transform-origin: top center; transition: opacity .18s var(--ease), transform .22s var(--ease); pointer-events: none; }
.cp-panel.up { transform-origin: bottom center; transform: translateY(6px) scale(.985); }
.cp-panel.show { opacity: 1; transform: none; pointer-events: auto; }
.cp-panel::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--grad); opacity: .8; }
.cp-tabs { display: flex; gap: 4px; padding: 12px 12px 10px; overflow-x: auto; border-bottom: 1px solid var(--line); flex: none; scrollbar-width: none; }
.cp-tabs::-webkit-scrollbar { display: none; }
.cp-tab { --c: var(--violet); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid var(--line); background: transparent; color: var(--text-2);
  border-radius: 99px; padding: 5px 11px; font: 500 12px var(--font-body); cursor: pointer; transition: .15s; }
.cp-tab i { font-style: normal; color: var(--c); font-size: 11px; }
.cp-tab:hover { color: #fff; border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.cp-tab.on { color: #fff; border-color: transparent; background: color-mix(in srgb, var(--c) 22%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent); }
.cp-tab.on:first-child { background: var(--grad); box-shadow: none; }
.cp-list { overflow-y: auto; padding: 6px 6px 8px; overscroll-behavior: contain; }
.cp-group { --c: var(--violet); position: sticky; top: -6px; z-index: 1; display: flex; align-items: center; gap: 9px; padding: 12px 10px 6px; margin-top: -6px;
  background: linear-gradient(rgba(14,14,24,1) 75%, rgba(14,14,24,0)); font: 600 10.5px var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.cp-gicon { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; letter-spacing: 0; color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.cp-count { margin-left: auto; font: 500 11px var(--font-body); letter-spacing: 0; color: var(--text-3); opacity: .8; }
.cp-opt { --c: var(--violet); position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; cursor: pointer; color: var(--text-2); transition: background .12s, color .12s; }
.cp-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--c); opacity: .55; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 14%, transparent); transition: .15s; }
.cp-name { flex: 1; min-width: 0; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-name mark { background: none; color: var(--cyan); font-weight: 600; }
.cp-hsn { flex: none; font: 500 11px var(--font-body); color: var(--text-3); padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.cp-hsn em { font-style: normal; opacity: .7; }
.cp-check { flex: none; width: 14px; color: var(--c); font-size: 12px; opacity: 0; }
.cp-opt.act { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 16%, transparent), rgba(255,255,255,.02)); color: #fff; }
.cp-opt.act::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--c); }
.cp-opt.act .cp-dot { opacity: 1; }
.cp-opt.act .cp-hsn { color: var(--text-2); border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.cp-opt.sel { color: #fff; }
.cp-opt.sel .cp-check { opacity: 1; }
.cp-new { margin-top: 6px; border-top: 1px dashed var(--line); border-radius: 0 0 10px 10px; color: var(--text-2); }
.cp-plus { flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 600; }
.cp-empty { padding: 26px 14px; text-align: center; color: var(--text-3); font-size: 13px; }

/* GSTIN check */
.gst-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; padding: 8px 12px; border-radius: 10px; }
.gst-status.ok { color: var(--good); background: rgba(52,211,153,.08); border: 1px solid rgba(52,211,153,.25); }
.gst-status.bad { color: var(--bad); background: rgba(251,113,133,.08); border: 1px solid rgba(251,113,133,.25); }
.gst-status .btn { margin-left: auto; color: var(--text-2); }
.gst-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.t-rnd { background: rgba(236,72,153,.14); color: #f9a8d4; font-size: 10px; }

/* chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart .bar { fill: var(--violet); transition: fill .15s; }
.chart .hit:hover + .bar, .chart .bar.on { fill: #a78bfa; }
.chart .axis text { fill: var(--text-3); font-size: 11px; font-family: var(--font-body); }
.chart .gridline { stroke: var(--line); }
.tip { position: absolute; pointer-events: none; background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px; font-size: 12.5px;
  white-space: nowrap; transform: translate(-50%, -100%); opacity: 0; transition: opacity .12s; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.tip b { display: block; font: 600 15px var(--font-display); }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(5,5,8,.6); display: grid; place-items: center; padding: 16px; animation: splashIn .25s backwards; }
.modal-card { width: 100%; max-width: 560px; max-height: 86vh; overflow: auto; border-radius: 20px; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.6); background: rgba(16,16,28,.96); }
.modal-card h2 { font-size: 20px; }

/* toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 30px); z-index: 99; background: var(--surface-solid); border: 1px solid var(--line-strong);
  color: #fff; padding: 12px 20px; border-radius: 12px; opacity: 0; transition: .3s var(--ease); pointer-events: none; max-width: calc(100% - 32px); box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.toast::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 10px; vertical-align: 1px; }
.toast.bad::before { background: var(--bad); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* document preview */
.sheet { overflow-x: auto; padding: 4px 0 12px; }
.sheet .page { margin: 0 auto; box-shadow: 0 30px 90px rgba(0,0,0,.6); border-radius: 4px; }
.sheet .page + .page { margin-top: 22px; }

@media (max-width: 960px) {
  .login { grid-template-columns: 1fr; gap: 32px; }
  .login-hero p { display: none; }
  .login-logo { height: 48px; margin-bottom: 20px; }
}
/* ---------- mobile: top bar + bottom tab bar + tile sheets (built by buildMobileNav in portal-app.js) ---------- */
.mtop, .mnav, .msheet { display: none; }
@media (max-width: 860px) {
  #app { flex-direction: column; }
  .side { display: none; }
  main { padding: 18px 16px calc(110px + env(safe-area-inset-bottom)); }
  .g2, .g3, .g4, .g6, .split { grid-template-columns: 1fr; }
  .span2, .span3, .span4, .span6 { grid-column: auto; }
  h1 { font-size: 23px; }

  .mtop { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; height: 58px; padding: 0 14px;
    padding-top: env(safe-area-inset-top); box-sizing: content-box;
    background: rgba(8,8,16,.72); backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-bottom: 1px solid rgba(255,255,255,.06); }
  .mtop-brand img { height: 30px; display: block; }
  .mtop-title { flex: 1; min-width: 0; font: 600 15px var(--font-display); color: var(--text-1); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mtop-me .avatar { width: 34px; height: 34px; font-size: 12px; box-shadow: 0 0 0 2px rgba(255,255,255,.08); }

  .mnav { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; z-index: 40;
    left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); height: 66px; padding: 0 6px 8px; border-radius: 22px;
    background: rgba(12,12,22,.82); backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
    border: 1px solid rgba(255,255,255,.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 18px 40px -12px rgba(0,0,0,.9); }
  .mnav > a, .mnav > button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0 0;
    border: 0; background: none; color: var(--text-3); font: 500 10.5px var(--font-body); letter-spacing: .01em; cursor: pointer; transition: color .2s; }
  .mnav svg { width: 22px; height: 22px; transition: transform .25s var(--ease); }
  .mnav .on { color: #fff; }
  .mnav .on svg { color: var(--cyan); transform: translateY(-1px); }
  .mnav .on::after { content: ""; position: absolute; top: -1px; width: 22px; height: 3px; border-radius: 0 0 3px 3px; background: var(--grad); }
  .mnav .mnav-add { align-self: center; justify-self: center; width: 54px; height: 54px; margin-top: -22px; padding: 0; border-radius: 18px; justify-content: center;
    color: #fff; background: var(--grad); box-shadow: 0 10px 26px -6px rgba(139,92,246,.85), inset 0 1px 0 rgba(255,255,255,.35); }
  .mnav .mnav-add svg { width: 26px; height: 26px; }
  .mnav .mnav-add:active { transform: scale(.94); }

  .msheet { display: block; position: fixed; inset: 0; z-index: 60; }
  .msheet.hidden { display: none; }
  .msheet-scrim { position: absolute; inset: 0; background: rgba(2,2,8,.6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s; }
  .msheet-panel { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 16px calc(22px + env(safe-area-inset-bottom)); border-radius: 26px 26px 0 0;
    background: linear-gradient(180deg, rgba(22,22,38,.98), rgba(12,12,22,.98)); border-top: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 -20px 60px rgba(0,0,0,.6); transform: translateY(100%); transition: transform .32s var(--ease); max-height: 82vh; overflow-y: auto; }
  .msheet.open .msheet-scrim { opacity: 1; }
  .msheet.open .msheet-panel { transform: none; }
  .msheet-grab { width: 42px; height: 5px; border-radius: 5px; background: rgba(255,255,255,.18); margin: 4px auto 14px; }
  .msheet-title { font: 600 17px var(--font-display); color: var(--text-1); margin: 0 4px 14px; }
  .msheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .mtile { --c: var(--violet); min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 108px; padding: 12px; border-radius: 16px; text-align: left;
    color: var(--text-1); font: inherit; cursor: pointer; border: 1px solid rgba(255,255,255,.07);
    background: linear-gradient(160deg, color-mix(in srgb, var(--c) 12%, rgba(255,255,255,.03)), rgba(255,255,255,.02)); transition: transform .2s var(--ease), border-color .2s; }
  .mtile:active { transform: scale(.96); border-color: color-mix(in srgb, var(--c) 50%, transparent); }
  .mtile-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 8px; color: #fff;
    background: linear-gradient(150deg, color-mix(in oklch, var(--c), #fff 15%), var(--c) 50%, color-mix(in oklch, var(--c), #0b0620 40%));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 18px -8px var(--c); }
  .mtile-ic svg { width: 20px; height: 20px; }
  .mtile b { font: 600 13px/1.25 var(--font-body); }
  .mtile em { font-style: normal; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  body.sheet-open { overflow: hidden; }

  /* page header: title on top, actions as a tidy row of equal buttons */
  .head { align-items: stretch; margin-bottom: 18px; }
  .head .actions { width: 100%; }
  .head .actions > .btn { flex: 1 1 auto; }
  .dash-actions { display: none !important; } /* the ＋ button does this on phones */
  .filters { flex-wrap: wrap; }
  .filters > * { flex: 1 1 100%; }

  /* document lists become cards */
  .doclist, .doclist tbody { display: block; }
  .doclist thead { display: none; }
  .doclist tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .doclist tr:last-child { border-bottom: 0; }
  .doclist td { display: block; padding: 0 !important; border: 0 !important; background: none !important; }
  .doclist .c-no { grid-column: 1; }
  .doclist .c-amt { grid-column: 2; grid-row: 1; text-align: right; font-size: 15px; }
  .doclist .c-date { grid-column: 1; grid-row: 2; font-size: 12px; color: var(--text-3); }
  .doclist .c-st { grid-column: 2; grid-row: 2; text-align: right; }
  .doclist .c-party { grid-column: 1 / -1; grid-row: 3; font-weight: 500; color: var(--text-1); margin-top: 4px; }
  .doclist .c-subj, .doclist .c-by { display: none; }
  .doclist .row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
  .doclist .row-actions .btn { flex: 1 1 auto; }
  .doclist .empty { display: block; }
}

/* ---------- avatars with photos ---------- */
.avatar.has-photo { background: var(--surface-3); padding: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatar.xl { width: 96px; height: 96px; font-size: 30px; box-shadow: 0 0 0 3px rgba(139,92,246,.45), 0 14px 40px rgba(0,0,0,.45); }
.me .muted.sm { display: block; text-transform: none; }

/* ---------- document numbers & cancelled documents ---------- */
input.locked { background: rgba(255,255,255,.02); border-style: dashed; color: var(--text-1); font-family: var(--font-display); font-weight: 600; letter-spacing: .04em; cursor: not-allowed; }
input.locked:focus { box-shadow: none; border-color: var(--line-strong); }
.s-Cancelled { background: rgba(251,113,133,.16); color: var(--bad); border: 1px solid rgba(251,113,133,.35); letter-spacing: .08em; text-transform: uppercase; }
table.grid tr.is-cancelled td { opacity: .62; }
table.grid tr.is-cancelled td.amt b, table.grid tr.is-cancelled td.num b { text-decoration: line-through; }
table.grid tr.is-cancelled td.row-actions { opacity: 1; }
.hint.bad-hint { background: rgba(251,113,133,.08); border-color: rgba(251,113,133,.3); color: #fecdd3; }
.num-list { display: grid; gap: 10px; }
.num-row { display: grid; grid-template-columns: 1.2fr 1.3fr 1fr auto; gap: 14px; align-items: end; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.025); border: 1px solid var(--line); }
.num-row > div:first-child b { display: block; } .num-row > div:first-child span { display: block; margin-top: 2px; }
.num-next em { display: block; font-style: normal; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.num-next b { font-family: var(--font-display); font-size: 17px; letter-spacing: .03em; background: var(--grad-2); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- inventory ---------- */
.lock-note { font-size: 11.5px; color: var(--text-3); white-space: nowrap; padding: 0 6px; }
.items-ed .isugg { margin: 6px 0; white-space: normal; }
.items-ed .isugg .sg { max-width: 100%; }
.sg small .warn { color: var(--warn); }

/* ---------- team / profile ---------- */
.emp-id { font-family: var(--font-display); letter-spacing: .06em; background: rgba(139,92,246,.16); color: #ddd6fe; }
.prof { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.prof-photo { position: relative; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.prof-photo em { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); font: 600 10.5px var(--font-body); font-style: normal; padding: 3px 9px; border-radius: 99px;
  background: var(--surface-solid); border: 1px solid var(--line-strong); color: var(--text-2); opacity: 0; transition: .2s; }
.prof-photo:hover em { opacity: 1; }
.prof-main { flex: 1; min-width: 240px; display: grid; gap: 4px; }
.prof-main > b { font: 600 22px var(--font-display); }
.prof-pos { color: var(--cyan); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.prof-meta { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 10px 0 12px; font-size: 13.5px; }
.prof-meta em { display: block; font-style: normal; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.prof-card { margin-top: 22px; }
.prof-card:empty { display: none; }
table.kv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.kv td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv td:first-child { color: var(--text-3); width: 38%; padding-right: 12px; }
table.kv tr:last-child td { border-bottom: 0; }

/* ---------- first sign-in onboarding ---------- */
.onboard { position: relative; z-index: 2; min-height: 100vh; padding: 48px 16px 80px; animation: splashIn .6s var(--ease) backwards; }
.ob-wrap { max-width: 880px; margin: 0 auto; }
.ob-head { text-align: center; margin-bottom: 28px; }
.ob-logo { height: 52px; margin-bottom: 22px; }
.ob-head h1 { font-size: clamp(26px, 4vw, 38px); margin: 0 0 8px; }
.ob-id { display: inline-flex; align-items: center; gap: 12px; margin-top: 14px; padding: 8px 8px 8px 16px; border-radius: 99px; background: rgba(255,255,255,.04); border: 1px solid var(--line-strong); }
.ob-id span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.ob-id b { font: 600 15px var(--font-display); letter-spacing: .06em; padding: 6px 14px; border-radius: 99px; background: var(--grad); color: #fff; }
.ob-id.big { display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 18px; text-align: center; }
.ob-id.big b { font-size: 26px; padding: 10px 26px; }
.ob-card { border-radius: 22px; padding: clamp(20px, 4vw, 34px); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.ob-card section { padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.ob-card section:last-of-type { border-bottom: 0; margin-bottom: 8px; }
.ob-card h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; margin: 0 0 16px; }
.ob-card h2 i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 600 13px var(--font-display); font-style: normal; background: var(--grad); color: #fff; }
.ob-photo-row { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; }
.ob-photo { width: 104px; height: 104px; flex-shrink: 0; border-radius: 50%; padding: 0; overflow: hidden; cursor: pointer; border: 2px dashed var(--line-strong);
  background: rgba(255,255,255,.03); color: var(--text-2); font-size: 28px; transition: .2s var(--ease); }
.ob-photo:hover { border-color: var(--violet); color: #fff; }
.ob-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ob-photo span { display: grid; place-items: center; gap: 2px; }
.ob-photo span em { font-style: normal; font-size: 11px; }
.ob-photo:has(img) { border: 0; box-shadow: 0 0 0 3px rgba(139,92,246,.5); }
.field { display: grid; gap: 6px; font-size: 12px; color: var(--text-3); font-weight: 500; letter-spacing: .02em; }
.field .seg { justify-self: start; }
.ob-phone { display: flex; gap: 8px; }
.ob-phone select { width: 84px; flex-shrink: 0; }
.ob-opt { font-style: normal; color: var(--text-3); opacity: .8; }
.invalid, .seg.invalid { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(251,113,133,.15) !important; }
.ob-photo.invalid { border-style: dashed; }
.pw-meter { height: 5px; border-radius: 99px; background: rgba(255,255,255,.06); margin: 14px 0 8px; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--bad); transition: .3s var(--ease); }
.pw-meter span.ok { background: var(--warn); } .pw-meter span.strong { background: var(--good); }
.ob-card .err ul { margin: 6px 0 0; padding-left: 18px; }
.ob-actions { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.ob-done .ob-card { text-align: center; max-width: 880px; margin: 0 auto; }
.ob-done .vc-prev { justify-content: center; margin-top: 14px; }
.ob-check { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: rgba(52,211,153,.14); color: var(--good); border: 1px solid rgba(52,211,153,.4); }
.ob-done .ob-actions { justify-content: center; }
@media (max-width: 860px) {
  .num-row { grid-template-columns: 1fr 1fr; }
  .ob-photo-row { flex-direction: column; text-align: center; }
}

/* ---------- themed dropdowns (js/portal-dropdown.js) ---------- */
select.dd-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: 0 !important; border: 0 !important;
  opacity: 0; pointer-events: none; clip-path: inset(50%); left: 0; top: 0; } /* pinned: left where it falls, it could stick out past the screen edge and make phones zoom out */
.dd { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-width: 0; text-align: left; cursor: pointer;
  font: 14px var(--font-body); color: var(--text-1); background: rgba(255,255,255,.04); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 10px 12px; transition: border-color .15s, box-shadow .15s, background .15s; }
.dd:hover:not(:disabled) { border-color: rgba(139,92,246,.45); background: rgba(255,255,255,.06); }
.dd:focus-visible, .dd.dd-open { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,.22); background: rgba(255,255,255,.06); }
.dd:disabled { opacity: .5; cursor: not-allowed; }
.dd.ph .dd-val { color: #6d6d82; }
.dd-val { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-chev { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--text-3); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease), stroke .15s; }
.dd.dd-open .dd-chev { transform: rotate(180deg); stroke: var(--violet); }
.filters .dd { width: auto; min-width: 170px; }
.items-ed .dd { padding: 8px 9px; font-size: 13.5px; }
.items-ed .dd.domain { margin-top: 6px; font-size: 12.5px; }
.adj .dd { width: 54px; padding: 5px 7px; gap: 4px; }
.adj .dd .dd-chev { width: 13px; height: 13px; }
.ob-phone .dd { width: 92px; flex-shrink: 0; }

.dd-panel { position: fixed; z-index: 300; overflow-y: auto; overscroll-behavior: contain; padding: 6px; border-radius: 14px;
  background: rgba(14,14,24,.98); border: 1px solid var(--line-strong); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 24px 70px rgba(0,0,0,.6), 0 0 0 1px rgba(139,92,246,.08), inset 0 1px 0 rgba(255,255,255,.04);
  opacity: 0; transform: translateY(-6px) scale(.985); transform-origin: top center; transition: opacity .16s var(--ease), transform .2s var(--ease); pointer-events: none; }
.dd-panel.up { transform-origin: bottom center; transform: translateY(6px) scale(.985); }
.dd-panel.show { opacity: 1; transform: none; pointer-events: auto; }
.dd-opt { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer;
  color: var(--text-2); font-size: 13.5px; transition: background .1s, color .1s; }
.dd-opt .dd-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-opt em { font-style: normal; color: var(--text-3); font-size: 12px; margin-left: 8px; }
.dd-opt mark { background: none; color: var(--cyan); font-weight: 600; }
.dd-opt.act { background: linear-gradient(90deg, rgba(139,92,246,.2), rgba(255,255,255,.02)); color: #fff; }
.dd-opt.act::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--grad); }
.dd-opt.sel { color: #fff; font-weight: 500; }
.dd-opt.ph { color: var(--text-3); }
.dd-opt.dis { opacity: .4; cursor: not-allowed; }
.dd-check { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: var(--violet); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.dd-opt.sel .dd-check { opacity: 1; }
.dd-empty { padding: 10px 12px; color: var(--text-3); font-size: 13px; }

.ob-sub { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; margin: 22px 0 12px; }

.city-sugg { margin-top: -4px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid var(--line); animation: splashIn .18s var(--ease) backwards; }

/* office addresses (Settings) */
.office-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.office { padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--line); display: grid; gap: 6px; align-content: start; }
.office.def { border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.04); }
.of-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.of-addr { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.office .bc-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }

/* sidebar profile link */
.me-link { color: inherit; text-decoration: none; padding: 6px 8px; margin: -6px -8px; border-radius: 12px; transition: background .15s; }
.me-link:hover, .me-link.on { background: rgba(255,255,255,.06); }
.me-link.on .avatar { box-shadow: 0 0 0 2px var(--violet); }

/* "+ Add …" buttons in Settings */
.add-btn { margin-top: 16px; border-style: dashed; }
.add-btn:hover { border-style: solid; }

/* former employees */
.s-Left { background: rgba(148,163,184,.14); color: #cbd5e1; border: 1px solid rgba(148,163,184,.3); }
.doc-list { display: grid; gap: 10px; margin-top: 18px; text-align: left; }
.doc-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 14px; cursor: pointer; text-align: left;
  background: rgba(255,255,255,.03); border: 1px solid var(--line-strong); color: var(--text-1); font: 14px var(--font-body); transition: .2s var(--ease); }
.doc-btn:hover:not(:disabled) { border-color: rgba(139,92,246,.6); background: rgba(139,92,246,.08); transform: translateY(-1px); }
.doc-btn:disabled { opacity: .5; cursor: not-allowed; }
.doc-btn i { width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; display: grid; place-items: center; font-style: normal; font-size: 17px; background: var(--grad); color: #fff; }
.doc-btn span { flex: 1; min-width: 0; display: grid; gap: 2px; }
.doc-btn em { font-style: normal; font-size: 12px; color: var(--text-3); }
.doc-btn u { text-decoration: none; font-size: 12.5px; font-weight: 600; color: var(--cyan); white-space: nowrap; }
.exit-card { max-width: 560px !important; }
.exit-card .ob-logo { display: block; margin: 0 auto 18px; }

/* next document numbers (Settings) */
.num-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.num-tile { padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.num-tile em { display: block; font-style: normal; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.num-tile b { font: 600 18px var(--font-display); letter-spacing: .03em; }
/* 15-per-page tables */
tr.pg-off { display: none; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: -6px 0 22px; padding: 0 4px; }
.pager .pg-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pager .btn.on { background: var(--grad); border-color: transparent; color: #fff; }
.pager .btn:disabled { opacity: .4; cursor: default; }
.pager .pg-gap { color: var(--text-3); padding: 0 2px; }
.co-tiles { grid-template-columns: repeat(4, 1fr); }
.co-tiles b { font-size: 15px; word-break: break-all; }
@media (max-width: 1100px) { .co-tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) { .num-tiles { grid-template-columns: 1fr; } }

/* authorised signatures (Settings) */
.sign-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.sign-card { padding: 12px 14px 14px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--line); display: grid; gap: 6px; align-content: start; }
.sign-card.def { border-color: rgba(52,211,153,.35); }
.sign-img { height: 86px; border-radius: 10px; background: #fff; display: grid; place-items: center; padding: 8px; overflow: hidden; }
.sign-img img { max-width: 100%; max-height: 100%; }
.sign-img.big { height: 140px; cursor: pointer; border: 2px dashed rgba(0,0,0,.15); text-align: center; }
.sign-img.big .muted { color: #6b6b7b; font-size: 13px; }

/* letterhead writer */
.lh-split { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
.lh-prev-wrap { position: sticky; top: 18px; overflow: hidden; border-radius: 6px; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.lh-prev { width: 210mm; transform-origin: 0 0; }
.lh-prev .page { margin: 0; }
.lh-empty { color: #9a98a8; font-style: italic; }
@media (max-width: 1100px) { .lh-split { grid-template-columns: 1fr; } .lh-prev-wrap { position: static; } }


.lh-prev-wrap { background: #2a2a36; }



/* letterhead preview pager */
.lh-prev-col { position: sticky; top: 18px; }
.lh-prev-col .lh-prev-wrap { position: static; cursor: default; }
.lh-pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 13px; color: var(--text-2); }
.lh-pager .btn { width: 34px; height: 34px; padding: 0; font-size: 18px; border-radius: 50%; }
.lh-pager.single .btn { visibility: hidden; }
.lh-pager span { min-width: 92px; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) { .lh-prev-col { position: static; } }
.lh-pager .btn:disabled { cursor: not-allowed; opacity: .3; }
.lh-prev-col .lh-prev-wrap.multi { cursor: pointer; }

/* letter message: formatting toolbar */
.lh-msg { display: flex; flex-direction: column; gap: 6px; }
.lh-msg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.form .lh-size { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.form .lh-size select { width: auto; min-width: 120px; padding: 6px 10px; font-size: 12.5px; }
.fmt-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px; border: 1px solid var(--line); border-radius: 12px 12px 4px 4px; background: var(--surface-2); }
.fmt-btn { width: 34px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-3); color: var(--text-1); font: 600 15px/1 Georgia, "Times New Roman", serif; cursor: pointer; transition: background .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease); }
.fmt-btn i { font-style: italic; font-weight: 500; }
.fmt-btn:hover { background: rgba(139,92,246,.18); border-color: rgba(139,92,246,.5); }
.fmt-btn:active { transform: scale(.94); }
.fmt-sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 2px; }
.fmt-btn.wide { width: auto; padding: 0 10px; font: 600 12.5px/1 var(--font-body); }
.fmt-btn u { text-underline-offset: 2px; }
.lh-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 12px; border-radius: 12px; border: 1px dashed rgba(251,191,36,.28); background: rgba(251,191,36,.04); }
.lh-note { font-size: 12.5px; color: var(--text-2); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.fmt-bar .fmt-sel { width: auto; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-3); color: var(--text-1); font-size: 12.5px; }
.lh-msg textarea { border-top-left-radius: 4px; border-top-right-radius: 4px; }
.lh-fmt-help { font-size: 11.5px; color: var(--text-3); }
.lh-fmt-help b { color: var(--text-2); }
.lh-msg textarea { line-height: 1.6; tab-size: 2; }
.tbl-panel { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 10px 12px; border: 1px solid rgba(139,92,246,.35); border-radius: 10px; background: rgba(139,92,246,.07); }
.tbl-panel.hidden { display: none; }
.form .tbl-panel label { flex-direction: column; gap: 4px; margin: 0; font-size: 12px; }
.form .tbl-panel input[type=number] { width: 78px; padding: 6px 8px; }
.form .tbl-panel label.check { flex-direction: row; align-items: center; padding-bottom: 7px; }
.tbl-help { flex-basis: 100%; font-size: 11.5px; }
.lh-file { position: relative; justify-content: center; width: 100%; cursor: pointer; overflow: hidden; }
.lh-file input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.lh-file.busy { pointer-events: none; opacity: .6; }
.lh-file.busy::after { content: " · reading…"; }
.fmt-bar .fmt-sel optgroup { color: #9a98a8; }
.fmt-bar .fmt-sel option { color: var(--text-1); background: var(--surface-solid); }

/* =====================================================================================================
   PHONES (≤ 860px). Desktop is not affected. js/portal-app.js (mobilize) adds the classes used here:
   .rt tables (cells carry data-label), .m-hide / .m-more for collapsed buttons, and the A4 preview zoom.
   ===================================================================================================== */
@media (max-width: 860px) {
  /* nothing may be wider than the screen: phones would zoom the whole app out */
  html, body { overflow-x: clip; }
  .split > *, .lh-split > *, .lh-prev-col, .card { min-width: 0; }
  main { padding: 14px 14px calc(108px + env(safe-area-inset-bottom)); }
  .card { padding: 16px; border-radius: 18px; margin-bottom: 14px; }
  .card-head { margin-bottom: 12px; }
  h2 { font-size: 15.5px; }

  /* comfortable tap targets; 16px text in fields stops iPhones zooming in on focus */
  input, select, textarea, .dd { font-size: 16px; }
  input, select, .dd { min-height: 44px; }
  textarea { min-height: 44px; }
  .btn { min-height: 42px; padding: 10px 16px; border-radius: 12px; }
  .btn.sm { min-height: 36px; padding: 7px 12px; font-size: 13px; border-radius: 10px; }
  label.check { min-height: 32px; }
  .chip { min-height: 36px; padding: 8px 14px; font-size: 13px; }
  .sg, .hs { min-height: 32px; padding-top: 6px; padding-bottom: 6px; }
  label.check input { width: 20px; height: 20px; min-height: 0; }
  .switch input { min-height: 0; }

  /* page header: title, then at most two buttons and a "More" button (the rest are in its sheet) */
  .head { gap: 12px; margin-bottom: 16px; }
  .head h1 { font-size: 24px; line-height: 1.2; word-break: break-word; }
  .head .sub { font-size: 13px; margin-top: 4px; }
  .head .actions { display: flex; flex-wrap: nowrap; gap: 8px; }
  .head .actions > .btn { flex: 1 1 0; min-width: 0; padding-left: 10px; padding-right: 10px; overflow: hidden; text-overflow: ellipsis; }
  .head .actions > .m-more { flex: 0 0 48px; padding: 0; }
  .m-hide { display: none !important; }
  .card-head .actions:has(> .m-more) { flex-wrap: nowrap; }
  .card-head .actions > .m-more { min-width: 40px; padding: 0 10px; }
  .m-more { font-size: 18px; letter-spacing: 1px; line-height: 1; }

  /* document forms: Cancel / Save stay at the bottom of the screen (the tab bar steps aside) */
  body.route-form .mnav { display: none; }
  body.route-form main > .head { animation: none; }
  body.route-form main > .head .actions { position: fixed; z-index: 41; width: auto; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 8px;
    border-radius: 20px; background: rgba(12,12,22,.88); backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
    border: 1px solid rgba(255,255,255,.09); box-shadow: 0 18px 40px -12px rgba(0,0,0,.9); }
  body.route-form main > .head .actions .btn { min-height: 48px; font-size: 15px; }
  body.route-form main > .head .actions .btn.primary { flex-grow: 1.6; }
  body.route-form .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }

  /* search on its own line, filters two per row */
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters > * { flex: none; min-width: 0; max-width: none !important; }
  .filters > .search, .filters > input[type=search], .filters > .btn { grid-column: 1 / -1; }
  .filters > button.dd:only-of-type { grid-column: 1 / -1; }

  /* dashboard numbers: two compact tiles per row */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px 14px 13px; border-radius: 16px; }
  .stat span { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat b { font-size: 19px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chart svg { height: 180px; }

  /* every data table becomes a list of cards: first cell is the title, the rest are "label … value" lines */
  .card.flush:has(> .tablewrap > table.rt), .card.flush:has(table.rt) { background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible; }
  .tablewrap:has(> table.rt) { overflow: visible; }
  table.rt, table.rt tbody, table.rt tfoot { display: block; width: 100%; }
  table.rt thead { display: none; }
  table.rt tr { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; padding: 14px 16px; margin-bottom: 10px;
    border-radius: 16px; background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  table.rt tbody tr:hover td { background: none; }
  table.rt td { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: 4px 10px; padding: 0 !important; border: 0 !important; text-align: right; min-width: 0; font-size: 14px; }
  table.rt td > * { min-width: 0; max-width: 100%; }
  table.rt td[data-label]:not([data-label=""]):not(:first-child)::before { content: attr(data-label); margin-right: auto; text-align: left; font-size: 12px; letter-spacing: .02em; color: var(--text-3); }
  table.rt td:first-child { display: block; font-size: 15px; font-weight: 600; color: var(--text-1); text-align: left; padding: 0 0 4px !important; border-bottom: 1px solid var(--line) !important; margin-bottom: 2px; }
  table.rt td:first-child .muted, table.rt td:first-child .sm { font-weight: 400; }
  table.rt td.row-actions, table.rt td[data-label=""]:not(:first-child) { justify-content: flex-start; gap: 8px; margin-top: 4px; text-align: left; }
  table.rt td.row-actions:empty, table.rt td[data-label=""]:empty, table.rt td:not(:first-child):empty { display: none; }
  .search { max-width: none !important; }
  table.rt td.row-actions .btn { margin: 0; flex: 1 1 auto; }
  table.rt td.empty, table.rt td[colspan] { display: block; grid-column: 1 / -1; text-align: center; }
  table.rt tr:has(> td.empty) { background: transparent; border-style: dashed; }
  table.rt tfoot tr { background: rgba(255,255,255,.03); }
  table.rt td img, table.rt td .avatar { justify-self: start; }

  /* document lists: number + amount, date + status, customer; tap the card to open it */
  .card.flush:has(.doclist) { background: transparent; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible; }
  .doclist tr { margin-bottom: 10px; border: 1px solid var(--line) !important; border-radius: 16px; background: var(--surface); padding: 14px 16px; gap: 4px 12px; }
  .doclist tr.is-cancelled { opacity: .7; }
  .doclist .c-no b { font: 600 15px var(--font-display); letter-spacing: .01em; }
  .doclist .c-no .pill { margin-left: 4px; }
  .doclist .c-no .muted.sm { margin-top: 2px; }
  .doclist .c-amt b { font: 700 16px var(--font-display); }
  .doclist .c-party { font-size: 14px; }
  .doclist .row-actions { margin-top: 10px; display: flex; gap: 8px; }
  .doclist .row-actions .btn { flex: 1 1 0; }
  .doclist .row-actions .m-more { flex: 0 0 auto; }

  /* items in the document form: one card per item */
  table.items-ed.rt tr { grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; gap: 10px 8px; padding: 14px; background: rgba(255,255,255,.03); }
  table.items-ed.rt td { display: grid; gap: 4px; padding: 0 !important; text-align: left; min-width: 0; }
  table.items-ed.rt td[data-label]:not([data-label=""]):not(:first-child)::before { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
  table.items-ed.rt td:nth-child(1) { display: block; align-self: center; grid-column: 1 / 4; padding: 0 !important; border: 0 !important; margin: 0; font: 600 12px var(--font-body); color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; }
  table.items-ed.rt td:nth-child(1)::before { content: "Item "; }
  table.items-ed.rt td:nth-child(10) { grid-column: 4 / 7; grid-row: 1; justify-self: end; }
  table.items-ed.rt td:nth-child(2) { grid-column: 1 / -1; }
  table.items-ed.rt td:nth-child(3), table.items-ed.rt td:nth-child(7) { grid-column: 1 / 4; }
  table.items-ed.rt td:nth-child(4), table.items-ed.rt td:nth-child(8) { grid-column: 4 / 7; }
  table.items-ed.rt td:nth-child(5) { grid-column: 1 / 3; }
  table.items-ed.rt td:nth-child(6) { grid-column: 3 / 7; }
  table.items-ed.rt td:nth-child(9) { grid-column: 1 / -1; grid-template-columns: 1fr auto; align-items: baseline; padding-top: 8px !important; border-top: 1px dashed var(--line) !important; font: 700 17px var(--font-display); color: var(--text-1); }
  table.items-ed.rt td:nth-child(9)::before { font-family: var(--font-body); }
  .items-ed .w-xs, .items-ed .w-sm, .items-ed .w-md { width: 100%; }
  .items-ed .adj { display: flex; gap: 6px; }
  .items-ed .adj input { flex: 1; min-width: 0; }
  .items-ed .adj select, .items-ed .adj .dd { width: 64px; flex: none; }
  #addItem { width: 100%; }

  /* A4 previews (quotation / bill / letter) are shrunk to the screen width by mobilize(); no sideways scrolling */
  .sheet { overflow: hidden; padding: 0 0 8px; }
  .sheet .page { box-shadow: 0 16px 40px rgba(0,0,0,.55); }
  .sheet .page + .page { margin-top: 14px; }

  /* pop-ups slide up from the bottom like the menus */
  .modal { place-items: end stretch; padding: 0; }
  .modal-card { max-width: none; max-height: 90vh; border-radius: 24px 24px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    animation: sheetUp .32s var(--ease) backwards; }
  .modal-card .card-head { position: sticky; top: -22px; z-index: 2; margin: -22px -18px 12px; padding: 18px 18px 12px; background: rgba(16,16,28,.98); border-bottom: 1px solid var(--line); }
  .modal-card .card-head { flex-wrap: nowrap; }
  .modal-card .card-head h2 { min-width: 0; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .modal-card .card-head .btn { flex: none; }
  .modal-card .actions .btn, .modal-card form > .actions .btn { flex: 1 1 0; }

  /* messages sit above the tab bar */
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 28px); font-size: 13.5px; text-align: center; }

  /* top bar: back arrow on inner pages */
  .mtop-back { display: none; width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: 12px; background: none; color: var(--text-1); place-items: center; cursor: pointer; }
  .mtop-back svg { width: 24px; height: 24px; }
  .mtop-back:active { background: rgba(255,255,255,.08); }
  .mtop.has-back .mtop-back { display: grid; }
  .mtop.has-back .mtop-brand { display: none; }
  .mtop-title { text-align: left; }
  .mtop:not(.has-back) .mtop-title { text-align: center; }

  /* action sheet (the "More" button): a clean list instead of tiles */
  .msheet-grid.as-list { display: grid; grid-template-columns: 1fr; gap: 0; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.035); border: 1px solid var(--line); }
  .as-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 0 18px; border: 0; border-bottom: 1px solid var(--line); background: none;
    color: var(--text-1); font: 500 15px var(--font-body); text-align: left; cursor: pointer; }
  .as-item:last-child { border-bottom: 0; }
  .as-item:active { background: rgba(139,92,246,.14); }
  .as-item.danger { color: var(--bad); }
  .as-cancel { justify-content: center; margin-top: 10px; border-radius: 16px; border: 1px solid var(--line) !important; background: rgba(255,255,255,.05); font-weight: 600; }
  .msheet-grid.as-list:has(.as-cancel) { background: none; border: 0; gap: 0; }
  .as-group { border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.035); border: 1px solid var(--line); }

  /* folded "Add customer" card */
  .m-fold > h2 { display: flex; align-items: center; justify-content: space-between; margin: 0; cursor: pointer; }
  .m-fold > h2::after { content: "+"; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--grad); color: #fff; font: 500 20px/1 var(--font-body); }
  .m-fold:not(.m-folded) > h2 { margin-bottom: 14px; }
  .m-fold:not(.m-folded) > h2::after { content: "–"; background: var(--surface-3); }
  .m-fold.m-folded > :not(h2) { display: none; }

  /* forms and editor pieces */
  .form { gap: 12px; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1 1 auto; padding: 10px 8px; }
  .bank-opts, .bank-list, .link-slots { grid-template-columns: 1fr; }
  #ptPresets { margin-left: 0; }
  .pt-row { grid-template-columns: 1fr 96px 40px; }
  .ff-bar .search { max-width: none; }
  .ff-item { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 11px 14px; }
  .ff-no { grid-column: 1; grid-row: 1; display: flex; align-items: baseline; gap: 8px; }
  .ff-amt { grid-column: 2; grid-row: 1; text-align: right; }
  .ff-cust { grid-column: 1; grid-row: 2; justify-self: stretch !important; font-size: 13px; color: var(--text-2); }
  .ff-cust em { display: none; }
  .ff-go { grid-column: 2; grid-row: 2; justify-self: end !important; }
  .pay-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pay-sum > div:only-child, .pay-sum > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .aging { gap: 8px; }
  .age { padding: 12px 14px 16px; }
  .age b { font-size: 17px; }
  .prof { flex-direction: column; gap: 14px; text-align: center; }
  .prof-main { min-width: 0; width: 100%; justify-items: center; }
  .prof-meta { justify-content: center; gap: 10px 22px; }
  .prof-main .actions { justify-content: center; }
  .num-row { grid-template-columns: 1fr; }
  table.kv td:first-child { width: 42%; }

  /* letterhead writer */
  .lh-quick { grid-template-columns: 1fr; }
  .fmt-bar { gap: 6px; }
  .fmt-bar .fmt-sel, .fmt-bar .dd { flex: 1 1 calc(33% - 6px); min-width: 0; }
  .fmt-btn { width: 40px; height: 40px; }
  .fmt-btn.wide { height: 40px; }
  .lh-msg-head { align-items: flex-start; }

  /* inventory category navigator */
  .catnav { padding: 14px 12px 12px; border-radius: 18px; }
  .catnav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catcell { height: 52px; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 0 9px; padding: 0 10px 0 8px; }
  .catcell-ic { width: 30px; height: 30px; font-size: 14px; }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }
@media print { .sheet .page { zoom: 1 !important; } }
