@font-face {
  font-family: Thai;
  src: url('../fonts/NotoSansThai.woff2') format('woff2');
  font-display: swap;
}
:root {
  --ink: #17161c;
  --paper: #f7f5f2;
  --card: #fff;
  --accent: #6b4e9e;
  --accent-soft: #f0ebf8;
  --line: #e4e0da;
  --muted: #6e6a72;
  --danger: #b33129;
  --sidebar: 236px;
  --header: 72px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px Thai,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button {
  border: 1px solid var(--accent);
  border-radius: 9px;
  background: var(--accent);
  color: white;
  padding: 9px 15px;
  min-height: 40px;
  cursor: pointer;
  line-height: 1.45;
  font-weight: 600;
  transition: background .15s;
}
button:hover {
  background: #593c89;
}
button.secondary {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}
button.secondary:hover {
  background: var(--accent-soft);
  border-color: #c4b5dc;
}
button:disabled {
  opacity: .4;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
  padding: 10px 12px;
  min-height: 42px;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}
input[readonly] {
  background: var(--paper);
}
input[type=checkbox] {
  width: 20px;
  min-height: 20px;
}
textarea {
  min-height: 94px;
  resize: vertical;
}
label {
  display: block;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  margin: 12px 0 16px;
}
label > input,
label > select,
label > textarea {
  display: block;
  margin-top: 6px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 27px;
  line-height: 1.3;
  margin-bottom: 8px;
  letter-spacing: -.5px;
}
h2 {
  font-size: 18px;
  line-height: 1.4;
  margin-bottom: 16px;
}
h3 {
  font-size: 16px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 0 18px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  display: none!important;
}
.app-header,
.login-header {
  height: var(--header);
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0 26px;
}
.app-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
}
.brand {
  font: 800 24px -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  letter-spacing: -1px;
  color: var(--ink);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover {
  text-decoration: none;
}
.brand span {
  font-size: 11px;
  letter-spacing: 1.3px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 7px;
  border-radius: 6px;
}
.header-label {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-left: auto;
}
.identity {
  font-size: 12px;
  color: var(--muted);
}
.header-tools > button {
  font-size: 12px;
  min-height: 34px;
  padding: 7px 10px;
}
.language-selector {
  margin: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
}
.language-selector:after {
  content: "";
  pointer-events: none;
  border: 4px solid transparent;
  border-top-color: var(--muted);
  position: absolute;
  right: 11px;
  top: calc(50% + 2px);
}
.language-selector select {
  appearance: none;
  -webkit-appearance: none;
  width: 112px;
  min-height: 36px;
  margin: 0;
  padding: 7px 29px 7px 12px;
  font-size: 13px;
  cursor: pointer;
  background: var(--paper);
  border-color: transparent;
}
.language-selector select:hover {
  border-color: var(--line);
}
.login-page > .language-selector {
  position: absolute;
  right: 26px;
  top: 18px;
}
.sidebar {
  position: fixed;
  top: var(--header);
  bottom: 0;
  left: 0;
  width: var(--sidebar);
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 28px 16px 18px;
  display: flex;
  flex-direction: column;
  overflow: auto;
  z-index: 19;
}
.sidebar nav {
  flex: 1;
}
.nav-group {
  margin-bottom: 25px;
}
.nav-caption {
  font-size: 11px;
  color: #8a8390;
  letter-spacing: 1px;
  font-weight: 600;
  margin: 0 12px 9px;
}
.nav-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 9px;
  color: #57515f;
  font-weight: 500;
  margin: 3px 0;
}
.nav-item:hover {
  background: var(--paper);
  text-decoration: none;
}
.nav-item[aria-current=page] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.nav-item[aria-current=page]:before {
  content: "";
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 10px;
}
.sidebar-account {
  border-top: 1px solid var(--line);
  padding: 20px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.account-name {
  font-weight: 600;
}
.icon-button {
  background: none;
  border: 0;
  color: var(--ink);
  padding: 4px 8px;
  font-size: 21px;
}
.icon-button:hover {
  background: var(--accent-soft);
}
#nav-toggle {
  display: none;
}
.nav-scrim {
  display: none;
}
.workspace-main {
  margin: var(--header) 0 0 var(--sidebar);
  padding: 16px 28px 40px;
  max-width: 1800px;
}
.staff-workspace {
  line-height: 1.5;
}
.breadcrumbs {
  display: flex;
  gap: 11px;
  align-items: center;
  font-size: 12px;
  color: #918995;
  min-height: 22px;
  margin-bottom: 12px;
}
.breadcrumbs a {
  color: var(--muted);
}
.breadcrumbs > button {
  margin-left: auto;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 26px;
}
.page-heading p {
  margin: 0;
  max-width: 800px;
}
.page-heading > button {
  white-space: nowrap;
}
.list-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}
.request-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 10px;
}
.request-filters button[aria-pressed="true"] {
  background: #f0ebf8;
  border-color: var(--accent);
}
.payment-link-summary table {
  table-layout: fixed;
  min-width: 0;
}
.payment-link-summary th:first-child {
  width: 38%;
}
.payment-link-summary th,
.payment-link-summary td {
  overflow-wrap: anywhere;
  white-space: normal;
}
.payment-link-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.list-toolbar label {
  margin: 0;
}
.list-toolbar input,
.list-toolbar select {
  margin: 0;
}
.list-toolbar .search-field {
  flex: 1;
  min-width: 170px;
  max-width: 460px;
}
.list-toolbar > label:not(.search-field) {
  max-width: 175px;
}
.list-toolbar > label.sort-field {
  flex: 0 0 280px;
  max-width: 100%;
}
.list-toolbar button {
  margin-left: auto;
}
.table-wrap {
  width: 100%;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
th {
  background: #faf9f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}
td {
  padding: 11px 16px;
  border-bottom: 1px solid #eeeae5;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
tr:last-child td {
  border-bottom: 0;
}
tr:hover td {
  background: #fcfbfe;
}
td .order {
  font-weight: 600;
  white-space: nowrap;
}
td button {
  font-size: 12px;
  padding: 7px 10px;
  min-height: 33px;
  white-space: nowrap;
}
td .row {
  min-width: 160px;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}
.page-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}
.page-controls button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}
.page-size {
  margin: 0 8px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.page-size select {
  width: 65px;
  min-height: 32px;
  margin: 0;
  padding: 5px 8px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 6px;
  font-size: 11px;
  padding: 4px 8px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge-success {
  background: #eaf4ef;
  color: #2e7155;
}
.empty {
  padding: 70px 24px;
  text-align: center;
  color: var(--muted);
}
[aria-busy=true] {
  opacity: .55;
  pointer-events: none;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 10px 20px;
}
.lookup-form {
  display: flex;
  align-items: end;
  gap: 12px;
}
.lookup-form label {
  flex: 1;
  max-width: 520px;
}
.lookup-form input {
  margin-top: 6px;
  font-family: ui-monospace, monospace;
}
.detail-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.detail-groups button[aria-pressed=true] {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.info-grid p {
  margin-bottom: 4px;
}
.amount {
  font-size: 30px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: -.5px;
}
.detail-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin: 12px 0 16px;
  overflow: auto;
}
.detail-tabs button {
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  padding: 10px 1px 13px;
  font-size: 14px;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.detail-tabs button[aria-selected=true] {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}
.detail-tabs button:hover {
  color: var(--accent);
}
[role=tabpanel] > .table-wrap {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 18px;
}
[role=tabpanel] > .action-entry {
  margin: 14px 10px 14px 0;
  display: inline-block;
}
.notice {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 16px 20px;
  color: #64527f;
  font-size: 13px;
}
.warning {
  border-left: 3px solid #b38432;
  background: #fff6df;
  border-radius: 6px;
  padding: 15px;
  color: #78511b;
  font-size: 13px;
  white-space: pre-wrap;
}
.success {
  color: #2e7155;
}
details {
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 30px;
}
details > table,
details > .table-wrap {
  margin-top: 16px;
}
details > form {
  margin-top: 12px;
}
code {
  font: 12px ui-monospace,monospace;
  overflow-wrap: anywhere;
}
.form-dialog {
  width: min(700px,calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 100px #17161c26;
}
.form-dialog::backdrop,
dialog::backdrop {
  background: #211b2e66;
}
.dialog-heading {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 18px;
}
.dialog-heading h2 {
  font-size: 21px;
  margin: 0;
}
.dialog-heading button {
  min-height: 32px;
  font-size: 12px;
}
.form-dialog details {
  border: 0;
  padding: 0;
  margin: 0;
}
.form-dialog form > button[type=submit] {
  margin-top: 10px;
  width: 100%;
}
.form-dialog .grid label {
  color: var(--muted);
}
dialog:not(.form-dialog) {
  max-width: 95vw;
  max-height: 95vh;
  border: 0;
  border-radius: 12px;
  padding: 20px;
}
dialog img {
  max-width: 85vw;
  max-height: 75vh;
  object-fit: contain;
}
#message:empty {
  display: none;
}
#message {
  border: 1px solid #dacfeb;
  border-radius: 10px;
  background: #f0ebf8;
  padding: 14px 18px;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#pending {
  background: #fff8e8;
  border: 1px solid #ddc589;
  border-radius: 10px;
  padding: 18px;
  margin: 16px 0;
}
#pending button {
  margin: 6px 8px 0 0;
}
.login {
  width: calc(100% - 32px);
  max-width: 440px;
  margin: 8vh auto;
  background: white;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.login h1 {
  font-size: 26px;
}
.login form > button {
  width: 100%;
  margin-top: 10px;
}
.eyebrow {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 20px;
}
.login-header {
  background: transparent;
  border: 0;
}
.login .muted {
  line-height: 1.6;
}
@media (min-width:1600px) {
  .workspace-main {
    padding-left: 46px;
    padding-right: 46px;
  }
}
@media (max-width:1100px) {
  :root {
    --sidebar: 204px;
  }
  .workspace-main {
    padding: 16px;
  }
  .identity {
    display: none;
  }
  .header-label {
    display: none;
  }
  .info-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .pagination {
    align-items: flex-start;
  }
  .page-controls {
    flex-wrap: wrap;
  }
  td,
  th {
    padding-left: 13px;
    padding-right: 13px;
  }
}
@media (max-width:760px) {
  :root {
    --header: 62px;
  }
  .app-header {
    padding: 0 14px;
    gap: 12px;
  }
  .header-tools {
    gap: 8px;
  }
  .header-tools > button {
    font-size: 11px;
    padding: 6px;
  }
  .language-selector select {
    width: 96px;
    font-size: 12px;
  }
  .brand {
    font-size: 21px;
  }
  .brand span {
    font-size: 9px;
    padding: 5px;
  }
  #nav-toggle {
    display: block;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .15s;
    width: 236px;
  }
  .nav-open .sidebar {
    transform: translateX(0);
  }
  .nav-open .nav-scrim {
    display: block;
    position: fixed;
    inset: var(--header) 0 0;
    z-index: 18;
    background: #17161c55;
    border: 0;
    border-radius: 0;
  }
  .workspace-main {
    margin-left: 0;
    padding: 12px 14px 32px;
  }
  .breadcrumbs {
    margin-bottom: 12px;
    font-size: 11px;
  }
  h1 {
    font-size: 23px;
  }
  .page-heading {
    margin-bottom: 20px;
  }
  .page-heading p {
    font-size: 12px;
  }
  .list-toolbar {
    padding: 14px;
    flex-wrap: wrap;
    gap: 9px;
  }
  .list-toolbar .search-field {
    flex-basis: 100%;
    max-width: none;
  }
  .list-toolbar > label:not(.search-field) {
    max-width: none;
    flex: 1;
  }
  .list-toolbar > label.sort-field {
    flex: 1 0 100%;
  }
  .list-toolbar select {
    font-size: 12px;
  }
  .list-toolbar button {
    font-size: 12px;
  }
  table {
    min-width: 660px;
  }
  .pagination {
    padding: 14px;
  }
  .page-size {
    width: 100%;
    margin-bottom: 6px;
  }
  .page-controls {
    gap: 6px;
  }
  #page-number {
    margin: 0 2px;
  }
  .card {
    padding: 14px;
  }
  .amount {
    font-size: 27px;
  }
  .detail-tabs {
    gap: 20px;
    margin-top: 10px;
  }
  .detail-tabs button {
    font-size: 13px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .form-dialog {
    padding: 20px;
  }
  .info-grid {
    gap: 14px;
  }
  .login {
    margin: 4vh auto;
    padding: 26px;
  }
  .login-header {
    padding: 0 18px;
  }
}
@media (prefers-reduced-motion:reduce) {
  * {
    transition: none!important;
  }
}

/* 小屏列表采用带列名的紧凑记录，金额和操作无需横向寻找。 */
.sidebar-account {
  padding-bottom: 24px;
}
.currency-cell {
  white-space: nowrap;
}
.reference-code {
  white-space: nowrap;
  word-break: normal;
  font-size: 12px;
}
@media (max-width: 760px) {
  .list-card .table-wrap {
    overflow: visible;
  }
  .list-card table,
  .list-card tbody {
    display: block;
    min-width: 0;
  }
  .list-card tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
  }
  .list-card tr:has(th) {
    display: none;
  }
  .list-card tr:last-child {
    border-bottom: 0;
  }
  .list-card td {
    display: block;
    border: 0;
    padding: 0;
    min-width: 0;
    font-size: 12px;
  }
  .list-card td:before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 10px;
    margin-bottom: 2px;
  }
  .list-card td:first-child {
    grid-column: 1 / -1;
    font-size: 13px;
  }
  .list-card td:first-child:before,
  .list-card td:last-child:before {
    display: none;
  }
  .list-card td:first-child a {
    white-space: normal;
  }
  .list-card td:last-child {
    grid-column: 1 / -1;
    align-self: end;
    text-align: right;
  }
  .list-card td:last-child a {
    display: inline-block;
    padding: 7px 10px;
    background: var(--accent-soft);
    border-radius: 6px;
  }
  .list-card tr:hover td {
    background: none;
  }
}
.date-time-field {
  min-width: 0;
}
.date-time-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.date-time-row > input {
  flex: 1;
  min-width: 0;
  width: 0;
}
.date-time-row > button {
  flex: none;
  padding: 8px 10px;
  margin: 0;
  font-size: .85rem;
}
.review-hint {
  grid-column: 1 / -1;
  margin: 0;
}
.confirmation-field {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.confirmation-field > input {
  width: 18px;
  height: 18px;
  flex: none;
  margin: 0;
}
.success-toast {
  position: fixed;
  z-index: 2000;
  top: 76px;
  left: 50%;
  width: max-content;
  max-width: min(640px, calc(100vw - 32px));
  padding: 12px 18px;
  color: #fff;
  background: #175b49;
  border-radius: 10px;
  box-shadow: 0 6px 24px #18382a26;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
}
.success-toast.toast-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.exception-preview {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.exception-summary {
  overflow-wrap: anywhere;
}
@media (prefers-reduced-motion: reduce) {
  .success-toast {
    transition: none;
  }
}

.exception-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  margin: 16px 0;
}
.exception-facts > div {
  min-width: 0;
}
.exception-facts dt {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.exception-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.exception-summary table {
  font-size: 12px;
}
.exception-summary th,
.exception-summary td {
  padding: 8px 10px;
}
@media (max-width: 480px) {
  .exception-facts {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
