:root {
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #f1f5f9;
  --sidebar: #101827;
  --sidebar-strong: #0b1220;
  --ink: #172033;
  --ink-strong: #0f172a;
  --muted: #64748b;
  --line: #d8e0ea;
  --line-strong: #c4cedb;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --red: #dc2626;
  --red-soft: #fff1f2;
  --amber: #b7791f;
  --amber-soft: #fffbeb;
  --scrollbar-thumb: #b8c4d4;
  --scrollbar-thumb-hover: #8fa0b5;
  --shadow: 0 1px 2px #d9e2ef;
  --motion-fast: 140ms;
  --motion-base: 190ms;
  --motion-slow: 260ms;
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out-soft: cubic-bezier(0.37, 0, 0.18, 1);
  --ease-touch: cubic-bezier(0.16, 1, 0.3, 1);
  --font-main: "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  --font-base: 13px;
  --font-small: 11px;
  --font-table: 12px;
  --font-title: 17px;
  --font-section-title: 14px;
  font-family: var(--font-main);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--bg);
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  min-width: 1120px;
  overflow: hidden;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

html:has(dialog[open]),
body:has(dialog[open]) {
  overflow: hidden;
}

body,
button,
input,
select,
textarea {
  font: var(--font-base)/1.42 var(--font-main);
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

@keyframes hsmz-view-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes hsmz-menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hsmz-menu-up-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hsmz-dialog-card-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hsmz-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes hsmz-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sidebar,
.business-table-wrap,
.table-wrap,
.reference-table-wrap,
.template-table-wrap,
.dropdown-table-wrap,
.template-combobox-menu,
.edit-card,
.order-tab-panel,
.bill-section,
#logBox {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

.sidebar::-webkit-scrollbar,
.business-table-wrap::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar,
.reference-table-wrap::-webkit-scrollbar,
.template-table-wrap::-webkit-scrollbar,
.dropdown-table-wrap::-webkit-scrollbar,
.template-combobox-menu::-webkit-scrollbar,
.edit-card::-webkit-scrollbar,
.order-tab-panel::-webkit-scrollbar,
.bill-section::-webkit-scrollbar,
#logBox::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.sidebar::-webkit-scrollbar-track,
.business-table-wrap::-webkit-scrollbar-track,
.table-wrap::-webkit-scrollbar-track,
.reference-table-wrap::-webkit-scrollbar-track,
.template-table-wrap::-webkit-scrollbar-track,
.dropdown-table-wrap::-webkit-scrollbar-track,
.template-combobox-menu::-webkit-scrollbar-track,
.edit-card::-webkit-scrollbar-track,
.order-tab-panel::-webkit-scrollbar-track,
.bill-section::-webkit-scrollbar-track,
#logBox::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.business-table-wrap::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb,
.reference-table-wrap::-webkit-scrollbar-thumb,
.template-table-wrap::-webkit-scrollbar-thumb,
.dropdown-table-wrap::-webkit-scrollbar-thumb,
.template-combobox-menu::-webkit-scrollbar-thumb,
.edit-card::-webkit-scrollbar-thumb,
.order-tab-panel::-webkit-scrollbar-thumb,
.bill-section::-webkit-scrollbar-thumb,
#logBox::-webkit-scrollbar-thumb {
  min-height: 42px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--scrollbar-thumb);
  background-clip: padding-box;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.business-table-wrap::-webkit-scrollbar-thumb:hover,
.table-wrap::-webkit-scrollbar-thumb:hover,
.reference-table-wrap::-webkit-scrollbar-thumb:hover,
.template-table-wrap::-webkit-scrollbar-thumb:hover,
.dropdown-table-wrap::-webkit-scrollbar-thumb:hover,
.template-combobox-menu::-webkit-scrollbar-thumb:hover,
.edit-card::-webkit-scrollbar-thumb:hover,
.order-tab-panel::-webkit-scrollbar-thumb:hover,
.bill-section::-webkit-scrollbar-thumb:hover,
#logBox::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
}

.sidebar::-webkit-scrollbar-button,
.business-table-wrap::-webkit-scrollbar-button,
.table-wrap::-webkit-scrollbar-button,
.reference-table-wrap::-webkit-scrollbar-button,
.template-table-wrap::-webkit-scrollbar-button,
.dropdown-table-wrap::-webkit-scrollbar-button,
.template-combobox-menu::-webkit-scrollbar-button,
.edit-card::-webkit-scrollbar-button,
.order-tab-panel::-webkit-scrollbar-button,
.bill-section::-webkit-scrollbar-button,
#logBox::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
  border-color: var(--blue);
}

img {
  max-width: 100%;
  display: block;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

body:not(.logged-in) .app-shell {
  display: none;
}

body.logged-in .login-screen {
  display: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(460px, 1fr) minmax(380px, 520px);
  background: var(--bg);
}

.login-screen::before {
  content: "HSMZ ERP\A Ocean Freight Operations";
  white-space: pre-line;
  display: flex;
  align-items: center;
  padding: 72px;
  color: #ffffff;
  font-size: 36px;
  line-height: 1.18;
  font-weight: 900;
  background: var(--sidebar);
  border-right: 1px solid #243044;
}

.login-card {
  align-self: center;
  justify-self: center;
  width: min(420px, calc(100% - 56px));
  padding: 30px;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px #d0d9e7;
}

.login-card img {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
}

.login-card h1 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 21px;
  line-height: 1.15;
}

