:root {
  --bg: #f4f6fa;
  --surface: #fff;
  --ink: #1b2333;
  --muted: #66708a;
  --line: #e3e8f1;
  --brand: #2f5bea;
  --brand-ink: #fff;
  --brand-soft: #e8eeff;
  --ok: #138a52;
  --ok-soft: #e1f6ec;
  --warn: #a15c00;
  --warn-soft: #fff1d6;
  --bad: #c0332b;
  --bad-soft: #fde8e6;
  --info: #0f6f94;
  --info-soft: #dff3fa;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 4px 14px rgba(20, 30, 60, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

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

.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.boot {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  min-height: 60vh;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Sidebar */
.side {
  background: #101a33;
  color: #cfd8f0;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
}

.brand {
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  padding: 4px 6px 14px 10px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.side-tools {
  padding: 0 6px 8px 10px;
}

.side-settings {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #cfd8f0;
}

.side-settings:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.side-settings.on {
  background: var(--brand);
  color: #fff;
}

.side-settings:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.brand .logo {
  display: inline-flex;
  flex: none;
}

.brand .logo img {
  display: block;
  height: auto;
  max-width: 48px;
}

.brand .bname {
  font-size: 15px;
  line-height: 1.2;
}

.bizmenu {
  position: relative;
  min-width: 0;
  flex: 1;
}

.bizbtn {
  background: none;
  border: 0;
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 2px;
  border-radius: 6px;
  width: 100%;
}

.bizbtn:hover,
.bizbtn[aria-expanded="true"] {
  background: rgba(255, 255, 255, .1);
}

.bizbtn .bizname {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: break-word;
}

.bizbtn .chev {
  width: 7px;
  height: 7px;
  flex: none;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  opacity: .8;
}

.bizbtn[aria-expanded="true"] .chev {
  transform: rotate(45deg);
  margin-bottom: 3px;
}

.bizdrop {
  position: fixed;
  margin: 0;
  background: #fff;
  color: #111827;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  padding: 4px;
  z-index: 30;
  min-width: 170px;
}

.bizdrop button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: inherit;
  border-radius: 6px;
  cursor: pointer;
}

.bizdrop button.sep {
  border-top: 1px solid #e5e7eb;
  border-radius: 0 0 6px 6px;
  margin-top: 4px;
  padding-top: 11px;
}

.bizdrop button.sign-out {
  color: #b91c1c;
}

.bizdrop button:hover,
.bizdrop button:focus-visible {
  background: #eef2ff;
}

.nav {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.nav a.grp,
.nav .grp {
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav .grp.cur {
  color: #fff;
}

.nav a.grp.on,
.nav .grp.on {
  background: var(--brand);
  color: #fff;
}

.nav .chev {
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  margin: 0 6px 0 0;
  opacity: .7;
  transition: transform .15s;
}

.nav .grp[aria-expanded="true"] {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.nav .sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 6px 10px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, .14);
}

.nav .sub.flyout {
  position: fixed;
  z-index: 40;
  margin: 0;
  padding: 6px;
  border: 0;
  min-width: 210px;
  overflow-y: auto;
  background: #1b2748;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.nav .sub button,
.nav .sub a {
  padding: 6px 10px;
  font-size: 14px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav button,
.nav a {
  all: unset;
  cursor: pointer;
  padding: 9px 12px;
  border-radius: 8px;
  color: #cfd8f0;
  display: block;
}

.nav button:hover,
.nav a:hover {
  background: rgba(255, 255, 255, .07);
}

.nav a[aria-current="page"],
.nav button[aria-current="page"] {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

.nav a:focus-visible,
.nav button:focus-visible {
  outline: 2px solid #9db4ff;
  outline-offset: 1px;
}

.side .me {
  margin-top: auto;
  padding: 10px;
  font-size: 13px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  word-break: break-all;
}

.me .me-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.side .lang {
  display: flex;
  gap: 3px;
  margin: 0;
  flex: none;
}

.lang-btn {
  background: transparent;
  color: #cfd8e3;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 10.5px;
  line-height: 1.5;
  font-weight: 600;
  cursor: pointer;
}

.lang-btn[aria-pressed="true"] {
  background: #fff;
  color: #1b2a3a;
}

.me b {
  display: block;
  color: #fff;
  font-weight: 600;
}

/* Main */
.main {
  padding: 22px 26px 40px;
  min-width: 0;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

h1 {
  font-size: 22px;
  margin: 0;
}

h2 {
  font-size: 16px;
  margin: 0 0 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.grid {
  display: grid;
  gap: 14px;
}

.kpis {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 14px;
}

.kpi {
  min-width: 0;
}

.kpi .v {
  font-size: clamp(17px, 4.6vw, 23px);
  font-weight: 700;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}

.kpi .l {
  color: var(--muted);
  font-size: 13px;
}

.kpi.warn .v {
  color: var(--warn);
}

.kpi-link {
  cursor: pointer;
}

.kpi-link:hover,
.kpi-link:focus-visible {
  box-shadow: 0 0 0 2px var(--accent, #2563eb);
  outline: none;
}

.cols2 {
  grid-template-columns: 1.4fr 1fr;
}

.cols2b {
  grid-template-columns: 1fr 1fr;
  margin-top: 14px;
}

.cols3 {
  grid-template-columns: 1fr 1.1fr 1.5fr;
}

#account-info th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  width: 40%;
}

/* Controls */
.btn {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 500;
}

.btn:hover {
  background: #f1f4fb;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}

.btn.sm {
  padding: 4px 10px;
  font-size: 13px;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
th button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar input[type=search] {
  flex: 1;
  min-width: 180px;
}

input[type=text],
input[type=search],
input[type=email],
input[type=number],
input[type=date],
input[type=tel],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cfd6e4;
  border-radius: 8px;
  background: #fff;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

input:disabled,
select:disabled {
  background: #f1f3f8;
  color: var(--muted);
}

.toolbar select {
  width: auto;
  min-width: 150px;
}

.repbar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: #f5f7f6;
  border: 1px solid #e3e6e8;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.repbar .field {
  margin: 0;
}

.repbar .rprow {
  display: flex;
  gap: 8px;
  align-items: center;
}

.repbar select,
.repbar input[type=date] {
  width: auto;
  min-width: 140px;
}

.repbar .rpbtns {
  margin-left: auto;
}

.repbar .field>label span {
  font-weight: 400;
  color: #555;
}

.repmore {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid #e3e6e8;
  border-radius: 8px;
  padding: 12px 14px;
  margin: -4px 0 12px;
}


/* Droplist có tìm kiếm (bọc <select>) */
.cb {
  position: relative;
  display: block;
  width: 100%;
}

.cb select {
  opacity: 0;
  pointer-events: none;
}

.cb .cb-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding-right: 28px;
  text-overflow: ellipsis;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23687089' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
}

.cb .cb-input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.cb.disabled .cb-input {
  background-color: #f1f3f8;
}

.toolbar .cb,
.recbank .cb,
.head .cb {
  display: inline-block;
  width: auto;
}

.cb-menu {
  position: fixed;
  z-index: 100000;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #cfd6e4;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 30, 60, .18);
  padding: 4px;
}

.cb-opt {
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.cb-opt.active {
  background: #e8edff;
}

.cb-opt.sel {
  font-weight: 700;
}

.cb-opt.dis {
  color: var(--muted);
  cursor: not-allowed;
}

.cb-none {
  padding: 8px 10px;
  color: var(--muted);
}

.tx-attach {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #dfe4ee;
  font-size: 13px;
}

.tx-attach ul.plain {
  margin: 6px 0;
}

.tx-attach .actions {
  margin-top: 6px;
}

.dnd-over {
  outline: 2px dashed var(--brand);
  outline-offset: 2px;
  background: rgba(37, 99, 235, .05);
}

.quickadd {
  margin-top: 4px;
  font-size: 13px;
}

td.overdue,
.overdue {
  color: var(--danger, #c0392b);
  font-size: 12px;
}

.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  padding-top: 10px;
}

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0 0 12px;
}

.dl dt {
  color: var(--muted);
}

.dl dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.ageing {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.ageing .age {
  flex: 1;
  min-width: 100px;
  padding: 8px 10px;
  border: 1px solid var(--border, #dfe4ee);
  border-radius: 8px;
  text-align: right;
}

.notes {
  white-space: pre-wrap;
}

@media print {

  .tabs,
  .toolbar,
  .head .actions,
  nav,
  #sidebar {
    display: none !important;
  }
}

.cashchart .bars {
  height: 150px;
}

.card.inner {
  margin-bottom: 12px;
  box-shadow: none;
}

.seg {
  display: inline-flex;
  gap: 4px;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--muted, #64748b);
}

.crumbs .sep {
  opacity: .6;
}

.crumbs .cur {
  color: inherit;
  font-weight: 600;
}

.modal header .crumbs {
  margin: 0;
  flex: 1;
}

/* Table */
.tablewrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td.wrap {
  white-space: normal;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: #f8f9fd;
  position: sticky;
  top: 0;
}

th button {
  all: unset;
  cursor: pointer;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tr:hover td {
  background: #fafbff;
}

.actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  gap: 10px;
  flex-wrap: wrap;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 34px 10px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: #eef0f6;
  color: #46506a;
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.badge.info {
  background: var(--info-soft);
  color: var(--info);
}

.badge.brand {
  background: var(--brand-soft);
  color: var(--brand);
}

/* Modal */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 22, 45, .5);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 20;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: min(560px, 100%);
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(10, 15, 40, .35);
}

.modal header {
  padding: 16px 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal h2 {
  margin: 0;
  font-size: 18px;
}

.modal .body {
  padding: 14px 20px;
  display: grid;
  gap: 12px;
}

.docpage .body {
  padding: 0;
  display: grid;
  gap: 12px;
}

.docpage footer {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.modal footer {
  padding: 12px 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.field .req {
  color: var(--bad);
}

.field .err {
  color: var(--bad);
  font-size: 12.5px;
  margin-top: 3px;
}

.field.has-err input,
.field.has-err select,
.field.has-err textarea {
  border-color: var(--bad);
}

.field .hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
}

.check input {
  width: auto;
}

/* Charts (CSS thuần, không cần thư viện) */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 170px;
  padding-top: 8px;
}

.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 4px;
  min-width: 0;
}

.bar .col {
  width: 100%;
  max-width: 56px;
  background: var(--brand);
  border-radius: 6px 6px 0 0;
  min-height: 2px;
}

.bar .val {
  font-size: 11px;
  color: var(--muted);
}

.bar .lab {
  font-size: 12px;
  color: var(--muted);
}

.hbar {
  display: grid;
  grid-template-columns: 110px 1fr 36px;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  font-size: 13px;
}

.hbar .track {
  background: #edf0f7;
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
}

.hbar .fill {
  background: var(--brand);
  height: 100%;
  border-radius: 99px;
}

ul.plain {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.plain li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

ul.plain li:last-child {
  border-bottom: 0;
}

/* Toast */
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 40;
}

.toast {
  background: #17203a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 360px;
}

.toast.bad {
  background: var(--bad);
}

.toast.ok {
  background: var(--ok);
}

/* Màn hình lỗi toàn trang */
.fatal {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 20px;
  background: radial-gradient(900px 480px at 50% -8%, var(--brand-soft) 0%, rgba(232, 238, 255, 0) 60%);
}

.fatal .card {
  max-width: 480px;
  text-align: center;
}

/* Màn hình đăng nhập / đăng ký / quên-đặt lại mật khẩu */
.fatal .card {
  border-radius: 16px;
  padding: 34px 30px 28px;
  box-shadow: 0 2px 4px rgba(20, 30, 60, .05), 0 14px 34px rgba(20, 30, 60, .09);
}

.fatal .card>img {
  display: block;
  margin: 0 auto 16px;
}

.fatal .card>h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0 0 20px;
}

.fatal .card form,
.fatal .card>p {
  text-align: left;
}

.fatal .field {
  margin-bottom: 15px;
}

.fatal .field label {
  font-size: 13px;
  color: var(--muted);
}

.fatal input[type=email],
.fatal input[type=password],
.fatal input[type=text],
.fatal input[type=tel] {
  padding: 10px 12px;
  font-size: 15px;
  border-radius: 9px;
  border-color: #d7dceb;
  transition: border-color .15s, box-shadow .15s;
}

.fatal input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  outline: none;
}

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.field-head label {
  margin-bottom: 0 !important;
}

.linkbtn.sm {
  font-size: 12.5px;
  font-weight: 600;
}

.btn.block {
  display: block;
  width: 100%;
  text-align: center;
  padding: 11px 14px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 9px;
  margin-top: 2px;
}

.fatal .btn.primary.block {
  box-shadow: 0 3px 10px rgba(47, 91, 234, .28);
}

.fatal .btn.primary.block:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 5px 16px rgba(47, 91, 234, .34);
}

.fatal .err {
  min-height: 0;
  margin: 0 0 10px;
  font-size: 13px;
}

.fatal .err:empty {
  display: none;
  margin: 0;
}

.login-backlink {
  text-align: center;
  margin-top: 18px;
  font-size: 13.5px;
}

.fatal .lang {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
}

.fatal .lang-btn,
.fatal .lang-btn[aria-pressed="true"] {
  transition: background-color .15s, color .15s, border-color .15s;
}

.fatal .lang-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.fatal .lang-btn[aria-pressed="true"] {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-soft);
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px;
  }

  .brand {
    padding: 0 8px 0 4px;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .side .me {
    margin: 0 0 0 auto;
    border: 0;
    padding: 0 6px;
  }

  .main {
    padding: 16px 12px 40px;
  }

  .cols2,
  .cols2b,
  .cols3 {
    grid-template-columns: 1fr;
  }

  .nav {
    width: 100%;
    overflow: visible;
  }

  .brand .logo img {
    max-width: 44px;
  }

  .bizdrop {
    left: 8px !important;
    top: 64px !important;
  }

  .nav .sub.flyout {
    position: static !important;
    max-height: none !important;
    box-shadow: none;
    background: transparent;
  }

  .nav .sub {
    flex: 1 0 100%;
    flex-direction: row;
    flex-wrap: wrap;
    border-left: 0;
    margin: 0 0 4px;
    padding: 0;
  }
}

/* Kế toán */
.muted {
  color: var(--muted);
  font-size: 13px;
}

.linkbtn {
  all: unset;
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
}

.linkbtn:hover {
  text-decoration: underline;
}

.tx-del {
  margin-top: 18px;
  padding-top: 8px;
  border-top: 1px dashed var(--line, #e3e6ee);
  text-align: right;
}

.tx-del .tx-del-btn {
  color: var(--muted, #6b7280);
  font-weight: 400;
  font-size: 12px;
  opacity: .75;
}

.tx-del .tx-del-btn:hover {
  color: #b42318;
  opacity: 1;
}

.numlink {
  font-weight: 500;
}

.linkbtn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.modal.wide {
  width: min(900px, 100%);
}

.pp-modal {
  width: min(960px, 100%);
  height: 94vh;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pp-modal header {
  padding: 12px 18px;
  border-bottom: 1px solid #e3e6e8;
}

.logodrop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 110px;
  border: 2px dashed #b9c0c7;
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  background: #fafbfb;
  text-align: center;
}

.logodrop.over {
  border-color: var(--brand, #2f5bea);
  background: #eef3ff;
}

.logodrop:focus {
  outline: 2px solid var(--brand, #2f5bea);
  outline-offset: 2px;
}

.pp-actions {
  display: flex;
  gap: 8px;
}

.pp-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

.dochead {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.docno {
  font-size: 20px;
  font-weight: 700;
}

.docmeta {
  text-align: right;
  display: grid;
  gap: 2px;
}

.docmeta input,
.docmeta select {
  width: 190px;
  max-width: 100%;
  padding: 4px 8px;
}

.docno-input {
  font-weight: 700;
  font-size: 16px;
  width: 220px;
  max-width: 100%;
  padding: 4px 8px;
}

.dochead select {
  max-width: 320px;
  padding: 4px 8px;
}

.totals {
  margin-left: auto;
  width: min(320px, 100%);
  display: grid;
  gap: 4px;
}

.trow {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

.trow.strong {
  font-weight: 700;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.lineform {
  background: #f8f9fd;
  border: 1px dashed #cfd6e4;
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.lf-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.lineform .err {
  color: var(--bad);
  font-size: 13px;
}

.txhead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 6px;
}

.txamt {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.txamt.in {
  color: var(--ok);
}

.txamt.out {
  color: var(--bad);
}

.card.tx {
  margin-bottom: 12px;
}

.tabs .btn[aria-selected="true"] {
  cursor: default;
}

tr.sect td {
  font-weight: 700;
  background: #f8f9fd;
}

tr.strong td {
  font-weight: 700;
  border-top: 2px solid var(--line);
}

tr.neg td {
  color: var(--bad);
}

tr.pos td {
  color: var(--ok);
}

.bar .pair {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 100%;
  width: 100%;
  justify-content: center;
}

.bar .pair .col {
  max-width: 24px;
}

.bar .col.exp {
  background: #e0803a;
}

.legend {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--brand);
  margin-left: 4px;
}

.legend .dot.exp {
  background: #e0803a;
}

@media print {

  #app,
  .toasts,
  .noprint {
    display: none !important;
  }

  .overlay {
    position: static;
    background: none;
    padding: 0;
    display: block;
  }

  .modal {
    box-shadow: none;
    max-height: none;
    width: 100%;
    overflow: visible;
  }

  .modal header button {
    display: none;
  }

  body {
    background: #fff;
  }
}

table.kv {
  width: 100%;
  border-collapse: collapse
}

table.kv th {
  width: 30%;
  text-align: left;
  font-weight: 600;
  color: var(--muted, #555)
}

table.kv th,
table.kv td {
  padding: 12px 8px;
  border-bottom: 1px solid #e5e7eb
}

table.kv tr:last-child th,
table.kv tr:last-child td {
  border-bottom: 0
}

table.kv td.right {
  text-align: right;
  width: 90px
}

/* Menu bên trái: nền nâu đất, chữ kem */
.side {
  background: #7b4f33;
  color: #f3e6d3;
}

.side .brand,
.side .bizbtn,
.side .me b {
  color: #fff;
}

.side-settings {
  color: #f3e6d3;
}

.side-settings.on {
  background: #4a2c17;
  color: #fff;
}

.nav button,
.nav a {
  color: #f3e6d3;
}

.nav a.grp.on,
.nav .grp.on,
.nav a[aria-current="page"],
.nav button[aria-current="page"] {
  background: #4a2c17;
  color: #fff;
}

.nav .sub.flyout {
  background: #5e3a24;
  box-shadow: 0 10px 30px rgba(40, 20, 5, .4);
}

.lang-btn {
  color: #f3e6d3;
  border-color: rgba(255, 255, 255, .35);
}

.lang-btn[aria-pressed="true"] {
  background: #f3e6d3;
  color: #4a2c17;
}

.access-table {
  width: 100%;
  max-width: 420px;
  border-collapse: collapse
}

.access-table td {
  padding: 4px 8px 4px 0
}

.access-table select {
  width: 100%
}

.finpos-total {
  font-size: 28px;
  font-weight: 600;
  margin: 4px 0
}

.legend .lg {
  margin-right: 8px;
  white-space: nowrap
}

.home3 {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.15fr) minmax(0, 1.15fr);
  gap: 14px;
  align-items: stretch
}

.home3 .bars {
  gap: 4px
}

@media (max-width:1100px) {
  .home3 {
    grid-template-columns: 1fr 1fr
  }

  .home3 #finpos {
    grid-column: 1 / -1
  }
}

@media (max-width:700px) {
  .home3 {
    grid-template-columns: 1fr
  }
}

.cardhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px
}

.cardhead h2 {
  margin: 0
}

.cardhead .cb {
  width: auto;
  min-width: 150px;
  flex: 0 0 auto
}

.cardhead .cb select,
.cardhead .cb .cb-input {
  font-size: 13px
}

.dropzone {
  text-align: center;
  padding: 28px 16px;
  border: 2px dashed var(--border, #cbd5e1);
  cursor: pointer;
  margin-bottom: 12px;
}

.dropzone.over,
.dropzone:focus-visible {
  border-color: var(--accent, #2563eb);
  background: rgba(37, 99, 235, .06);
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.rec-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 1.6fr);
  gap: 16px;
  align-items: start;
}

.rec-left .desc {
  margin: 2px 0 6px;
  word-break: break-word;
}

.rec-right {
  border-left: 1px solid var(--line);
  padding-left: 16px;
  min-width: 0;
}

.ptabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.ptab {
  all: unset;
  cursor: pointer;
  padding: 6px 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.ptab[aria-selected="true"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

.ptab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.rec-right ul.plain li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.match-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 90px auto;
  gap: 12px;
  align-items: center;
  background: #ace9d2;
  border: 1px solid #8fd8bb;
  border-left: 5px solid var(--ok);
  border-radius: 6px;
  padding: 12px 14px;
}

.match-card .mc-title {
  margin: 2px 0;
  word-break: break-word;
}

.match-card .muted {
  color: #3b5f50;
}

.match-card .mc-col {
  text-align: right;
}

.match-card .mc-amt {
  font-weight: 600;
  min-height: 1.2em;
}

.mc-more {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
}

.rec-card.has-match>.rec-left {
  border-left: 0;
}

.rec-panel ul.plain[hidden] {
  display: none;
}

@media (max-width: 800px) {
  .match-card {
    grid-template-columns: 1fr 1fr;
  }

  .match-card .mc-main,
  .match-card .mc-ok {
    grid-column: 1 / -1;
  }
}

.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.stab {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--ink, #1c2540);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.stab:hover {
  background: #f3f5fb;
}

.stab[aria-selected="true"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

.stab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.stab-count {
  color: var(--muted);
  font-size: 13px;
}

.stab-count:empty {
  display: none;
}

.dup-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--warn);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 0 0 12px;
}

.dup-banner[hidden] {
  display: none;
}

#dup-review h3 {
  margin: 14px 0 4px;
  font-size: 15px;
}

.cell-in {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 6px;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
}

.cell-in:hover {
  border-color: var(--line);
}

.cell-in:focus {
  border-color: var(--brand);
  background: #fff;
  outline: none;
}

.cell-in.bad {
  border-color: var(--bad);
  background: var(--bad-soft);
}

#lines {
  width: 100%;
  font-size: 12.5px;
}

#lines th,
#lines td {
  font-size: 12.5px;
  padding-left: 6px;
  padding-right: 6px;
}

#lines .cell-in {
  font-size: 12.5px;
  padding: 4px 5px;
}

#lines td.wrap {
  width: 100%;
}

#lines td.wrap .cell-in {
  min-width: 200px;
}

#lines textarea.cell-in {
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.35;
  display: block;
}

#lines td {
  vertical-align: top;
}

#lines td.num .cell-in {
  text-align: right;
  width: 74px;
  min-width: 0;
}

#lines td:nth-child(2) select.cell-in {
  width: 250px;
  min-width: 0;
}

