/* ============================================================
   Office Accountant — TallyPrime-style visual language
   ============================================================ */
:root {
  --font: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", ui-monospace, monospace;

  --blue-900: #0d2e47;
  --blue-800: #123b5c;
  --blue-700: #17507c;
  --blue-600: #1d6296;
  --blue-500: #2b7cb5;
  --blue-200: #cfe0ef;
  --blue-100: #e4eef7;

  --bg: #edf1f5;
  --panel: #ffffff;
  --panel-2: #f7f9fb;
  --line: #c3d0dc;
  --line-2: #dde5ec;
  --ink: #17262f;
  --ink-2: #4a5e6d;
  --ink-3: #7b8d9b;
  --red: #b02a1f;
  --green: #1c6b46;
  --amber: #8a5a00;
  --sel: #d3e5f5;
  --sel-strong: #b9d6ee;
  --focus: #1f6fb2;

  --radius: 3px;
  --shadow: 0 10px 30px rgba(13, 46, 71, .18), 0 2px 6px rgba(13, 46, 71, .12);
  --keybar-h: 36px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---------- title bar ---------- */
.titlebar {
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  color: #eaf3fa;
  background: linear-gradient(180deg, var(--blue-700) 0%, var(--blue-900) 100%);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .12);
  user-select: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  letter-spacing: .2px;
  font-size: 14px;
  white-space: nowrap;
}
.brand svg { width: 20px; height: 20px; display: block; }
.brand .tag {
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: #9dc4e0;
  border: 1px solid rgba(157, 196, 224, .45);
  border-radius: 2px;
  padding: 1px 5px;
}
.titlebar .company {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 12.5px;
  color: #cfe3f2;
  white-space: nowrap;
  overflow: hidden;
}
.titlebar .company b { color: #fff; font-weight: 600; font-size: 13px; }
.titlebar .clock { font-variant-numeric: tabular-nums; color: #a9c9e0; }
.titlebar .user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(157, 196, 224, .35);
  border-radius: 20px;
  background: rgba(255, 255, 255, .07);
  color: #eaf3fa;
  font: inherit;
  font-size: 11.5px;
  white-space: nowrap;
  cursor: pointer;
}
.titlebar .user-chip:hover { background: rgba(255, 255, 255, .15); }
.titlebar .user-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #63d98a; box-shadow: 0 0 6px rgba(99, 217, 138, .8);
}
.titlebar .user-chip .name { font-weight: 600; }
.titlebar .user-chip .role { color: #9dc4e0; }
.titlebar .storage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid rgba(157, 196, 224, .28);
  border-radius: 20px;
  background: rgba(255, 255, 255, .05);
  color: #cfe3f2;
  font: inherit;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}