.login-subtitle {
  margin: -8px 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.app-shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  background: var(--bg);
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: #dbeafe;
  background: var(--sidebar);
  overflow: auto;
}

.brand {
  min-height: 62px;
  padding: 4px 4px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #25324a;
}

.brand-mark {
  width: 38px;
  height: 38px;
  padding: 4px;
  border-radius: 8px;
  background: #ffffff;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

.brand-title {
  color: #ffffff;
  font-size: 16px;
  line-height: 1;
  font-weight: 900;
}

.brand-subtitle {
  margin-top: 4px;
  color: #93a4b8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  color: #cbd5e1;
  text-align: left;
  font-weight: 800;
  background: transparent;
  transition:
    color var(--motion-base) var(--ease-in-out-soft),
    background-color var(--motion-base) var(--ease-in-out-soft),
    transform var(--motion-fast) var(--ease-touch);
}

.nav-item:hover,
.nav-item.active {
  color: #ffffff;
  background: var(--blue);
}

.nav-item:hover {
  transform: translateX(2px);
}

.sidebar-footer {
  margin-top: auto;
  min-height: 38px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #25324a;
  border-radius: 6px;
  color: #cbd5e1;
  background: var(--sidebar-strong);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--amber);
}

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

.status-dot.bad {
  background: var(--red);
}

.main {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  min-width: 0;
  min-height: 56px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar > div:first-child {
  min-width: 0;
  overflow: hidden;
}

.topbar h1 {
  margin: 0;
  color: var(--ink-strong);
  font-size: var(--font-title);
  line-height: 1.2;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions,
.split-actions,
.form-actions,
.search-actions,
.selection-actions,
.schedule-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-actions {
  flex: 0 0 auto;
  min-width: max-content;
  white-space: nowrap;
}

.selection-template-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #475569;
  font-size: var(--font-small);
  font-weight: 800;
}

.selection-template-picker select {
  width: 170px;
  min-height: 34px;
}

.template-combobox {
  position: relative;
  min-width: 0;
}

.template-combobox-button {
  width: 100%;
  min-height: 40px;
  padding: 8px 34px 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--ink-strong);
  background: #ffffff;
  font-size: var(--font-base);
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  transition:
    border-color var(--motion-base) var(--ease-in-out-soft),
    box-shadow var(--motion-base) var(--ease-soft),
    background-color var(--motion-base) var(--ease-in-out-soft);
}

.template-combobox-button::after {
  position: absolute;
  right: 13px;
  width: 8px;
  height: 8px;
  border-top: 2px solid #334155;
  border-left: 2px solid #334155;
  content: "";
  transform: translateY(2px) rotate(45deg);
  transition: transform var(--motion-base) var(--ease-soft), border-color var(--motion-base) var(--ease-in-out-soft);
}

.template-combobox.open .template-combobox-button {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px #dbeafe;
}

.template-combobox.open .template-combobox-button::after {
  transform: translateY(-2px) rotate(225deg);
}

.template-combobox-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 20;
  max-height: 220px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  display: none;
  overflow: auto;
  background: #ffffff;
  box-shadow: 0 -10px 24px #cbd5e1;
  transform-origin: bottom center;
}

.template-combobox.open .template-combobox-menu {
  display: grid;
  gap: 2px;
  animation: hsmz-menu-up-in var(--motion-base) var(--ease-soft) both;
}

.template-combobox-option {
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  color: var(--ink-strong);
  background: transparent;
  font-size: var(--font-base);
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  transition:
    color var(--motion-fast) var(--ease-in-out-soft),
    background-color var(--motion-fast) var(--ease-in-out-soft),
    transform var(--motion-fast) var(--ease-touch);
}

.template-combobox-option:hover,
.template-combobox-option:focus-visible {
  color: var(--blue-dark);
  background: var(--blue-soft);
  transform: translateX(2px);
}

.template-combobox-option[aria-selected="true"] {
  color: #ffffff;
  background: var(--blue);
}

.system-combobox,
.system-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.system-select > select.native-system-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.system-combobox > input {
  padding-right: 42px;
}

.system-combobox-button,
.system-select-button {
  position: absolute;
  top: 1px;
  right: 1px;
  z-index: 2;
  width: 38px;
  height: calc(100% - 2px);
  border: 0;
  border-left: 1px solid transparent;
  border-radius: 0 5px 5px 0;
  background: transparent;
  transition:
    background-color var(--motion-base) var(--ease-in-out-soft),
    border-color var(--motion-base) var(--ease-in-out-soft);
}

.system-combobox-button::after,
.system-select-button::after {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  border-top: 2px solid #0f172a;
  border-left: 2px solid #0f172a;
  content: "";
  transform: translateY(-65%) rotate(225deg);
  transition: transform var(--motion-base) var(--ease-soft), border-color var(--motion-base) var(--ease-in-out-soft);
}

.system-select-button {
  position: relative;
  width: 100%;
  min-height: 32px;
  padding: 5px 38px 5px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--ink-strong);
  background: #ffffff;
  font-size: var(--font-base);
  font-weight: 500;
  line-height: 1.35;
  text-align: left;
  transition:
    color var(--motion-base) var(--ease-in-out-soft),
    background-color var(--motion-base) var(--ease-in-out-soft),
    border-color var(--motion-base) var(--ease-in-out-soft),
    box-shadow var(--motion-base) var(--ease-soft);
}

.system-select-button::after {
  right: 13px;
}

.system-combobox.open > input,
.system-combobox > input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px #dbeafe;
}

