/* Surovi ERP - one stylesheet, no framework */
:root {
  --bg: #f4f6f5; --panel: #ffffff; --ink: #1d2826; --muted: #66736f; --line: #dde3e1; --line-strong: #c5cfcc;
  --accent: #0f5c4c; --accent-ink: #ffffff; --accent-soft: #e3f0ec; --side: #10302a; --side-ink: #cfe0db; --side-hover: #1a443b;
  --good: #1f8a4c; --good-soft: #e3f4ea; --warn: #a96500; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fde8e6; --neutral-soft: #eceff3;
  --radius: 8px; --shadow: 0 1px 2px rgba(16, 48, 42, .06), 0 2px 8px rgba(16, 48, 42, .05);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Bengali", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --side-w: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 14px; margin: 14px 0 8px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error-text { color: var(--bad); }
code { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.boot { padding: 40px; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); flex: 0 0 var(--side-w); background: var(--side); color: var(--side-ink); padding: 0 0 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: #fff; color: var(--accent); display: grid; place-items: center; font-weight: 800; font-size: 19px; flex: none; }
.brand-mark.big { width: 56px; height: 56px; font-size: 30px; background: var(--accent); color: #fff; margin: 0 auto 10px; border-radius: 14px; }
.brand-name { color: #fff; font-weight: 650; font-size: 15px; }
.brand-sub { font-size: 11px; opacity: .7; }
.side a, .side summary { display: flex; align-items: center; gap: 10px; color: var(--side-ink); text-decoration: none; padding: 7px 16px; cursor: pointer; border-radius: 0; }
.side a:hover, .side summary:hover { background: var(--side-hover); color: #fff; }
.side .ico { width: 18px; text-align: center; opacity: .75; font-size: 13px; }
.nav-top { font-weight: 600; margin-bottom: 2px; }
.nav-group summary { list-style: none; font-weight: 600; user-select: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: '▸'; margin-left: auto; font-size: 11px; opacity: .6; transition: transform .15s; }
.nav-group[open] summary::after { transform: rotate(90deg); }
.nav-group a { padding-left: 44px; font-size: 13px; }
.side a.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 #6fd3b6; }
.body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.menu-btn { display: none; }
.quick { flex: 1; max-width: 420px; }
.quick input { width: 100%; }
.who { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 13px; }
.who .role { background: var(--accent-soft); color: var(--accent); border-radius: 20px; padding: 1px 9px; font-size: 11px; text-transform: capitalize; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
#main { padding: 22px 24px 60px; outline: none; max-width: 1500px; width: 100%; }
.scrim { display: none; }

/* ---------- page ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.page-actions select, .page-actions input[type=month] { width: auto; max-width: 100%; }
.page-actions { min-width: 0; max-width: 100%; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.note { margin-top: 10px; padding: 8px 12px; background: var(--accent-soft); border-radius: 6px; font-size: 13px; }
.note:empty { display: none; }
.note.warn { background: var(--warn-soft); color: #6b4000; margin-bottom: 12px; }
.loading { padding: 30px; color: var(--muted); text-align: center; }
.loading::before { content: ''; display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; margin-right: 8px; vertical-align: -2px; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- controls ---------- */
input, select, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; padding: 7px 9px; width: 100%; min-height: 36px; }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--accent); }
input[type=file] { border-style: dashed; padding: 6px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(15, 92, 76, .15); }
input:disabled, select:disabled { background: var(--bg); color: var(--muted); }
textarea { resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 7px 14px; min-height: 36px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #0b4a3d; }
.btn.danger { color: var(--bad); border-color: #e9b4ae; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { padding: 3px 10px; min-height: 28px; font-size: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; color: var(--muted); border-radius: 6px; }
.icon-btn:hover { background: var(--bg); color: var(--bad); }
.inline-check { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; font-size: 13px; }
.link { font-size: 13px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field.check { display: flex; align-items: center; gap: 8px; padding-top: 18px; }
.field.check label { margin: 0; font-size: 13px; color: var(--ink); font-weight: 500; }
.field.w-2 { grid-column: span 2; }
.field.w-3 { grid-column: 1 / -1; }
.req { color: var(--bad); }
.help { font-size: 11px; color: var(--muted); margin-top: 3px; }
.form-section { grid-column: 1 / -1; font-weight: 650; font-size: 13px; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.form-section:first-child { border: 0; padding-top: 0; margin: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin: 6px 0 20px; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.filters .form-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); flex: 1; }
.filters.inline { gap: 10px; align-items: center; }
.filters.inline > select, .filters.inline > .combo { width: auto; min-width: 200px; }
.search-row, .upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.search-row > :first-child { flex: 1; }
.upload-row input[type=file] { width: auto; flex: 1; min-width: 220px; }
.upload-row select, .upload-row input[type=date] { width: auto; }
.upload-row .inline-check { white-space: normal; }
.big-search { font-size: 18px; padding: 10px 12px; font-family: var(--mono); }
.add-line { max-width: 520px; margin-bottom: 10px; }

/* combo */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 2px); background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 300px; overflow-y: auto; }
.combo-item { padding: 7px 10px; cursor: pointer; display: flex; flex-direction: column; }
.combo-item small { color: var(--muted); font-size: 11px; }
.combo-item.active, .combo-item:hover { background: var(--accent-soft); }
.combo-empty { padding: 8px 10px; color: var(--muted); }

/* ---------- tables ---------- */
.table-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.table-tools input[type=search] { max-width: 280px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th, .grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { font-size: 12px; font-weight: 650; color: var(--muted); background: #fafbfb; white-space: nowrap; position: sticky; top: 0; }
.grid th.num, .grid td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.th-btn { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 0; }
.grid tbody tr.click { cursor: pointer; }
.grid tbody tr.click:hover { background: var(--accent-soft); }
.grid tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: 0; background: #fafbfb; }
.grid td.empty { text-align: center; color: var(--muted); padding: 24px; }
.grid tr.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.grid.lines td { vertical-align: middle; }
.num-in { width: 110px; text-align: right; }
.num-in.small { width: 80px; }
.more { text-align: center; padding: 10px; }
.row-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
table.grid td .row-actions { margin: 0; }
.totals { text-align: right; margin-top: 10px; font-size: 14px; }
.totals-grid > div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.totals-grid > div:last-child { font-size: 17px; border: 0; }
.serial-text { font-family: var(--mono); line-height: 1.6; }
table.fin { margin-bottom: 8px; }

/* ---------- badges, stats ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11px; font-weight: 650; white-space: nowrap; background: var(--neutral-soft); color: #42505f; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.warn .stat-value { color: var(--warn); }
.stat.bad .stat-value { color: var(--bad); }
.stat.good .stat-value { color: var(--good); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 1px; }
dl.kv dd { margin: 0; }
.todo { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.todo a { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); padding: 6px 8px; border-radius: 6px; }
.todo a:hover { background: var(--accent-soft); }
.todo-n { background: var(--warn); color: #fff; border-radius: 20px; min-width: 26px; text-align: center; font-weight: 700; font-size: 12px; padding: 1px 6px; }
.chart { width: 100%; height: auto; max-height: 280px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.health { padding: 12px 14px; border-radius: 6px; font-weight: 650; margin-bottom: 10px; }
.health.ok { background: var(--good-soft); color: var(--good); }
.health.bad { background: var(--bad-soft); color: var(--bad); }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.checks li:last-child { border: 0; }
.check-mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none; }
.checks .pass .check-mark { background: var(--good-soft); color: var(--good); }
.checks .fail .check-mark { background: var(--bad-soft); color: var(--bad); }
.checks .fail strong { color: var(--bad); }
details summary { cursor: pointer; font-weight: 600; margin: 8px 0 4px; }

/* ---------- serial scanning ---------- */
.serial-box > label, .two-col > div > label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.serial-box .serial-in { font-family: var(--mono); font-size: 16px; padding: 9px 11px; border: 2px solid var(--accent); }
.serial-box textarea { margin-top: 6px; font-family: var(--mono); font-size: 12px; }
.serial-count { font-size: 12px; color: var(--muted); margin: 6px 0; }
.serial-list, .chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 2px; font-family: var(--mono); font-size: 12px; padding: 2px 4px 2px 8px; border-radius: 4px; border: 1px solid var(--line-strong); background: #fff; }
.chip small { font-family: var(--font); color: var(--muted); }
.chip.good { border-color: #a6d9bb; background: var(--good-soft); }
.chip.bad { border-color: #efb3ad; background: var(--bad-soft); }
.chip.bad small { color: var(--bad); }
.chip.pending { opacity: .6; }
.chip-x { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 14px; padding: 0 4px; }
.chip-x:hover { color: var(--bad); }
.serial-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.serial-head h2 { font-family: var(--mono); font-size: 20px; margin: 0; }
.adj-line { border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin-bottom: 10px; }
.adj-line-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.splits { display: grid; gap: 8px; }
.split-row { display: flex; gap: 8px; align-items: center; }
.split-row select { max-width: 260px; }
.je-head { display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; margin-bottom: 8px; }

/* ---------- dialogs & toasts ---------- */
.overlay { position: fixed; inset: 0; background: rgba(16, 30, 27, .45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--panel); border-radius: 10px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dialog.wide { max-width: 920px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dialog-head h3 { margin: 0; font-size: 16px; }
.dialog-body { padding: 16px 18px; overflow-y: auto; }
.dialog-body ul { padding-left: 18px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #17302b; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: 13px; transition: opacity .5s, transform .5s; }
.toast.err { background: var(--bad); }
.toast.warn { background: var(--warn); }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- login ---------- */
.login-page { background: linear-gradient(160deg, #0f5c4c 0%, #10302a 100%); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: #fff; border-radius: 14px; padding: 28px; width: 100%; max-width: 380px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card h1 { margin-bottom: 4px; }
.login-card .form-grid { grid-template-columns: 1fr; text-align: left; margin: 18px 0 8px; }
.forgot { margin-top: 14px; text-align: left; font-size: 13px; color: var(--muted); }
.forgot summary { cursor: pointer; color: var(--accent); }
.forgot p { margin: 8px 0; }
.big-note { font-size: 15px; padding: 12px 14px; }
.login-err { color: var(--bad); min-height: 20px; font-size: 13px; margin-bottom: 8px; }

/* ---------- invoice sheet ---------- */
.invoice-sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; max-width: 900px; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 12px; }
.inv-head h2 { margin: 0 0 4px; font-size: 20px; }
.inv-title { text-align: right; }
.inv-title h2 { letter-spacing: .08em; color: var(--accent); }
.inv-to { margin-bottom: 12px; }
.inv-sum { display: flex; justify-content: flex-end; margin-top: 12px; }
.inv-sum dl.kv dd { text-align: right; font-variant-numeric: tabular-nums; }
.inv-sign { display: flex; justify-content: space-between; margin-top: 70px; }
.inv-sign div { border-top: 1px solid var(--ink); padding-top: 4px; width: 200px; text-align: center; font-size: 12px; }

/* ---------- long jobs, old records ---------- */
.progress { margin: 12px 0; }
.bar { height: 12px; background: var(--neutral-soft); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.bar-fill.busy { background: repeating-linear-gradient(45deg, var(--accent) 0 12px, #2b7f6b 12px 24px); background-size: 34px 34px; animation: slide 1s linear infinite; }
@keyframes slide { to { background-position: 34px 0; } }
.bar-label { font-size: 13px; color: var(--muted); margin-top: 6px; }
a.link-stat { text-decoration: none; color: inherit; display: block; }
a.link-stat:hover { border-color: var(--accent); background: var(--accent-soft); }
ul.problems { margin: 0; padding-left: 18px; font-size: 13px; max-height: 420px; overflow-y: auto; }
ul.problems li { margin-bottom: 4px; }
ol.steps { margin: 6px 0 12px; padding-left: 20px; }
.radio-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; flex-wrap: wrap; }
.radio-row input { width: auto; min-height: 0; }
.old-doc .inv-title h2, .old-doc .inv-head h2 { color: var(--ink); }

/* ---------- bell, permissions ---------- */
.bell { position: relative; font-size: 17px; }
.bell-n { position: absolute; top: -2px; right: -4px; background: var(--bad); color: #fff; border-radius: 10px; font-size: 10px; font-weight: 700; padding: 0 5px; line-height: 16px; }
ul.notes { list-style: none; margin: 0; padding: 0; }
ul.notes li { padding: 8px 4px; border-bottom: 1px solid var(--line); }
ul.notes li.unread a { font-weight: 650; }
ul.notes a { color: var(--ink); text-decoration: none; }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.perm-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.perm-row select { width: auto; min-width: 150px; }

/* ---------- small screens: phone use ---------- */
@media (max-width: 960px) {
  .side { position: fixed; z-index: 60; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 50; }
  .menu-btn { display: inline-block; font-size: 22px; }
  .top { padding: 8px 16px; }
  .who > span:first-child { display: none; }
  #main { padding: 16px 16px 60px; }
  .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .form-grid, .filters .form-grid { grid-template-columns: 1fr; }
  .field.w-2, .field.w-3 { grid-column: auto; }
  .who .role { display: none; }
  h1 { font-size: 19px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 10px; }
  .stat-value { font-size: 16px; word-break: break-word; }
  .stat-sub { font-size: 11px; }
  table.inv { font-size: 11px; }
  table.inv th, table.inv td { padding: 5px 4px; }
  .card { padding: 12px; }
  /* list tables become stacked cards */
  .table-scroll table.grid:not(.inv):not(.fin) thead { display: none; }
  .table-scroll table.grid:not(.inv):not(.fin) tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .table-scroll table.grid:not(.inv):not(.fin) td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 4px; text-align: right; }
  .table-scroll table.grid:not(.inv):not(.fin) td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; }
  .table-scroll table.grid:not(.inv):not(.fin) td:empty { display: none; }
  .table-scroll table.grid tfoot td { display: none; }
  .num-in { width: 120px; }
  .invoice-sheet { padding: 14px; overflow-x: auto; }
  .grid.je { display: block; overflow-x: auto; }
  .upload-row input[type=file] { min-width: 0; width: 100%; }
  .upload-row > * { max-width: 100%; }
  .inv-head { flex-direction: column; }
  .inv-title { text-align: left; }
  dl.kv { grid-template-columns: 1fr; gap: 0 0; }
  dl.kv dd { margin-bottom: 6px; }
  .page-actions { width: 100%; }
  .perm-grid { grid-template-columns: 1fr; }
  .page-actions select { flex: 1 1 100%; min-width: 0; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1; }
}

/* ---------- add model + quantity ---------- */
.quick-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.quick-add .qa-model { flex: 1 1 320px; min-width: 0; }
.quick-add .qa-qty { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
@media (max-width: 700px) { .quick-add .qa-model { flex-basis: 100%; } .quick-add .qa-qty { flex: 1; } .quick-add .num-in { width: 100%; } }

/* ---------- invoice / challan / return documents ---------- */
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.inv-parties > div:last-child { text-align: right; }
.grid.inv tfoot td { font-weight: 650; border-top: 2px solid var(--line-strong); }
.serials-cell { font-family: var(--mono); font-size: 11px; line-height: 1.5; word-break: break-all; max-width: 320px; }
.good-text { color: var(--good); }
.link-list { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 14px; }
button.chip { cursor: pointer; padding: 2px 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; font: inherit; color: var(--muted); cursor: pointer; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 650; }
@media (max-width: 700px) { .form-actions { flex-wrap: wrap; } .form-actions > label.inline-check { flex: 1 1 100%; } .inv-parties { grid-template-columns: 1fr; } .inv-parties > div:last-child { text-align: left; } .serials-cell { max-width: none; } }
@media print { .grid.inv { font-size: 11px; } .serials-cell { max-width: none; } }

/* ---------- printed sales documents, old-ERP layout ---------- */
.doc { font-size: 13px; }
.doc-title { text-align: center; margin-bottom: 14px; }
.doc-title h2 { margin: 0 0 2px; font-size: 20px; text-decoration: underline; text-underline-offset: 4px; letter-spacing: .02em; }
.doc-office-name { font-size: 17px; font-weight: 600; }
.doc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 12px; }
.doc-right { text-align: right; }
.doc-right .doc-facts { margin-left: auto; }
.doc-office { margin-bottom: 8px; line-height: 1.45; }
.doc-label { font-weight: 700; }
.doc-label.u { text-decoration: underline; }
.doc-dealer { line-height: 1.6; }
.doc-dealer-name { font-weight: 700; font-size: 14px; }
.doc-addr { white-space: pre-line; margin: 4px 0; }
.doc-rep { margin: 6px 0; }
.doc-facts { border-collapse: collapse; }
.doc-facts th { text-align: left; font-weight: 500; padding: 2px 10px 2px 0; white-space: nowrap; vertical-align: top; color: var(--muted); }
.doc-facts td { padding: 2px 0; text-align: left; }
.doc-bottom { display: grid; grid-template-columns: 1fr auto; gap: 20px; margin-top: 10px; align-items: start; }
.doc-sum { border-collapse: collapse; min-width: 300px; }
.doc-sum th, .doc-sum td { border: 1px solid var(--line-strong); padding: 4px 10px; }
.doc-sum th { text-align: right; font-weight: 600; }
.doc-sum td { text-align: right; font-variant-numeric: tabular-nums; min-width: 110px; }
.doc-sum tr.strong td, .doc-sum tr.strong th { font-weight: 700; }
.doc-sum tfoot th, .doc-sum tfoot td { font-weight: 500; color: var(--muted); }
.doc-comment { margin-top: 12px; }
.doc-signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 56px; }
.doc-sign-name { min-height: 18px; text-align: center; font-size: 12px; }
.doc-sign-line { border-top: 1px solid var(--ink); padding-top: 4px; text-align: center; font-size: 12px; }
.printed-on { margin-top: 14px; font-size: 11px; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
@media (max-width: 700px) { .doc-cols, .doc-bottom { grid-template-columns: 1fr; } .doc-right { text-align: left; } .doc-right .doc-facts { margin-left: 0; } .doc-sum { min-width: 0; width: 100%; } .doc-signs { gap: 10px; } }
@media print { .doc { font-size: 11.5px; } .doc-signs { margin-top: 48px; } .doc-sum th, .doc-sum td { border-color: #555; } }

/* ---------- printing ---------- */
@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  .side, .top, .page-actions, .form-actions, .filters, .table-tools, .scrim, #toasts, .more { display: none !important; }
  .shell, .body { display: block; }
  #main { padding: 0; max-width: none; }
  .card, .invoice-sheet { border: 0; box-shadow: none; padding: 0; }
  .page:has(.print-area) > :not(.page-head):not(.print-area) { display: none; }
  .page:has(.print-area .doc) > .page-head { display: none; }
  .grid th { position: static; }
  a { color: inherit; text-decoration: none; }
}
/* wide document tables (sales return has 11 columns) must stay inside the page */
.doc .grid.inv { width: 100%; }
.doc .grid.inv th, .doc .grid.inv td { padding: 6px 6px; }
.doc .grid.inv th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.doc .grid.inv td.mono { font-size: 11px; word-break: break-all; }

/* =====================================================================
   Version 7: cleaner menu, quick jump, smart search, boards, document
   header (stages + linked documents), notes & history, charts, labels
   ===================================================================== */
/* ---------- menu ---------- */
.side { padding-bottom: 28px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.side svg.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.side a, .side summary { margin: 1px 8px; padding: 7px 10px; border-radius: 7px; }
.nav-group a { padding-left: 38px; }
.side a.active { background: rgba(255,255,255,.13); box-shadow: inset 3px 0 0 #6fd3b6; }
.side .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-n { background: #6fd3b6; color: #0b2a24; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; min-width: 20px; text-align: center; }
.nav-n.warn { background: #f3c06b; }
.nav-group summary .nav-n { margin-right: 4px; }
.side-search { display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); margin: 0 8px 10px; padding: 7px 10px; border-radius: 7px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: var(--side-ink); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.side-search:hover { background: rgba(255,255,255,.1); color: #fff; }
.side-search span { flex: 1; }
kbd { font: 11px var(--font); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; opacity: .6; white-space: nowrap; }
.top .quick { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; max-width: 460px; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--muted); font: inherit; cursor: text; text-align: left; }
.top .quick:hover { border-color: var(--accent); }
.top .quick span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .quick svg.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (max-width: 640px) { .top .quick kbd { display: none; } }

/* ---------- quick jump (Ctrl+K) ---------- */
.overlay.qj { place-items: start center; padding-top: 10vh; }
.qj-box { width: min(640px, calc(100vw - 24px)); padding: 10px; }
.qj-box > input { font-size: 16px; min-height: 44px; }
.qj-results { max-height: 55vh; overflow-y: auto; margin-top: 8px; }
.qj-item { display: grid; grid-template-columns: 96px 1fr; gap: 2px 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.qj-item.active, .qj-item:hover { background: var(--accent-soft); }
.qj-type { grid-row: span 2; font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; padding-top: 2px; }
.qj-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qj-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qj-help, .qj-empty { padding: 8px 10px 2px; }

/* ---------- breadcrumbs ---------- */
.page-title { min-width: 0; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- smart search bar ---------- */
.sb { position: relative; flex: 1 1 320px; max-width: 560px; min-width: 0; }
.sb-box { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 6px; background: #fff; min-height: 36px; cursor: text; }
.sb-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 92, 76, .15); }
.sb-box input { border: 0; box-shadow: none !important; padding: 4px 2px; min-height: 0; flex: 1; min-width: 140px; max-width: none !important; }
.sb-chips { display: contents; }
.sb-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 1px 2px 1px 7px; font-size: 12px; max-width: 100%; }
.sb-chip.filt { background: var(--warn-soft); color: #7a4a00; }
.sb-chip.grp { background: #e7eefb; color: #1c4f95; }
.sb-chip b { font-weight: 650; }
.sb-chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 4px; opacity: .7; }
.sb-chip button:hover { opacity: 1; }
.sb-drop { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px); background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; }
.sb-opt { padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.sb-opt.active, .sb-opt:hover { background: var(--accent-soft); }
.sb-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; background: #fbfcfc; }
.sb-panel[hidden] { display: none; }
.sb-col h4 { margin: 0 0 6px; font-size: 13px; }
.sb-col hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.sb-item { display: flex; gap: 8px; align-items: center; padding: 3px 4px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.sb-item:hover { background: var(--accent-soft); }
.sb-item.on { font-weight: 600; }
.sb-fav { display: flex; align-items: center; justify-content: space-between; }
.linkish { background: none; border: 0; padding: 3px 0; color: var(--accent); cursor: pointer; font: inherit; text-align: left; }
.sb-save { display: grid; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.sb-save label { display: flex; gap: 6px; align-items: center; }
@media (max-width: 700px) { .sb-panel { grid-template-columns: 1fr; } .sb { flex-basis: 100%; max-width: none; } }
.view-switch { display: inline-flex; }
.view-switch .btn { border-radius: 0; }
.view-switch .btn:first-child { border-radius: 6px 0 0 6px; }
.view-switch .btn:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.view-switch .btn.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); position: relative; }
.btn.small { min-height: 30px; padding: 4px 10px; font-size: 12px; }

/* grouped rows */
.grid tr.grp { cursor: pointer; background: #f7f9f8; }
.grid tr.grp:hover { background: var(--accent-soft); }
.grid tr.grp td { border-bottom: 1px solid var(--line); }
.grid tr.grp.lvl1 { background: #fbfcfc; }
.grp-caret { display: inline-block; width: 14px; color: var(--muted); }

/* ---------- board (kanban) ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(205px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.kcol { background: #f3f5f4; border-radius: 8px; padding: 8px; min-height: 120px; }
.kcol header { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 13px; padding: 2px 4px 8px; border-bottom: 3px solid var(--line-strong); margin-bottom: 8px; flex-wrap: wrap; }
.kcol.warn header { border-bottom-color: #e5a33a; } .kcol.good header { border-bottom-color: #4caf7d; } .kcol.bad header { border-bottom-color: #d9534f; }
.kcount { background: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; color: var(--muted); }
.ksum { width: 100%; font-size: 12px; font-weight: 500; color: var(--muted); }
.kcards { display: grid; gap: 8px; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; box-shadow: 0 1px 2px rgba(0,0,0,.04); font-size: 13px; display: grid; gap: 3px; }
.kcard.click { cursor: pointer; }
.kcard.click:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(15, 92, 76, .15); }
.kc-title { font-weight: 650; }
.kc-line { color: var(--ink); }
.kc-foot { font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 4px; margin-top: 2px; }
.kc-foot.late { color: var(--bad); font-weight: 600; }
.kcard .btn { justify-self: start; margin-top: 4px; }
.kempty { color: var(--muted); font-size: 12px; text-align: center; padding: 16px 0; }
@media (max-width: 640px) { .kanban { grid-auto-columns: 82vw; } }

/* ---------- document header: linked documents + stage bar ---------- */
.doc-top { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.smart-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.smart-btn { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; padding: 5px 12px 5px 8px; min-height: 40px; font: inherit; color: var(--ink); text-decoration: none; cursor: pointer; }
.smart-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.sm-ico { color: var(--accent); font-size: 16px; width: 18px; text-align: center; }
.sm-label { display: block; font-weight: 600; font-size: 13px; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-sub { display: block; font-size: 11px; color: var(--muted); }
.pay-pill { align-self: center; border-radius: 20px; padding: 3px 12px; font-size: 12px; font-weight: 700; }
.pay-pill.good { background: var(--good-soft); color: var(--good); } .pay-pill.warn { background: var(--warn-soft); color: var(--warn); } .pay-pill.bad { background: var(--bad-soft); color: var(--bad); }
.stagebar { display: flex; list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: #fff; }
.stagebar li { position: relative; padding: 7px 14px 7px 22px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.stagebar li:first-child { padding-left: 14px; }
.stagebar li + li::before { content: ''; position: absolute; left: -1px; top: 50%; width: 14px; height: 14px; border-top: 1px solid var(--line-strong); border-right: 1px solid var(--line-strong); background: inherit; transform: translate(-50%, -50%) rotate(45deg); }
.stagebar li.done { color: var(--ink); }
.stagebar li.now { background: var(--accent); color: #fff; }
.stagebar li.now + li::before { background: var(--accent); border-color: var(--accent); }
.stagebar li.off { background: var(--bad); color: #fff; }
.stagebar.is-off li:not(.off) { opacity: .55; }
@media (max-width: 640px) { .stagebar { width: 100%; overflow-x: auto; } .stagebar li { padding: 6px 10px 6px 16px; } }
.link-pick { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.link-pick a { display: block; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); }
.link-pick a:hover { background: var(--accent-soft); }

/* ---------- notes & history ---------- */
.chatter h3 { margin-top: 0; }
.composer { display: grid; gap: 8px; margin-bottom: 14px; }
.composer-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.composer-row select { width: auto; min-width: 170px; }
.composer-row input[type=date] { width: auto; }
.timeline { display: grid; gap: 2px; }
.tl-item { display: flex; gap: 10px; align-items: flex-start; padding: 7px 4px; border-radius: 6px; }
.tl-item.ev { color: var(--muted); font-size: 13px; padding: 4px 4px 4px 14px; }
.tl-item.ev strong { color: var(--ink); font-weight: 600; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); margin-top: 6px; flex: none; }
.tl-time { color: var(--muted); font-size: 12px; margin-left: 8px; }
.tl-quote { border-left: 3px solid var(--line); padding: 2px 8px; margin-top: 3px; color: var(--ink); }
.tl-item.note { background: #fafbfb; border: 1px solid var(--line); margin: 4px 0; padding: 8px 10px; }
.tl-item.note.todo { border-color: #f0cf91; background: #fffaf0; }
.tl-item.note.done { opacity: .8; }
.tl-body { flex: 1; min-width: 0; }
.tl-text { white-space: pre-wrap; margin-top: 2px; word-wrap: break-word; }
.tl-follow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
@media print { .no-print, .doc-top, .chatter { display: none !important; } }

/* ---------- dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.dash-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dash-side .card h3 { margin-top: 0; }
@media (max-width: 1180px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .dash-pair { grid-template-columns: 1fr; } }
.follow-list, .low-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.follow-list li { border-left: 3px solid #e5a33a; padding-left: 8px; }
.follow-list li.late { border-left-color: var(--bad); }
.low-list li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.chart-card { min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.chart-head h3 { margin: 0 0 2px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.chart-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; border: 0 solid; }
.chart-wrap { position: relative; }
.chart-plot { min-height: 60px; }
.chart-svg { display: block; overflow: visible; }
.chart-svg .grid { stroke: #e9edec; stroke-width: 1; }
.chart-svg .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .cross { stroke: #9aa7a3; stroke-width: 1; }
.chart-svg .hit.click { cursor: pointer; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.12); min-width: 130px; }
.tip-h { font-weight: 650; margin-bottom: 3px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-row i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.tip-row b { margin-left: auto; font-variant-numeric: tabular-nums; padding-left: 10px; }
.tip-sub { color: var(--muted); margin-top: 2px; }
.chart-table { max-height: 320px; overflow: auto; }
.barlist { display: grid; }
.bl-row { display: flex; align-items: center; gap: 8px; font-size: 12px; border-radius: 4px; }
.bl-row.click { cursor: pointer; }
.bl-row.click:hover { background: var(--accent-soft); }
.bl-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: none; padding-left: 2px; }
.bl-track { flex: none; height: 14px; display: flex; align-items: center; }
.bl-bar { display: block; height: 14px; border-radius: 0 4px 4px 0; }
.bl-val { flex: none; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-empty { padding: 20px 0; }

/* ---------- barcode labels ---------- */
.label-src { display: grid; gap: 8px; margin: 10px 0; }
.label-sheet { display: flex; flex-wrap: wrap; gap: 10px; }
.label { box-sizing: border-box; border: 1px dashed #b7c2bf; background: #fff; padding: 1.5mm 2mm; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; color: #000; font-family: Arial, sans-serif; }
.label .lb-top { display: flex; justify-content: space-between; gap: 4px; font-size: 7pt; line-height: 1.1; }
.label .lb-org { font-weight: 700; }
.label .lb-price { font-weight: 700; }
.label .lb-model { font-weight: 700; font-size: 8pt; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label .lb-name { font-size: 6.5pt; line-height: 1.15; max-height: 2.3em; overflow: hidden; }
.label .lb-mrp { font-size: 12pt; font-weight: 800; }
.label .barcode { width: 100%; height: 9mm; flex: none; }
.label.tag .barcode { height: 5mm; }
.label .lb-code { font-family: var(--mono); font-size: 7pt; text-align: center; letter-spacing: .04em; line-height: 1; }
.size-t38 .label .lb-model { font-size: 7pt; } .size-t38 .label .barcode { height: 8mm; }
.size-a4 .label .barcode { height: 12mm; } .size-a4 .label .lb-model { font-size: 10pt; } .size-a4 .label .lb-top { font-size: 8pt; }
@media print {
  .page:has(.labels-area) > .page-head { display: none; }
  .labels-area .label-sheet { gap: 0; }
  .labels-area .label { border: 0; }
}
.kc-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kcard .kc-line.muted { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 1180px) { .dash-side { order: -1; } .dash-side > p { display: none; } }
.warn-text { color: var(--warn); }
/* company logo */
.side a.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px 18px 12px; margin: 0 0 8px; border-radius: 0; text-decoration: none; }
.side a.brand:hover { background: transparent; }
.brand-logo { width: 168px; height: auto; display: block; }
.side .brand-sub { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .65; padding-left: 2px; }
.login-logo { display: block; width: 220px; max-width: 80%; height: auto; margin: 0 auto 10px; }
.doc { position: relative; }
.doc-logo { position: absolute; top: 0; left: 0; height: 46px; width: auto; }
@media (max-width: 700px) { .doc-logo { position: static; display: block; height: 36px; margin-bottom: 8px; } }
@media print { .doc-logo { height: 42px; } }

/* ---------- v9: cancelled / returned stamps, scan warnings, challan drafts, ledger print ---------- */
.doc-stamp { position: absolute; top: 330px; left: 50%; transform: translateX(-50%) rotate(-14deg); border: 4px solid var(--bad); color: var(--bad); font-weight: 800; font-size: 44px;
  letter-spacing: .14em; padding: 4px 22px; border-radius: 8px; opacity: .45; pointer-events: none; z-index: 2; white-space: nowrap; }
.doc-stamp.return { top: 70px; left: auto; right: 24px; transform: rotate(-8deg); border-width: 3px; border-color: var(--warn); color: var(--warn); font-size: 15px; letter-spacing: .06em; opacity: .85; background: rgba(255,255,255,.7); }
.doc.is-cancelled .grid.inv tbody { text-decoration: line-through; text-decoration-color: rgba(180,35,24,.45); }
.return-mark { color: var(--warn); font-weight: 600; white-space: nowrap; }
.scan-warn p { margin: 0 0 8px; }
.scan-problems { margin: 0 0 8px; padding-left: 18px; max-height: 50vh; overflow: auto; }
.scan-problems li { margin: 3px 0; }
.scan-problems strong { font-family: ui-monospace, Menlo, Consolas, monospace; }
.challan-missing { margin-top: 10px; padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.challan-missing.warn { background: var(--warn-soft); color: #6b4000; }
.challan-missing.ok { background: var(--good-soft); color: var(--good); }
.grid tr.row-done td { background: #f4fbf6; }
.good-text { color: var(--good); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.ledger-items { font-size: 11px; color: var(--muted); margin-top: 2px; }
.grid.ledger tr.opening td { background: #fafbfb; }
.ledger-old { margin-top: 18px; }
.ledger-old h3 { font-size: 13px; margin: 0 0 6px; }
.ledger-sheet { margin-bottom: 24px; }
@media print {
  .ledger-sheet { page-break-after: always; break-after: page; margin: 0; }
  .ledger-sheet:last-child { page-break-after: auto; break-after: auto; }
  .doc-stamp.return { background: none; }
}

.grid.ledger td:first-child, .grid.ledger td:nth-child(2) { white-space: nowrap; }
.grid.ledger td:nth-child(n+4) { white-space: nowrap; }
.grid.ledger tr.total td { border-top: 2px solid var(--line-strong); background: #fafbfb; }
@media print { .grid.ledger { font-size: 10.5px; } .grid.ledger th, .grid.ledger td { padding: 3px 5px; } .grid.ledger tr { break-inside: avoid; } }
