/* Satyam Quotations — design tokens
   Ink (navy from the printed invoice), bronze (the product: aluminium bronze),
   machined-steel greys. IBM Plex Sans with tabular figures for money. */

@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url(../lib/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url(../lib/fonts/ibm-plex-sans-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap; src: url(../lib/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap; src: url(../lib/fonts/ibm-plex-sans-latin-ext-500-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url(../lib/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url(../lib/fonts/ibm-plex-sans-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02AF, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ink: #17263D;
  --ink-2: #2B3E5C;
  --bronze: #9A5A22;
  --bronze-dark: #7C4617;
  --bronze-soft: #F4E9DD;
  --steel: #5C6776;
  --plate: #ECEFF3;
  --line: #D3D9E1;
  --paper: #FFFFFF;
  --ok: #1E7B4F;
  --bad: #B42318;
  --warn: #B26B00;

  --rail-w: 216px;
  --top-h: 56px;
  --bottom-h: 64px;
  --radius-s: 4px;
  --radius-m: 8px;

  --bs-body-font-family: "Plex", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--plate);
  --bs-border-color: var(--line);
  --bs-link-color-rgb: 124, 70, 23;
  --bs-link-hover-color-rgb: 23, 38, 61;
  --bs-focus-ring-color: rgba(154, 90, 34, .35);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--bs-body-font-family);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "tnum" 1;
  min-height: 100vh;
}
h1, h2, h3 { color: var(--ink); letter-spacing: -0.01em; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--bronze); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--steel); }
.small { font-size: 13px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  background: var(--bronze); color: #fff; font-weight: 600; font-size: 14px; border-radius: var(--radius-s);
  overflow: hidden;
}
.brand-mark.has-logo { background: #fff; padding: 2px; }
.brand-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: #B7C2D3; }
.storage-pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: rgba(255,255,255,.12); color: #fff; white-space: nowrap; }
.storage-pill.is-danger { background: var(--bad); }
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-acct { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-user { font-size: 12.5px; color: #B7C2D3; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.topbar-user:hover { color: #fff; text-decoration: underline; }
.topbar-logout { font-size: 12.5px; font-weight: 600; color: #fff; background: rgba(255,255,255,.14); border: 0; border-radius: 99px; padding: 5px 13px; cursor: pointer; white-space: nowrap; }
.topbar-logout:hover { background: rgba(255,255,255,.24); }
/* Network status pill in the top bar: green when online, red when offline. */
.net-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; padding: 4px 10px; border-radius: 99px; border: 1px solid transparent; }
.net-status .net-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.net-status.is-online { color: #4ADE80; background: rgba(34,197,94,.14); border-color: rgba(74,222,128,.5); }
.net-status.is-offline { color: #FCA5A5; background: rgba(239,68,68,.16); border-color: rgba(248,113,113,.55); }
@media (max-width: 560px) { .topbar-user { display: none; } }

.rail {
  position: fixed; z-index: 25; background: var(--paper);
  left: 0; right: 0; bottom: 0;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
}
.rail a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--steel); text-decoration: none; font-size: 11px; font-weight: 500; min-height: 44px;
}
.rail svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.rail a.is-active { color: var(--bronze-dark); }
.rail a.is-active svg { stroke-width: 2.2; }
/* On the mobile bottom bar the 5 primary items fill the row; Account lives in the top bar
   (name + Sign out) and under Settings → Account, so the rail's Account shortcut is hidden
   here and only shown in the desktop side rail. (Selector must out-specify `.rail a`.) */
.rail a.rail-account { display: none; }

.main {
  padding: 16px 14px calc(var(--bottom-h) + 28px + env(safe-area-inset-bottom));
  max-width: 1180px; margin: 0 auto; outline: none;
}
body.has-savebar .main { padding-bottom: calc(var(--bottom-h) + 104px + env(safe-area-inset-bottom)); }

@media (min-width: 900px) {
  .rail {
    top: var(--top-h); bottom: 0; right: auto; width: var(--rail-w); height: auto;
    display: flex; flex-direction: column; gap: 2px; padding: 16px 10px;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .rail a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 9px 12px; font-size: 14px; border-radius: var(--radius-s); }
  .rail a:hover { background: var(--plate); color: var(--ink); }
  .rail a.is-active { background: var(--bronze-soft); }
  .main { margin-left: var(--rail-w); padding: 28px 32px 48px; max-width: calc(1180px + var(--rail-w)); }
  body.has-savebar .main { padding-bottom: 110px; }
}

/* ---------- Page structure ---------- */
.page-head { margin: 4px 0 14px; }
.page-head h1 { font-size: 24px; font-weight: 600; margin: 0 0 4px; }
.page-lede { color: var(--steel); margin: 0; max-width: 64ch; }
.page-head.with-action { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.back-link { display: inline-block; margin-bottom: 6px; font-size: 14px; background: none; border: 0; padding: 0; color: var(--bronze-dark); text-decoration: underline; }
.back-link::before { content: "‹ "; text-decoration: none; }

.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 14px; margin-bottom: 14px;
}
@media (min-width: 640px) { .panel { padding: 18px; } }
.panel.narrow { max-width: 760px; }
.panel-title { font-size: 17px; font-weight: 600; margin: 0 0 10px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
fieldset:last-child { margin-bottom: 0; }
legend {
  font-size: 15px; font-weight: 600; color: var(--ink); float: none; width: 100%;
  padding-bottom: 8px; margin-bottom: 14px; border-bottom: 1px solid var(--line);
}
.sub-label { font-size: 13px; font-weight: 500; color: var(--steel); margin: 10px 0 4px; }

.grid-2, .grid-3, .grid-4 { display: grid; gap: 10px 14px; grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .span-2 { grid-column: span 2; }
  .span-3 { grid-column: 1 / -1; }
}
.split { display: grid; gap: 16px; }
@media (min-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .preview-col { position: sticky; top: calc(var(--top-h) + 20px); }
}

/* ---------- Forms ---------- */
.field { min-width: 0; }
.form-label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 2px; display: block; }
.req { color: var(--bad); }
.form-control, .form-select { border-color: #BFC7D2; font-size: 14px; min-height: 32px; padding: 4px 9px; background-color: var(--paper); color: var(--ink); }
.form-select { padding-right: 28px; }
.form-control-sm, .form-select-sm { min-height: 30px; font-size: 13px; padding: 3px 8px; }
.form-select-sm { padding-right: 24px; }
.form-control:focus, .form-select:focus { border-color: var(--bronze); box-shadow: 0 0 0 3px rgba(154,90,34,.2); }
.form-control.is-upper { text-transform: uppercase; letter-spacing: .03em; }
.form-control[readonly] { background: var(--plate); }
.form-text { font-size: 12px; color: var(--steel); margin-top: 2px; }
.field-error { font-size: 12.5px; color: var(--bad); margin-top: 4px; font-weight: 500; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--bad); background-image: none; padding-right: .75rem; }
.form-switch { padding-left: 2.8em; min-height: 32px; display: flex; flex-wrap: wrap; align-items: center; }
.form-switch .form-check-input { width: 2.4em; height: 1.3em; margin-left: -2.8em; margin-top: 0; }
.form-check-input:checked { background-color: var(--bronze); border-color: var(--bronze); }
.form-check-input:focus { border-color: var(--bronze); box-shadow: 0 0 0 3px rgba(154,90,34,.2); }
.form-switch .form-text, .form-switch .field-error { width: 100%; }
.input-group-text { background: var(--plate); border-color: #BFC7D2; color: var(--steel); font-size: 14px; }
.derived {
  min-height: 38px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px;
  padding: 6px 12px; background: var(--plate); border-radius: var(--radius-s); font-weight: 500;
}
.derived .sep { color: var(--steel); font-weight: 400; margin-left: 8px; }
.derived .bad, .bad { color: var(--bad); font-weight: 500; }
.ok-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; margin-right: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { font-weight: 500; border-radius: var(--radius-s); min-height: 38px; display: inline-flex; align-items: center; justify-content: center; }
.btn-sm { min-height: 30px; }
.btn-bronze { background: var(--bronze); border-color: var(--bronze); color: #fff; }
.btn-bronze:hover, .btn-bronze:focus-visible { background: var(--bronze-dark); border-color: var(--bronze-dark); color: #fff; }
.btn-bronze:disabled { background: #C9A585; border-color: #C9A585; }
.btn-quiet { background: var(--paper); border: 1px solid #BFC7D2; color: var(--ink); }
.btn-quiet:hover { background: var(--plate); border-color: var(--steel); color: var(--ink); }
.btn-link { color: var(--bronze-dark); }
.text-danger-ink { color: var(--bad) !important; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.icon-btn {
  width: 34px; height: 34px; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius-s);
  color: var(--steel); font-size: 16px; line-height: 1; display: inline-grid; place-items: center;
}
.icon-btn:hover:not(:disabled) { color: var(--ink); border-color: var(--steel); }
.icon-btn:disabled { opacity: .35; }
.icon-btn.danger { color: var(--bad); }
.icon-btn.danger:hover { color: #fff; background: var(--bad); border-color: var(--bad); }

/* ---------- Settings sub-navigation ---------- */
.subnav {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  margin: -4px -14px 16px; padding: 0 14px; border-bottom: 1px solid var(--line);
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  flex: none; padding: 10px 12px; color: var(--steel); text-decoration: none; font-weight: 500; font-size: 14px;
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.subnav a:hover { color: var(--ink); }
.subnav a.is-active { color: var(--ink); border-bottom-color: var(--bronze); }
@media (min-width: 900px) { .subnav { margin: -8px 0 22px; padding: 0; } }

/* ---------- Letterhead preview (the one bold element) ---------- */
.preview-label { font-size: 13px; font-weight: 500; color: var(--steel); margin-bottom: 8px; }
.letterhead {
  background: var(--paper); border: 1px solid var(--line); border-radius: 2px;
  box-shadow: 0 1px 0 var(--line), 0 12px 24px -18px rgba(23,38,61,.45);
  padding: 18px 16px 16px; font-size: 11px; color: #111;
}
.lh-top { display: flex; gap: 12px; align-items: center; justify-content: center; text-align: center; }
.lh-logo { max-width: 72px; max-height: 44px; object-fit: contain; }
.lh-name { font-size: 18px; font-weight: 600; letter-spacing: .02em; color: #111; line-height: 1.2; }
.lh-tag { font-style: italic; color: #444; }
.lh-addr { font-size: 10px; font-weight: 500; color: #222; }
.lh-band { margin-top: 12px; background: #C8570F; color: #fff; font-weight: 600; text-align: center; padding: 4px; font-size: 13px; }
.lh-row { display: flex; justify-content: space-between; gap: 8px; border: 1px solid #9aa3ae; border-top: 0; padding: 4px 6px; background: #EEF2FA; }
.lh-row span { color: #333; font-weight: 500; }
.lh-row b { font-weight: 500; text-align: right; }
.lh-foot { display: flex; justify-content: flex-end; margin-top: 14px; }
.lh-sig { text-align: center; min-width: 150px; color: #1F3864; font-weight: 600; }
.lh-sig img { max-height: 44px; max-width: 150px; display: block; margin: 6px auto; }
.lh-sig-space { height: 36px; }
.lh-sig-name { font-weight: 400; color: #333; border-top: 1px solid #999; padding-top: 2px; font-size: 10px; }

.image-field .image-box {
  height: 88px; border: 1px dashed #BFC7D2; border-radius: var(--radius-s); background:
  repeating-conic-gradient(#F3F5F8 0% 25%, #fff 0% 50%) 50% / 16px 16px;
  display: grid; place-items: center; overflow: hidden;
}
.image-box img { max-height: 76px; max-width: 90%; object-fit: contain; }
.image-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.image-actions label { cursor: pointer; margin: 0; }
.images { margin-top: 16px; }

/* ---------- Banks ---------- */
.bank-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
@media (min-width: 760px) { .bank-list { grid-template-columns: repeat(2, 1fr); } }
.bank-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; display: flex; flex-direction: column; }
.bank-card.is-default { border-color: var(--bronze); box-shadow: inset 4px 0 0 var(--bronze); }
.bank-card.is-inactive { background: #F7F8FA; }
.bank-card.is-inactive .bank-name, .bank-card.is-inactive dd { color: var(--steel); }
.bank-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bank-name { font-weight: 600; font-size: 16px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--plate); color: var(--steel); font-weight: 500; white-space: nowrap; }
.tag-bronze { background: var(--bronze-soft); color: var(--bronze-dark); }
.bank-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 14px 0; }
.bank-dl dt { font-size: 12px; font-weight: 400; color: var(--steel); }
.bank-dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.bank-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- List editor ---------- */
.list-editor { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.le-row { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; padding: 8px; background: #F7F8FA; border: 1px solid var(--line); border-radius: var(--radius-s); }
.le-num { font-size: 12px; color: var(--steel); padding-top: 6px; text-align: right; }
.le-fields { display: grid; gap: 6px 8px; grid-template-columns: 1fr 1fr; min-width: 0; }
.is-single .le-fields { grid-template-columns: 1fr; }
.le-field { display: flex; flex-direction: column; min-width: 0; margin: 0; }
.le-field:first-child { grid-column: 1 / -1; }
.is-single .le-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.le-label { font-size: 11.5px; color: var(--steel); margin-bottom: 2px; }
.le-tools { grid-column: 2; display: flex; gap: 6px; justify-content: flex-end; }
@media (min-width: 760px) {
  .le-row { grid-template-columns: 22px 1fr auto; align-items: center; }
  .le-fields { display: flex; gap: 10px; }
  .le-field { flex: var(--w) 1 0; }
  .le-tools { grid-column: auto; }
  .is-single .le-row { align-items: start; }
}

/* ---------- Number preview ---------- */
.number-preview {
  display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: baseline;
  padding: 14px 16px; margin: -2px 0 22px; background: var(--ink); color: #fff; border-radius: var(--radius-s);
}
.np-label { display: block; font-size: 12px; color: #B7C2D3; }
.np-value { font-size: 18px; font-weight: 600; letter-spacing: .01em; }
.np-note { width: 100%; margin: 0; font-size: 13px; color: #F2C79B; }

/* ---------- Page shape preview ---------- */
.page-shape-wrap { display: grid; place-items: center; min-height: 320px; background: var(--plate); border-radius: var(--radius-m); padding: 10px; }
.page-shape { position: relative; background: #fff; box-shadow: 0 1px 2px rgba(23,38,61,.2), 0 10px 22px -14px rgba(23,38,61,.5); transition: width .2s, height .2s; }
.page-inner { position: absolute; border: 1px dashed var(--bronze); display: flex; flex-direction: column; gap: 6%; padding: 8% 6%; transition: inset .2s; }
.page-inner span { display: block; height: 5px; background: #DCE2EA; border-radius: 2px; }
.page-inner span:first-child { background: var(--ink); height: 9px; width: 60%; margin: 0 auto; }
.page-inner span:nth-child(2) { background: #C8570F; }

/* ---------- Data screen ---------- */
.meter { height: 12px; background: var(--plate); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.meter.is-warn span { background: var(--warn); }
.meter.is-danger span { background: var(--bad); }
.meter-caption { margin: 8px 0 10px; }
.kv-table { max-width: 420px; margin: 0; }
.kv-table th { font-weight: 400; color: var(--steel); }
.kv-table td { text-align: right; }
.persist-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 12px; }
.danger-zone { border-color: #E9B8B2; }

/* ---------- Home ---------- */
.hero {
  display: grid; gap: 16px; margin-bottom: 16px; padding: 22px 18px;
  background: var(--ink); color: #fff; border-radius: var(--radius-m);
}
.hero-kicker { color: #B7C2D3; margin: 0 0 4px; font-weight: 500; }
.hero-title { color: #fff; font-size: 16px; font-weight: 400; margin: 0 0 10px; line-height: 1.3; }
.hero-number { display: inline-block; font-size: clamp(28px, 7vw, 44px); font-weight: 600; letter-spacing: -.01em; color: #fff; margin-top: 2px; word-break: break-word; }
.hero-meta { color: #D5DCE7; max-width: 60ch; margin-bottom: 16px; }
.hero .btn-quiet { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.hero .btn-quiet:hover { background: rgba(255,255,255,.08); color: #fff; }
.hero-side { border-top: 1px solid rgba(255,255,255,.18); padding-top: 14px; }
.hero-side .muted { color: #B7C2D3; }
.hero-bank { font-weight: 600; font-size: 16px; }
@media (min-width: 760px) {
  .hero { grid-template-columns: 1fr 240px; padding: 28px; }
  .hero-side { border-top: 0; border-left: 1px solid rgba(255,255,255,.18); padding: 0 0 0 20px; align-self: center; }
}
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist a { color: var(--ink); font-weight: 500; }
.check-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #BFC7D2; flex: none; position: relative; }
.is-done .check-dot { background: var(--ok); border-color: var(--ok); }
.is-done .check-dot::after { content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.phases { margin: 0; padding-left: 22px; color: var(--steel); }
.phases li { padding: 4px 0; }
.phases li.is-done { color: var(--ink); font-weight: 500; }
.phases li.is-done::marker { color: var(--ok); }

/* ---------- Empty, notices ---------- */
.empty { background: var(--paper); border: 1px dashed #BFC7D2; border-radius: var(--radius-m); padding: 28px 20px; text-align: center; }
.empty p { max-width: 52ch; margin: 0 auto 12px; }
.notice {
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center;
  background: var(--bronze-soft); border: 1px solid #E3C9AE; color: var(--ink);
  padding: 10px 14px; border-radius: var(--radius-s); margin-bottom: 14px;
}
.notice.is-danger { background: #FDECEA; border-color: #F1B8B1; }

/* ---------- Save bar ---------- */
.savebar {
  position: fixed; z-index: 40; left: 10px; right: 10px;
  bottom: calc(var(--bottom-h) + 10px + env(safe-area-inset-bottom));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  background: var(--ink); color: #fff; padding: 10px 12px 10px 16px; border-radius: var(--radius-m);
  box-shadow: 0 10px 30px -10px rgba(23,38,61,.6);
  animation: rise .18s ease-out;
}
.savebar[hidden] { display: none; }
.savebar-actions { display: flex; gap: 8px; margin-left: auto; }
.savebar .btn-quiet { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.savebar .btn-quiet:hover { background: rgba(255,255,255,.1); color: #fff; }
@media (min-width: 900px) {
  .savebar { left: calc(var(--rail-w) + 32px); right: 32px; bottom: 20px; max-width: 1116px; }
}
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Toasts & dialog ---------- */
.toasts {
  position: fixed; z-index: 60; left: 12px; right: 12px; top: calc(var(--top-h) + 10px + env(safe-area-inset-top));
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast-msg {
  pointer-events: auto; display: flex; align-items: center; gap: 14px; max-width: 520px; width: fit-content;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--ink);
  padding: 10px 14px; border-radius: var(--radius-s); box-shadow: 0 8px 24px -12px rgba(23,38,61,.45);
  transition: opacity .25s, transform .25s;
}
.toast-msg.is-success { border-left-color: var(--ok); }
.toast-msg.is-error { border-left-color: var(--bad); }
.toast-msg.is-leaving { opacity: 0; transform: translateY(-6px); }
.toast-action { background: none; border: 0; color: var(--bronze-dark); font-weight: 600; text-decoration: underline; padding: 4px; }

.app-dialog { border: 0; border-radius: var(--radius-m); padding: 0; width: min(440px, calc(100vw - 24px)); box-shadow: 0 24px 60px -20px rgba(23,38,61,.6); }
.app-dialog.is-cust-dialog { width: min(560px, calc(100vw - 24px)); max-height: 88vh; }
.app-dialog::backdrop { background: rgba(23,38,61,.45); }
.dialog-body { padding: 20px; }
.cust-dialog { max-height: 88vh; overflow: auto; }
.dialog-error { color: var(--bad); font-size: 13px; font-weight: 500; margin: 12px 0 0; }
.lbl-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
/* Editing presence banner ("X is also editing this"). */
.presence-banner { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius-s); font-size: 13px; font-weight: 500; color: #7A4A00; background: #FFF4E0; border: 1px solid #F0D28A; }
/* GSTIN auto-fill: manual fetch button + inline status line. */
.gst-fetch-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gst-status { font-size: 12.5px; font-weight: 500; }
.gst-status.gst-busy { color: var(--steel); }
.gst-status.gst-busy::before { content: "⟳ "; }
.gst-status.gst-ok { color: #157347; }
.gst-status.gst-bad { color: var(--bad); }
.dialog-title { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.dialog-text { color: var(--steel); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.install-modal .install-body { text-align: center; padding: 26px 22px; }
.install-modal .install-icon { font-size: 40px; line-height: 1; margin-bottom: 8px; }
.install-modal .dialog-actions { justify-content: center; margin-top: 20px; }
.install-steps { margin: 8px 0 0; padding-left: 20px; color: var(--steel); }
.install-steps li { margin: 6px 0; line-height: 1.5; }

/* ---------- Launch splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: var(--ink, #17263D);
  transition: opacity .5s ease, visibility .5s ease;
}
#splash.splash-hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner { text-align: center; animation: splashIn .7s ease both; }
.splash-logo {
  width: 128px; height: 128px; object-fit: contain;
  background: #fff; border-radius: 22px; padding: 14px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .65);
  animation: splashPulse 1.9s ease-in-out infinite;
}
.splash-name { margin-top: 20px; color: #fff; font-weight: 600; font-size: 18px; letter-spacing: .02em; opacity: .92; }
.splash-dots { display: flex; gap: 7px; justify-content: center; margin-top: 16px; }
.splash-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .6); animation: splashDot 1.2s ease-in-out infinite; }
.splash-dots span:nth-child(2) { animation-delay: .18s; }
.splash-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes splashIn { from { opacity: 0; transform: translateY(12px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes splashPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes splashDot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .splash-inner, .splash-logo, .splash-dots span { animation: none !important; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Single-value lists: keep the tools on the same line, even on phones */
.is-single .le-row { grid-template-columns: 22px minmax(0, 1fr) auto; align-items: start; }
.is-single .le-tools { grid-column: auto; }
.form-switch .form-check-label { padding-left: 6px; }

/* =================== Phase 2–7 components =================== */
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
.toolbar { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1 1 240px; }
.toolbar select { flex: 0 0 150px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid #BFC7D2; background: var(--paper); color: var(--ink); border-radius: 99px; padding: 5px 14px; font-size: 13px; font-weight: 500; min-height: 34px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.rec-list { list-style: none; padding: 0; margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); }
.rec { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: center; }
.rec:first-child { border-top: 0; }
.rec-main { text-decoration: none; color: var(--ink); min-width: 0; display: flex; flex-direction: column; }
.rec-main:hover .rec-title { text-decoration: underline; }
.rec-title { font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; word-break: break-word; }
.rec-sub { font-size: 13px; color: var(--steel); }
.rec-meta { font-weight: 600; text-align: right; white-space: nowrap; }
.rec-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 900px) {
  .rec { grid-template-columns: minmax(0, 1fr) auto auto; }
  .rec-actions { grid-column: auto; justify-content: flex-end; }
}

.status { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--plate); color: var(--steel); white-space: nowrap; }
.status-sent { background: #E3EDF9; color: #1F4E8C; }
.status-won { background: #E1F3EA; color: var(--ok); }
.status-lost { background: #FDECEA; color: var(--bad); }
.status-expired { background: #FFF1DC; color: var(--warn); }
.status-revised { background: #EEE; color: #666; text-decoration: line-through; }

/* ---------- Editor layout ---------- */
.q-layout { display: grid; gap: 16px; }
.q-main { min-width: 0; }
.q-main .grid-2, .q-main .grid-3, .q-main .grid-4 { gap: 8px 12px; }
.q-main .panel-title { margin-bottom: 8px; }
.q-aside { order: 2; }
.q-dock {
  position: fixed; z-index: 35; left: 0; right: 0; bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; box-shadow: 0 -6px 18px -10px rgba(23,38,61,.5);
}
.q-dock .muted { color: #B7C2D3; }
.dock-total { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.dock-total b { font-size: 18px; }
.dock-total .link-btn { color: #F2C79B; text-align: left; }
.dock-btns { display: flex; gap: 8px; }
.q-dock .btn-quiet { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
body[data-view="quotations"] .main { padding-bottom: calc(var(--bottom-h) + 96px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  .q-dock { left: var(--rail-w); bottom: 0; }
  body[data-view="quotations"] .main { padding-bottom: 90px; }
}
@media (min-width: 1200px) {
  .q-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .q-aside { position: sticky; top: calc(var(--top-h) + 16px); }
  .q-dock { display: none; }
  body[data-view="quotations"] .main { padding-bottom: 48px; }
}
body:not([data-view="quotations"]) .q-dock { display: none; }
.panel-title-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.panel-title-row .panel-title { margin: 0; }
.fold { padding: 0; }
.fold > summary { padding: 14px 18px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "+"; font-size: 20px; color: var(--steel); line-height: 1; }
.fold[open] > summary::after { content: "−"; }
.fold-body { padding: 0 18px 18px; }
.fold > summary .fold-h { display: inline-flex; gap: 8px; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.fold > summary .cust-name { color: var(--bronze); font-weight: 600; }
.fold > summary .muted { font-weight: 400; }
.link-btn { background: none; border: 0; padding: 0; color: var(--bronze-dark); text-decoration: underline; text-align: left; font: inherit; }

.cust-card { margin-top: 12px; padding: 14px; background: #F7F8FA; border: 1px solid var(--line); border-radius: var(--radius-s); }
.ship-card { padding: 12px; margin-bottom: 10px; background: #F7F8FA; border: 1px solid var(--line); border-radius: var(--radius-s); }
.tax-badge { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 10px 12px; border-radius: var(--radius-s); background: var(--plate); border-left: 4px solid var(--steel); }
.tax-badge b { font-size: 15px; }
.tax-badge span { font-size: 13px; color: var(--steel); }
.tax-badge.is-intra { border-left-color: var(--ok); background: #EAF5EF; }
.tax-badge.is-inter { border-left-color: #1F4E8C; background: #E8EFF8; }
.tax-badge.is-zero { border-left-color: var(--warn); background: #FFF4E3; }

/* ---------- Item groups ---------- */
.seg { display: inline-flex; border: 1px solid #BFC7D2; border-radius: var(--radius-s); overflow: hidden; }
.seg-btn { border: 0; background: var(--paper); padding: 6px 10px; font-size: 12.5px; color: var(--steel); min-height: 34px; }
.seg-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.grp { border: 1px solid var(--line); border-radius: var(--radius-s); margin-bottom: 14px; background: #FBFBFC; }
.grp-head { display: flex; gap: 8px; align-items: center; padding: 10px; background: var(--bronze-soft); border-bottom: 1px solid #E3C9AE; border-radius: var(--radius-s) var(--radius-s) 0 0; }
.grp-title { flex: 1; min-width: 0; }
.grp-title-input { font-weight: 600; background: #fff; }
.grp-tools { display: flex; gap: 4px; }
.grp-opts { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.mini-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; min-height: 28px; margin: 0; }
.mini-check input { width: 16px; height: 16px; accent-color: var(--bronze); }
.grp-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
.grp-sub { font-size: 14px; }
.it-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.it-wrap:has(.it.stacked) { overflow: visible; } /* wrapped rows don't scroll, so don't clip the row menu */
.it { width: 100%; border-collapse: collapse; }
.cell-computed { display: inline-block; width: 100%; padding: 5px 6px; min-height: 30px; text-align: right;
  background: var(--bronze-soft, #F5EBDD); border: 1px dashed #D8C0A4; border-radius: var(--radius-s); color: var(--ink); font-weight: 600; }
.fx-tag { display: inline-block; font-size: 10px; font-weight: 700; line-height: 1; padding: 2px 4px; border-radius: 4px;
  background: #E7DFCF; color: #7A5A2E; vertical-align: middle; }
.grp-opts-export { border-top: 0; padding-top: 0; }
.fx-help { margin: 10px 0 4px; padding: 10px 12px; background: #F7F9FC; border: 1px solid var(--line); border-radius: var(--radius-s); }
.fx-help code { background: #EEF2F7; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.fx-tokens { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 12.5px; color: var(--steel); align-items: center; }
.fx-token { border: 1px solid #C7D0DC; background: #fff; border-radius: 99px; padding: 2px 9px; font-size: 12px; cursor: pointer; color: var(--ink); }
.fx-token:hover { background: var(--bronze-soft, #F5EBDD); border-color: #D8C0A4; }
.fx-bad { margin-top: 8px; color: #9A3412; font-size: 12.5px; }
.chk-wrap { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.fx-token-std { border-style: dashed; }
.cell-readonly { display: inline-block; width: 100%; padding: 5px 6px; min-height: 30px; background: #F4F6F9; border: 1px solid var(--line); border-radius: var(--radius-s); color: var(--ink-2, #444); font-size: 13px; }

/* Many-column rows: show every field, wrapping onto multiple lines instead of scrolling. */
.it.stacked { min-width: 0 !important; width: 100%; }
.it.stacked thead { display: none; }
.it.stacked, .it.stacked tbody { display: block; }
.it.stacked tr {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px 10px;
  padding: 34px 10px 10px; position: relative; align-items: end;
  border: 1px solid var(--line); border-radius: var(--radius-s); margin-bottom: 8px; background: #fff;
}
.it.stacked tbody tr + tr td { border-top: 0; }
.it.stacked td { display: block; padding: 0; width: auto !important; }
.it.stacked td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; color: var(--steel); margin-bottom: 1px; line-height: 1.25; }
.it.stacked .c-desc { grid-column: 1 / -1; }
/* Serial number and row menu sit in a reserved top strip, clear of the fields. */
.it.stacked .c-sr { position: absolute; left: 14px; top: 10px; width: auto; text-align: left; color: var(--steel); font-size: 13px; font-weight: 600; }
.it.stacked .c-sr::before { display: none !important; }
.it.stacked .c-sr span::before { content: "#"; }
.it.stacked .c-tools { position: absolute; right: 6px; top: 4px; width: auto; display: flex; gap: 4px; }
.it .c-tools .icon-btn { width: 26px; height: 26px; }
.it.stacked .cell-computed, .it.stacked .cell-readonly { text-align: left; }
/* Amount on its own full-width line, right-aligned and prominent */
.it.stacked .c-amt { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: baseline; gap: 10px;
  border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
.it.stacked .c-amt::before { margin-bottom: 0; font-size: 12px; }
.it.stacked .c-amt span { font-size: 16px; font-weight: 700; color: #157347; }
/* On phones: a clean 2-column card. DOM order pairs Qty|HSN? no — order is Qty, HSN, Unit, GST, Rate,
   which with 2 columns lays out as HSN|Unit and GST|Rate on their own lines. */
@media (max-width: 640px) {
  .it.stacked tr { grid-template-columns: 1fr 1fr; gap: 6px 8px; padding: 32px 8px 8px; }
  .it.stacked .c-cus { grid-column: auto !important; } /* every field is one column wide, so they pair 2-up */
  .it.stacked .c-disc { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .it.stacked .form-control-sm, .it.stacked .form-select-sm, .it.stacked .cell-computed, .it.stacked .cell-readonly { min-height: 28px; }
}
.it.stacked .disc-pair { display: flex; gap: 6px; }
.it th { font-size: 12px; font-weight: 600; color: var(--steel); text-align: left; padding: 8px 4px 4px; white-space: nowrap; }
.it td { padding: 4px; vertical-align: middle; }
.it tbody tr + tr td { border-top: 1px solid #EDF0F4; }
.it .form-control-sm, .it .form-select-sm { min-height: 30px; font-size: 13px; padding: 3px 6px; }
.it .form-select-sm { padding-right: 20px; background-position: right 4px center; }
.it input.num { text-align: right; }
/* No spinner arrows on number / calculation fields */
.it input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.it input[type="number"]::-webkit-outer-spin-button,
.it input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
.it .c-sr { width: 34px; text-align: center; color: var(--steel); font-size: 13px; }
.it .c-hsn { width: 84px; } .it .c-qty { width: 70px; } .it .c-unit { width: 76px; }
.it .c-rate { width: 96px; } .it .c-gst { width: 74px; } .it .c-disc { width: 124px; }
.it .c-cus { width: 80px; } .it .c-amt { width: 118px; text-align: right; font-weight: 600; white-space: nowrap; }
.it .c-tools { width: 68px; text-align: right; white-space: nowrap; }
.disc-pair { display: flex; gap: 4px; }
.disc-pair select { width: 56px; flex: none; }
.row-menu { position: relative; display: inline-block; }
.row-menu > summary { list-style: none; cursor: pointer; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-list { position: absolute; right: 0; top: 38px; z-index: 20; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: 0 10px 24px -12px rgba(23,38,61,.5); min-width: 200px; padding: 4px; display: flex; flex-direction: column; }
.row-menu-list button { background: none; border: 0; text-align: left; padding: 9px 10px; border-radius: 3px; font-size: 14px; color: var(--ink); }
.row-menu-list button:hover:not(:disabled) { background: var(--plate); }
.row-menu-list button:disabled { color: #aab; }
.row-menu-list .danger { color: var(--bad); }

/* Old mobile card layout — for NON-stacked tables only (few columns). Stacked tables have their own rules. */
@media (max-width: 899px) {
  .it:not(.stacked) thead { display: none; }
  .it:not(.stacked), .it:not(.stacked) tbody { display: block; }
  .it:not(.stacked) { min-width: 0 !important; }
  .cell-computed { text-align: left; }
  .it:not(.stacked) tr { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px 8px; padding: 10px; position: relative; }
  .it:not(.stacked) tbody tr + tr { border-top: 1px solid var(--line); }
  .it:not(.stacked) tbody tr + tr td { border-top: 0; }
  .it:not(.stacked) td { display: block; padding: 0; width: auto !important; }
  .it:not(.stacked) td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--steel); margin-bottom: 2px; }
  .it:not(.stacked) .c-sr { position: absolute; left: 10px; top: 10px; text-align: left; }
  .it:not(.stacked) .c-sr::before { display: none !important; }
  .it:not(.stacked) .c-sr span::before { content: "#"; }
  .it:not(.stacked) .c-desc { grid-column: 1 / -1; padding-top: 18px; padding-right: 40px; }
  .it:not(.stacked) .c-tools { position: absolute; right: 8px; top: 8px; }
  .it:not(.stacked) .c-cus, .it:not(.stacked) .c-hsn, .it:not(.stacked) .c-gst, .it:not(.stacked) .c-disc { grid-column: span 3; }
  .it:not(.stacked) .c-qty, .it:not(.stacked) .c-unit, .it:not(.stacked) .c-rate { grid-column: span 2; }
  .it:not(.stacked) .c-amt { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; padding-top: 4px; border-top: 1px dashed var(--line); }
  .it:not(.stacked) .c-amt::before { margin: 0; }
  .grp-head { flex-wrap: wrap; }
}

/* Collapsible item rows (editor) */
.items-list { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.it-row { border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; }
.it-row-summary { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; }
.it-row-toggle { flex: none; width: 26px; height: 26px; margin-top: 1px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; border-radius: 6px; cursor: pointer; color: var(--steel); }
.it-row-toggle:hover { background: var(--bronze-soft); color: var(--ink); }
.it-row-toggle .chev { transition: transform .15s ease; }
.it-row[data-collapsed="false"] .it-row-toggle .chev { transform: rotate(90deg); }
.it-row-sr { flex: none; min-width: 18px; margin-top: 6px; text-align: center; color: var(--steel); font-size: 13px; font-weight: 600; }
.it-row-head { flex: 1; min-width: 0; }
.it-row-desc { font-weight: 600; font-size: 14px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.it-row-desc .muted { font-weight: 400; }
.it-row-chips { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 3px; }
.chip { font-size: 12.5px; color: var(--ink); white-space: nowrap; }
.chip-k { color: var(--steel); font-size: 10px; text-transform: uppercase; letter-spacing: .03em; margin-right: 4px; }
.it-row-amt { flex: none; margin-top: 4px; font-weight: 700; font-size: 15px; color: #157347; white-space: nowrap; }
.it-row-tools { flex: none; display: flex; gap: 4px; align-items: center; }
/* Expanded shows the edit fields (chips hidden); collapsed shows the chips (fields hidden). */
.it-row[data-collapsed="false"] .it-row-chips { display: none; }
.it-row[data-collapsed="true"] .it-row-fields { display: none; }
.it-row-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 10px; padding: 4px 12px 12px 44px; border-top: 1px solid #EDF0F4; }
.it-row-fields .cell { min-width: 0; }
.it-row-fields .c-desc { grid-column: 1 / -1; }
.it-row-fields .cell[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; color: var(--steel); margin-bottom: 2px; line-height: 1.25; }
.it-row-fields .form-control-sm, .it-row-fields .form-select-sm { min-height: 30px; font-size: 13px; padding: 3px 6px; }
.it-row-fields .cell-computed, .it-row-fields .cell-readonly { display: block; padding: 5px 2px; font-size: 13px; }
.it-row-fields input.num, .it-row-fields .cell-computed.num, .it-row-fields .cell-readonly.num { text-align: left; }
.it-row-fields input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.it-row-fields input[type="number"]::-webkit-outer-spin-button,
.it-row-fields input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
/* Line total pinned at the bottom of an open row, so the amount stays visible while editing. */
.it-line-total { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 2px; padding-top: 8px; border-top: 1px solid #EDF0F4; }
.it-line-total .ilt-k { font-weight: 600; color: var(--steel); font-size: 12px; }
.it-line-total .num { font-weight: 700; font-size: 15px; color: #157347; }
@media (max-width: 560px) {
  .it-row-fields { grid-template-columns: 1fr 1fr; padding-left: 12px; }
  /* Give the collapsed summary a full-width chip row so details flow across
     the screen instead of stacking one-per-line in a squeezed middle column. */
  .it-row-summary {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas:
      "toggle sr desc  tools"
      ".      .  amt   amt"
      "chips  chips chips chips";
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
  }
  .it-row-toggle { grid-area: toggle; margin-top: 0; }
  .it-row-sr { grid-area: sr; margin-top: 0; }
  .it-row-head { display: contents; }
  /* Let the full description wrap instead of being clipped in the narrow column. */
  .it-row-desc { grid-area: desc; min-width: 0; white-space: normal; overflow: visible; text-overflow: clip; }
  /* Amount on its own line, aligned to the right edge of the card. */
  .it-row-amt { grid-area: amt; margin-top: 0; justify-self: end; }
  /* Chips span the full card width and pack tighter so HSN/Qty/GST share a row. */
  .it-row-chips { grid-area: chips; margin-top: 0; gap: 6px 8px; }
  .it-row-chips .chip { padding: 4px 10px; min-height: 30px; }
  .it-row-tools { grid-area: tools; }
  /* Compact per-row action buttons (delete, more) on small devices. */
  .it-row-tools .icon-btn { width: 25px; height: 25px; font-size: 12px; }
}

.charge-list { display: grid; gap: 8px; margin-bottom: 10px; }
.charge-row { display: grid; grid-template-columns: 1fr 1fr 36px; gap: 6px; padding: 8px; background: #F7F8FA; border: 1px solid var(--line); border-radius: var(--radius-s); }
.charge-row > :nth-child(1) { grid-column: 1 / 3; }
.charge-row > :nth-child(6) { grid-row: 1; grid-column: 3; }
.charge-row > :nth-child(5) { grid-column: 1 / 3; }
@media (min-width: 760px) {
  .charge-row { grid-template-columns: 2fr 1.2fr 0.9fr 0.8fr 1.8fr 36px; align-items: center; }
  .charge-row > :nth-child(n) { grid-column: auto; grid-row: auto; }
}
.label-grid { gap: 8px 10px; }
.tpl-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tpl-row select { flex: 1 1 200px; }

.bank-picks { display: grid; gap: 8px; }
@media (min-width: 760px) { .bank-picks { grid-template-columns: 1fr 1fr; } }
.bank-pick { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); cursor: pointer; margin: 0; }
.bank-pick:has(input:checked) { border-color: var(--bronze); background: var(--bronze-soft); }
.bank-pick input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--bronze); flex: none; }
.history { padding-left: 18px; margin: 0; }
.history li { padding: 2px 0; }

/* ---------- Totals card ---------- */
.totals-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.totals-dl { margin: 0; padding: 14px 16px 8px; }
.totals-dl div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 14px; }
.totals-dl dt { font-weight: 400; color: var(--steel); }
.totals-dl dd { margin: 0; font-weight: 500; text-align: right; }
.grand { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; background: var(--ink); color: #fff; padding: 12px 16px; }
.grand b { font-size: 22px; }
.words { font-size: 12.5px; color: var(--steel); padding: 8px 16px 0; margin: 0; }
.mini-summary { padding: 6px 16px 0; font-size: 13px; }
.mini-summary summary { color: var(--bronze-dark); cursor: pointer; }
.mini-summary table { font-size: 12.5px; margin-top: 4px; }
.actions { padding: 14px 16px; display: grid; gap: 8px; }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dirty-flag { font-size: 12.5px; color: var(--warn); font-weight: 600; }
.problems { border-top: 1px solid var(--line); padding: 12px 16px; font-size: 13px; }
.problems-title { font-weight: 600; color: var(--bad); margin: 0 0 6px; }
.problems ul { margin: 0; padding-left: 18px; }
.problems li { padding: 2px 0; }
.ready { margin: 0; color: var(--ok); font-weight: 500; }

/* ---------- Dialogs ---------- */
.picker { display: flex; flex-direction: column; gap: 10px; max-height: min(80vh, 640px); }
.pick-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-s); min-height: 120px; }
.pick-list li + li { border-top: 1px solid var(--line); }
.pick-item { display: flex; gap: 10px; padding: 10px 12px; cursor: pointer; margin: 0; align-items: flex-start; }
.pick-item input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--bronze); }
.export-btns { display: grid; gap: 8px; grid-template-columns: 1fr; margin-top: 14px; }
@media (min-width: 480px) { .export-btns { grid-template-columns: repeat(3, 1fr); } }
.preview-dialog { border: 0; padding: 0; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; background: #C9CFD8; }
.preview-dialog::backdrop { background: rgba(23,38,61,.6); }
.pv-bar { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--ink); color: #fff; }
.pv-title { margin-right: auto; }
.pv-bar select { width: auto; }
.pv-bar .btn-quiet { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.pv-body { padding: 12px; }

/* ---------- Dashboard ---------- */
.hero-side { display: grid; gap: 12px; }
.stat { display: flex; flex-direction: column; }
.stat span { font-size: 12.5px; color: #B7C2D3; }
.stat b { font-size: 22px; line-height: 1.2; }
.stat small { color: #D5DCE7; font-size: 12.5px; }
@media (min-width: 760px) { .hero { grid-template-columns: 1fr 260px; } }
@media (max-width: 759px) { .hero-side { grid-template-columns: repeat(3, 1fr); } .stat b { font-size: 16px; } }
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.steps li { display: flex; align-items: center; gap: 8px; }
.steps a { color: var(--ink); font-weight: 500; }
.dash-grid { display: grid; gap: 16px; }
.dash-grid .panel { margin: 0; }
@media (min-width: 1000px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
.att-list { list-style: none; padding: 0; margin: 0 0 8px; }
.att-list li { display: flex; flex-direction: column; padding: 8px 0; border-top: 1px solid var(--line); }
.att-list li:first-child { border-top: 0; padding-top: 0; }
.att-list a { color: var(--ink); text-decoration: none; }
.att-list a:hover { text-decoration: underline; }
.att-list .small { display: flex; gap: 8px; align-items: center; }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; height: 170px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-stack { flex: 1; width: 100%; max-width: 44px; position: relative; background: var(--plate); border-radius: 3px 3px 0 0; }
.bar-q, .bar-w { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 3px 3px 0 0; }
.bar-q { background: #9FB3CC; }
.bar-w { background: var(--bronze); left: 25%; right: 25%; }
.bar-label { font-size: 12px; margin-top: 4px; }
.bar-n { font-size: 11px; color: var(--steel); }
.legend { font-size: 12.5px; color: var(--steel); margin: 8px 0 0; display: flex; align-items: center; gap: 6px; }
.lg { width: 10px; height: 10px; display: inline-block; border-radius: 2px; margin-left: 8px; }
.lg-q { background: #9FB3CC; margin-left: 0; } .lg-w { background: var(--bronze); }
.top-list { margin: 0; padding-left: 20px; }
.top-list li { padding: 4px 0; }
.top-list li span { display: inline-block; max-width: 60%; }
.top-list b { float: right; }

/* ---------- Login screen ---------- */
body.is-login .topbar, body.is-login .rail, body.is-login .main, body.is-login .q-dock, body.is-login .savebar { display: none !important; }
#login-screen { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #22364f, var(--ink, #17263D)); }
.login-card { width: 100%; max-width: 360px; background: var(--paper, #fff); border-radius: 14px; padding: 24px 22px;
  box-shadow: 0 24px 70px -24px rgba(0,0,0,.6); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-brand .brand-mark { width: 40px; height: 40px; border-radius: 9px; background: var(--bronze, #9A5A22); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.login-title { font-weight: 700; font-size: 18px; color: var(--ink); }
.login-sub { color: var(--steel); font-size: 13px; }
#login-form .form-label { margin-top: 8px; }
.login-btn { width: 100%; margin-top: 16px; }
.login-error { color: var(--bad, #B00020); font-size: 13px; margin-top: 10px; font-weight: 500; }
.login-note { color: var(--steel); font-size: 12px; margin-top: 14px; text-align: center; }

/* ---------- Account rail item, banners, users ---------- */
@media (min-width: 900px) { .rail { display: flex; flex-direction: column; } .rail a.rail-account { display: flex; margin-top: auto; } }
#app-banners { position: sticky; top: 0; z-index: 60; }
.app-banner { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 13px;
  background: #EAF2FB; border-bottom: 1px solid #cfe0f5; color: var(--ink); }
.app-banner.banner-warn { background: #FFF6E6; border-color: #F0D9A8; }
.app-banner [data-install] { margin-left: auto; }
.app-banner .banner-x { margin-left: auto; background: none; border: 0; font-size: 20px; line-height: 1; cursor: pointer; color: var(--steel); padding: 0 4px; }
.app-banner [data-install] + .banner-x { margin-left: 4px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.act-list { list-style: none; margin: 0; padding: 0; }
.act-row { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.act-row:last-child { border-bottom: 0; }
.act-when { flex: 0 0 auto; min-width: 108px; color: var(--muted, #6b7280); font-variant-numeric: tabular-nums; }
.act-what { flex: 1 1 auto; }
.act-who { flex: 0 0 auto; }
.pill { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--bronze-soft, #F3E6D6); color: #7A5A2E; vertical-align: middle; }

/* ---------- Password field with eye toggle ---------- */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 40px; }
.pw-eye { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--steel); padding: 6px; cursor: pointer; display: grid; place-items: center; border-radius: 6px; }
.pw-eye:hover { color: var(--ink); }
.pw-eye.is-on { color: var(--bronze); }

/* ---------- Sync status badge ---------- */
.sync-badge { position: fixed; right: 12px; bottom: 12px; z-index: 400; pointer-events: none;
  font-size: 11.5px; font-weight: 500; padding: 4px 10px; border-radius: 99px;
  background: rgba(23,38,61,.9); color: #fff; box-shadow: 0 4px 14px -6px rgba(0,0,0,.5); }
.sync-badge.sync-offline { background: #9A3412; }
.sync-badge.sync-error { background: var(--bad, #B00020); }
.sync-badge.sync-synced { background: #157347; }
.sync-badge.sync-idle { background: rgba(23,38,61,.6); }
@media (max-width: 1199px) { .sync-badge { bottom: 76px; } }