.system-select.open .system-select-button,
.system-select-button:focus-visible {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px #dbeafe;
}

.system-combobox.open .system-combobox-button::after,
.system-select.open .system-select-button::after {
  transform: translateY(-35%) rotate(45deg);
}

.system-combobox-menu,
.system-select-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  left: 0;
  z-index: 70;
  max-height: 260px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  display: none;
  overflow: auto;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  transform-origin: top center;
}

.system-combobox.drop-up .system-combobox-menu,
.system-select.drop-up .system-select-menu {
  top: auto;
  bottom: calc(100% + 6px);
  box-shadow: 0 -16px 36px rgba(15, 23, 42, 0.18);
}

.system-combobox.open .system-combobox-menu,
.system-select.open .system-select-menu {
  display: grid;
  gap: 2px;
  animation: hsmz-menu-in var(--motion-base) var(--ease-soft) both;
}

.system-combobox.drop-up.open .system-combobox-menu,
.system-select.drop-up.open .system-select-menu {
  animation-name: hsmz-menu-up-in;
  transform-origin: bottom center;
}

.system-combobox-option,
.system-select-option {
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  display: flex;
  align-items: center;
  color: var(--ink-strong);
  background: transparent;
  font-size: var(--font-base);
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  transition:
    color var(--motion-fast) var(--ease-in-out-soft),
    background-color var(--motion-fast) var(--ease-in-out-soft),
    transform var(--motion-fast) var(--ease-touch);
}

.system-combobox-option:hover,
.system-combobox-option:focus-visible,
.system-select-option:hover,
.system-select-option:focus-visible {
  color: var(--blue-dark);
  background: var(--blue-soft);
  transform: translateX(2px);
}

.system-combobox-option[aria-selected="true"],
.system-select-option[aria-selected="true"] {
  color: #ffffff;
  background: var(--blue);
}

.system-combobox-empty {
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.system-combobox.is-disabled,
.system-select.is-disabled {
  opacity: 0.58;
}

.workflow-name {
  height: 36px;
  min-width: 0;
  max-width: 180px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-strong);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 800;
}

.workflow-name span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-name img {
  width: 22px;
  height: 22px;
  border-radius: 5px;
}

.view {
  display: none;
  min-height: 0;
  padding: 10px;
  max-width: 100%;
  overflow: hidden;
}

.view.active {
  display: grid;
  animation: hsmz-view-in var(--motion-slow) var(--ease-soft) both;
}

.primary-button,
.ghost-button,
.danger-button,
.icon-button,
.link-button,
.modal-close-button,
.detail-tab,
.config-tab,
.ref-tab,
.resource-tab,
.reference-tab,
.carrier-tab {
  min-height: 32px;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  background: #ffffff;
  box-shadow: 0 0 0 rgba(15, 23, 42, 0);
  transform: translateY(0);
  transition:
    color var(--motion-base) var(--ease-in-out-soft),
    background-color var(--motion-base) var(--ease-in-out-soft),
    border-color var(--motion-base) var(--ease-in-out-soft),
    box-shadow var(--motion-base) var(--ease-soft),
    opacity var(--motion-base) var(--ease-in-out-soft),
    transform var(--motion-fast) var(--ease-touch);
}

.primary-button {
  border-color: var(--blue);
  color: #ffffff;
  background: var(--blue);
}

.primary-button:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.18);
}

.ghost-button,
.icon-button,
.modal-close-button,
.link-button {
  border-color: var(--line-strong);
  color: #334155;
  background: #ffffff;
}

.ghost-button:hover,
.icon-button:hover,
.modal-close-button:hover,
.link-button:hover {
  border-color: #93c5fd;
  color: var(--blue-dark);
  background: var(--blue-soft);
  box-shadow: 0 5px 12px rgba(37, 99, 235, 0.1);
}

.danger-button,
.danger-link,
.system-dialog-close,
.modal-close-button,
.panel-head .icon-button[id^="close"] {
  border-color: #fecaca;
  color: #b91c1c;
  background: var(--red-soft);
}

