:root {
  color-scheme: light;
  --primary: #1976d2;
  --primary-dark: #0d47a1;
  --primary-light: #eaf3fc;
  --text: #17273d;
  --muted: #52647b;
  --border: #dce4ee;
  --paper: #fff;
  --body: #f2f4f8;
  --danger: #a92436;
  --radius: 14px;
  font-family: 'HarmonyOS Sans SC', 'Microsoft YaHei UI', 'PingFang SC', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--body); color: var(--text); font-size: 14px; }
h1, h2, p { margin: 0; }
h1 { font-size: 21px; line-height: 1.35; }
h2 { font-size: 20px; line-height: 1.35; }
button, input { font: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid #79b8f4; outline-offset: 2px; }

.topbar { background: linear-gradient(102deg, var(--primary-dark), var(--primary)); color: var(--paper); }
.topbar-inner { margin: auto; max-width: 1240px; min-height: 60px; padding: 8px 26px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; white-space: nowrap; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #ffffff66; border-radius: 9px; font-size: 19px; background: #ffffff1a; }
.brand-divider { height: 16px; width: 1px; background: #ffffff55; }
.section-name { font-weight: 500; }
main { max-width: 1240px; margin: 0 auto; padding: 24px 26px; }
.panel { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 18px #17325508; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; }

.button { min-height: 34px; display: inline-flex; justify-content: center; align-items: center; padding: 6px 13px; border: 1px solid transparent; border-radius: 8px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.button:disabled { cursor: wait; opacity: .65; }
.button.primary { background: var(--primary-dark); color: var(--paper); }
.button.primary:not(:disabled):hover { background: #103f8a; }
.button.secondary { background: var(--paper); color: var(--primary-dark); border-color: var(--border); }
.button.secondary:not(:disabled):hover { background: var(--primary-light); }
.button.on-dark { background: #ffffff18; border-color: #ffffff60; color: var(--paper); }
.button.on-dark:hover { background: #ffffff30; }
.button.row-button { min-height: 30px; padding: 5px 10px; background: var(--primary-light); color: var(--primary-dark); font-size: 13px; }
.button.row-button:hover { background: #dceeff; }

.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 820px; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 11px 12px; text-align: left; vertical-align: middle; overflow-wrap: anywhere; }
th:first-child, td:first-child { padding-left: 20px; width: 18%; }
th:nth-child(2) { width: 24%; }
th:nth-child(3) { width: 13%; }
th:nth-child(4) { width: 16%; }
th:nth-child(5) { width: 16%; }
th:last-child, td:last-child { padding-right: 20px; }
thead { background: #f5f8fc; color: var(--muted); border-block: 1px solid var(--border); }
th { font-size: 12px; font-weight: 600; }
tbody tr + tr { border-top: 1px solid var(--border); }
tbody tr:hover { background: #f8fbff; }
.number-cell, .actions { text-align: right; }
.actions .row-button + .row-button { margin-top: 5px; }
.amount, .order-no { font-variant-numeric: tabular-nums; font-weight: 650; }
.detail { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.detail.order-remark { max-width: 24rem; overflow-wrap: anywhere; }
.transaction-number { overflow-wrap: anywhere; }
.detail.invoice-name { max-height: 2.9em; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.badge { display: inline-flex; padding: 3px 8px; border-radius: 6px; white-space: nowrap; font-size: 12px; font-weight: 600; background: #edf1f6; color: #475a70; }
.badge.pending, .badge.review { background: #fff2d6; color: #804800; }
.badge.paid { background: #e5f5ee; color: #1a644a; }
td.empty { padding: 32px 20px; text-align: center; color: var(--muted); }
.footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: center; }

.login-panel { max-width: 366px; margin: min(9vh, 88px) auto 0; padding: 25px; display: grid; gap: 8px; }
.login-panel h1 { margin-bottom: 8px; }
.login-panel label:not(:first-of-type) { margin-top: 6px; }
.login-panel .primary { margin-top: 5px; min-height: 40px; }
label { color: var(--text); font-weight: 600; }
input { min-width: 0; width: 100%; min-height: 38px; border: 1px solid #bac9da; border-radius: 8px; padding: 8px 10px; background: var(--paper); color: var(--text); }
input::placeholder, small { color: var(--muted); }
input[type='file'] { padding: 5px; }
input[type='file']::file-selector-button { color: var(--primary-dark); background: var(--primary-light); border: 0; border-radius: 5px; padding: 6px 10px; margin-right: 8px; font: inherit; cursor: pointer; }
.message { color: var(--muted); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.message:empty { display: none; }
.panel > .message:not(:empty) { padding: 0 20px 12px; }
.message.error { color: var(--danger); }

dialog { width: min(420px, calc(100vw - 32px)); max-width: none; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 0; box-shadow: 0 16px 56px #152c5240; }
dialog::backdrop { background: #17273d64; }
.action-form { display: grid; gap: 14px; padding: 22px; }
.order-summary { padding: 10px 12px; background: #f4f7fb; border-radius: 8px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.field-group { display: grid; gap: 7px; }
.field-group label:not(:first-child) { margin-top: 5px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 680px) {
  .topbar-inner, main { padding-inline: 14px; }
  main { padding-top: 16px; }
  .panel-header { padding-inline: 14px; }
}
