:root {
  --ink: #1c2833;
  --muted: #5d6b76;
  --line: #d5e0e4;
  --bg: #f3f6f7;
  --card: #ffffff;
  --teal: #0d6e6a;
  --teal-dark: #0a5552;
  --danger: #8d1d1d;
  --shadow: 0 8px 24px rgba(22, 40, 46, 0.06);
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", sans-serif;
  line-height: 1.5;
}

body { margin: 0; }

a { color: var(--teal-dark); }

.top, .topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
  background: var(--teal);
  color: #f7fbfb;
  position: sticky;
  top: 0;
  z-index: 25;
}

.top a, .brand, .topbar a { color: inherit; text-decoration: none; }
.topbar .finder, .org-switch { margin: 0; }
.topbar-trai { display: flex; align-items: center; gap: 0.75rem; margin-right: auto; }
.topbar-dm { display: flex; align-items: center; gap: 0.35rem; margin-right: 0.5rem; }
.topbar-dm summary::-webkit-details-marker { display: none; }
.dm-chuyen { position: relative; }
.dm-chuyen div {
  position: absolute;
  top: calc(100% + 0.3rem);
  right: 0;
  z-index: 30;
  min-width: 16rem;
  max-height: 22rem;
  overflow: auto;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.25rem 0;
}
.dm-chuyen a {
  display: block;
  margin: 0;
  padding: 0.35rem 0.75rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 0.92rem;
  font-weight: 400;
  white-space: nowrap;
}
.dm-chuyen a:hover,
.dm-chuyen a.dang { background: #eef8f6; }
.dm-bang {
  max-height: calc(100vh - 8.5rem);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.dm-bang table { width: max-content; min-width: 100%; border-collapse: collapse; }
.dm-bang th,
.dm-bang td {
  padding: 0.35rem 0.55rem;
  border-bottom: 1px solid #e7eef1;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}
.dm-bang thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3faf8;
}
.dm-bang button { margin: 0 0.25rem 0 0; }
.topbar .ve-nha { display: inline-flex; align-items: center; line-height: 0; color: #f7fbfb; }
.topbar .ve-nha svg { width: 1.35rem; height: 1.35rem; display: block; }
.org-switch { display: flex; align-items: center; }
.org-switch label { margin: 0; font-weight: 600; }
.org-switch select { max-width: 18rem; margin: 0; background: #fff; color: var(--ink); }
.topbar .org-switch label { color: #f7fbfb; }
.topbar .finder label { margin: 0; color: #f7fbfb; font-weight: 600; }
.topbar .finder input { width: 16rem; margin: 0 0 0 0.4rem; background: #fff; color: var(--ink); }

.shell { display: flex; min-height: 100vh; }

.workspace { flex: 1; min-width: 0; }

.topbar button, nav button {
  margin: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

main { padding: 1.2rem; }

.panel, .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}

.panel { max-width: 52rem; }
.sheet {
  max-width: 40rem;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.2rem 1.3rem 1.5rem;
}
.sheet.wide { max-width: 72rem; overflow-x: auto; }
.sheet.voucher.wide { max-width: 100%; overflow: hidden; }
.lines input, .lines select { min-width: var(--o-nhap, 6.5rem); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.8rem; }
.actions .button, .actions button, .actions a { margin-top: 0; }
button.ghost, a.ghost {
  background: #fff;
  color: var(--teal-dark);
  border: 1px solid var(--teal);
}

.narrow { max-width: 28rem; }
.wide, .sheet { max-width: none; }

.nut-icon { width: 1.35rem; height: 1.35rem; flex: 0 0 auto; display: block; }
.actions .button { display: inline-flex; align-items: center; gap: 0.35rem; }

fieldset { border: 1px solid var(--line); border-radius: 10px; margin-top: 0.8rem; }
label { display: block; margin-top: 0.8rem; font-weight: 600; }

input, select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.6rem;
  margin-top: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

input:focus, select:focus { outline: 2px solid #9fd4d0; border-color: var(--teal); }

button, .button {
  display: inline-block;
  margin-top: 0.8rem;
  background: var(--teal);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

button:hover, .button:hover { background: var(--teal-dark); }

.xac-nhan { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; }
.xac-nhan[hidden] { display: none; }
.xac-nhan-nen { position: absolute; inset: 0; background: rgba(22, 40, 46, 0.35); }
.xac-nhan-hop {
  position: relative; width: min(22rem, calc(100% - 2rem));
  background: #fff; border-radius: 10px; padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
}
.xac-nhan-hop p { margin: 0 0 1rem; }
.xac-nhan-hop label { display: block; margin: 0 0 0.8rem; }
.xac-nhan-hop input { width: 100%; box-sizing: border-box; }
.ho-so-moi { margin-top: 1.4rem; }
.xac-nhan-nut { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; }
.xac-nhan-nut form { margin: 0; }
.xac-nhan-nut button, .xac-nhan-nut .button { margin-top: 0; }
.xac-nhan-nut .xac-nhan-xoa { background: var(--danger); }
.xac-nhan-nut .xac-nhan-xoa:hover { background: #6e1616; }
button:focus, .button:focus, a:focus { outline: 2px solid #9fd4d0; outline-offset: 2px; }

.bat-buoc { color: #d00000; font-weight: 700; }
.quan-tri-dau { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.quan-tri-dau h1 { margin: 0; }
.quan-tri-dau button { margin-top: 0; }
.quan-tri-loc { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: flex-end; margin: 0.8rem 0 1rem; }
.quan-tri-loc label { margin: 0; }
.quan-tri-loc input, .quan-tri-loc select { width: 14rem; }
.quan-tri tr.sap-het td { background: #fff6df; }
.quan-tri tr.khoa td { color: #5c6b70; }
.quan-tri-nhat-ky { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.help, .errors { margin: 0.2rem 0 0; font-size: 0.92rem; }
.errors, .warning { color: var(--danger); }
.warning { background: #fff4f4; border: 1px solid #f0d0d0; border-radius: 8px; padding: 0.5rem 0.7rem; }

table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 0.45rem; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }

.mau { margin-top: 0.4rem; color: #172126; font-family: "Times New Roman", Times, serif; }
.mau-top { display: flex; justify-content: space-between; gap: 1.5rem; align-items: flex-start; }
.mau-top p, .mau-line, .mau-ngay, .mau-ky-han, .mau-dvt { margin: 0; }
.mau-code { text-align: center; margin-right: 2.5rem; }
.mau-so { font-size: 0.92rem; font-weight: 700; }
.mau-kem { font-size: 0.8rem; font-style: italic; }
.mau h1 { text-align: center; font-size: 1.25rem; margin: 0.7rem 0 0.2rem; font-family: "Times New Roman", Times, serif; }
.mau-line, .mau-ky-han { text-align: center; }
.mau .mau-loc { position: relative; display: inline-block; vertical-align: baseline; }
.mau .mau-loc-chu {
  display: inline-block; width: auto; field-sizing: content; min-width: 2ch; max-width: 28rem;
  margin: 0; padding: 0 0.1rem; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  font-family: "Times New Roman", Times, serif; font-size: 1rem; font-weight: 400; color: inherit;
  line-height: inherit; appearance: none;
}
.mau .mau-loc-chu:focus { outline: none; border: 0; background: transparent; }
.mau .mau-loc-ds {
  position: absolute; left: 0; top: 100%; z-index: 6; margin: 0.1rem 0 0; padding: 0.15rem 0;
  list-style: none; background: #fff; border: 1px solid #1c3338; min-width: 12rem; max-width: 28rem;
  max-height: 14rem; overflow: auto; text-align: left; font-weight: 400;
}
.mau .mau-loc-ds[hidden] { display: none; }
.mau .mau-loc-ds li { padding: 0.12rem 0.45rem; cursor: pointer; white-space: nowrap; }
.mau .mau-loc-ds li[hidden] { display: none; }
.mau .mau-loc-ds li:hover, .mau .mau-loc-ds li.dang { background: #e7f3f2; }
.mau-dvt { text-align: right; font-style: italic; padding-right: 2.5rem; }
.mau-donvi { font-weight: 700; }
.mau-bang { margin-top: 0.35rem; border-collapse: separate; border-spacing: 0; }
.mau-bang th, .mau-bang td {
  border: 0; border-right: 1px solid #1c3338; border-bottom: 1px solid #1c3338;
  background: #fff; color: inherit; text-align: center; font-weight: 600; vertical-align: middle;
}
.mau-bang tr > :first-child { border-left: 1px solid #1c3338; }
.mau-cuon { margin-top: 0.35rem; max-height: calc(100vh - 8rem); overflow: auto; overscroll-behavior: contain; }
.mau-cuon .mau-bang { margin: 0; }
.mau-bang thead { position: sticky; top: 0; z-index: 3; background: #fff; }
.mau-bang thead th { border-top: 1px solid #1c3338; background: #fff; }
.mau-bang thead tr + tr th { border-top: 0; }
.mau-bang a { color: inherit; text-decoration: none; }
.mau-bang td { text-align: left; font-weight: 400; }
.mau-bang td.so { text-align: right; min-width: var(--cot-so, 0); }
.mau-bang tr.dam td { font-weight: 700; }
.mau-ngay { text-align: right; margin-top: 1rem; font-style: italic; padding-right: 2.5rem; }
.phieu-trang { max-width: 52rem; margin: 0 auto; background: #fff; }
.phieu-in { background: #fff; }
.phieu-in .mau-code { margin-right: 0; }
.phieu-lien { padding-bottom: 0.4rem; }
.phieu-lien + .phieu-lien { border-top: 1px dashed #1c3338; margin-top: 0.3rem; padding-top: 0.35rem; }
.lien-nhan { margin: 0; text-align: right; font-weight: 700; }
.phieu-lien h1 { margin: 0.15rem 0; font-size: 1.05rem; }
.phieu-lien .phieu-dong { margin: 0.12rem 0; }
.phieu-lien .mau-ngay { margin-top: 0.25rem; padding-right: 0; }
.phieu-lien .mau-ky { margin-top: 0.15rem; }
.phieu-dong { margin: 0.45rem 0; }
.phieu-chu { font-style: italic; }
.phieu-sau { margin-top: 0.45rem; }
.phieu-gio { margin: 0.4rem 0 0; text-align: right; font-size: 0.92rem; }
.phieu-bang { width: 100%; }
.phieu-bang th, .phieu-bang td { font-size: 0.92rem; padding: 0.28rem 0.35rem; }
.phieu-in .mau-ky div { width: 24%; }
.phieu-in .mau-ky strong { display: block; }
.phieu-in .mau-ky span { display: block; }
.mau-ky { display: flex; justify-content: space-between; gap: 1rem; text-align: center; margin-top: 0.4rem; }
.mau-ky div { width: 32%; }
.mau-ky strong { font-weight: 700; }
.mau-ky span { font-style: italic; font-weight: 400; }
.mau .mau-ngay-o { position: relative; display: inline-flex; align-items: center; vertical-align: baseline; }
.mau .mau-ngay-loc { min-width: 10.2ch; text-align: center; letter-spacing: -0.02em; }
.gia-von {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.gia-von-nen { position: absolute; inset: 0; background: rgba(22, 40, 46, 0.35); }
.gia-von-hop {
  position: relative; width: min(24rem, 100%);
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px rgba(22, 40, 46, 0.18);
  padding: 1.35rem 1.4rem 1.2rem; text-align: center;
}
.gia-von-hop h2 { margin: 0 0 0.4rem; font-size: 1.15rem; line-height: 1.3; }
.gia-von-hop p { margin: 0 auto 1.15rem; max-width: 22rem; color: var(--muted); line-height: 1.45; }
.gia-von-nut { display: flex; justify-content: center; align-items: center; gap: 0.6rem; }
.gia-von-nut form { margin: 0; }
.gia-von-nut .gia-von-khoa { margin: 0; max-width: none; color: var(--danger); }
.gia-von-nut button, .gia-von-nut .button {
  box-sizing: border-box; min-width: 8.2rem; margin-top: 0;
  padding: 0.5rem 0.85rem; border: 1px solid var(--teal);
  line-height: 1.25; text-align: center;
}
.topbar .ho-so-mo { color: #f7fbfb; font-weight: 700; text-decoration: none; white-space: nowrap; }
.ho-so { max-width: 46rem; }
.ho-so fieldset { padding: 0.15rem 1rem 1rem; }
.ho-so legend { font-weight: 700; padding: 0 0.35rem; }
.ho-so .hai { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.ho-so input[type="checkbox"], .ho-so input[type="file"] { width: auto; }
.ho-so-logo { display: flex; align-items: center; gap: 1rem; margin-top: 0.8rem; }
.ho-so-logo img, .mau-logo {
  width: 5.2rem; height: 5.2rem; object-fit: contain;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.mau-dau { position: relative; text-align: left; }
.mau-dau .mau-donvi { margin: 0; text-align: left; }
.mau-logo {
  position: absolute; left: 0; top: calc(100% + 0.15rem); z-index: 1;
  width: 8.4rem; height: 6.4rem; object-fit: contain; object-position: left top;
  pointer-events: none; border: 0; border-radius: 0; background: transparent;
}
.ho-so-xoa { font-weight: 600; }
.mau-ky .ten-ky { display: block; margin-top: 1.6rem; font-style: normal; font-weight: 700; }
@media (max-width: 720px) {
  .ho-so .hai { grid-template-columns: 1fr; }
}
.mau button.mau-lich {
  display: inline-flex; align-items: center; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; color: #8aa0a4;
  opacity: 0.22; line-height: 0; cursor: pointer;
}
.mau button.mau-lich:hover, .mau button.mau-lich:focus { opacity: 0.5; background: transparent; outline: none; }
.mau button.mau-lich svg { width: 0.82rem; height: 0.82rem; display: block; }
.mau input.mau-lich-an {
  position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; opacity: 0;
}
#loc-so { margin: 0; }
.loc-du-phong { display: none; }
a.loc-phu, button.loc-phu, summary.loc-phu {
  display: inline-flex; align-items: center; gap: 0.25rem; margin: 0;
  padding: 0.15rem 0.5rem; border-radius: 6px; font-size: 0.85rem; line-height: 1.2;
  font-family: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  white-space: nowrap; list-style: none;
}
.topbar a.loc-phu, .topbar button.loc-phu, .topbar summary.loc-phu {
  background: transparent; color: #f7fbfb; border: 1px solid rgba(255, 255, 255, 0.5);
}
body.giao-don-gian .loc-du-phong { display: flex; justify-content: flex-end; gap: 0.35rem; margin-bottom: 0.35rem; }
body.giao-don-gian a.loc-phu, body.giao-don-gian button.loc-phu { background: var(--teal); color: #fff; border: 0; }
.so-chu { margin: 0.8rem 0 0; padding-left: 1.1rem; }
.so-gio { display: none; }
@media print {
  @page { size: A4 portrait; margin: 0; }
  .topbar, .loc-du-phong, .finder, .top, #cua-so, #thanh-cua-so, #xac-nhan, .gia-von, .so-menu, a.loc-phu, button.loc-phu, .mau-lich, .mau-lich-an, .mau-bo-loc, .mau-tick-hang, .so-chu {
    display: none !important;
  }
  html, body, .shell, .workspace, main, .panel, .sheet, .so-sheet, .voucher .trade-table {
    background: #fff; box-shadow: none; border: 0; margin: 0; max-width: none;
    height: auto; min-height: 0; overflow: visible;
  }
  .shell { display: block; }
  main { padding: 0; }
  .so-sheet {
    width: 210mm; margin: 0 auto; padding: 8mm 10mm 10mm; box-sizing: border-box;
  }
  .mau-cuon, .sheet.wide, .workspace {
    max-height: none !important; height: auto !important; overflow: visible !important;
  }
  .mau-bang { width: 100%; }
  .mau-bang thead { position: static; display: table-header-group; }
  .mau-bang thead tr.dong-loc { display: none !important; }
  .mau-bang th, .mau-bang td {
    font-size: 10pt; padding: 1mm 1.2mm; white-space: normal; overflow: visible;
  }
  .mau-bang tr { break-inside: avoid; page-break-inside: avoid; }
  .so-gio {
    display: block; position: static; margin: 6mm 0 0;
    font-family: "Times New Roman", Times, serif; font-size: 11pt; text-align: right;
    break-before: avoid; page-break-before: avoid;
  }
}
.so-menu { position: relative; display: inline-flex; }
.so-ds {
  display: none; position: absolute; top: 100%; left: 0; z-index: 30;
  min-width: 18rem; max-width: 28rem; max-height: 70vh; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 0.3rem 0;
}
.so-menu:hover .so-ds, .so-menu:focus-within .so-ds { display: block; }
.topbar .so-ds a, .loc-du-phong .so-ds a {
  display: block; margin: 0; padding: 0.35rem 0.75rem; border: 0; border-radius: 0;
  background: transparent; color: var(--ink); font-weight: 400; font-size: 0.92rem;
  white-space: normal; line-height: 1.35; text-decoration: none;
}
.topbar .so-ds a:hover, .topbar .so-ds a.dang,
.loc-du-phong .so-ds a:hover, .loc-du-phong .so-ds a.dang { background: #e7f3f2; color: var(--ink); }

.search { display: flex; gap: 0.5rem; align-items: end; }
.search input { margin: 0; }
.search button { margin: 0; }

#cua-so { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.float-window {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(22, 40, 46, 0.22);
  overflow: hidden;
}
.float-window.is-min { display: none; }
.float-title {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.65rem;
  background: var(--teal);
  color: #fff;
  cursor: move;
}
.float-title > span { display: inline-flex; align-items: center; gap: 0.28rem; }
.float-title button { margin: 0; background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.55); }
.float-title button.is-on { background: rgba(255, 255, 255, 0.22); }
.float-title button[data-act="history"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  line-height: 0;
}
.float-title button[data-act="history"][hidden] { display: none; }
.float-title button[data-act="history"] svg { display: block; }
.float-history-wrap { position: relative; display: inline-flex; }
.float-history {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  width: 22rem;
  max-height: 13rem;
  overflow: auto;
  box-sizing: border-box;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(22, 40, 46, 0.18);
  padding: 0.55rem 0.75rem 0.7rem;
  font-size: 0.84rem;
  line-height: 1.4;
  cursor: default;
}
.float-history[hidden] { display: none; }
.float-history h2 { margin: 0 0 0.35rem; font-size: 0.92rem; color: var(--teal); }
.float-history ul { margin: 0; padding-left: 1.05rem; }
.float-history li { margin: 0.18rem 0; white-space: nowrap; }
.float-body { display: flex; flex: 1; min-height: 0; min-width: 0; }
.float-window iframe { flex: 1; width: auto; min-width: 0; min-height: 0; border: 0; background: #f7fbfb; }
.float-help {
  flex: 0 0 300px;
  width: 300px;
  box-sizing: border-box;
  border-left: 1px solid var(--line);
  background: #fff;
  overflow: auto;
  padding: 0.75rem 0.85rem 1rem;
  color: var(--ink);
  font-size: 0.84rem;
  line-height: 1.45;
}
.float-help[hidden] { display: none; }
.float-help h2 { margin: 0 0 0.45rem; font-size: 1rem; color: var(--teal, #0f6f6a); }
.float-help h3 { margin: 0.7rem 0 0.2rem; font-size: 0.86rem; }
.float-help p { margin: 0.2rem 0; }
.float-help ul, .float-help ol { margin: 0.2rem 0 0.35rem; padding-left: 1.15rem; }
.float-help li { margin: 0.12rem 0; }
.float-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; }
#thanh-cua-so {
  position: fixed;
  left: 15.5rem;
  right: 0.6rem;
  bottom: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  z-index: 41;
}
#thanh-cua-so:empty { display: none; }
#thanh-cua-so button { margin: 0; }
body.in-window { background: #f7fbfb; }
body.in-window .sheet.voucher:not(.wide) { width: max-content; }
body.in-window main { padding: 0.4rem 0.6rem 0.8rem; }
.money-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.2rem 1rem; }
.money-grid .span-2 { grid-column: span 2; }
.money-grid .span-3 { grid-column: span 3; }
.voucher-actions, .nut-phieu { display: flex; justify-content: flex-end; gap: 0.4rem; flex-wrap: wrap; }
.nut-phieu { margin-top: 0.55rem; }
.nut-phieu .button, .nut-phieu button { margin-top: 0; }
.nut-phieu button:disabled,
.nut-phieu a[aria-disabled="true"] { opacity: 0.4; pointer-events: none; cursor: default; }
.phieu-hang-tren {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.65rem;
}
.phieu-nav-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1 1 16rem;
  min-width: 15rem;
}
.phieu-nav-wrap.khoa { opacity: 0.45; pointer-events: none; }
select.phieu-thang {
  flex: 0 0 auto;
  width: 5.6rem;
  min-width: 5.6rem;
  margin: 0;
  padding-left: 0.35rem;
  padding-right: 0.2rem;
  font-weight: 400;
}
.phieu-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fbfa;
}
.phieu-nav[hidden] { display: none; }
.phieu-nav-nut {
  min-width: 2rem;
  padding: 0.2rem 0.35rem;
  margin: 0;
}
.phieu-nav-thanh {
  flex: 1 1 auto;
  min-width: 6rem;
  height: 1.35rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--teal);
  touch-action: none;
}
.phieu-nav-vi-tri {
  min-width: 4.2rem;
  text-align: right;
  font-size: 0.84rem;
  color: #466071;
  white-space: nowrap;
}
.hop-tim-phieu {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hop-tim-phieu[hidden] { display: none; }
.hop-tim-nen {
  position: absolute;
  inset: 0;
  background: rgba(22, 40, 46, 0.35);
}
.hop-tim-khung {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(42rem, calc(100vw - 1.5rem));
  height: min(34rem, calc(100vh - 1.5rem));
  max-height: min(34rem, calc(100vh - 1.5rem));
  overflow: hidden;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(18, 35, 58, 0.18);
  padding: 0.55rem 0.85rem 0.75rem;
}
.hop-tim-dau {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.hop-tim-dau h2 { margin: 0; font-size: 1.1rem; }
.hop-tim-tuy-chon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.2rem;
  margin-bottom: 0.65rem;
}
.hop-tim-radio {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.hop-tim-hang {
  display: flex;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin: 0 0 0.4rem;
}
.hop-tim-hang label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 0;
  margin: 0;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 600;
}
.hop-tim-hang input { flex: 1 1 auto; min-width: 0; width: auto; margin: 0; font-weight: 400; }
.hop-tim-actions {
  display: flex;
  gap: 0.45rem;
  margin: 0.15rem 0 0.4rem;
}
.hop-tim-thong-bao { margin: 0 0 0.45rem; font-size: 0.9rem; color: #466071; }
.hop-tim-thong-bao.loi { color: #b42318; }
.hop-tim-ket-qua {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
}
.hop-tim-ket-qua table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.hop-tim-ket-qua th,
.hop-tim-ket-qua td { padding: 0.4rem 0.5rem; border-bottom: 1px solid #e7eef1; text-align: left; }
.hop-tim-ket-qua th.so,
.hop-tim-ket-qua td.so { text-align: right; font-variant-numeric: tabular-nums; }
.hop-tim-ket-qua tbody tr[data-url] { cursor: pointer; }
.hop-tim-ket-qua tbody tr[data-url]:hover,
.hop-tim-ket-qua tbody tr[data-url]:focus {
  background: #eef8f6;
  outline: none;
}
form.khoa-phieu :is(input, select, textarea):not([type="hidden"]) { pointer-events: none; }
form.khoa-phieu .phieu-nav-wrap :is(input, select, textarea),
form.khoa-phieu .phieu-nav :is(input, select, textarea) { pointer-events: auto; }
.trade-split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(16rem, 0.7fr); gap: 0.8rem; align-items: start; }
.trade-side { background: #f7fbfb; border: 1px solid var(--line); border-radius: 12px; padding: 0.6rem 0.8rem 0.8rem; }
.trade-side textarea, .trade-top textarea, .trade-field textarea { width: 100%; box-sizing: border-box; }
.trade-top {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.9fr;
  gap: 0.35rem 0.8rem;
  margin-bottom: 0.7rem;
}
.trade-mua .trade-top,
.trade-ban .trade-top {
  grid-template-columns: 11rem minmax(0, 1fr) 9.5rem;
  width: 100%;
  max-width: 100%;
  justify-content: stretch;
}
.trade-mua .trade-top {
  grid-template-areas:
    "pay pay pay"
    "code name num"
    "desc desc date";
}
.trade-mua .trade-top.tra-gui {
  grid-template-areas:
    "pay pay pay"
    "code name num"
    "bank bname date"
    "desc desc desc";
}
.trade-ban .trade-top,
.trade-ban .trade-top.tra-gui {
  grid-template-areas:
    "pay pay pay"
    "code name num"
    "bank bname date"
    "ecode ename dtthang"
    "desc desc dtyear";
}
.trade-nhap .trade-top,
.trade-xuat .trade-top {
  grid-template-columns: 11rem minmax(0, 1fr) 9.5rem;
  width: 100%;
  max-width: 100%;
  justify-content: stretch;
}
.trade-nhap .trade-top {
  grid-template-areas:
    "nav nav nav"
    "code name num"
    "desc desc date";
}
.trade-xuat .trade-top,
.trade-xuat .trade-top.xuat-dung {
  grid-template-areas:
    "purpose purpose purpose"
    "code name num"
    "fee fname date"
    "desc desc desc";
}
.trade-xuat .trade-top.chuyen-kho {
  grid-template-areas:
    "purpose purpose purpose"
    "code name num"
    "dest dest date"
    "desc desc desc";
}
.trade-top .f-purpose { grid-area: purpose; }
.trade-top .f-nav { grid-area: purpose; }
.trade-nhap .trade-top .f-nav { grid-area: nav; }
.trade-top .f-fee { grid-area: fee; }
.trade-top .f-fname { grid-area: fname; }
.trade-top .f-dest { grid-area: dest; }
.trade-xuat .trade-top .f-fee,
.trade-xuat .trade-top .f-fname { display: block; }
.trade-xuat .trade-top .f-dest { display: none; }
.trade-xuat .trade-top.chuyen-kho .f-fee,
.trade-xuat .trade-top.chuyen-kho .f-fname { display: none; }
.trade-xuat .trade-top.chuyen-kho .f-dest { display: block; }
.trade-xuat .trade-top.xuat-dung .f-fee,
.trade-xuat .trade-top.xuat-dung .f-fname { display: block; }
.trade-xuat .trade-top.xuat-dung .f-dest { display: none; }
.trade-pay {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
  grid-area: pay;
  width: 100%;
  min-width: 0;
}
.trade-pay.f-purpose,
.trade-pay.f-nav {
  margin-bottom: 0.15rem;
}
.trade-pay.f-purpose .field-label,
.trade-pay.f-nav .field-label {
  margin: 0 0.4rem 0 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.trade-pay label { display: flex; align-items: center; gap: 0.35rem; margin: 0; }
.trade-pay input { width: auto; margin: 0; }
.trade-pay > select { width: 8.5rem; margin: 0; }
.trade-top .f-pay { grid-area: pay; }
.trade-top .f-code { grid-area: code; }
.trade-top .f-name { grid-area: name; }
.trade-top .f-num { grid-area: num; }
.trade-top .f-bank { grid-area: bank; }
.trade-top .f-bname { grid-area: bname; }
.trade-top .f-stk { grid-area: stk; }
.trade-top .f-ecode { grid-area: ecode; }
.trade-top .f-ename { grid-area: ename; }
.trade-top .f-dtthang { grid-area: dtthang; }
.trade-top .f-dtyear { grid-area: dtyear; }
.voucher .trade-top .f-bank,
.voucher .trade-top .f-bname,
.voucher .trade-top .f-stk { display: none; }
.voucher .trade-top.tra-gui .f-bank,
.voucher .trade-top.tra-gui .f-bname,
.voucher .trade-top.tra-gui .f-stk,
.voucher .trade-ban .trade-top .f-bank,
.voucher .trade-ban .trade-top .f-bname,
.voucher .trade-ban .trade-top .f-stk { display: block; }
.trade-top .f-date { grid-area: date; }
.trade-top .f-desc { grid-area: desc; }
.trade-top .f-tax { grid-area: tax; }
.trade-top .f-address { grid-area: address; }
.field-plus { position: relative; display: block; }
.field-plus select { padding-right: 1.7rem; }
.field-plus .combo-add {
  position: absolute;
  right: 0.15rem;
  top: 0.28rem;
  height: calc(100% - 0.45rem);
  width: 1.45rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: #fff;
  color: var(--teal);
  font-weight: 700;
}
.trade-top .span-2 { grid-column: span 2; }
.trade-top .span-3 { grid-column: span 3; }
.voucher .trade-field {
  display: block;
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
}
.trade-top .trade-field { margin-bottom: 0; }
.voucher .trade-field input,
.voucher .trade-field select,
.voucher .trade-field textarea { font-weight: 400; }
.trade-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.voucher .trade-table { height: calc(1.75rem * 6 + 18px); width: 100%; max-width: 100%; min-width: 0; overflow: auto; }
.voucher .lines th,
.voucher .lines td {
  height: 1.75rem;
  padding: 0 0.28rem;
  vertical-align: middle;
  box-sizing: border-box;
  overflow: hidden;
}
.voucher .lines td:focus-within { overflow: visible; position: relative; z-index: 3; }
.voucher .lines input,
.voucher .lines select {
  height: 1.55rem;
  margin: 0;
  padding: 0 0.3rem;
}
.voucher .lines thead th { position: sticky; top: 0; z-index: 2; background: #f3faf8; }
.voucher .lines td.o-ton { width: 6.5rem; min-width: 6.5rem; font-variant-numeric: tabular-nums; }
.voucher .lines td.o-ton.am, #tien-ton.am { color: var(--danger); font-weight: 700; }
.voucher .o-ton-tien { width: 9rem; }
.voucher .lines th.cot-xoa,
.voucher .lines td.cot-xoa {
  position: sticky;
  right: 0;
  z-index: 3;
  background: #fff;
  box-shadow: -6px 0 10px rgba(18, 35, 58, 0.08);
  width: 2.6rem;
  min-width: 2.6rem;
  text-align: center;
}
.voucher .lines th.cot-xoa { background: #f3faf8; z-index: 4; }
.voucher .lines td.cot-xoa .xoa-dong { margin: 0 auto; width: 1.45rem; height: 1.45rem; padding: 0.05rem; }
.voucher .trade-mua .trade-top,
.voucher .trade-ban .trade-top,
.voucher .trade-mua .trade-top.tra-gui,
.voucher .trade-ban .trade-top.tra-gui,
.voucher .trade-nhap .trade-top,
.voucher .trade-xuat .trade-top,
.voucher .trade-xuat .trade-top.xuat-dung,
.voucher .trade-xuat .trade-top.chuyen-kho {
  grid-template-columns: 11rem minmax(0, 1fr) 9.5rem;
  width: 100%;
  max-width: 100%;
  justify-content: stretch;
}
.voucher .trade-mua .trade-top { grid-template-areas: "pay pay pay" "code name num" "desc desc date"; }
.voucher .trade-mua .trade-top.tra-gui { grid-template-areas: "pay pay pay" "code name num" "bank bname date" "desc desc desc"; }
.voucher .trade-ban .trade-top,
.voucher .trade-ban .trade-top.tra-gui { grid-template-areas: "pay pay pay" "code name num" "bank bname date" "ecode ename dtthang" "desc desc dtyear"; }
.voucher .lines { width: max-content; }
.sheet.voucher.trade-nhap .lines,
.sheet.voucher.trade-xuat .lines { width: 100%; }
.voucher .lines .o-combo { width: 6.6rem; min-width: 6.6rem; }
.voucher .lines .o-combo .combo-text { width: 100%; }
.voucher .lines input[type="text"],
.voucher .lines input:not([type]) { width: 6.6rem; }
.voucher .lines td.num input { width: 5rem; min-width: 0; }
.sheet .lines { width: max-content; }
.sheet .lines input,
.sheet .lines select { width: 8rem; }
.sheet form > input,
.sheet form > select,
.sheet form > textarea { width: 22rem; }
.voucher .xoa-dong {
  margin: 0;
  padding: 0.2rem;
  width: 1.8rem;
  height: 1.8rem;
  background: #fff;
  color: #b42318;
  border: 1px solid #e7b4b0;
  border-radius: 8px;
  line-height: 0;
}
.voucher .lines input, .voucher .lines select { min-width: 4.2rem; }
.voucher .lines th { background: #f3faf8; white-space: nowrap; }
.voucher .lines td.num, .voucher .lines tfoot td { text-align: right; font-weight: 700; }
.voucher .lines td.num input { text-align: right; min-width: 4.6rem; }
.voucher .lines td.num input.o-ck-pct,
.voucher .lines td.num input.o-gtgt-pct { width: 4.2rem; min-width: 3.6rem; }
.voucher .lines td.num input.o-tu-tinh {
  background: #f3f6f8;
  color: #334155;
  cursor: default;
}
.voucher .lines td.item-name, .voucher .lines td.item-unit { white-space: nowrap; color: var(--ink); }
.trade-grid-foot {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: start;
  gap: 0.6rem 0.8rem;
  margin-top: 0.55rem;
}
.trade-grid-foot p { margin: 0.45rem 0 0; }
.trade-grid-foot .voucher-totals { width: min(18rem, 100%); }
.trade-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.9rem; }
.trade-actions .button, .trade-actions button { margin-top: 0; }
.is-hidden { display: none; }
.voucher-head { display: grid; grid-template-columns: 1.4fr 0.8fr 0.8fr; gap: 0.6rem 1rem; }
.voucher-totals { margin-left: auto; width: min(18rem, 100%); }
.voucher-totals div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.15rem 0; }
.voucher-bar { display: flex; justify-content: space-between; gap: 0.8rem; align-items: center; flex-wrap: wrap; margin-top: 0.6rem; }

@media (max-width: 960px) {
  .shell { display: block; }
  #thanh-cua-so { left: 0.4rem; }
  .voucher-head, .money-grid, .trade-split, .trade-top { grid-template-columns: 1fr; }
  .trade-mua .trade-top, .trade-ban .trade-top, .trade-mua .trade-top.tra-gui, .trade-ban .trade-top.tra-gui,
  .trade-nhap .trade-top, .trade-xuat .trade-top, .trade-xuat .trade-top.xuat-dung, .trade-xuat .trade-top.chuyen-kho { grid-template-areas: none; }
  .trade-top .f-pay, .trade-top .f-purpose, .trade-top .f-nav, .trade-top .f-code, .trade-top .f-name, .trade-top .f-num,
  .trade-top .f-bank, .trade-top .f-bname, .trade-top .f-stk, .trade-top .f-ecode, .trade-top .f-ename, .trade-top .f-dtthang, .trade-top .f-dtyear, .trade-top .f-date, .trade-top .f-desc, .trade-top .f-fname,
  .trade-top .f-tax, .trade-top .f-address, .trade-top .f-fee, .trade-top .f-fname, .trade-top .f-dest { grid-area: auto; }
  .trade-top .span-2, .trade-top .span-3 { grid-column: auto; }
  .money-grid .span-2, .money-grid .span-3 { grid-column: auto; }
}
body.in-window { height: 100vh; overflow: hidden; }
body.in-window .sheet { border: 0; box-shadow: none; padding: 0.4rem 0.7rem 0.8rem; }
body.in-window main {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
body.in-window .sheet.voucher {
  flex: 1 1 auto;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.in-window .sheet.voucher > form {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.in-window .sheet.voucher .nut-phieu { margin-top: auto; }
.voucher .trade-top .trade-field { min-width: 0; }
.voucher .trade-top .trade-field input,
.voucher .trade-top .trade-field select,
.voucher .trade-top .o-combo {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
body.in-window h1 { display: none; }
body.in-window label { margin-top: 0.25rem; font-size: 0.85rem; font-weight: 600; }
body.in-window input,
body.in-window select { padding: 0.35rem 0.5rem; }

.voucher .money-grid { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; }
.voucher .money-row { display: flex; flex-wrap: nowrap; align-items: flex-end; gap: 0.7rem; }
.voucher .money-grid .o { flex: 0 0 auto; }
.voucher .o-tien { width: 9rem; }
.voucher .o-so { width: 8rem; }
.voucher .o-muc-dich { width: 9rem; }
.o-loai-phieu {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
}
.o-loai-phieu label {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.o-loai-phieu select {
  width: 11.5rem;
  margin: 0;
  font-weight: 400;
}
.voucher .o-loai-phieu { width: auto; }
.voucher .o-loai-phieu select { width: 9.5rem; }
.trade-pay .o-loai-phieu select { width: 13.5rem; }
.voucher .money-row:has(.o-loai-phieu) { align-items: center; }
.voucher .o-ma { width: 9rem; }
.voucher .o-ten { width: calc(9rem + 0.7rem + 8rem + 0.7rem + 8rem); }
.voucher .o-dien { width: calc(9rem + 0.7rem + 9rem + 0.7rem + 8rem + 0.7rem + 8rem); }
.voucher .money-grid input, .voucher .money-grid select { width: 100%; box-sizing: border-box; }
.voucher .money-row[hidden], .muc-an[hidden] { display: none !important; }
.chon-muc { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: center; margin: 0.2rem 0 0.45rem; }
.chon-muc label { font-weight: 400; display: flex; gap: 0.35rem; align-items: center; }
.chon-muc input { width: auto; }
.field-label { display: block; font-weight: 600; }
.inline-form { display: inline; }
#khoan-phi .o-combo, #ten-phi-o input, #kho-nhan select { width: 100%; max-width: 100%; }
#so-chung-tu.mo { color: var(--muted); }
.o-combo { position: relative; }
.o-combo .combo-text { padding-right: 3.1rem; margin-top: 0; width: 100%; }
.trade-field .o-combo .combo-add,
.trade-field .o-combo .combo-open,
.lines .o-combo .combo-add,
.lines .o-combo .combo-open { top: 1px; height: calc(100% - 2px); }
.lines .o-combo { min-width: 8.5rem; }
.o-combo .combo-add,
.o-combo .combo-open {
  position: absolute;
  top: 0.15rem;
  height: calc(100% - 0.3rem);
  width: 1.4rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 700;
}
.o-combo .combo-add { right: 1.45rem; z-index: 2; }
.o-combo .combo-open { right: 0.1rem; color: var(--ink); z-index: 2; }
.combo-list[hidden] { display: none !important; }
.combo-list {
  position: absolute;
  z-index: 6;
  left: 0;
  top: 100%;
  min-width: 22rem;
  max-height: 12rem;
  overflow: auto;
  margin: 0.15rem 0 0;
  padding: 0.15rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.combo-list li { display: flex; gap: 0.8rem; padding: 0.28rem 0.5rem; cursor: pointer; }
.combo-list li.combo-dau {
  display: flex;
  gap: 0.8rem;
  padding: 0.28rem 0.5rem;
  font-size: 0.78rem;
  color: #5d7380;
  cursor: default;
  border-bottom: 1px solid var(--line);
}
.combo-list li.combo-dau span:first-child { min-width: 5.5rem; }
.o-combo .combo-kinh {
  position: absolute;
  top: 0.15rem;
  right: 1.45rem;
  height: calc(100% - 0.3rem);
  width: 1.4rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 700;
}
.o-combo .combo-add { right: 2.75rem; }
.o-combo .combo-text { padding-right: 4.3rem; }
.voucher .o-combo .combo-add { right: 1.45rem; }
.voucher .o-combo .combo-text { padding-right: 2.9rem; }
.tra-dm {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(22, 40, 46, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tra-dm[hidden] { display: none; }
.tra-dm-khung {
  width: min(36rem, calc(100vw - 1.5rem));
  max-height: min(28rem, calc(100vh - 2rem));
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 0.8rem 0.9rem 0.9rem;
}
.tra-dm-khung header { display: flex; justify-content: space-between; align-items: center; }
.tra-dm-khung h2 { margin: 0; font-size: 1.05rem; }
.tra-dm table { width: 100%; border-collapse: collapse; margin-top: 0.45rem; }
.tra-dm th, .tra-dm td { text-align: left; padding: 0.35rem 0.4rem; border-bottom: 1px solid #e7eef1; }
.tra-dm th span { display: block; font-size: 0.82rem; }
.tra-dm th input { width: 100%; margin-top: 0.2rem; font-weight: 400; }
.tra-dm tbody tr { cursor: pointer; }
.tra-dm tbody tr:hover { background: #eef8f6; }
.tra-dm tbody tr[hidden] { display: none; }
.tra-dm-nut { display: flex; justify-content: flex-end; gap: 0.4rem; margin-top: 0.55rem; }
.lich-hop {
  position: fixed;
  z-index: 95;
  width: 16.5rem;
  padding: 0.45rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(18, 35, 58, 0.16);
}
.lich-hop[hidden] { display: none; }
.lich-dau { display: flex; align-items: center; gap: 0.25rem; }
.lich-mui, .lich-tieu-de, .lich-o, .nut-lich {
  margin: 0;
  background: #fff;
  color: var(--ink);
  border: 1px solid transparent;
}
.lich-mui, .lich-tieu-de { padding: 0.2rem 0.35rem; }
.lich-tieu-de { flex: 1; font-weight: 700; }
.lich-tieu-de:hover, .lich-mui:hover, .lich-o:hover { background: #eef8f6; }
.lich-luoi { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.12rem; margin-top: 0.35rem; }
.lich-luoi.lich-thang, .lich-luoi.lich-nam { grid-template-columns: repeat(4, 1fr); }
.lich-thu { text-align: center; font-size: 0.72rem; color: #5d7380; }
.lich-thu.t7, .lich-o.t7 { color: #1565c0; }
.lich-thu.cn, .lich-o.cn { color: #c62828; }
.lich-o { padding: 0.28rem 0; border-radius: 6px; }
.lich-o.ngoai { color: #9aadb4; }
.lich-o.t7.ngoai { color: #90b8e0; }
.lich-o.cn.ngoai { color: #e7a39e; }
.lich-o.dang, .lich-o.t7.dang, .lich-o.cn.dang { background: var(--teal); color: #fff; }
.o-ngay-tron { position: relative; display: block; }
.o-ngay-tron > input { width: 100%; padding-right: 1.7rem; box-sizing: border-box; }
.nut-lich {
  position: absolute;
  right: 0.28rem;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #5d7380;
  line-height: 0;
}
.nut-lich svg { width: 0.95rem; height: 0.95rem; display: block; }
.voucher .money-grid .o-ngay { width: 8rem; }
.mau button.mau-lich { opacity: 0.85; }
.o-loc { display: flex; align-items: center; gap: 0.15rem; min-width: 0; }
.o-loc .loc-dau, .o-loc .loc-phu {
  flex: 0 0 auto;
  color: #0f5c56;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}
.o-loc .loc-dau:empty, .o-loc .loc-phu:empty { display: none; }
.mau-bang thead tr.dong-loc .o-loc input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.05rem 0.2rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #172126;
  font-family: "Times New Roman", Times, serif;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
}
.mau-bang thead tr.dong-loc .o-loc input:focus { outline: none; background: #fff; }
.loc-cot {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.05rem;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #466071;
  line-height: 0;
}
.loc-cot svg { width: 0.95rem; height: 0.95rem; display: block; }
.loc-cot:hover, .loc-cot:focus { background: #e5f4f1; color: var(--teal-dark); }
.loc-cot.dang-loc { color: var(--teal-dark); }
.mau-bang thead tr.dong-loc th {
  padding: 0.12rem 0.2rem;
  background: #f4f8f8;
  border-top: 1px solid #c5d5d8;
  font-weight: 400;
  vertical-align: middle;
}
.mau-bang thead tr.dong-loc th.dang-loc { background: #e5f4f1; }
.hop-loc-cot {
  position: fixed;
  z-index: 94;
  width: 16.5rem;
  padding: 0.55rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(18, 35, 58, 0.16);
}
.hop-loc-cot[hidden] { display: none; }
.hop-loc-cot label { display: grid; gap: 0.2rem; margin: 0 0 0.4rem; font-size: 0.82rem; font-weight: 600; }
.hop-loc-cot select, .hop-loc-cot input { font-weight: 400; width: 100%; }
.hop-loc-nut { display: flex; justify-content: flex-end; gap: 0.35rem; }
@media print {
  .dong-loc, .loc-cot, .nut-lich, .lich-hop, .hop-loc-cot, .tra-dm { display: none !important; }
}
.combo-list li[hidden] { display: none !important; }
.combo-list li span:first-child { min-width: 5.5rem; font-weight: 600; }
.combo-list li:hover,
.combo-list li:focus { background: #e7f3f2; }
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; }
dialog.dm-dialog { width: min(52rem, 96vw); max-height: 88vh; overflow: auto; }
dialog.dm-dialog h2 { margin: 0 0 0.4rem; font-size: 1.15rem; }
@media (max-width: 720px) {
  dialog.dm-dialog .dm-row.cols-2,
  dialog.dm-dialog .dm-row.cols-3 { grid-template-columns: 1fr; }
}
dialog::backdrop { background: rgba(28, 40, 51, 0.35); }
dialog label { display: block; }
dialog button { margin-right: 0.4rem; }

body.giao-don-gian main { padding: 0; }
body.giao-don-gian .simple-home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% 0%, rgba(13, 110, 106, 0.08), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(31, 95, 191, 0.07), transparent 26%),
    #f3f7f9;
  overflow-x: hidden;
}
body.giao-don-gian .simple-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 0.35rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
body.giao-don-gian .simple-name {
  font-size: 1rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.giao-don-gian .simple-year,
body.giao-don-gian .simple-tools,
body.giao-don-gian .simple-tools form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  width: auto;
  flex: 0 0 auto;
}
body.giao-don-gian .simple-bar .org-switch { flex: 0 1 16rem; min-width: 0; }
body.giao-don-gian .simple-bar .org-switch select { max-width: 12rem; }
body.giao-don-gian .simple-bar label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  width: auto;
  font-weight: 600;
}
body.giao-don-gian .simple-bar input {
  width: 5rem;
  max-width: 5rem;
  margin: 0;
  flex: 0 0 5rem;
}
body.giao-don-gian .simple-year select {
  width: 3.6rem;
  max-width: 3.6rem;
  margin: 0;
}
body.giao-don-gian .simple-bar .button,
body.giao-don-gian .simple-bar button { margin: 0; }
body.giao-don-gian .simple-tools { margin-left: auto; }
body.giao-don-gian .simple-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
  gap: 0.9rem;
  padding: 0.9rem 1rem 1rem;
  min-height: 0;
}
body.giao-don-gian .bang {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #dce8e6;
  border-radius: 20px;
  overflow: hidden;
}
body.giao-don-gian .day-buoc {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1rem 1rem 1.2rem;
  min-height: 0;
  gap: 1rem;
}
body.giao-don-gian .bang-logo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
}
body.giao-don-gian .bang-logo img {
  width: min(16.5rem, 68vw);
  height: auto;
  display: block;
}
body.giao-don-gian .bang-slogan {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #0b5cad;
  text-align: center;
}
body.giao-don-gian .cum-giua {
  width: min(56rem, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}
body.giao-don-gian .cum-buoc {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.55rem;
  align-items: stretch;
}
body.giao-don-gian .buoc-thue {
  width: min(14.5rem, 100%);
}
body.giao-don-gian .buoc-the {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
body.giao-don-gian .buoc-chinh {
  display: grid;
  gap: 0.35rem;
  justify-items: start;
  min-height: 9.5rem;
  padding: 1rem;
  border: 1px solid #d7e6e3;
  border-radius: 18px;
  background:
    linear-gradient(180deg, #f7fcfb 0%, #ffffff 58%);
  color: var(--teal-dark);
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
body.giao-don-gian .buoc-chinh:hover {
  transform: translateY(-2px);
  border-color: #9fc9c4;
  background: #fff;
}
body.giao-don-gian .buoc-hai {
  align-content: center;
}
body.giao-don-gian .buoc-hai:hover {
  transform: none;
}
body.giao-don-gian .buoc-hai a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 3.2rem;
  color: inherit;
  text-decoration: none;
}
body.giao-don-gian .buoc-hai a:hover .buoc-ten {
  color: var(--teal-dark);
}
body.giao-don-gian .buoc-hai .buoc-icon {
  width: 2.6rem;
  height: 2.6rem;
}
body.giao-don-gian .buoc-icon {
  width: 3.1rem;
  height: 3.1rem;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #e7f4f3;
}
body.giao-don-gian .buoc-icon .nut-icon,
body.giao-don-gian .buoc-icon img,
body.giao-don-gian .buoc-icon svg {
  width: 1.85rem;
  height: 1.85rem;
}
body.giao-don-gian .buoc-ten {
  font-size: 1.08rem;
  font-weight: 750;
  color: var(--ink);
}
body.giao-don-gian .buoc-mo {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}
body.giao-don-gian .buoc-phu {
  display: grid;
  gap: 0.4rem;
}
body.giao-don-gian .buoc-phu a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.3rem 0.7rem 0.3rem 0.35rem;
  border: 1px solid #d7e6e3;
  border-radius: 12px;
  background: #fff;
  color: var(--teal-dark);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease;
}
body.giao-don-gian .buoc-phu a:hover {
  background: #eef8f7;
  border-color: #9fc9c4;
}
body.giao-don-gian .buoc-phu .nut-icon,
body.giao-don-gian .buoc-phu img,
body.giao-don-gian .buoc-phu svg {
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
}
body.giao-don-gian .simple-side {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.15rem 1rem;
  align-self: start;
  position: sticky;
  top: 0.9rem;
}
body.giao-don-gian .simple-side .hello { margin: 0; color: var(--muted); font-size: 0.9rem; }
body.giao-don-gian .simple-side h2 { margin: 0.25rem 0 1rem; font-size: 1.02rem; line-height: 1.35; }
body.giao-don-gian .simple-side .figures {
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
body.giao-don-gian .simple-side .figures div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid #e5eef0;
  border-radius: 12px;
  background: #f8fbfb;
}
body.giao-don-gian .simple-side .figures dt,
body.giao-don-gian .simple-side .figures dd {
  margin: 0;
  white-space: nowrap;
}
body.giao-don-gian .simple-side .figures dd {
  margin-left: auto;
  text-align: right;
  font-size: 1.05rem;
}
body.giao-don-gian .simple-side .figures .am,
body.giao-don-gian .simple-side .figures .am dt,
body.giao-don-gian .simple-side .figures .am dd { color: var(--danger); }
body.giao-don-gian .bang .warning { margin: 0.4rem 1rem; }
body.giao-don-gian .chan-bang {
  margin-top: auto;
  display: flex;
  justify-content: space-around;
  gap: 0.6rem;
  padding: 0.7rem 0.6rem;
  border-top: 1px solid #e1eeeb;
  background: #f7fbfb;
}
body.giao-don-gian .chan-muc { position: relative; }
body.giao-don-gian .chan-bang > .chan-muc > a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--teal-dark);
  font-weight: 700;
  text-decoration: none;
  padding: 0.35rem 0.2rem;
}
body.giao-don-gian .menu-con {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 24rem;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid #d7e6e3;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(22, 40, 46, 0.12);
  z-index: 4;
}
body.giao-don-gian .chan-muc:first-child .menu-con { left: 0; transform: none; }
body.giao-don-gian .chan-muc:last-child .menu-con { left: auto; right: 0; transform: none; }
body.giao-don-gian .chan-muc:hover .menu-con,
body.giao-don-gian .chan-muc:focus-within .menu-con { display: flex; flex-direction: column; }
body.giao-don-gian .menu-con a {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  color: var(--teal-dark);
  font-weight: 600;
  text-decoration: none;
  white-space: normal;
}
body.giao-don-gian .menu-con a:hover { background: #e7f4f3; }

.figures { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem 1rem; margin: 0; }
.figures div { margin: 0; }
.figures dt { color: var(--muted); font-size: 0.88rem; }
.figures dd { margin: 0.1rem 0 0; font-size: 1.2rem; font-weight: 700; }
@media (max-width: 1100px) {
  body.giao-don-gian .cum-buoc {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  body.giao-don-gian .buoc-thue { width: 100%; }
}
@media (max-width: 760px) {
  body.giao-don-gian .simple-body { grid-template-columns: 1fr; }
  body.giao-don-gian .simple-side { position: static; }
  body.giao-don-gian .buoc-chinh { min-height: 0; }
}

body.in-window .sheet:has(.dm-form) { width: max-content; margin: 0; }
.dm-form { width: max-content; height: auto; }
.dm-form label { display: grid; gap: 0.25rem; margin: 0.55rem 0; }
.dm-form > label:not(.tick) { width: 20rem; }
.dm-form:has(.dm-row) > label:not(.tick) { width: 41.6rem; }
.dm-form:has(.o-hd) > label:not(.tick) { width: 50.2rem; }
.dm-form .tick { display: flex; align-items: center; gap: 0.4rem; width: auto; }
.dm-form .tick input { width: auto; }
.dm-row { display: flex; align-items: flex-end; gap: 0.7rem; }
.dm-row > label { flex: 0 0 auto; margin: 0.55rem 0; }
.dm-row.cols-2 > label { width: 20.45rem; }
.dm-row.cols-3 > label { width: 13.4rem; }
.dm-row.cols-3 > label.span-2 { width: 27.5rem; }
.mau-bo-loc { margin: 0.35rem 0 0.45rem; }
.mau-loc-dong { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.15rem 1.15rem; }
.mau-loc-dong:not(:has(.mau-line)) { display: none; }
.mau-tick-hang { display: flex; justify-content: center; gap: 0.8rem; margin: 0.35rem 0 0; }
.mau-tick { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0 0.9rem 0.25rem 0; font-weight: 600; }
.mau-tick input { width: auto; margin: 0; }
.dm-form input,
.dm-form select,
.dm-form textarea { width: 100%; max-width: 100%; box-sizing: border-box; }
.dm-form input[type="radio"],
.dm-form input[type="checkbox"] { width: auto; max-width: none; }
.dm-form label .ghost { width: auto; justify-self: start; }
.dm-form .o-combo { width: 100%; }
.dm-form .o-combo .combo-add,
.dm-form .o-combo .combo-open { top: 1px; height: calc(100% - 2px); }
.dm-row.cols-3 > label.o-hd { width: 22rem; }
.voucher .trade-mua .trade-top,
.voucher .trade-ban .trade-top,
.voucher .trade-mua .trade-top.tra-gui,
.voucher .trade-ban .trade-top.tra-gui,
.voucher .trade-nhap .trade-top,
.voucher .trade-xuat .trade-top,
.voucher .trade-xuat .trade-top.xuat-dung,
.voucher .trade-xuat .trade-top.chuyen-kho {
  grid-template-columns: 11rem minmax(0, 1fr) 9.5rem;
  width: 100%;
  max-width: 100%;
  justify-content: stretch;
}
.voucher .trade-mua .trade-top { grid-template-areas: "pay pay pay" "code name num" "desc desc date"; }
.voucher .trade-mua .trade-top.tra-gui { grid-template-areas: "pay pay pay" "code name num" "bank bname date" "desc desc desc"; }
.voucher .trade-ban .trade-top,
.voucher .trade-ban .trade-top.tra-gui { grid-template-areas: "pay pay pay" "code name num" "bank bname date" "ecode ename dtthang" "desc desc dtyear"; }
.voucher .trade-top .f-code { grid-area: code; }
.voucher .trade-top .f-name { grid-area: name; }
.voucher .trade-top .f-num { grid-area: num; }
.voucher .trade-top .f-bank { grid-area: bank; }
.voucher .trade-top .f-bname { grid-area: bname; }
.voucher .trade-top .f-stk { grid-area: stk; }
.voucher .trade-top .f-ecode { grid-area: ecode; }
.voucher .trade-top .f-ename { grid-area: ename; }
.voucher .trade-top .f-dtthang { grid-area: dtthang; }
.voucher .trade-top .f-dtyear { grid-area: dtyear; }
.voucher .trade-top .f-date { grid-area: date; }
.voucher .trade-top .f-desc { grid-area: desc; }
.voucher .trade-top .f-tax { grid-area: tax; }
.voucher .trade-top .f-address { grid-area: address; }
.voucher .lines td.item-name { width: 8rem; min-width: 8rem; }
.voucher .lines td.item-unit { width: 4.5rem; min-width: 4.5rem; }
.dm-choices { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.dm-choices ul, .dm-form #id_party, .dm-form #id_gender { display: flex; gap: 1rem; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.dm-form h3 { margin: 1rem 0 0.2rem; font-size: 1rem; }
.dm-actions { display: flex; justify-content: flex-end; gap: 0.45rem; }
.dm-actions .button,
.dm-actions button { margin-top: 0.7rem; }
.so-du h2 { margin: 1.2rem 0 0.4rem; font-size: 1.05rem; }
.so-du table { margin-top: 0.3rem; }
.so-du td input, .so-du td select { width: 100%; margin: 0; }
.so-du td:nth-child(n+2) input { text-align: right; }
.dm-actions .xoa-dm { margin-right: auto; background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.dm-actions .xoa-dm:hover { background: #fff4f4; }