.danger-button:hover,
.danger-link:hover,
.system-dialog-close:hover,
.modal-close-button:hover,
.panel-head .icon-button[id^="close"]:hover {
  color: #ffffff;
  border-color: var(--red);
  background: var(--red);
  box-shadow: 0 6px 14px rgba(220, 38, 38, 0.16);
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.icon-button:hover,
.link-button:hover,
.modal-close-button:hover,
.detail-tab:hover,
.config-tab:hover,
.ref-tab:hover,
.resource-tab:hover,
.reference-tab:hover,
.carrier-tab:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.ghost-button:active,
.danger-button:active,
.icon-button:active,
.link-button:active,
.modal-close-button:active,
.detail-tab:active,
.config-tab:active,
.ref-tab:active,
.resource-tab:active,
.reference-tab:active,
.carrier-tab:active {
  transform: translateY(0) scale(0.985);
}

.icon-button {
  min-width: 34px;
}

label,
.login-card label,
.manual-form label,
.order-create-form label,
.reference-form label,
.dropdown-form label,
.template-form label,
.business-search label,
.bill-form label,
.detail-column label,
.detail-form-grid label,
.order-section label,
.bill-template-picker {
  display: grid;
  gap: 4px;
  align-content: start;
  color: #334155;
  font-size: var(--font-small);
  font-weight: 800;
}

label > span,
.login-card label span,
.manual-form label span,
.order-create-form label span,
.reference-form label span,
.dropdown-form label span,
.template-form label span,
.business-search label span,
.bill-form label span,
.detail-column label span,
.detail-form-grid label span,
.order-section label span,
.bill-template-picker span {
  display: inline-flex;
  min-height: 15px;
  align-items: center;
  color: #475569;
  font-size: var(--font-small);
  line-height: 1.2;
  font-weight: 800;
}

input,
select,
textarea,
.business-search input,
.business-search select,
.bill-form input,
.bill-form select,
.bill-template-picker select,
.detail-column input,
.detail-column select,
.detail-column textarea,
.detail-form-grid input,
.detail-form-grid select,
.detail-form-grid textarea,
.order-section input,
.order-section select,
.order-section textarea,
.manual-form input,
.manual-form select,
.manual-form textarea,
.order-create-form input,
.order-create-form select,
.order-create-form textarea,
.reference-form input,
.reference-form select,
.reference-form textarea,
.dropdown-form input,
.dropdown-form select,
.template-form input,
.template-form select,
.template-form textarea {
  width: 100%;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: var(--ink-strong);
  background: #ffffff;
  box-shadow: none;
  transition:
    border-color var(--motion-base) var(--ease-in-out-soft),
    box-shadow var(--motion-base) var(--ease-soft),
    background-color var(--motion-base) var(--ease-in-out-soft);
}

input:hover,
select:hover,
textarea:hover,
.system-combobox:hover > input,
.system-select:hover .system-select-button {
  border-color: #a7b7cb;
}

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

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

.check-row input,
.radio-row input,
input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.panel,
.run-card,
.business-board,
.schedule-board,
.reference-panel,
.audit-panel,
.resource-pane,
.console-panel,
.bill-form,
.bill-table-wrap,
.bill-toolbar,
.fee-summary-bar,
.detail-column,
.order-section,
.edit-card,
.order-detail-card,
.result-box,
.template-summary section,
.diag-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition:
    border-color var(--motion-base) var(--ease-in-out-soft),
    box-shadow var(--motion-base) var(--ease-soft),
    transform var(--motion-fast) var(--ease-touch);
}

