:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1c2b3f;
  background: #edf1f6;
  --nav: #213954;
  --panel: #fff;
  --line: #cbd5e1;
  --soft-line: #dfe6ee;
  --tint: #f4f7fb;
  --text-muted: #53657a;
  --accent: #195aa5;
  --accent-dark: #12457f;
  --focus: #2675cf;
}

* { box-sizing: border-box; }

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  margin: 0;
}

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

button, input, textarea, select {
  border: 1px solid var(--line);
  border-radius: 4px;
  color: inherit;
}

button {
  min-height: 34px;
  padding: 5px 12px;
  background: var(--panel);
  cursor: pointer;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  border-color: #90a9c8;
  background: var(--tint);
}

button:disabled {
  color: #67778a;
  background: #f5f7f9;
  cursor: default;
}

.button-primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
  font-weight: 600;
}

.button-primary:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

input, textarea, select {
  width: 100%;
  min-width: 0;
  padding: 6px 9px;
  background: var(--panel);
}

input, select { min-height: 34px; }

input::placeholder, textarea::placeholder {
  color: #617288;
  opacity: 1;
}

textarea {
  display: block;
  min-height: 67px;
  resize: vertical;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.workbench-header {
  color: #fff;
  background: var(--nav);
  border-bottom: 1px solid #182b42;
}

.workbench-header-inner {
  display: flex;
  min-height: 48px;
  padding: 0 18px;
  align-items: stretch;
}

.workbench-name {
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 670;
  white-space: nowrap;
}

.workbench-shortcuts { position: relative; margin-inline-start: 12px; }
.workbench-shortcuts > summary { padding: 3px 6px; cursor: pointer; }
.workbench-shortcuts > summary.current-shortcut { text-decoration: underline; }
.workbench-shortcuts nav {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  width: 11rem;
  max-height: 65vh;
  overflow-y: auto;
  background: #edf5ff;
  border: 1px solid #98aec7;
  box-shadow: 0 3px 8px rgb(35 56 77 / 20%);
}
.workbench-shortcuts nav a { display: block; padding: 4px 10px 4px 18px; color: #274768; text-decoration: none; }
.workbench-shortcuts nav a:hover, .workbench-shortcuts nav a[aria-current="page"] { background: #cedff0; }

.session-logout {
  align-self: center;
  margin-inline-start: auto;
  min-height: 25px;
  padding: 1px 8px;
  color: #213954;
}

.import-group-picker {
  align-self: center;
  margin-inline-start: auto;
  min-height: 25px;
  padding: 1px 8px;
  color: #213954;
}

.import-group-picker + .session-logout { margin-inline-start: 8px; }

.workspace-shell {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
}

.module-pane {
  min-width: 0;
  border-right: 1px solid #afbed0;
  background: #dfe8f3;
}

.module-group {
  cursor: pointer;
  margin: 0;
  padding: 8px 12px;
  border-bottom: 1px solid #b9c9dc;
  color: #274768;
  background: #cfdef0;
  font-weight: 650;
}

.module-pane a {
  display: block;
  padding: 8px 9px 8px 15px;
  border-left: 3px solid transparent;
  color: #274768;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.module-pane .export-statistics-menu summary {
  padding: 5px 8px;
  color: #274768;
  cursor: pointer;
}

.module-pane .export-statistics-menu a { padding-inline-start: 16px; }

.module-pane .export-statistics-menu > summary > a {
  display: inline;
  padding: 2px 3px;
}


.module-pane a[aria-current="page"] {
  border-left: 3px solid var(--accent);
  color: #143b67;
  background: #edf5ff;
  font-weight: 600;
}

.module-nav-group :is(summary, a):focus-visible { outline: 2px solid #345f99; outline-offset: -2px; }
.workspace-shell:has(> .module-pane[hidden]) { grid-template-columns: minmax(0, 1fr); }

.module-pane a:hover { background: #edf5ff; }

.workbench {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 0 19px 25px;
}

.workspace-tabs {
  display: flex;
  align-items: end;
  min-height: 36px;
  margin-inline: -19px;
  padding: 4px 19px 0;
  border-bottom: 1px solid #afbed0;
  background: #dce6f2;
}

.workspace-tab {
  padding: 5px 15px;
  margin-bottom: -1px;
  border: 1px solid #afbed0;
  border-bottom-color: var(--panel);
  border-radius: 5px 5px 0 0;
  background: var(--panel);
  color: #274768;
  font-weight: 650;
}

[data-air-workspace] [hidden] { display: none !important; }
.air-tabs button:not([aria-selected="true"]) {
  background: #e6edf6;
  border-bottom-color: #afbed0;
}
.air-review-note {
  margin: 6px 15px;
  white-space: pre-wrap;
}

.workbench-footer {
  min-height: 22px;
  padding: 1px 13px;
  border-top: 1px solid #afbed0;
  background: #dce6f2;
  color: #324e6e;
  font-size: 12px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.panel-header, .panel-footer, .section-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header {
  min-height: 56px;
  padding: 10px 17px;
  border-bottom: 1px solid var(--soft-line);
}

h1, h2, h3 {
  margin: 0;
  line-height: 1.35;
}

h1 { font-size: 20px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

.list-toolbar {
  display: flex;
  padding: 10px 17px;
  background: var(--tint);
}

.search-form, .pagination, .editor-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

.search-form {
  width: min(100%, 355px);
}

.search-form.house-bill-search { width: 100%; flex-wrap: wrap; }
.house-bill-search > input { width: min(72%, 280px); }
.house-bill-filter-panel { flex-basis: 100%; min-width: 0; }
.house-bill-filter-panel summary { cursor: pointer; width: fit-content; padding-block: 4px; }
.house-bill-filter-panel .field-grid { margin-block: 8px 12px; }
.house-bill-filter-panel label { display: grid; gap: 3px; min-width: 0; }
.house-bill-filter-panel input, .house-bill-filter-panel select { width: 100%; min-width: 0; }

.table-scroll {
  overflow: auto;
  overscroll-behavior-x: contain;
}

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

.booking-table {
  min-width: 700px;
}

th, td {
  padding: 7px 16px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th {
  border-top: 1px solid var(--soft-line);
  background: #e8eef6;
  font-weight: 650;
  white-space: nowrap;
}

.booking-table th:first-child { width: 19%; }
.booking-table th:nth-child(2) { width: 31%; }
.booking-table th:last-child { width: 19%; }

tbody tr:nth-child(even) { background: #f8fafc; }

.booking-table tbody tr:hover,
.booking-table tbody tr:focus-within,
.booking-table tbody tr[aria-selected="true"],
.booking-table tbody tr.selected {
  background: #e8f2fc;
}

.booking-table td button {
  min-height: 26px;
  padding: 1px 3px;
  border-color: transparent;
  color: var(--accent-dark);
  background: transparent;
  font-weight: 600;
  text-align: left;
}

.panel-footer {
  min-height: 48px;
  padding: 7px 17px;
}

.list-summary, .editor-status {
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.list-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}

.editor-status {
  margin: 0;
}

.editor-status:not(:empty) {
  padding: 10px 17px 0;
}

#editor-status[data-error="true"],
#list-status[data-error="true"] {
  color: #a22722;
}

.editor-body {
  display: grid;
  gap: 17px;
  padding: 14px 17px 18px;
}

#booking-fields, #record-collections {
  display: grid;
  gap: 13px;
}

.booking-section {
  min-width: 0;
  margin: 0;
  padding: 8px 13px 13px;
  border: 1px solid var(--soft-line);
  border-radius: 4px;
}

.booking-section legend {
  padding: 0 7px;
  font-weight: 650;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 11px 15px;
}

.booking-field {
  min-width: 0;
}

.booking-field label {
  display: block;
  margin-bottom: 4px;
  color: #354860;
  font-weight: 550;
}

.booking-field:has([required]) label::after {
  content: " *";
  color: #a22722;
}

.container-section {
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 4px;
}

.section-toolbar {
  padding: 7px 12px;
}

.container-table { min-width: 460px; }
.container-table td { min-width: 116px; }
.container-table td:last-child { min-width: 86px; }
.container-table th:last-child { width: 91px; }
.container-table tr:last-child td { border-bottom: 0; }

.container-table td {
  padding: 7px 10px;
}

.container-table td button {
  min-height: 32px;
  color: #8d2b26;
}

@media (max-width: 960px) {
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .workbench-header-inner { padding: 0 13px; }
  .workspace-shell { grid-template-columns: minmax(0, 1fr); }
  .module-pane { border-right: 0; border-bottom: 1px solid #afbed0; }
  .module-pane nav { max-height: 34vh; overflow: auto; }
  .module-group { border-bottom: 0; }
  .module-pane a { padding-inline: 13px; }
  .workbench { padding: 0 10px 20px; gap: 12px; }
  .workspace-tabs { margin-inline: -10px; padding-inline: 10px; }
  .panel-header, .panel-footer, .list-toolbar { padding-inline: 11px; }
  .panel-header { flex-wrap: wrap; }
  .editor-status:not(:empty) { padding-inline: 11px; }
  .editor-body { padding: 12px 11px; }
}

@media (max-width: 420px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); }
  .panel-footer { flex-wrap: wrap; }
}

.air-file-form {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #c3cfdd;
}

.air-file-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.air-file-picker input {
  min-width: min(220px, 100%);
  flex: 1 1 auto;
}

.air-file-form output { overflow-wrap: anywhere; }
.air-file-pane table { min-width: 850px; }
.air-file-pane [data-error="true"] { color: #a02124; }

.air-fees-header { min-height: 42px; }
.air-fees-grids { display: grid; gap: 8px; padding: 8px 12px; }
.air-fees-direction { min-width: 0; border: 1px solid var(--line); }
.air-fees-direction .section-toolbar { min-height: 32px; padding: 3px 8px; background: var(--tint); flex-wrap: wrap; }
.air-fees-direction .editor-actions { gap: 4px; }
.air-fees-scroll { min-height: 110px; max-height: min(38vh, 315px); }
.air-fees-table { min-width: 1260px; }
.air-fees-table th, .air-fees-table td { padding: 4px 6px; }
.air-fees-table th { position: sticky; top: 0; z-index: 1; }
.air-fees-table tr[data-fee-row] { cursor: pointer; }
.air-fees-table tr.selected, .air-fees-table tr:focus-within { background: #e8f2fc; }
.air-fees-table input:not([type="checkbox"]), .air-fees-table select { min-height: 24px; width: 100%; }
.air-fees-table [data-fee-field="FYMC"], .air-fees-table [data-fee-field="YWDX"],
.air-fees-table [data-fee-field="FPTT"], .air-fees-table [data-fee-field="Note"] { min-width: 104px; }
.air-fees-table :is([data-fee-field="BZ"], [data-fee-field="HL"], [data-fee-field="DJ"], [data-fee-field="SL"], [data-fee-field="BL"]) { min-width: 63px; }
.air-fees-table :is([data-fee-field="HL"], [data-fee-field="DJ"], [data-fee-field="SL"], [data-fee-field="BL"],
  [data-fee-field="SJJE"], [data-fee-field="DXJE"]),
.air-fees-table :is([data-fee-input="HL"], [data-fee-input="DJ"], [data-fee-input="SL"], [data-fee-input="BL"]) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.air-fees-empty { color: var(--text-muted); }
.air-fees-totals { display: block; padding: 4px 8px; background: var(--tint); font-variant-numeric: tabular-nums; }
.air-fees-profit { display: flex; gap: 5px 16px; flex-wrap: wrap; padding: 4px 12px; font-variant-numeric: tabular-nums; }
.air-fees-profit output { font-weight: 650; }
.air-fees-pane [data-error="true"] { color: #a02124; }

.booking-table tbody tr.air-copy-selected td { background: #d4e7fa; }
.air-list-menu {
  position: fixed;
  z-index: 50;
  background: #fff;
  padding: 2px;
  border: 1px solid #8598a8;
  box-shadow: 1px 2px 5px #0003;
}
.air-list-menu button {
  display: block;
  width: 100%;
  min-height: 25px;
  border: 0;
  text-align: left;
  padding: 3px 16px;
  background: #fff;
}
.air-list-menu button:hover, .air-list-menu button:focus { background: #d4e7fa; }

.air-review-actions { margin: 4px 0; }
.booking-table tbody tr.air-review-selected td { background: #d4e7fa; }

.air-query-form { flex-wrap: wrap; }
.air-query-details { flex: 1 0 100%; }
.air-query-details summary { cursor: pointer; padding-block: .3rem; width: fit-content; }
.air-query-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .4rem .7rem; margin: .45rem 0; }
.air-query-grid label { display: grid; gap: .15rem; }
.air-query-grid input { min-width: 0; width: 100%; }

.counterparty-window [hidden] { display: none !important; }
.counterparty-tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid #92a8c0; }
.counterparty-tabs button { border: 1px solid #a8b9ca; border-radius: 4px 4px 0 0; background: #e6edf5; }
.counterparty-tabs button[aria-selected="true"] { background: white; border-bottom-color: white; font-weight: 600; }
tr[data-counterparty-draft] .record-link { font-style: italic; }
.counterparty-list { max-height: 222px; }
.counterparty-list.compact { max-height: 62px; }
.counterparty-list th { position: sticky; top: 0; z-index: 1; background: #eaf0f7; }