#lines td:nth-child(3) .cell-in {
  width: 50px;
}

#lines td select.cell-in {
  min-width: 0;
}

#lines td:nth-child(2),
#lines td:nth-child(3),
#lines td:nth-child(4) {
  white-space: nowrap;
}

#lines td:not(.wrap):not(.num):not(:nth-child(2)) select.cell-in {
  width: 120px;
}

.findrow {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.findrow input {
  flex: 1;
}

.fgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 8px 0;
  font-size: 13px;
}

.balstrip {
  display: flex;
  gap: 32px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.balstrip .v {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.balstrip .grow {
  flex: 1;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #98a2b3;
}

.dot.on {
  background: var(--ok);
}

.banner {
  background: var(--info-soft);
  color: var(--info);
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.okbox {
  background: var(--ok-soft);
  color: var(--ok);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.menu {
  position: relative;
  display: inline-block;
}

.menu summary {
  list-style: none;
  cursor: pointer;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu-items {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 6px;
  min-width: 240px;
  display: grid;
}

.menu-items .mi {
  padding: 7px 10px;
  text-align: left;
}

.menu-items .mi:hover {
  background: var(--info-soft);
  text-decoration: none;
}

.modal.wide {
  width: min(760px, 100%);
}

#recon-report tr.tot td {
  font-weight: 700;
  border-top: 1px solid var(--line);
}

#recon-report tr.grp td {
  font-weight: 600;
  background: #f6f7fb;
}

.recbank select {
  font-size: 16px;
  font-weight: 700;
  padding: 5px 8px;
  max-width: 100%;
  min-width: 260px;
}

.banktiles {
  display: grid;
  gap: 10px;
}

.banktile {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.banktile .nm {
  font-weight: 700;
}

.banktile .nums {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.banktile .nums .v {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 800px) {
  .rec-card {
    grid-template-columns: 1fr;
  }

  .rec-right {
    border-left: 0;
    padding-left: 0;
  }

  .fgrid {
    grid-template-columns: 1fr;
  }
}

#cash-table select,
#cash-table input[type=text] {
  min-width: 170px;
  width: 100%;
}

#cash-table td:nth-child(3) {
  min-width: 200px;
}

/* Typography uses component sizes; see screen refresh below. */
.access-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 200px
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  background: #e8f1ff;
  color: #1d4ed8;
  white-space: nowrap
}

.chip.access-view {
  background: #f1f5f9;
  color: #475569
}

/* LOTUSA CRM reference theme — screen only. Prepared locally; deployment pending. */
@media screen {
  :root {
    --bg: #f5f5f2;
    --surface: #fff;
    --ink: #242722;
    --muted: #62685f;
    --line: #e4e6df;
    --brand: #c24a23;
    --brand-soft: #fcf0e9;
    --brand-ink: #fff;
    --accent: #c24a23;
    --border: #e4e6df;
    --ok: #356247;
    --ok-soft: #edf4ee;
    --info: #3d647f;
    --info-soft: #edf3f8;
    --warn: #846222;
    --warn-soft: #faf3e4;
    --bad: #a53428;
    --bad-soft: #faeeeb;
    --radius: 9px;
    --shadow: 0 1px 2px rgba(36, 39, 34, .025);
  }

  html,
  body {
    font-size: 14px;
    line-height: 1.5;
  }

  .app {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .main {
    padding: 35px 34px 40px;
  }

  .head {
    margin-bottom: 22px;
    gap: 16px;
  }

  h1 {
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -.035em;
    line-height: 1.25;
  }

  h2 {
    font-size: 15px;
    line-height: 1.4;
    font-weight: 650;
  }

  .side {
    background: #fcfcfa;
    color: #5c6359;
    border-right: 1px solid var(--line);
    padding: 28px 12px 16px;
  }

  .brand {
    gap: 10px;
    padding-bottom: 18px;
  }

  .side-tools {
    padding-bottom: 14px;
  }

  .nav {
    gap: 5px;
  }

  .nav button,
  .nav a {
    padding: 10px 12px;
    font-size: 14px;
    border-radius: 7px;
  }

  .nav a.grp.on,
  .nav .grp.on,
  .nav a[aria-current="page"],
  .nav button[aria-current="page"] {
    background: var(--brand-soft);
    color: var(--brand);
    box-shadow: none;
  }

  .nav .sub.flyout {
    background: #fcfcfa;
    border: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(36, 39, 34, .12);
  }

  .side-settings.on {
    background: var(--brand-soft);
    color: var(--brand);
  }

  .side .me {
    line-height: 1.6;
    font-size: 12px;
    padding-top: 16px;
    border-color: var(--line);
    color: var(--muted);
  }

  .card {
    padding: 18px;
  }

  .grid {
    gap: 16px;
  }

  .kpis {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    margin-bottom: 18px;
  }

  .kpi {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100px;
    border-top: 1px solid var(--line);
  }

  .kpi .v {
    font-size: 20px;
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.035em;
  }

  .kpi .l {
    font-size: 12px;
    margin-top: 7px;
  }

  .kpi.warn {
    background: var(--warn-soft);
    border-color: #e8dcc2;
  }

  .kpi-link:hover {
    border-color: #d7b7a5;
    box-shadow: 0 2px 6px rgba(36, 39, 34, .05);
  }

  .home3 {
    gap: 16px;
  }

  .cardhead {
    margin-bottom: 14px;
    gap: 10px;
  }

  .finpos-total {
    font-size: 28px;
    line-height: 1.3;
    letter-spacing: -.035em;
    font-variant-numeric: tabular-nums;
  }

  .banktile {
    background: #f7f8f3;
    padding: 14px;
    border-radius: 8px;
    gap: 8px;
  }

  .banktile .nums {
    gap: 16px;
  }

  .banktile .nums .v {
    font-size: 16px;
  }

  .btn {
    border-color: #dbded4;
    border-radius: 6px;
    min-height: 36px;
    font-size: 13px;
    padding: 8px 13px;
  }

  .btn:hover {
    background: #f5f5f0;
  }

  .btn.primary {
    background: var(--brand);
    border-color: var(--brand);
  }

  .btn.primary:hover:not(:disabled) {
    background: #a73b18;
    filter: none;
  }

  .btn.sm {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 12px;
  }

  .head .actions {
    flex-wrap: wrap;
  }

  .toolbar {
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
  }

  input[type=text],
  input[type=search],
  input[type=email],
  input[type=password],
  input[type=number],
  input[type=date],
  input[type=tel],
  select,
  textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #cbd0c4;
    border-radius: 7px;
    background-color: #fff;
  }

  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible {
    outline-offset: 2px;
  }

  input::placeholder,
  textarea::placeholder {
    color: #777a70;
  }

  .tablewrap {
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  th {
    background: #fcfcfa;
    color: #747c6b;
    font-size: 11px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  td {
    font-size: 13px;
  }

  th,
  td {
    padding-left: 12px;
    padding-right: 12px;
  }

  tr:hover td {
    background: #fdfdfa;
  }

  .empty {
    padding: 44px 16px;
  }

  .badge {
    padding: 3px 9px;
    font-size: 11px;
  }

  .status-tabs {
    gap: 6px;
    margin-bottom: 18px;
  }

  .stab {
    padding: 11px 14px;
    font-size: 13px;
  }

  .stab[aria-selected="true"] {
    background: transparent;
  }

  ul.plain li {
    padding: 10px 0;
    font-size: 13px;
    align-items: baseline;
    flex-wrap: wrap;
  }

  ul.plain li>.linkbtn {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .modal {
    border: 1px solid var(--line);
    border-radius: 9px;
  }

  .modal header {
    padding-top: 20px;
  }

  .modal h2 {
    font-size: 18px;
  }

  .modal footer {
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    padding-top: 14px;
    background: #fafbf8;
  }

  .overlay {
    background: rgba(36, 35, 29, .48);
  }

  .repbar,
  .lineform {
    background: #f6f7f2;
  }

  #report {
    overflow-x: auto;
  }

  .cb-opt.active,
  .bizdrop button:hover,
  .bizdrop button:focus-visible {
    background: var(--brand-soft);
  }

  .fatal {
    min-height: 100vh;
    padding: 32px 16px;
    background: var(--bg);
  }

  .fatal .card {
    border-top: 4px solid var(--brand);
    padding: 36px 30px 28px;
    box-shadow: 0 12px 36px rgba(63, 49, 32, .08);
  }

  .fatal .btn.primary.block {
    box-shadow: 0 3px 10px rgba(194, 74, 35, .12);
  }

  .fatal .btn.primary.block:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(194, 74, 35, .18);
  }

  .fatal .lang-btn {
    min-height: 28px;
    padding: 3px 10px;
  }

  /* CRM reference: warm white navigation, terracotta active actions. */
  .side .brand,
  .side .bizbtn,
  .side .me b {
    color: var(--ink);
  }

  .side-settings,
  .nav button,
  .nav a {
    color: #5c6359;
  }

  .side-settings:hover,
  .nav button:hover,
  .nav a:hover {
    background: #f1f1eb;
    color: var(--ink);
  }

  .nav .grp.cur {
    background: var(--brand-soft);
    color: var(--brand);
  }

  .nav .grp[aria-expanded="true"] {
    background: #f1f1eb;
    color: var(--ink);
  }

  .bizbtn:hover,
  .bizbtn[aria-expanded="true"] {
    background: #f1f1eb;
  }

  .nav .sub {
    border-left-color: var(--line);
  }

  .side .lang-btn {
    color: var(--muted);
    border-color: var(--line);
  }

  .side .lang-btn[aria-pressed="true"] {
    background: var(--brand-soft);
    color: var(--brand);
  }

  .nav a:focus-visible,
  .nav button:focus-visible,
  .side-settings:focus-visible {
    outline-color: #d68457;
  }

  .crumbs {
    padding-bottom: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line);
  }

  .modal .crumbs {
    margin-bottom: 0;
    border-bottom: 0;
  }

  @media (max-width: 1100px) {
    .kpis {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  @media (max-width: 860px) {
    .app {
      grid-template-columns: minmax(0, 1fr);
    }

    .side {
      padding: 12px;
    }

    .brand {
      padding-bottom: 0;
    }

    .side-tools {
      padding: 0 6px;
    }

    .nav {
      gap: 4px;
    }

    .nav button,
    .nav a {
      padding: 9px 10px;
      font-size: 13px;
    }

    .main {
      padding: 20px 16px 32px;
    }

    .head {
      margin-bottom: 18px;
    }

    .nav .sub.flyout {
      background: transparent;
      border: 0;
    }

    .side .me {
      padding-top: 0;
    }
  }

  @media (max-width: 600px) {
    h1 {
      font-size: 23px;
    }

    .main {
      padding: 18px 12px 28px;
    }

    .kpis {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }

    .kpi {
      min-height: 94px;
      padding: 14px 12px;
    }

    .kpi .v {
      font-size: 19px;
    }

    .card {
      padding: 14px;
    }

    .toolbar input[type=search],
    .toolbar select,
    .toolbar .cb {
      min-width: 0;
      max-width: 100%;
    }

    .toolbar input[type=search] {
      flex-basis: 100%;
    }

    .cols {
      grid-template-columns: minmax(0, 1fr);
    }

    .repbar select,
    .repbar input[type=date] {
      min-width: 0;
      max-width: 100%;
    }

    .repbar .field {
      min-width: 0;
      max-width: 100%;
    }

    .repbar .rprow {
      flex-wrap: wrap;
    }

    .repbar .cb {
      min-width: 0;
      max-width: 100%;
      flex: 1 1 160px;
    }

    .recbank select {
      min-width: 0;
    }

    input,
    select,
    textarea,
    .cb .cb-input {
      font-size: 16px;
    }

    .modal {
      max-height: 94dvh;
    }

    .modal header,
    .modal .body,
    .modal footer {
      padding-left: 14px;
      padding-right: 14px;
    }

    .btn {
      min-height: 40px;
    }
  }
}

/* LOTUSA wordmark, business identity and main-area section navigation. */
.side .brand {
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 8px 6px 14px;
}

.lotusa-wordmark {
  display: block;
  width: fit-content;
  color: var(--ink);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.2;
  text-decoration: none;
  padding: 0 6px;
}

.lotusa-wordmark:hover {
  color: var(--brand);
}

.side .bizbtn {
  gap: 8px;
  padding: 8px 6px;
  min-height: 48px;
}

.business-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--brand-soft);
}

.business-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--surface, #fff);
}

.business-logo img[hidden],
.business-initials[hidden] {
  display: none;
}

.business-initials {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.bizbtn .bizname {
  flex: 1;
}

.section-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface, #fff);
}

.section-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
}