.run-card:hover,
.reference-panel:hover,
.audit-panel:hover,
.resource-pane:hover,
.console-panel:hover,
.diag-card:hover,
.template-summary section:hover {
  border-color: #c7d2e2;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.panel,
.schedule-board,
.reference-panel,
.audit-panel,
.resource-pane,
.console-panel {
  max-width: 100%;
  padding: 12px;
}

.panel.wide {
  width: 100%;
}

.panel + .panel,
.task-panel,
.run-grid + .panel {
  margin-top: 12px;
}

.panel-head,
.reference-head,
.business-table-head,
.bill-section-head,
.template-card-head,
.order-section-head,
.console-head {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2,
.panel-head h3,
.reference-head h3,
.business-table-head h2,
.bill-form h3,
.bill-table-wrap h3,
.order-section-head h3,
.detail-column h3,
.run-card h2,
.template-summary h3,
.diag-card h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: var(--font-section-title);
  line-height: 1.25;
  font-weight: 900;
}

.panel-note,
.business-table-head span,
.reference-head span,
.bill-section-head span,
.order-section-head span,
.diag-meta,
.empty-note {
  color: var(--muted);
  font-size: var(--font-small);
  font-weight: 700;
}

.business-board {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  padding: 0;
  overflow: hidden;
}

.business-tabs {
  grid-column: 1;
  grid-row: 1;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.business-tab {
  width: 100%;
  min-height: 56px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-strong);
  text-align: left;
  background: var(--surface-soft);
  box-shadow: 0 0 0 rgba(15, 23, 42, 0);
  transform: translateY(0);
  transition:
    color var(--motion-base) var(--ease-in-out-soft),
    background-color var(--motion-base) var(--ease-in-out-soft),
    border-color var(--motion-base) var(--ease-in-out-soft),
    box-shadow var(--motion-base) var(--ease-soft),
    transform var(--motion-fast) var(--ease-touch);
}

.business-tab:hover {
  color: var(--blue-dark);
  border-color: #93c5fd;
  background: var(--blue-soft);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.business-tab.active,
.business-tab.danger.active {
  color: #ffffff;
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
}

.business-tab:active {
  transform: translateY(0) scale(0.99);
}

.business-tab span {
  display: block;
  color: inherit;
  font-size: var(--font-small);
  font-weight: 900;
}

.business-tab strong {
  display: block;
  margin-top: 0;
  color: var(--ink-strong);
  font-size: 20px;
  line-height: 1.1;
}

.business-tab.active strong,
.business-tab.danger.active strong {
  color: #ffffff;
}

.business-search {
  grid-column: 1;
  grid-row: 2;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: minmax(132px, 0.65fr) minmax(132px, 0.65fr) minmax(132px, 0.5fr) minmax(132px, 0.58fr) minmax(110px, 0.42fr) minmax(132px, 0.55fr) auto;
  gap: 6px 8px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.business-search label,
.schedule-filters label {
  min-width: 0;
}

.business-search label > span,
.schedule-filters label > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.business-search input,
.business-search select,
.business-search .system-combobox,
.business-search .system-select,
.business-search .system-select-button,
.schedule-filters input,
.schedule-filters select,
.schedule-filters .system-combobox,
.schedule-filters .system-select,
.schedule-filters .system-select-button,
.range-inputs {
  min-width: 0;
}

.business-search input[type="date"],
.schedule-filters input[type="date"] {
  padding-right: 6px;
}

.business-search input[type="date"]::-webkit-calendar-picker-indicator,
.schedule-filters input[type="date"]::-webkit-calendar-picker-indicator {
  width: 14px;
  height: 14px;
  margin-left: 0;
}

.business-search .search-actions,
.schedule-filter-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: max-content;
  white-space: nowrap;
}

.business-search .hidden-filter {
  display: none;
}

.billing-mode .business-tabs {
  display: none;
}

.billing-mode {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.billing-mode .business-search {
  grid-row: 1;
  grid-template-columns: minmax(136px, 1fr) minmax(136px, 1fr) minmax(128px, 0.5fr) minmax(168px, 0.74fr) minmax(118px, 0.45fr) auto;
}

.billing-mode .business-search label:has([name="workNo"]),
.billing-mode .business-search .hidden-filter {
  display: none;
}

.billing-mode .business-table-head {
  grid-row: 2;
}

.billing-mode .business-table-wrap {
  grid-row: 3;
}

.business-table-head {
  grid-column: 1;
  grid-row: 3;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.business-table-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.business-table-wrap {
  grid-column: 1;
  grid-row: 4;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
}

.billing-mode .business-table-wrap {
  max-height: calc(100vh - 232px);
  min-height: 420px;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #eef4fb;
}

.billing-mode .business-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.billing-mode .business-table-wrap::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #eef4fb;
}

.billing-mode .business-table-wrap::-webkit-scrollbar-thumb {
  border: 2px solid #eef4fb;
  border-radius: 999px;
  background: #94a3b8;
}

.billing-mode .business-table-wrap::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.business-table {
  min-width: 1080px;
}

.billing-mode .business-table {
  min-width: 1320px;
}

.business-table th,
.reference-table th,
.bill-table th,
.table-wrap th,
.task-panel th {
  height: 30px;
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  color: #475569;
  font-size: var(--font-table);
  font-weight: 900;
  text-align: left;
  white-space: nowrap;
  background: var(--surface-soft);
}

.business-table td,
.reference-table td,
.bill-table td,
.table-wrap td,
.task-panel td {
  min-height: 34px;
  padding: 6px 9px;
  border-bottom: 1px solid #edf2f7;
  color: var(--ink);
  font-size: var(--font-table);
  line-height: 1.32;
  vertical-align: middle;
  background: #ffffff;
}

.business-table tbody tr:hover td,
.reference-table tbody tr:hover td,
.bill-table tbody tr:hover td,
.table-wrap tbody tr:hover td,
.task-panel tbody tr:hover td {
  background: var(--blue-soft);
}

.business-table tbody tr,
.reference-table tbody tr,
.bill-table tbody tr,
.table-wrap tbody tr,
.task-panel tbody tr {
  transition: transform var(--motion-fast) var(--ease-touch);
}

.business-table td,
.reference-table td,
.bill-table td,
.table-wrap td,
.task-panel td {
  transition:
    color var(--motion-base) var(--ease-in-out-soft),
    background-color var(--motion-base) var(--ease-in-out-soft);
}

.business-table tbody tr:hover,
.reference-table tbody tr:hover,
.bill-table tbody tr:hover,
.table-wrap tbody tr:hover,
.task-panel tbody tr:hover {
  transform: translateY(-1px);
}

.business-table .carrier-group-row td {
  color: #1e3a8a;
  background: #eef6ff;
  font-weight: 900;
}

.business-table tr.danger td,
.table-wrap tr.danger td {
  color: #991b1b;
  background: var(--red-soft);
}

.business-table th[data-col="select"],
.business-table td[data-col="select"] {
  width: 42px;
  text-align: center;
}

.business-table th[data-col="actions"],
.business-table td[data-col="actions"] {
  width: 230px;
  text-align: right;
}

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

.business-actions .link-button {
  white-space: nowrap;
}

.business-actions .ghost-button,
.business-actions .danger-link {
  min-width: 52px;
  min-height: 30px;
  padding: 5px 9px;
}

.business-empty {
  padding: 28px 12px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.manage-menu {
  position: relative;
  display: inline-flex;
}

.manage-menu-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 12;
  min-width: 112px;
  padding: 6px;
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 18px #cfd8e6;
  transform-origin: top right;
}

.manage-menu.open .manage-menu-list {
  display: grid;
  gap: 4px;
  animation: hsmz-menu-in var(--motion-base) var(--ease-soft) both;
}

.manage-menu-list button {
  justify-content: flex-start;
}

.manual-form,
.order-create-form,
.reference-form,
.dropdown-form,
.template-form,
.detail-form-grid,
.order-section-grid {
  display: grid;
  gap: 10px;
}

.manual-form,
.order-create-form {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.reference-form,
.template-form {
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  align-items: end;
}

.dropdown-form {
  grid-template-columns: 1fr;
  align-items: end;
}

.span-two {
  grid-column: span 2;
}

.form-actions {
  justify-content: flex-end;
  align-self: end;
}

.reference-form .form-actions,
.template-form .form-actions {
  grid-column: span 2;
}

.dropdown-form .form-actions {
  justify-content: flex-start;
}

.result-box {
  min-height: 34px;
  margin-top: 10px;
  padding: 8px 10px;
  color: #475569;
  font-size: 12px;
  background: var(--surface-soft);
}

.result-box.ok {
  color: #047857;
  border-color: #bbf7d0;
  background: var(--green-soft);
}

.result-box.bad {
  color: #b91c1c;
  border-color: #fecaca;
  background: var(--red-soft);
}

.booking-doc-page {
  display: grid;
  min-height: 0;
  gap: 10px;
  align-content: start;
  align-items: start;
  overflow: auto;
  padding-right: 2px;
}

.booking-doc-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.booking-doc-head {
  min-height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.booking-doc-head > div {
  display: none;
}

.booking-doc-head h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 18px;
  line-height: 1.15;
}

.booking-doc-head span,
.booking-doc-card-head span,
.doc-save-summary span {
  color: var(--muted);
  font-size: var(--font-small);
  font-weight: 800;
}

.booking-doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.booking-doc-card {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.booking-doc-card-head {
  min-height: 0;
  display: grid;
  gap: 2px;
}

.booking-doc-card-head strong {
  color: var(--ink-strong);
  font-size: 14px;
}

.booking-doc-paste {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: var(--font-small);
  font-weight: 800;
}

.booking-doc-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}

.booking-doc-form .span-two {
  grid-column: span 2;
}

.booking-doc-form-wide label:has(input[name="vesselVoyage"]),
.booking-doc-form-wide label:has(textarea[name="bookingRequest"]),
.booking-doc-form-wide .form-actions,
.booking-doc-form-wide + .result-box {
  grid-column: 1 / -1;
}

.booking-doc-form label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: var(--font-small);
  font-weight: 800;
}

.booking-doc-form label span,
.booking-doc-paste span {
  color: #475569;
  font-size: var(--font-small);
  font-weight: 800;
}

.combo-fields {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 82px;
  gap: 8px;
}

.doc-save-card {
  width: min(720px, calc(100vw - 36px));
}

.doc-save-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.doc-save-summary div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.doc-save-summary strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-strong);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-save-card .split-actions {
  justify-content: flex-end;
}

.schedule-board {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 12px;
  align-content: start;
  align-items: start;
  overflow: hidden;
  min-height: 0;
}

.schedule-carriers,
.carrier-segment {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  grid-auto-rows: 40px;
  gap: 6px;
  align-items: start;
  justify-content: stretch;
}

.schedule-carrier,
.carrier-tab {
  min-height: 40px;
  height: 40px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: #ffffff;
  box-shadow: 0 0 0 rgba(15, 23, 42, 0);
  transform: translateY(0);
  transition:
    color var(--motion-base) var(--ease-in-out-soft),
    background-color var(--motion-base) var(--ease-in-out-soft),
    border-color var(--motion-base) var(--ease-in-out-soft),
    box-shadow var(--motion-base) var(--ease-soft),
    transform var(--motion-fast) var(--ease-touch);
}

.schedule-carrier:hover,
.carrier-tab:hover {
  border-color: #93c5fd;
  background: var(--blue-soft);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.schedule-carrier strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-carrier span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--font-small);
  white-space: nowrap;
}

.schedule-carrier.active,
.carrier-tab.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.schedule-filters {
  padding: 10px;
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: minmax(142px, 0.9fr) minmax(142px, 0.9fr) minmax(226px, 1.25fr) minmax(150px, 0.7fr) minmax(116px, 0.52fr) auto;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.range-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.schedule-source-note {
  min-height: 18px;
  color: var(--muted);
  font-size: var(--font-small);
}

.schedule-table {
  min-width: 0;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 306px);
  min-height: 360px;
  padding-right: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #eef4fb;
}

.schedule-table::-webkit-scrollbar {
  width: 10px;
}

.schedule-table::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #eef4fb;
}

