/* Simple Inventory & GST Billing — mockup styles */
:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink2: #475569;
  --ink3: #8795a8;
  --line: #e2e8f0;
  --line2: #eef2f6;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --brand-soft: #d9f3ef;
  --brand-mid: #8fd3c9;
  --side: #0b1f2a;
  --side-ink: #b9c7d3;
  --green: #15803d; --green-bg: #dcfce7;
  --amber: #b45309; --amber-bg: #fef3c7;
  --red: #b91c1c;   --red-bg: #fee2e2;
  --blue: #1d4ed8;  --blue-bg: #dbeafe;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.r, .num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink2); }
.faint { color: var(--ink3); }
.sm { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ic { flex: none; vertical-align: -3px; }
body[data-role="billing"] .owner-only { display: none !important; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 16px 12px;
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 18px; flex: none;
}
.side .brand b { display: block; font-size: 14px; line-height: 1.2; }
.side .brand small { color: var(--side-ink); font-size: 11.5px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: var(--side-ink); font-weight: 500; text-decoration: none;
}
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .13); color: #fff; }
.side-foot { margin-top: auto; font-size: 11.5px; line-height: 1.5; padding: 10px; border-radius: 9px; background: rgba(255, 255, 255, .06); }
.side-foot b { color: #fff; }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; background: rgba(243, 246, 248, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.top-brand { display: none; align-items: center; gap: 8px; font-weight: 700; }
.gsearch {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; height: 38px; color: var(--ink3);
}
.gsearch input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; height: 100%; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.roleswitch { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink2); }
.roleswitch select { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 0 6px; }
.pill { font-size: 12px; font-weight: 600; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.page { padding: 22px 24px 40px; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; line-height: 1.25; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink2); margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--red); border-color: #f3c0c0; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.kbd { font: 600 10.5px ui-monospace, Consolas, monospace; background: rgba(255, 255, 255, .22); border-radius: 5px; padding: 1px 5px; }
.btn:not(.primary) .kbd { background: var(--line2); color: var(--ink2); }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--ink3); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { background: var(--line2); color: var(--red); }
.input, .select {
  width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  padding: 0 10px; min-width: 0;
}
.input:disabled, .select:disabled { background: #f1f5f9; color: var(--ink2); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span, .field > .lbl { font-size: 12px; font-weight: 600; color: var(--ink2); }
.static { height: 38px; display: flex; align-items: center; padding: 0 10px; background: #f8fafc; border: 1px dashed var(--line); border-radius: 9px; color: var(--ink2); font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.span4 { grid-column: 1 / -1; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line2); color: var(--ink2); white-space: nowrap; }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.blue { background: var(--blue-bg); color: var(--blue); }
.chip.brand { background: var(--brand-soft); color: var(--brand-dark); }
.seg { display: inline-flex; background: var(--line2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 8px; font-weight: 600; color: var(--ink2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button[disabled] { opacity: .45; cursor: not-allowed; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 0; }
.card-h h2 { font-size: 14.5px; font-weight: 700; }
.card-b { padding: 14px 16px 16px; }
.card-b.flush { padding: 8px 0 0; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.g4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.g21 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.g12 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; }
.mt { margin-top: 16px; }
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--ink2); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 25px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12.5px; color: var(--ink2); }
.up { color: var(--green); font-weight: 600; }
.down { color: var(--red); font-weight: 600; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t th.r, .t td.r { text-align: right; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.click:hover td { background: #f8fafc; }
.t tr.total td { font-weight: 700; background: #f8fafc; border-top: 1px solid var(--line); }
.item-n b { display: block; font-weight: 600; }
.item-n small { color: var(--ink3); font-size: 12px; }

/* ---------- bars / meters ---------- */
.meter { height: 8px; background: var(--line2); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.meter.warn > i { background: #d97706; }
.meter.bad > i { background: #dc2626; }
.stackbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line2); gap: 2px; }
.stackbar > i { display: block; height: 100%; min-width: 3px; }
.legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; margin-top: 12px; }
.legend div { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.chart text { fill: var(--ink3); font-size: 10.5px; font-family: inherit; }
.chart .bar { fill: var(--brand-mid); }
.chart .bar.today { fill: var(--brand); }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 3; }
.chart .val { fill: var(--ink); font-weight: 700; font-size: 11px; }

/* ---------- lists ---------- */
.rows > div { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line2); }
.rows > div:first-child { border-top: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows b { font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--ink2); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.rec { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line2); }
.rec:first-of-type { border-top: 0; }
.rec .ic { color: var(--green); margin-top: 1px; }
.rec.bad .ic { color: var(--red); }
.rec.warn .ic { color: #d97706; }
.rec b { display: block; font-weight: 600; }
.rec small { color: var(--ink2); }

/* ---------- billing ---------- */
.bill { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; align-items: start; }
.bill-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.bill-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 72px; }
.party-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; padding: 11px 16px; background: #f8fafc; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); font-size: 13px; }
.party-strip .grow { flex: 1; min-width: 220px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; flex-wrap: wrap; }
.banner.ok { background: var(--green-bg); color: #14532d; }
.banner.bad { background: var(--red-bg); color: #7f1d1d; }
.banner .actions { margin-left: auto; }
.search-wrap { position: relative; }
.search-wrap .input { padding-left: 36px; height: 42px; font-size: 15px; }
.search-wrap > .ic { position: absolute; left: 11px; top: 12px; color: var(--ink3); }
.search-wrap .kbd { position: absolute; right: 10px; top: 10px; background: var(--line2); color: var(--ink2); }
.suggest { position: absolute; z-index: 15; left: 0; right: 0; top: 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .14); overflow: hidden; }
.suggest button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line2); background: transparent; cursor: pointer; }
.suggest button:last-child { border-bottom: 0; }
.suggest button.on, .suggest button:hover { background: var(--brand-soft); }
.suggest .grow { flex: 1; min-width: 0; }
.suggest small { color: var(--ink2); display: block; }
.suggest .none { padding: 14px; color: var(--ink2); }
.lines { margin-top: 12px; }
.line {
  display: grid; grid-template-columns: minmax(150px, 1fr) 52px 100px 100px 68px 46px 108px 30px;
  gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line2);
}
.line-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink3); font-weight: 700; padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.line .input { height: 34px; padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; }
.line small { display: block; color: var(--ink3); font-size: 12px; }
.line small.warn { color: var(--red); font-weight: 600; }
.line .c-item b { font-weight: 600; }
.line .c-amt { font-weight: 700; }
.line .c-hsn, .line .c-gst { color: var(--ink2); font-size: 13px; }
.empty { text-align: center; color: var(--ink2); padding: 30px 10px; }
.empty .ic { color: var(--ink3); }
.more { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.more summary { cursor: pointer; font-weight: 600; color: var(--ink2); list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more[open] summary { margin-bottom: 10px; }
.total-big { display: flex; align-items: baseline; justify-content: space-between; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line); }
.total-big span { font-weight: 700; }
.total-big b { font-size: 27px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.slabs { width: 100%; font-size: 12px; margin-top: 12px; border-collapse: collapse; }
.slabs th { text-align: right; color: var(--ink3); font-weight: 600; padding: 3px 0; }
.slabs th:first-child, .slabs td:first-child { text-align: left; }
.slabs td { text-align: right; padding: 3px 0; font-variant-numeric: tabular-nums; }
.paychips { display: flex; gap: 6px; margin-bottom: 12px; }
.paychips button { flex: 1; height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; font-weight: 600; cursor: pointer; }
.paychips button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.paychips button[disabled] { opacity: .4; cursor: not-allowed; }
.profit { margin-top: 10px; padding: 8px 10px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-dark); font-size: 13px; display: flex; justify-content: space-between; }
.split { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.clist button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 12px 16px; border-top: 1px solid var(--line2); cursor: pointer; }
.clist button:first-child { border-top: 0; }
.clist button.on { background: var(--brand-soft); }
.clist button:hover:not(.on) { background: #f8fafc; }
.clist .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.clist .meter { margin-top: 7px; height: 6px; }
.age { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.age div { background: #f8fafc; border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; }
.age small { display: block; color: var(--ink2); font-size: 12px; }
.age b { font-size: 16px; font-variant-numeric: tabular-nums; }
.age .bad b { color: var(--red); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 200px; max-width: 360px; position: relative; }
.toolbar .grow .input { padding-left: 34px; }
.toolbar .grow > .ic { position: absolute; left: 10px; top: 10px; color: var(--ink3); }

/* ---------- drawer / toast ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { width: min(520px, 100%); background: var(--surface); height: 100%; overflow-y: auto; box-shadow: -10px 0 30px rgba(15, 23, 42, .2); display: flex; flex-direction: column; animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.drawer-h h2 { font-size: 16px; }
.drawer-b { padding: 16px 18px 24px; flex: 1; }
.drawer-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--surface); }
.form-col { display: flex; flex-direction: column; gap: 14px; }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.adv { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; background: #fafcfd; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: #0f172a; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .25); display: flex; gap: 10px; align-items: flex-start; animation: slide .18s ease-out; }
.toast.err { background: #7f1d1d; }
.toast.ok .ic { color: #6ee7b7; }

/* ---------- invoice paper ---------- */
.paper-wrap { display: flex; justify-content: center; }
.paper { width: 100%; max-width: 860px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 30px 32px; font-size: 12.5px; color: #111827; position: relative; }
.paper h2 { font-size: 20px; letter-spacing: .02em; }
.paper .ph { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #111827; padding-bottom: 12px; }
.paper .ph .biz > b:first-child { font-size: 18px; display: block; }
.paper .meta { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #cbd5e1; margin-top: 14px; }
.paper .meta > div { padding: 9px 12px; }
.paper .meta > div + div { border-left: 1px solid #cbd5e1; }
.paper .meta small { color: #64748b; display: block; text-transform: uppercase; letter-spacing: .04em; font-size: 10.5px; margin-bottom: 2px; }
.paper table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.paper th, .paper td { border: 1px solid #cbd5e1; padding: 6px 8px; }
.paper th { background: #f1f5f9; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.paper td.r, .paper th.r { text-align: right; font-variant-numeric: tabular-nums; }
.paper .bottom { display: grid; grid-template-columns: 1fr 280px; gap: 16px; margin-top: 14px; }
.paper .sumbox div { display: flex; justify-content: space-between; padding: 4px 8px; }
.paper .sumbox .gt { border-top: 2px solid #111827; font-weight: 700; font-size: 15px; margin-top: 4px; padding-top: 7px; }
.paper .words { margin-top: 12px; padding: 8px 10px; background: #f8fafc; border: 1px solid #e2e8f0; }
.paper .foot { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; font-size: 11.5px; color: #334155; }
.paper .qr { width: 78px; height: 78px; border: 1px dashed #94a3b8; display: grid; place-items: center; text-align: center; font-size: 9.5px; color: #64748b; }
.paper .stamp { display: inline-block; margin-top: 8px; border: 2px solid #b45309; color: #b45309; padding: 2px 10px; font-weight: 800; letter-spacing: .1em; transform: rotate(-3deg); opacity: .85; }
.paper .stamp.cancel { border-color: #b91c1c; color: #b91c1c; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .bill { grid-template-columns: 1fr; }
  .bill-side { position: static; }
  .g3, .g21, .g12 { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { display: block; }
  .side {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; top: auto; height: auto; padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    flex-direction: row; border-top: 1px solid rgba(255, 255, 255, .12);
  }
  .side .brand, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 4px; min-width: 0; flex: 1; align-items: center; text-align: center; }
  .top-brand { display: flex; }
  .gsearch { display: none; }
  .roleswitch span { display: none; }
  .topbar { padding: 8px 14px; }
  .page { padding: 16px 14px 90px; }
  .pill { display: none; }
}
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .span2 { grid-column: span 2; }
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .value { font-size: 20px; }
  .age { grid-template-columns: 1fr 1fr; }
  .lines .line-h { display: none; }
  .lines .line {
    grid-template-columns: 1fr 1fr 1fr; grid-template-areas: "item item x" "qty rate disc" "hsn gst amt";
    border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; gap: 8px 10px; align-items: start;
  }
  .line .c-item { grid-area: item; } .line .c-x { grid-area: x; justify-self: end; }
  .line .c-qty { grid-area: qty; } .line .c-rate { grid-area: rate; } .line .c-disc { grid-area: disc; }
  .line .c-hsn { grid-area: hsn; } .line .c-gst { grid-area: gst; } .line .c-amt { grid-area: amt; }
  .line [data-l]::before { content: attr(data-l); display: block; font-size: 11px; color: var(--ink3); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
  .paper { padding: 18px 14px; font-size: 11.5px; }
  .paper .bottom, .paper .foot, .paper .meta { grid-template-columns: 1fr; }
  .paper .meta > div + div { border-left: 0; border-top: 1px solid #cbd5e1; }
  .paper .table-wrap table { min-width: 620px; }
  .page-head h1 { font-size: 19px; }
  .legend { grid-template-columns: 1fr; }
}
@media print {
  .side, .topbar, .page-head, .no-print, #toasts { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .paper { box-shadow: none; border: 0; max-width: none; padding: 0; }
}

/* ---------- import wizard ---------- */
.stepper { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; padding: 0; list-style: none; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 13px; color: var(--ink2); }
.stepper .n { width: 22px; height: 22px; border-radius: 50%; background: var(--line2); display: grid; place-items: center; font-size: 12px; }
.stepper li.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.stepper li.on .n { background: var(--brand); color: #fff; }
.stepper li.done .n { background: var(--green); color: #fff; }
.imp-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.types { display: flex; flex-direction: column; gap: 8px; }
.type { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.type:hover { background: #f8fafc; }
.type.on { border-color: var(--brand); background: var(--brand-soft); }
.type b { display: block; }
.type small { display: block; color: var(--ink2); font-size: 12.5px; line-height: 1.35; }
.type small.needs { color: var(--amber); font-weight: 600; margin-top: 2px; }
.type .tn { width: 24px; height: 24px; border-radius: 50%; background: var(--line2); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; color: var(--ink2); }
.type.on .tn { background: var(--brand); color: #fff; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--blue-bg); color: #1e3a8a; font-size: 13px; margin-bottom: 14px; }
.callout.warn { background: var(--amber-bg); color: #78350f; margin-bottom: 14px; }
.callout .ic { margin-top: 2px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 34px 16px; border: 2px dashed #c6d1dd; border-radius: 12px; background: #fafcfd; text-align: center; cursor: pointer; color: var(--ink2); }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop b { color: var(--ink); }
.fieldlist { margin-top: 16px; }
.fieldlist .lbl { font-size: 12px; font-weight: 700; color: var(--ink2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.fieldlist .chip { margin: 0 2px 4px 0; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.tile small { color: var(--ink2); font-weight: 600; font-size: 12.5px; }
.tile b { display: block; font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile.ok b { color: var(--green); } .tile.warn b { color: var(--amber); } .tile.bad b { color: var(--red); }
.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.msgs li { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; }
.msgs li .ic { margin-top: 2px; }
.msgs li.e { color: var(--red); } .msgs li.w { color: var(--amber); }
.t tr.rerr td { background: #fffafa; }
@media (max-width: 1180px) { .imp-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .tiles { grid-template-columns: 1fr 1fr; } .stepper li { font-size: 12px; padding-right: 10px; } }
@media (max-width: 900px) { .nav a { font-size: 10px; padding: 6px 1px; } }
@media (max-width: 720px) {
  /* import review: stack each row as a card so the problems are readable without sideways scrolling */
  .t.rev, .t.rev tbody, .t.rev tr, .t.rev td { display: block; width: 100%; }
  .t.rev thead { display: none; }
  .t.rev tr { padding: 10px 14px; border-bottom: 1px solid var(--line2); }
  .t.rev td { border: 0; padding: 2px 0; text-align: left; }
  .t.rev td:nth-child(1), .t.rev td:nth-child(2) { display: inline-block; width: auto; margin-right: 8px; vertical-align: middle; }
  .t.rev td:nth-child(1)::before { content: 'Row '; color: var(--ink3); }
  .t.rev td:nth-child(3) { margin-top: 4px; font-weight: 600; }
  .t.rev td:nth-child(4) { margin-top: 4px; }
}

/* ======================= application additions ======================= */
.auth-body { background: var(--bg); }
.auth-wrap { max-width: 480px; margin: 0 auto; padding: 36px 16px 60px; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.auth-brand b { display: block; font-size: 18px; }
.auth-brand small { color: var(--ink2); }
.auth-card { padding: 24px; }
.auth-card h1 { font-size: 21px; margin-bottom: 4px; letter-spacing: -.01em; }
.auth-card .sub { color: var(--ink2); margin-bottom: 18px; }
.auth-links { margin-top: 16px; text-align: center; color: var(--ink2); font-size: 13px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field .hint { font-size: 12px; color: var(--ink3); }
.field-validation-error, .text-danger { color: var(--red); font-size: 12.5px; }
.validation-summary-errors ul, .validation-summary-valid ul { list-style: none; margin: 0; padding: 0; }
.validation-summary-valid { display: none; }
.alert-err { background: var(--red-bg); color: #7f1d1d; border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.alert-err ul { margin: 0; padding-left: 18px; }
select.select[multiple] { height: auto; }
textarea.input { height: auto; padding: 8px 10px; min-height: 70px; resize: vertical; }
.input.r, .select.r { text-align: right; }
.input[readonly] { background: #f8fafc; }
.input.is-bad { border-color: var(--red); }

.branchbox { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px 0 10px; height: 38px; color: var(--ink2); }
.branchbox select { border: 0; background: transparent; height: 100%; font-weight: 600; color: var(--ink); outline: 0; max-width: 230px; cursor: pointer; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker { display: none; }
.menu { position: absolute; right: 0; top: 44px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .16); min-width: 230px; z-index: 40; padding: 6px; }
.menu .who { padding: 8px 10px; border-bottom: 1px solid var(--line2); margin-bottom: 4px; }
.menu .who small { display: block; color: var(--ink2); }
.menu-item { display: flex; gap: 8px; align-items: center; width: 100%; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; text-align: left; }
.menu-item:hover { background: var(--line2); }

.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line2); color: var(--ink2); font-size: 13px; flex-wrap: wrap; }
.pager .btns { display: flex; gap: 6px; }
.cardlink { display: flex; gap: 12px; align-items: flex-start; padding: 16px; color: inherit; text-decoration: none; }
.cardlink:hover { background: #f8fafc; text-decoration: none; }
.cardlink .ic { color: var(--brand); margin-top: 2px; }
.cardlink b { display: block; }
.cardlink small { color: var(--ink2); }
.grid-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.stat { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.stat:last-child { border-bottom: 0; }
.stat b { font-variant-numeric: tabular-nums; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.tag { font-size: 11px; color: var(--ink2); background: var(--line2); border-radius: 6px; padding: 1px 6px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 10px; background: var(--blue-bg); color: #1e3a8a; margin-bottom: 14px; }
.notice.warn { background: var(--amber-bg); color: #78350f; }
.notice .ic { margin-top: 2px; }
dialog.modal { border: 0; border-radius: 14px; padding: 0; max-width: 540px; width: calc(100% - 32px); box-shadow: 0 24px 60px rgba(15, 23, 42, .35); color: var(--ink); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-h h2 { font-size: 16px; }
.modal-b { padding: 16px 18px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }
.mini-chart { margin-top: 4px; }
.perm-list { display: flex; flex-wrap: wrap; gap: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font: inherit; }
.link-btn:hover { text-decoration: underline; }
.table-wrap.tight .t td, .table-wrap.tight .t th { padding-top: 7px; padding-bottom: 7px; }
.big-total { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.money-in { color: var(--green); font-weight: 600; }
.money-out { color: var(--red); font-weight: 600; }

/* billing editor */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.editor-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.editor-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 72px; }
.combo { position: relative; }
.combo .suggest { top: 42px; }
.line .c-item small.warn { color: var(--red); font-weight: 600; }
.line .c-gst { font-size: 13px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.check-ok { color: var(--green); }
.check-bad { color: var(--red); }
.paybtn { flex: 1; }
@media (max-width: 1180px) { .editor-grid { grid-template-columns: 1fr; } .editor-side { position: static; } }
@media (max-width: 900px) { .nav { overflow-x: auto; scrollbar-width: none; } .nav a { min-width: 62px; } .branchbox select { max-width: 130px; } .branchbox { margin-left: auto; } .top-brand span { display: none; } .menu { right: -6px; } }
@media (max-width: 720px) { .form-row, .form-row.three { grid-template-columns: 1fr; } }

/* invoice print */
.paper .party-line { display: block; }
.print-only { display: none; }
@media print {
  .side, .topbar, .no-print, #toasts, .banner { display: none !important; }
  .app { display: block; } .main { display: block; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .paper { border: 0; box-shadow: none; max-width: none; padding: 0; }
  .print-only { display: block; }
}

/* ---------- reports, settings, platform ---------- */
.g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.repcard { display: block; color: inherit; text-decoration: none; transition: box-shadow .15s, transform .15s; }
.repcard:hover { box-shadow: 0 8px 22px rgba(15, 23, 42, .10); transform: translateY(-1px); }
.repcard b { display: block; font-size: 15px; margin: 8px 0 4px; }
.repcard p { margin: 0; font-size: 13px; }
.rep-ic { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); }
.quick { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.quick .chip { text-decoration: none; cursor: pointer; }
.quick .chip:hover { background: var(--brand-soft); color: var(--brand-dark); }
.t tfoot th { text-align: left; background: #f8fafc; border-top: 1px solid var(--line); font-weight: 700; padding: 9px 12px; }
.t tfoot th.r { text-align: right; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
@media (max-width: 960px) { .g2 { grid-template-columns: 1fr; } .quick { margin-left: 0; } }