.section-option:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.section-option:hover {
  color: var(--brand);
  background: var(--brand-soft);
}

.option-arrow {
  color: var(--brand);
  flex: none;
  font-size: 20px;
}

.section-option:focus-visible,
.lotusa-wordmark:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -3px;
}

@media (max-width: 860px) {
  .side .brand {
    gap: 8px;
  }

  .side .bizmenu {
    flex: initial;
  }
}

@media (max-width: 600px) {
  .section-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .section-option {
    padding: 16px;
    min-height: 60px;
  }

  .section-option:nth-child(odd) {
    border-right: 0;
  }
}

/* A persistent horizontal row of section choices above the selected result. */
.group-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 2px 10px;
  margin: 0 0 8px;
  scrollbar-width: thin;
}

.group-tabs .btn {
  flex: 0 0 auto;
  white-space: nowrap;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  min-height: 38px;
  color: var(--ink);
}

.group-tabs .btn.primary {
  color: var(--brand-ink, #fff);
}

.group-tabs .btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

@media (max-width: 600px) {
  .group-tabs {
    gap: 6px;
  }

  .group-tabs .btn {
    padding: 9px 12px;
  }
}

/* Dark sidebar, gold wordmark and blue data links. */
:root {
  --data-link: #1261b8;
  --data-link-hover: #084486;
  --side-bg: #29332f;
  --side-text: #e5eae5;
  --lotusa-gold: #edc967;
}

.side {
  background: var(--side-bg);
  color: var(--side-text);
  border-right-color: #39453e;
  overflow-y: auto;
}

.side .brand {
  gap: 18px;
  padding: 8px 0 12px;
}

.side .lotusa-wordmark,
.side .lotusa-wordmark:visited {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  color: var(--lotusa-gold);
  font-size: 30px;
  letter-spacing: .1em;
}

.side .lotusa-wordmark:hover {
  color: #ffe09b;
}

.side .bizbtn {
  color: #fff;
  padding: 8px 4px;
  gap: 10px;
  font-size: 17px;
  min-height: 68px;
}

.side .business-logo {
  flex-basis: 52px;
  width: 52px;
  height: 52px;
  background: #fff;
}

.side .business-initials {
  font-size: 18px;
  color: #65511d;
}

.side .bizbtn:hover,
.side .bizbtn[aria-expanded="true"] {
  background: #35423b;
}

.side .nav .grp,
.side .nav .side-settings {
  color: var(--side-text);
}

.side .nav .grp:hover,
.side .nav .side-settings:hover {
  color: #fff;
  background: #3a4940;
}

.side .nav .grp.cur,
.side .nav .grp.on,
.side .nav .side-settings.on {
  color: #fff;
  background: #a83f20;
}

.side .nav .side-settings {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  height: auto;
  min-height: 42px;
  padding: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

.side .side-settings svg {
  flex: 0 0 18px;
}

.side .me {
  color: #c4cec5;
  border-top-color: #4b584f;
}

.side .me b {
  color: #fff;
}

.side .bizdrop {
  color: var(--ink);
}

.side .nav a:focus-visible,
.side .nav button:focus-visible,
.side .bizbtn:focus-visible,
.side .lotusa-wordmark:focus-visible {
  outline: 2px solid var(--lotusa-gold);
  outline-offset: -2px;
}

.main a[href]:not(.btn),
.modal a[href]:not(.btn),
.fatal a[href],
.linkbtn,
.linkbtn:visited,
[role="link"],
.kpi-link .v,
.kpi-link .l {
  color: var(--data-link);
}

.main a[href]:not(.btn):visited,
.modal a[href]:not(.btn):visited {
  color: var(--data-link);
}

.main a[href]:not(.btn):hover,
.modal a[href]:not(.btn):hover,
.linkbtn:hover,
[role="link"]:hover {
  color: var(--data-link-hover);
}

.linkbtn:focus-visible,
[role="link"]:focus-visible {
  outline-color: var(--data-link);
}

@media (max-width: 860px) {
  .side .brand {
    gap: 10px;
  }

  .side .bizbtn {
    min-height: 60px;
  }

  .side .business-logo {
    flex-basis: 48px;
    width: 48px;
    height: 48px;
  }
}