.schedule-table::-webkit-scrollbar-thumb {
  border: 2px solid #eef4fb;
  border-radius: 999px;
  background: #94a3b8;
}

.schedule-table::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.schedule-table-head,
.schedule-row {
  display: grid;
  grid-template-columns: 104px 142px minmax(180px, 0.9fr) minmax(360px, 1.7fr) 70px 82px 88px 76px;
  gap: 10px;
  align-items: center;
}

.schedule-table-head {
  padding: 0 10px;
  color: var(--muted);
  font-size: var(--font-small);
  font-weight: 900;
}

.schedule-row {
  position: relative;
  min-height: 72px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.schedule-new {
  position: absolute;
  top: 5px;
  left: 10px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
}

.schedule-row:has(.schedule-new) {
  padding-top: 18px;
}

.schedule-vessel,
.route-port,
.schedule-booking-summary strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-path {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

.route-port {
  max-width: 132px;
  color: var(--ink-strong);
  font-family: var(--font-main);
  font-size: var(--font-small);
  font-weight: 800;
  line-height: 1.25;
}

.route-arrow {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.schedule-remark {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: var(--font-small);
  line-height: 1.15;
}

.schedule-remark.has-counts {
  color: var(--amber);
  font-weight: 900;
}

.schedule-actions {
  display: flex;
  justify-content: flex-end;
}

.schedule-book-button {
  min-width: 68px;
}

.schedule-booking-summary {
  margin-bottom: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.schedule-booking-summary div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.schedule-booking-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-wrap,
.reference-table-wrap,
.template-table-wrap,
.dropdown-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: #ffffff;
}

.table-wrap table,
.reference-table,
.bill-table {
  min-width: 780px;
}

.run-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
}

.run-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.run-card p,
.template-summary p,
.resource-pane p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.config-tabs,
.reference-tabs,
.resource-tabs {
  margin: 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--line);
}

.config-tab,
.ref-tab,
.resource-tab,
.reference-tab {
  margin-bottom: -1px;
  border-color: transparent;
  border-radius: 6px 6px 0 0;
  color: #475569;
  background: transparent;
}

.config-tab.active,
.ref-tab.active,
.resource-tab.active,
.reference-tab.active {
  color: var(--blue-dark);
  border-color: var(--line);
  border-bottom-color: #ffffff;
  background: #ffffff;
}

.settings-permission {
  min-height: 30px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--amber);
  border-radius: 6px;
  color: #8a4f0a;
  font-size: var(--font-small);
  font-weight: 900;
  background: var(--amber-soft);
}