.titlebar .storage-chip:hover { background: rgba(255, 255, 255, .13); }
.titlebar .storage-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #9dc4e0;
}
.titlebar .storage-chip.saved .dot { background: #63d98a; box-shadow: 0 0 6px rgba(99, 217, 138, .7); }
.titlebar .storage-chip.saving .dot { background: #ffd166; }
.titlebar .storage-chip.error .dot,
.titlebar .storage-chip.conflict .dot { background: #ff6b6b; box-shadow: 0 0 6px rgba(255, 107, 107, .7); }
.titlebar .storage-chip.conflict { border-color: rgba(255, 107, 107, .65); color: #ffd9d9; }
.titlebar .storage-chip.signed-out .dot { background: #8fa6b8; }

/* ---------- workspace ---------- */
.workspace {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.screen {
  flex: 1 1 auto;
  overflow: auto;
  padding: 14px 16px 28px;
  outline: none;
  scrollbar-gutter: stable;
}
.screen-inner {
  max-width: 1220px;
  margin: 0 auto;
}

.sidebar {
  flex: 0 0 214px;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, #f9fbfd, #eef3f8);
  padding: 10px 8px;
  overflow: auto;
  font-size: 12px;
}
.sidebar:empty { display: none; }
.sidebar h3 {
  margin: 2px 4px 8px;
  font-size: 10.5px;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.sidebar .act {
  display: flex;
  gap: 8px;
  align-items: baseline;
  width: 100%;
  text-align: left;
  padding: 5px 6px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  color: var(--ink);
}
.sidebar .act:hover { background: var(--blue-100); }
.sidebar .act .k {
  font-family: var(--font);
  font-size: 10.5px;
  color: var(--blue-700);
  min-width: 42px;
  font-weight: 600;
}
.sidebar .act.danger { color: var(--red); }
.sidebar .hint { margin: 12px 6px 0; color: var(--ink-3); line-height: 1.5; font-size: 11px; }

/* ---------- key bar ---------- */
.keybar {
  flex: 0 0 var(--keybar-h);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 10px;
  background: #14324a;
  color: #cfe0ee;
  font-size: 11.5px;
  overflow-x: auto;
  white-space: nowrap;
  user-select: none;
}
.keybar .key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  height: 24px;
  border-radius: 2px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  color: inherit;
}
.keybar .key:hover { background: rgba(255, 255, 255, .1); }
.keybar .key b {
  font-weight: 600;
  color: #fff;
  font-size: 11px;
  letter-spacing: .2px;
}
.keybar .sep { width: 1px; height: 14px; background: rgba(255, 255, 255, .18); margin: 0 3px; }
.keybar .spacer { margin-left: auto; }

/* ---------- page chrome ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 2px 2px 8px;
  border-bottom: 2px solid var(--blue-700);
  margin-bottom: 12px;
}
.page-head .crumb {
  font-size: 11px;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.page-head h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .1px;
  color: var(--blue-800);
}
.page-head .sub { color: var(--ink-2); font-size: 12px; margin-bottom: 3px; }
.page-head .period {
  margin-left: auto;
  text-align: right;
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.page-head .period b { color: var(--ink); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- cards / panels ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset;
}
.card > header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: linear-gradient(180deg, #f2f7fb, #e6eef6);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-800);
  letter-spacing: .2px;
}
.card > header .right { margin-left: auto; font-weight: 400; color: var(--ink-2); }
.card .body { padding: 10px; }
.card .body.tight { padding: 0; }

/* ---------- menu lists ---------- */
.menu {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.menu li > button {
  display: flex;
  width: 100%;
  align-items: baseline;
  gap: 10px;
  padding: 5px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  border-left: 3px solid transparent;
}
.menu li > button:hover { background: var(--blue-100); }
.menu li > button.sel {
  background: var(--sel);
  border-left-color: var(--blue-600);
}
.menu .label { font-size: 13.5px; }
.menu .hint { margin-left: auto; color: var(--ink-3); font-size: 11px; }
.menu .sep {
  height: 1px;
  background: var(--line-2);
  margin: 5px 10px;
  list-style: none;
}
u { text-underline-offset: 2px; text-decoration-thickness: 1px; }

/* ---------- tables ---------- */
.report { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.report th, .report td {
  padding: 5px 9px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}
.report thead th {
  background: #e7eff6;
  border-bottom: 1px solid var(--line);
  color: var(--blue-800);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .25px;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
}
.report tbody tr:hover { background: #f2f8fd; }
.report tr.sel td { background: var(--sel) !important; }
.report tr.sub td:first-child { padding-left: 22px; }
.report tr.total td { font-weight: 600; border-top: 2px solid var(--blue-700); background: #f5f9fc; }
.report tr.grand td { font-weight: 700; border-top: 2px solid var(--blue-800); border-bottom: 3px double var(--blue-800); background: #eaf2f9; }
.report td.num, .report th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report td.mono { font-family: var(--mono); font-size: 12px; }
.report td.dr { color: var(--red); }
.report td.cr { color: var(--green); }
.report td.zero { color: var(--ink-3); }
.report .group { color: var(--ink-2); }
.report .clickable { cursor: pointer; }
.report tr.clickable:hover td { background: #eaf4fc; }
.table-wrap { overflow: auto; max-height: calc(100vh - 300px); }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 2px; }
.form-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 210px minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  padding: 2px 0;
}
.form-row.single { grid-template-columns: 210px minmax(0, 1fr); }
.form-row.wide { grid-template-columns: 210px minmax(0, 1fr); }
.form-row > label {
  text-align: right;
  color: var(--ink-2);
  font-size: 12.5px;
  padding-right: 2px;
}
.form-row > label.req::after { content: " *"; color: var(--red); }
.field {
  min-height: 26px;
  width: 100%;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-bottom: 1px dotted #9fb2c1;
  background: #fbfdff;
  border-radius: 2px;
  outline: none;
}
.field:hover { background: #f4f9fe; }
.field:focus {
  border-color: var(--focus);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(31, 111, 178, .15);
}
.field[readonly] { background: #f1f4f7; color: var(--ink-2); }
.field.num { text-align: right; font-variant-numeric: tabular-nums; }
select.field { cursor: pointer; }
.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-2);
}
.form-hint { color: var(--ink-3); font-size: 11.5px; }
.form-error {
  margin: 8px 0 0;
  padding: 7px 10px;
  border: 1px solid #e3b4ae;
  background: #fdf2f1;
  color: var(--red);
  font-size: 12px;
  border-radius: var(--radius);
}
.form-section {
  margin: 12px 0 6px;
  padding: 4px 8px;
  background: #eef4f9;
  border-left: 3px solid var(--blue-500);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--blue-800);
}
.checkline { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.checkline input { width: 15px; height: 15px; accent-color: var(--blue-600); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #eef3f8);
  color: var(--ink);
  cursor: pointer;
  font-size: 12.5px;
}
.btn:hover { border-color: var(--blue-500); background: linear-gradient(180deg, #fff, #e4eef8); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border-color: var(--blue-700);
  background: linear-gradient(180deg, var(--blue-600), var(--blue-800));
  color: #fff;
  font-weight: 600;
}
.btn.primary:hover { background: linear-gradient(180deg, var(--blue-500), var(--blue-700)); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: #d9b0ab; }
.btn.small { padding: 3px 8px; font-size: 11.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10.5px;
  letter-spacing: .3px;
  text-transform: uppercase;
  background: var(--blue-100);
  color: var(--blue-800);
  border: 1px solid var(--blue-200);
}
.badge.red { background: #fbeceb; color: var(--red); border-color: #e6bdb8; }
.badge.green { background: #e9f5ef; color: var(--green); border-color: #bcdccd; }
.badge.amber { background: #fdf4e3; color: var(--amber); border-color: #e9d3a3; }
.badge.grey { background: #f0f2f4; color: var(--ink-2); border-color: #d9dee3; }

/* ---------- kpi ---------- */
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; }
.kpi .k { font-size: 10.5px; letter-spacing: .7px; text-transform: uppercase; color: var(--ink-3); }
.kpi .v { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.2px; }
.kpi .v.neg { color: var(--red); }
.kpi .s { font-size: 11px; color: var(--ink-2); }

/* ---------- voucher grid ---------- */
.vch-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px 18px;
  padding: 8px 4px 10px;
}
.vch-head .cell { display: flex; flex-direction: column; gap: 3px; }
.vch-head .cell > span { font-size: 10.5px; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-3); }
.vch-grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.vch-grid th {
  background: #e7eff6;
  border: 1px solid var(--line);
  padding: 4px 7px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .25px;
  color: var(--blue-800);
  text-align: left;
}
.vch-grid td { border: 1px solid var(--line-2); padding: 0; }
.vch-grid td.num { text-align: right; }
.vch-grid input, .vch-grid select {
  width: 100%;
  border: 0;
  padding: 5px 7px;
  background: transparent;
  outline: none;
}
.vch-grid input:focus, .vch-grid select:focus { background: #eef6fd; box-shadow: inset 0 0 0 1px var(--focus); }
.vch-grid td.num input { text-align: right; font-variant-numeric: tabular-nums; }
.vch-grid tfoot td { background: #f3f7fa; font-weight: 600; border-top: 1px solid var(--line); }
.vch-totals {
  display: flex;
  justify-content: flex-end;
  gap: 26px;
  padding: 8px 4px;
  border-top: 2px solid var(--blue-700);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.vch-totals .k { color: var(--ink-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.vch-totals .v { font-weight: 600; min-width: 110px; text-align: right; }
.vch-summary { max-width: 360px; margin: 8px 0 0 auto; }

/* ---------- inline list picker ---------- */
.picker {
  position: absolute;
  z-index: 40;
  min-width: 280px;
  max-height: 300px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--blue-600);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.picker .item { padding: 4px 10px; cursor: pointer; display: flex; gap: 10px; }
.picker .item:hover, .picker .item.sel { background: var(--sel); }
.picker .item .meta { margin-left: auto; color: var(--ink-3); font-size: 11px; }
.picker .empty { padding: 8px 10px; color: var(--ink-3); }

/* ---------- modals ---------- */
.modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 33, 48, .42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 16px;
  pointer-events: auto;
  overflow: auto;
}
.modal {
  width: min(760px, 100%);
  background: var(--panel);
  border: 1px solid var(--blue-800);
  border-radius: 4px;
  box-shadow: var(--shadow);
  animation: pop .12s ease-out;
}
.modal.wide { width: min(1080px, 100%); }
.modal.narrow { width: min(460px, 100%); }
.modal > header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(180deg, var(--blue-700), var(--blue-900));
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}
.modal > header .x {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .35);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 2px;
  cursor: pointer;
  line-height: 1;
}
.modal .content { padding: 12px; max-height: 70vh; overflow: auto; }
.modal footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--line-2);
  background: var(--panel-2);
}
@keyframes pop { from { transform: translateY(-6px); opacity: .6; } to { transform: none; opacity: 1; } }

/* ---------- toast ---------- */
.toast-root {
  position: fixed;
  right: 14px;
  bottom: calc(var(--keybar-h) + 12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  max-width: 420px;
  padding: 8px 12px;
  border-radius: 3px;
  border-left: 4px solid var(--blue-600);
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  animation: slidein .16s ease-out;
}
.toast.err { border-left-color: var(--red); color: var(--red); }
.toast.ok { border-left-color: var(--green); }
@keyframes slidein { from { transform: translateX(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- misc ---------- */
.empty-state {
  padding: 26px 14px;
  text-align: center;
  color: var(--ink-2);
}
.empty-state h3 { margin: 0 0 4px; color: var(--blue-800); font-size: 14px; }
.empty-state p { margin: 0 auto; max-width: 460px; line-height: 1.55; font-size: 12.5px; }
.muted { color: var(--ink-3); }
.small { font-size: 11.5px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1 1 auto; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
a.link { color: var(--blue-700); text-decoration: none; border-bottom: 1px dotted var(--blue-500); cursor: pointer; }
a.link:hover { color: var(--blue-900); }
hr.rule { border: 0; border-top: 1px solid var(--line-2); margin: 10px 0; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.stat-line { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dotted var(--line-2); font-size: 12.5px; }
.stat-line:last-child { border-bottom: 0; }
.stat-line .v { font-variant-numeric: tabular-nums; font-weight: 600; }
.calc-display {
  font-family: var(--mono);
  font-size: 22px;
  text-align: right;
  padding: 10px;
  background: #f4f8fb;
  border: 1px solid var(--line);
  border-radius: 2px;
  margin-bottom: 8px;
  min-height: 46px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.calc-keys button { padding: 10px 0; border: 1px solid var(--line); background: #fff; border-radius: 3px; cursor: pointer; }
.calc-keys button:hover { background: var(--blue-100); }
kbd {
  font-family: var(--font);
  font-size: 11px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 5px;
  background: #fbfdff;
  white-space: nowrap;
}

/* ---------- invoice document ---------- */
.invoice-wrap {
  max-width: 860px;
  margin: 0 auto;
}
.invoice-doc {
  background: #fff;
  color: #16242e;
  border: 1px solid var(--line);
  padding: 26px 30px 18px;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset;
}
.invoice-doc .inv-top {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  border-bottom: 3px solid var(--blue-800);
  padding-bottom: 12px;
}
.invoice-doc .inv-name { font-size: 22px; font-weight: 700; color: var(--blue-900); letter-spacing: .2px; }
.invoice-doc .inv-addr { color: var(--ink-2); white-space: pre-line; }
.invoice-doc .inv-meta { color: var(--ink-3); font-size: 11px; margin-top: 4px; }
.invoice-doc .inv-title { text-align: right; min-width: 220px; }
.invoice-doc .inv-kind {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2.4px;
  color: var(--blue-800);
  margin-bottom: 6px;
}
.invoice-doc .inv-meta-table { margin-left: auto; border-collapse: collapse; }
.invoice-doc .inv-meta-table td { padding: 2px 0 2px 10px; text-align: right; }
.invoice-doc .inv-meta-table td:first-child { color: var(--ink-3); text-align: left; }
.invoice-doc .inv-parties { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.invoice-doc .inv-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: .9px; color: var(--ink-3); }
.invoice-doc .inv-party { font-weight: 700; font-size: 13.5px; margin-top: 2px; }
.invoice-doc .inv-right { text-align: right; min-width: 190px; }
.invoice-doc .inv-items { width: 100%; border-collapse: collapse; margin: 12px 0; }
.invoice-doc .inv-items th {
  background: #e9f0f6;
  border-bottom: 1px solid var(--line);
  padding: 6px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--blue-800);
  text-align: left;
}
.invoice-doc .inv-items td { padding: 6px 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.invoice-doc .inv-items .r, .invoice-doc .inv-totals .r, .invoice-doc .inv-hsn .r { text-align: right; }
.invoice-doc .inv-items .c { text-align: center; }
.invoice-doc .tiny { font-size: 10px; color: var(--ink-3); }
.invoice-doc .inv-foot { display: flex; justify-content: space-between; gap: 24px; padding-top: 8px; }
.invoice-doc .inv-left { flex: 1 1 auto; max-width: 460px; }
.invoice-doc .inv-hsn { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.invoice-doc .inv-hsn th { font-size: 9.5px; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line-2); padding: 3px 4px; text-align: left; }
.invoice-doc .inv-hsn td { padding: 3px 4px; border-bottom: 1px dotted var(--line-2); }
.invoice-doc .inv-words { margin: 8px 0; }
.invoice-doc .inv-terms { font-size: 10.5px; color: var(--ink-2); }
.invoice-doc .inv-totals { flex: 0 0 270px; }
.invoice-doc .inv-totals table { width: 100%; border-collapse: collapse; }
.invoice-doc .inv-totals td { padding: 5px 4px; border-bottom: 1px dotted var(--line-2); }
.invoice-doc .inv-grand td {
  border-top: 2px solid var(--blue-800);
  border-bottom: 3px double var(--blue-800);
  font-weight: 700;
  font-size: 14px;
  color: var(--blue-900);
}
.invoice-doc .inv-bank { font-size: 10.5px; color: var(--ink-2); margin-top: 10px; }
.invoice-doc .inv-sign { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 26px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.invoice-doc .inv-note { font-size: 10.5px; color: var(--ink-3); max-width: 420px; }
.invoice-doc .inv-sign-box { text-align: center; font-size: 11px; min-width: 190px; }
.invoice-doc .inv-thanks { text-align: center; font-size: 9.5px; color: var(--ink-3); margin-top: 14px; letter-spacing: .6px; text-transform: uppercase; }

.invoice-doc.theme-modern { border-top: 6px solid var(--blue-700); }
.invoice-doc.theme-modern .inv-kind { background: var(--blue-800); color: #fff; display: inline-block; padding: 4px 12px; letter-spacing: 2px; }
.invoice-doc.theme-modern .inv-items th { background: var(--blue-800); color: #fff; }
.invoice-doc.theme-retail .inv-name { font-size: 26px; }
.invoice-doc.theme-retail .inv-kind { font-size: 18px; letter-spacing: 3px; color: var(--red); }
.invoice-doc.theme-retail .inv-items th { background: #fdf0ee; color: var(--red); }

@media print {
  .invoice-wrap { max-width: none; }
  .invoice-doc { border: 0; padding: 0; font-size: 11pt; }
}

/* ---------- print ---------- */
.print-only { display: none; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; overflow: visible; height: auto; }
  .titlebar, .keybar, .sidebar, .no-print, .modal-backdrop { display: none !important; }
  .app { display: block; height: auto; }
  .workspace { display: block; }
  .screen { overflow: visible; padding: 0; }
  .print-only { display: block; }
  .card { border: 0; box-shadow: none; }
  .report thead th { position: static; background: #eee !important; }
  .report th, .report td { border-bottom: 1px solid #ccc; }
  a { color: inherit; text-decoration: none; }
}

@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .sidebar { flex-basis: 180px; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .form-row { grid-template-columns: 150px minmax(0, 1fr); }
  .form-row > label:nth-of-type(2) { grid-column: 1; }
  .vch-head { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .form-row, .form-row.single, .form-row.wide { grid-template-columns: 1fr; }
  .form-row > label { text-align: left; }
  .titlebar .company .clock { display: none; }
  .screen { padding: 10px 10px 24px; }
  .page-head h1 { font-size: 16px; }
}