.settings-permission.is-admin {
  border-color: #86efac;
  color: #047857;
  background: var(--green-soft);
}

.settings-overview {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.settings-overview section {
  min-height: 78px;
  padding: 12px;
  display: grid;
  gap: 5px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.settings-overview strong {
  color: var(--ink-strong);
  font-size: 12px;
  font-weight: 900;
}

.settings-overview span,
.settings-admin-note {
  color: var(--muted);
  font-size: var(--font-small);
  font-weight: 700;
}

.settings-admin-note {
  margin-top: 10px;
  min-height: 18px;
}

.settings-readonly #referenceForm,
.settings-readonly #dropdownForm,
.settings-readonly #billTemplateForm,
.settings-readonly #userAdminForm {
  opacity: 0.68;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(440px, 1.05fr) minmax(340px, 0.95fr);
  gap: 12px;
}

.settings-grid.is-muted {
  display: none;
}

.resource-pane {
  display: none;
  margin-top: 12px;
}

.resource-pane.active {
  display: block;
}

.settings-tool-pane.active {
  display: block;
}

.template-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
}

.template-summary section {
  padding: 14px;
}

.template-settings {
  grid-template-columns: minmax(260px, 0.7fr) minmax(420px, 1.3fr);
}

.user-admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.7fr) minmax(520px, 1.3fr);
  gap: 12px;
  align-items: start;
}

.user-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.user-enabled-row,
.user-force-row {
  min-height: 36px;
  align-self: end;
  padding: 7px 0;
}

.password-card {
  width: min(560px, calc(100vw - 36px));
}

.password-form-grid {
  margin-top: 12px;
}

.reference-head {
  align-items: flex-start;
}

.reference-table-wrap,
.template-table-wrap,
.dropdown-table-wrap {
  margin-top: 12px;
}

.ref-field {
  display: none;
}

.audit-list,
.task-list {
  display: grid;
  gap: 8px;
}

.audit-row {
  padding: 10px 12px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.audit-row strong {
  color: var(--ink-strong);
  font-size: 12px;
}

.audit-row span {
  color: var(--muted);
  font-size: var(--font-small);
}

.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 12px;
}

.diag-card {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.diag-item {
  padding-top: 10px;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  border-top: 1px solid var(--line);
}

.badge {
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 4px;
  color: #047857;
  background: var(--green-soft);
  text-align: center;
  font-size: var(--font-small);
  font-weight: 900;
}

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

.diag-title {
  color: var(--ink-strong);
  font-weight: 800;
}

.console-panel {
  margin-top: 12px;
  padding: 0;
  overflow: hidden;
}

.console-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-strong);
  font-weight: 900;
}

#logBox {
  margin: 0;
  min-height: 160px;
  max-height: 280px;
  padding: 12px;
  overflow: auto;
  color: #dbeafe;
  background: var(--sidebar);
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.edit-dialog,
.order-dialog,
.system-dialog {
  border: 0;
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  background: transparent;
}

.edit-dialog::-webkit-scrollbar,
.order-dialog::-webkit-scrollbar,
.system-dialog::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.edit-dialog::backdrop,
.order-dialog::backdrop,
.system-dialog::backdrop {
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(2px);
  animation: hsmz-backdrop-in var(--motion-slow) var(--ease-in-out-soft) both;
}

.edit-dialog,
.order-dialog,
.system-dialog {
  margin: auto;
}

.edit-card {
  width: min(960px, calc(100vw - 36px));
  max-height: calc(100vh - 40px);
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
  animation: hsmz-dialog-card-in var(--motion-slow) var(--ease-soft) both;
}

.order-detail-card {
  width: min(1440px, calc(100vw - 40px));
  height: min(900px, calc(100vh - 40px));
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  animation: hsmz-dialog-card-in var(--motion-slow) var(--ease-soft) both;
}

.system-dialog-card {
  width: min(520px, calc(100vw - 36px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.24);
  animation: hsmz-dialog-card-in var(--motion-slow) var(--ease-soft) both;
}

.system-dialog-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.system-dialog-head h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 16px;
  line-height: 1.25;
}

.system-dialog-head p {
  margin: 8px 0 0;
  color: #334155;
  font-size: 12px;
  line-height: 1.6;
}

.system-dialog-close {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.system-dialog-input-wrap {
  display: grid;
  gap: 6px;
}

.system-dialog-input-wrap span {
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.system-dialog-input-wrap textarea {
  min-height: 92px;
  resize: vertical;
}

.system-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.order-detail-head {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.order-detail-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #475569;
  font-size: 13px;
}

.order-detail-summary strong {
  color: var(--ink-strong);
}

.normal-status {
  color: var(--green);
}

.order-detail-head .primary-button,
.order-detail-head .draft-return-button,
.order-detail-head .modal-close-button {
  width: auto;
  min-width: 88px;
  height: 38px;
}

.order-detail-head .draft-return-button {
  color: #1d4ed8;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.detail-tabs {
  display: flex;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.detail-tab {
  min-width: 84px;
  border: 0;
  border-radius: 0;
  color: #475569;
  background: transparent;
}

.detail-tab.active {
  color: var(--blue-dark);
  border-bottom: 2px solid var(--blue);
  background: #ffffff;
}

.order-tab-panel {
  display: none;
  min-height: 0;
  padding: 14px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: var(--surface-soft);
}

.order-tab-panel.active {
  display: block;
  animation: hsmz-view-in var(--motion-slow) var(--ease-soft) both;
}

.order-detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1.22fr);
  gap: 12px;
}

.detail-column {
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.party-sections,
.order-cargo-sections {
  display: grid;
  gap: 12px;
}

.party-section .detail-form-grid {
  grid-template-columns: 1fr;
}

.order-section {
  padding: 12px;
}

.order-section-grid {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.order-section-compact .order-section-grid {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
}

.order-section label:has(textarea),
.order-section label:has(input[name="marks"]),
.order-section label:has(input[name="cargoDescription"]) {
  grid-column: span 2;
}

.order-compatibility-fields {
  display: none;
}

.fee-summary-bar {
  padding: 12px;
  display: grid;
  gap: 8px;
}

.fee-profit-line,
.fee-confirm-line,
.fee-total-lines {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 12px;
}

.fee-profit-line strong {
  color: var(--ink-strong);
}

.fee-pill,
.bill-status-pill {
  padding: 3px 10px;
  border-radius: 4px;
  color: var(--blue-dark);
  background: #dbeafe;
  font-weight: 900;
}

.fee-unconfirmed {
  color: var(--red);
  font-weight: 900;
}

.bill-layout {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.bill-form {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.bill-form h3,
.bill-form input[name="billLineId"],
.bill-form label,
.bill-form #addBillLineBtn {
  grid-column: 1;
}

.bill-sections {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.bill-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: #ffffff;
}

.bill-section-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.bill-table {
  min-width: 900px;
}

.bill-toolbar {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fee-footer-actions {
  position: sticky;
  bottom: 0;
  z-index: 6;
  margin: 12px -14px -14px;
  padding: 12px 14px;
  display: flex;
  gap: 10px 12px;
  align-items: center;
  overflow: visible;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  box-shadow: 0 -8px 18px #d9e2ef, inset 0 1px 0 #ffffff;
}

.fee-footer-actions .bill-template-picker {
  min-width: 0;
  max-width: 560px;
  flex: 1 1 460px;
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr);
  gap: 10px;
  align-items: center;
}

.fee-footer-actions .bill-template-picker > span {
  min-height: auto;
  color: #334155;
  white-space: nowrap;
}

.fee-footer-actions .result-box {
  flex: 1 1 260px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: none;
  align-items: center;
  overflow: hidden;
  color: var(--muted);
  background: #ffffff;
  box-shadow: none;
}

.fee-footer-actions .result-box:not(:empty) {
  display: flex;
}

.fee-footer-actions #exportBillBtn {
  flex: 0 0 auto;
  min-height: 40px;
  padding-right: 18px;
  padding-left: 18px;
}

.entry-mode {
  margin-top: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.radio-row.disabled {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: 420px;
  padding: 10px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: var(--ink-strong);
  background: #ffffff;
  box-shadow: 0 8px 18px #cfd8e6;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.985);
  transition:
    opacity var(--motion-base) var(--ease-in-out-soft),
    transform var(--motion-base) var(--ease-soft);
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: hsmz-toast-in var(--motion-base) var(--ease-soft) both;
}

@media (max-width: 1280px) {
  body {
    min-width: 1040px;
  }

  .business-search {
    grid-template-columns: minmax(132px, 0.65fr) minmax(132px, 0.65fr) minmax(132px, 0.5fr) minmax(132px, 0.58fr) minmax(110px, 0.42fr) minmax(132px, 0.55fr) auto;
  }

  .billing-mode .business-search {
    grid-template-columns: minmax(136px, 1fr) minmax(136px, 1fr) minmax(128px, 0.5fr) minmax(168px, 0.74fr) minmax(118px, 0.45fr) auto;
  }

  .manual-form,
  .order-create-form,
  .booking-doc-grid,
  .run-grid,
  .settings-grid,
  .settings-overview,
  .template-summary {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .schedule-filters {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .login-screen {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .login-screen::before {
    display: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .business-board {
    grid-template-columns: 1fr;
  }

  .business-tabs,
  .business-search,
  .business-table-head,
  .business-table-wrap {
    grid-column: 1;
  }

  .business-tabs {
    grid-row: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    border-right: 0;
  }

  .business-search,
  .schedule-filters,
  .manual-form,
  .booking-doc-grid,
  .booking-doc-form,
  .order-create-form,
  .reference-form,
  .dropdown-form,
  .template-form,
  .settings-grid,
  .settings-overview,
  .template-summary,
  .user-admin-layout,
  .bill-layout,
  .fee-footer-actions,
  .order-detail-grid,
  .order-section-grid,
  .diagnostic-grid,
  .run-grid,
  .schedule-booking-summary {
    grid-template-columns: 1fr;
  }

  .span-two,
  .booking-doc-head,
  .order-section label:has(textarea),
  .order-section label:has(input[name="marks"]),
  .order-section label:has(input[name="cargoDescription"]) {
    grid-column: auto;
  }

  .booking-doc-head {
    display: grid;
    align-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
