:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9dee8;
  --sidebar: #ffffff;
  --sidebar-soft: #f1f5f9;
  --sidebar-text: #334155;
  --sidebar-muted: #64748b;
  --sidebar-faint: #94a3b8;
  --sidebar-line: #e2e8f0;
  --blue: #2563eb;
  --green: #0f8a5f;
  --red: #c2410c;
  --amber: #b7791f;
  --purple: #6d28d9;
  --shadow: 0 18px 45px rgba(30, 41, 59, 0.08);
}

.expandable-row {
  cursor: pointer;
}

.expandable-row:hover td {
  background: #f8fafc;
}

.row-expand-arrow {
  display: inline-flex;
  width: 18px;
  color: #2563eb;
  font-size: 12px;
  vertical-align: middle;
}

.expanded-row > td,
.expanded-detail-row > td,
.expanded-detail-cell {
  padding: 0 12px 16px;
  background: #f8fafc;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  width: 100%;
  max-width: 100%;
}

.detail-row td {
  padding: 0;
  background: #f8fafc;
}

.expanded-detail-row {
  width: 100%;
}

.expanded-panel,
.expanded-detail-card,
.detail-card {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
  margin: 12px;
  width: auto;
  max-width: 100%;
  min-width: 0;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
  overflow-x: hidden;
}

.detail-card * {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.expanded-section,
.expanded-detail-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #edf2f7;
  border-radius: 12px;
  background: #fbfdff;
}

.expanded-section-title,
.expanded-detail-section > h4 {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
}

.expanded-grid,
.expanded-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
}

.expanded-field,
.expanded-detail-item {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.expanded-field.is-wide,
.expanded-detail-item.is-wide {
  grid-column: 1 / -1;
}

.expanded-label,
.expanded-detail-item > .expanded-label {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.expanded-value,
.expanded-detail-value {
  display: block;
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.expanded-field.is-pre .expanded-value,
.expanded-detail-item.is-pre .expanded-detail-value {
  white-space: pre-wrap;
}

.expanded-field.is-strong .expanded-value,
.expanded-detail-item.is-strong .expanded-detail-value {
  font-size: 15px;
  font-weight: 700;
}

.expanded-value .status,
.expanded-value .customer-name-cell,
.expanded-detail-value .status,
.expanded-detail-value .customer-name-cell {
  display: inline-flex;
  margin: 0;
}

.expanded-value small,
.expanded-detail-value small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
}

.expanded-actions,
.expanded-detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
  white-space: normal;
}

.expanded-actions button,
.expanded-actions a,
.expanded-detail-actions button,
.expanded-detail-actions a {
  margin: 0;
  white-space: nowrap;
}

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

@media (max-width: 760px) {
  .expanded-grid,
  .expanded-detail-grid {
    grid-template-columns: 1fr;
  }

  .expanded-row > td,
  .expanded-detail-row > td,
  .expanded-detail-cell {
    padding: 0 8px 12px;
  }

  .expanded-panel,
  .expanded-detail-card {
    padding: 12px;
  }

  .expanded-actions,
  .expanded-detail-actions {
    justify-content: flex-start;
  }

  .expanded-actions button,
  .expanded-actions a,
  .expanded-detail-actions button,
  .expanded-detail-actions a {
    flex: 1 1 120px;
    text-align: center;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body.auth-login #password-change-screen,
body.auth-login #app-shell,
body.auth-password #login-screen,
body.auth-password #app-shell,
body.auth-app #login-screen,
body.auth-app #password-change-screen {
  display: none !important;
}

body.auth-login #login-screen,
body.auth-password #password-change-screen {
  display: grid !important;
}

body.auth-app #app-shell {
  display: block !important;
}

body.workspace-loading .view-panel,
body.workspace-forbidden .view-panel {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.login-screen,
.password-change-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #eef2f7;
}

.password-change-screen[hidden] {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-company {
  margin: 0 0 8px;
  color: #0f766e;
  font-size: 14px;
  font-weight: 800;
}

.login-card h1 {
  margin: 0;
  color: #111827;
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: 0;
}

.login-platform-code {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.login-copy {
  margin: 10px 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.login-screen-form {
  display: grid;
  gap: 14px;
}

.form-error {
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #b42318;
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 11px;
}

.login-screen-form .primary-button,
.login-screen-form .secondary-button {
  width: 100%;
  min-height: 42px;
}

.register-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.register-box summary {
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.register-box .login-screen-form {
  margin-top: 14px;
}

.register-box small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.app-shell {
  display: block;
  min-height: 100vh;
  background: #f8fafc;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: 240px;
  height: 100vh;
  padding: 22px 14px 18px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-line);
  overflow-y: auto;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.brand {
  padding: 2px 8px 18px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand h1 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}

.brand p {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0;
}

.brand-platform {
  color: var(--sidebar-muted);
}

.brand-company {
  color: var(--sidebar-faint);
}

.nav-tabs {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  gap: 6px;
  margin: 18px 0;
}

.nav-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav-tab::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 999px;
  background: transparent;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: #64748b;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: color 0.16s ease;
}

.nav-tab:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.nav-tab:hover .nav-icon {
  color: #2563eb;
}

.nav-tab.is-active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.nav-tab.is-active::before {
  background: #1d4ed8;
}

.nav-tab.is-active .nav-icon {
  color: #fff;
}

.user-box {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--sidebar-line);
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
}

.label,
.user-box small,
.metric small,
td small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.user-box .label,
.user-box small {
  color: #64748b;
}

.user-box strong {
  display: block;
  margin: 6px 0 2px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.main {
  min-width: 0;
  margin-left: 240px;
  padding: 28px 28px 48px;
}

.nav-backdrop,
.mobile-nav-button {
  display: none;
}

.mobile-nav-button {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #334155;
}

.mobile-nav-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.topbar h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  gap: 10px;
}

.account-button {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 124px;
  min-height: 38px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 4px 28px 4px 12px;
  text-align: left;
}

.account-button::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 11px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #64748b;
  transform: translateY(-35%);
}

.account-button:hover,
.account-button:focus-visible {
  border-color: #cbd5e1;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.account-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.account-button small {
  display: none;
  color: #667085;
  font-size: 12px;
  line-height: 1.2;
}

.account-menu-wrap {
  position: relative;
}

.account-menu[hidden] {
  display: none;
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  width: 236px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.14);
}

.account-menu-user {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
}

.account-menu-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #1e3a8a;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.account-menu-user strong,
.account-menu-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-user strong {
  color: #0f172a;
  font-size: 14px;
}

.account-menu-user small {
  color: #64748b;
  font-size: 12px;
}

.account-menu hr {
  width: 100%;
  height: 1px;
  border: 0;
  background: #e2e8f0;
  margin: 6px 0;
}

.account-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
}

.account-menu button span {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.account-menu button:hover,
.account-menu button:focus-visible {
  background: #f1f5f9;
  color: #0f172a;
}

.ghost-button,
.secondary-button,
.clear-button,
.primary-button,
.danger-button,
.export-card,
.row-actions button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2);
}

.primary-button {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
  font-weight: 700;
}

.secondary-button {
  background: #f8fafc;
}

.primary-button:hover:not(:disabled) {
  background: #0b5f57;
  border-color: #0b5f57;
}

.secondary-button:hover:not(:disabled) {
  background: #eef2ff;
  border-color: #93c5fd;
}

.primary-button:disabled,
.secondary-button:disabled,
.danger-button:disabled,
.clear-button:disabled,
.row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  background: #cbd5e1;
  border-color: #94a3b8;
  color: #64748b;
  box-shadow: none;
}

.danger-button {
  border-color: #b91c1c;
  background: #dc2626;
  color: #fff;
  font-weight: 700;
}

.danger-button:hover:not(:disabled) {
  background: #991b1b;
  border-color: #991b1b;
}

.clear-button {
  align-self: end;
  font-weight: 700;
}

.filters {
  display: block;
  position: sticky;
  top: 0;
  z-index: 12;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.04);
}

.filter-main-row {
  display: grid;
  grid-template-columns: minmax(140px, 170px) minmax(320px, 1fr) auto auto auto;
  gap: 10px;
  align-items: end;
}

.filter-advanced {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eef1f6;
}

.filter-advanced[hidden] {
  display: none;
}

.filter-summary {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.filter-main-row button {
  min-width: 76px;
}

.dashboard-filter-bar input,
.dashboard-filter-bar select,
.dashboard-filter-bar button {
  min-height: 40px;
  border-radius: 10px;
}

.filter-toggle {
  white-space: nowrap;
}

.cost-filter-panel {
  position: sticky;
}

.cost-filter-panel summary {
  display: none;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.cost-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  align-items: end;
}

.cost-filter-grid .wide {
  grid-column: span 2;
}

.cost-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.segmented-control {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.segmented-control button {
  min-height: 36px;
  border: 0;
  border-right: 1px solid #cbd5e1;
  background: transparent;
  color: #475569;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
}

.segmented-control button:last-child {
  border-right: 0;
}

.segmented-control button.is-active {
  background: #0f766e;
  color: #fff;
}

.cost-list-panel .panel-title {
  align-items: center;
}

.cost-table-wrap table {
  min-width: 1280px;
}

.cost-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.cost-pagination label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cost-pagination select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 8px;
}

.material-status {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 110px;
}

.row-more {
  position: relative;
}

.row-more summary {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.row-more summary::-webkit-details-marker {
  display: none;
}

.row-more-menu {
  position: absolute;
  right: 0;
  z-index: 8;
  display: grid;
  gap: 6px;
  min-width: 110px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.row-more-menu button,
.row-more-menu a {
  justify-content: flex-start;
  min-height: 30px;
  width: 100%;
}

.cost-drawer[hidden],
.cost-document-drawer[hidden] {
  display: none;
}

.cost-drawer,
.cost-document-drawer {
  position: fixed;
  inset: 0;
  z-index: 68;
  display: flex;
  justify-content: flex-end;
}

.cost-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
}

.cost-drawer-panel,
.cost-document-panel {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  height: 100vh;
  margin: 0;
  overflow-y: auto;
  border-radius: 0;
  border: 0;
  border-left: 1px solid #e2e8f0;
  box-shadow: -18px 0 42px rgba(15, 23, 42, 0.16);
}

.cost-drawer-panel {
  padding: 22px;
}

.cost-document-panel {
  width: min(760px, 100%);
  background: #fff;
  padding: 22px;
}

.cost-document-body {
  display: grid;
  gap: 12px;
}

.cost-document-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(110px, auto) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.cost-document-row strong {
  color: #0f172a;
  font-size: 14px;
}

.cost-document-row .document-file-list {
  display: grid;
  gap: 8px;
}

.cost-document-upload {
  align-self: start;
}

label span,
.form-field > span {
  display: block;
  margin-bottom: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.field-note {
  display: block;
  min-height: 16px;
  margin-top: 4px;
  color: #999;
  font-size: 12px;
  line-height: 16px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 8px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.view-panel {
  display: none;
}

.view-panel.is-active {
  display: block;
}

.workspace-state {
  min-height: calc(100vh - 150px);
  padding: 72px 24px;
}

.workspace-state-card {
  display: grid;
  gap: 12px;
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.workspace-state-card strong {
  color: #0f172a;
  font-size: 18px;
}

.workspace-state-card p,
.workspace-state-card ul {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.8;
}

.workspace-state-card ul {
  display: grid;
  gap: 4px;
  padding-left: 18px;
}

.workspace-state-card li::marker {
  color: #2563eb;
}

.is-hidden {
  display: none !important;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.metric {
  --metric-color: #64748b;
  position: relative;
  min-height: 132px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.045);
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--metric-color);
}

.metric span {
  display: block;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin: 16px 0 7px;
  color: #0f172a;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
}

.metric small {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
}

.metric.strong-alert {
  border-color: #fed7aa;
  background: #fff7ed;
}

.tone-blue { --metric-color: var(--blue); }
.tone-green { --metric-color: var(--green); }
.tone-red { --metric-color: var(--red); }
.tone-amber,
.tone-orange { --metric-color: var(--amber); }
.tone-purple,
.tone-indigo { --metric-color: var(--purple); }

.dashboard-layer {
  margin-bottom: 22px;
}

.dashboard-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 12px;
}

.dashboard-section-title span {
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.dashboard-section-title h3 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 800;
}

.dashboard-two-col,
.dashboard-three-col {
  display: grid;
  gap: 16px;
}

.dashboard-two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-grid,
.dashboard-chart-grid,
.dashboard-list-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-chart-grid {
  margin-bottom: 16px;
}

.dashboard-list-grid {
  align-items: start;
}

.settings-shell {
  display: grid;
  gap: 16px;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.settings-tab-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475467;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
}

.settings-tab-button.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.settings-tab-panel {
  display: grid;
  gap: 16px;
}

.settings-filter select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
}

.settings-filter input,
.settings-filter select {
  min-width: 160px;
  flex: 1 1 180px;
}

.settings-record-panel {
  max-width: min(760px, calc(100vw - 32px));
}

.settings-record-panel .entry-form {
  border: 0;
  box-shadow: none;
  padding: 0;
}

.settings-record-panel .form-header {
  padding-right: 36px;
}

.panel.dashboard-card {
  min-height: 100%;
  border-color: #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.045);
}

.dashboard-card .panel-title {
  align-items: center;
  margin-bottom: 16px;
}

.dashboard-card .panel-title h3 {
  color: #0f172a;
  font-size: 15px;
  font-weight: 800;
}

.dashboard-card .panel-title span {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
}

.panel,
.entry-form {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.panel-title,
.form-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-title-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-title h3,
.form-header h3 {
  margin: 0;
  font-size: 18px;
}

.form-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-header p.form-mode {
  color: #0f766e;
  font-weight: 700;
}

.form-header p.form-mode.is-editing {
  color: #b45309;
}

.entry-form {
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.permission-editor {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #fbfcfe;
}

.permission-editor[hidden] {
  display: none;
}

.permission-editor[open] {
  display: grid;
}

.permission-editor-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.permission-editor-title::-webkit-details-marker {
  display: none;
}

.permission-editor-title::after {
  content: "展开";
  flex: 0 0 auto;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
}

.permission-editor[open] .permission-editor-title::after {
  content: "收起";
}

.permission-editor-title small {
  color: var(--muted);
  font-size: 12px;
}

.permission-scope-field {
  max-width: 320px;
}

.permission-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.permission-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.permission-group h4 {
  margin: 0;
  color: #344054;
  font-size: 13px;
}

.permission-checks {
  display: grid;
  gap: 6px;
}

.permission-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.permission-check input {
  width: auto;
  min-height: auto;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.action-label button {
  width: 100%;
  min-height: 40px;
}

.term-field.is-hidden {
  display: none;
}

.installment-block {
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 12px;
}

.installment-items {
  display: grid;
  gap: 10px;
}

.installment-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.5fr) minmax(180px, 1.2fr) minmax(120px, 0.7fr) 42px;
  gap: 10px;
  align-items: end;
}

.installment-row label span {
  font-size: 12px;
}

.installment-row .delete-installment {
  width: 42px;
  min-height: 40px;
  padding: 0;
}

.rate-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.rate-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  grid-column: 1 / -1;
  min-height: 40px;
}

.exchange-rate-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rate-input-row input {
  flex: 1 1 120px;
  min-width: 0;
}

.exchange-rate-meta {
  grid-column: 1 / -1;
  margin-top: 4px;
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
}

.rate-input-row {
  min-height: 40px;
}

.rate-refresh {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  color: #475467;
  font-size: 18px;
  line-height: 1;
  white-space: nowrap;
}

.rate-meta {
  display: block;
  min-width: 0;
  margin: 4px 0 0;
  color: #999;
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.rate-meta::-webkit-scrollbar {
  display: none;
}

.rate-meta.warning {
  color: #b45309;
}

.cost-items-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.cost-items-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cost-items-title strong {
  color: #1d2939;
  font-size: 14px;
}

.cost-items {
  display: grid;
  gap: 10px;
}

.order-search-picker {
  display: grid;
  gap: 8px;
}

.order-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.order-search-picker.is-selected #cost-order-search {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475467;
}

.order-search-results {
  display: grid;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.order-search-results:empty {
  display: none;
}

.order-search-option,
.order-search-empty {
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #edf0f5;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.order-search-option {
  cursor: pointer;
}

.order-search-option:hover,
.order-search-option.is-keyboard-active {
  background: #eff6ff;
}

.order-search-option.is-keyboard-active {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.order-search-option:last-child,
.order-search-empty:last-child {
  border-bottom: 0;
}

.order-search-option strong {
  display: block;
  font-size: 13px;
}

.order-detail-panel {
  padding: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.detail-block {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.compact-form {
  padding: 12px;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #fbfcfe;
}

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

.document-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.document-card.uploaded {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.document-card.missing {
  background: #fff;
  border-color: #fecaca;
}

.document-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.document-card-head strong {
  color: #0f172a;
  font-size: 14px;
}

.document-card-head a,
a.small-link {
  color: var(--blue);
  font-size: 12px;
  text-decoration: none;
}

button.small-link {
  color: var(--blue);
  font-size: 12px;
  text-decoration: none;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.document-upload-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.document-upload-control:hover,
.supplier-doc-upload:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.document-upload-control.is-busy,
.supplier-doc-upload.is-busy {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #2563eb;
}

.document-upload-control input,
.supplier-doc-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.document-file-list {
  display: grid;
  gap: 8px;
}

.document-file-list-title {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
}

.upload-empty-state {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
}

.upload-empty-state span {
  font-size: 17px;
  line-height: 1;
}

.upload-empty-state strong {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.uploaded-file-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.uploaded-file-card.is-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.uploaded-file-card.is-error {
  border-color: #fecaca;
  background: #fef2f2;
}

.uploaded-file-card.is-waiting {
  border-color: #fde68a;
  background: #fffbeb;
}

.uploaded-file-card.is-uploading {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.file-state-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 15px;
  font-weight: 900;
}

.uploaded-file-card.is-success .file-state-icon {
  background: #bbf7d0;
  color: #047857;
}

.uploaded-file-card.is-error .file-state-icon {
  background: #fecaca;
  color: #b91c1c;
}

.uploaded-file-card.is-waiting .file-state-icon {
  background: #fde68a;
  color: #a16207;
}

.uploaded-file-card.is-uploading .file-state-icon {
  border: 2px solid #bfdbfe;
  border-top-color: #2563eb;
  background: transparent;
  animation: upload-spin 0.85s linear infinite;
}

@keyframes upload-spin {
  to {
    transform: rotate(360deg);
  }
}

.file-card-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.file-card-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.file-card-main > small {
  color: #64748b;
  font-size: 12px;
}

.file-card-main .original-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #64748b;
}

.file-type-label {
  width: max-content;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
}

.file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.file-status.success {
  color: #047857;
  font-weight: 800;
}

.file-actions {
  align-self: center;
}

.file-actions a,
.file-actions button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

.upload-progress {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.upload-waiting {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.upload-waiting strong {
  color: #a16207;
  font-size: 12px;
}

.upload-waiting small {
  color: #854d0e;
  font-size: 12px;
}

.upload-progress div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
}

.upload-progress i {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.upload-progress b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.upload-error {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.upload-error strong {
  color: #b91c1c;
  font-size: 12px;
}

.upload-error small {
  color: #991b1b;
  font-size: 12px;
}

.upload-queue-notice {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  display: grid;
  gap: 3px;
  min-width: 210px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: rgba(239, 246, 255, 0.96);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  color: #1e40af;
  backdrop-filter: blur(8px);
}

.upload-queue-notice strong {
  font-size: 13px;
  font-weight: 900;
}

.upload-queue-notice small {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.supplier-doc-list {
  display: grid;
  min-width: 260px;
  gap: 10px;
  white-space: normal;
}

.supplier-doc-item {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.supplier-doc-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.supplier-doc-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.supplier-doc-list.is-optional {
  min-width: 220px;
}

.muted-cell,
.missing-docs {
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
}

.muted-cell {
  color: var(--muted);
}

.positive-note {
  color: var(--green);
  font-size: 12px;
}

.tax-completeness {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tax-completeness.is-complete {
  background: #e8f7ef;
  color: #067647;
}

.tax-completeness.is-empty {
  background: #f2f4f7;
  color: #667085;
}

.tax-completeness.is-missing {
  background: #fee4e2;
  color: #b42318;
}

.tax-completeness.is-partial {
  background: #fffaeb;
  color: #b54708;
}

.tax-refund-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 420px) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.tax-refund-toolbar input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  background: #fff;
}

.pagination-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.tax-detail-drawer[hidden] {
  display: none;
}

.tax-detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  justify-content: flex-end;
}

.tax-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
}

.tax-detail-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  height: 100%;
  overflow-y: auto;
  background: #fff;
  border-left: 1px solid #e2e8f0;
  box-shadow: -18px 0 42px rgba(15, 23, 42, 0.16);
  padding: 22px;
}

.tax-detail-title {
  padding-right: 42px;
  margin-bottom: 16px;
}

.tax-detail-body {
  display: grid;
  gap: 18px;
}

.tax-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 260px);
  gap: 16px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.tax-detail-hero-main {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.tax-detail-hero-main h3 {
  margin: 0;
  color: #0f172a;
  font-size: 22px;
  line-height: 1.25;
  word-break: break-word;
}

.tax-detail-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #64748b;
  font-size: 13px;
}

.tax-detail-hero-side {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-content: start;
}

.tax-package-button {
  justify-content: center;
  width: 100%;
  min-height: 36px;
  background: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
  box-shadow: none;
}

.tax-detail-overall-card,
.tax-detail-status-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
}

.tax-detail-overall-card span,
.tax-detail-status-card span {
  color: #64748b;
  font-size: 12px;
}

.tax-detail-overall-card strong {
  color: #0f172a;
  font-size: 28px;
  line-height: 1;
}

.tax-detail-overall-card small {
  color: #64748b;
}

.tax-detail-status-card strong {
  width: fit-content;
}

.tax-detail-missing-summary {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: #fff7f7;
}

.tax-detail-missing-summary.is-complete {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.tax-detail-missing-summary > strong {
  color: #0f172a;
  font-size: 14px;
}

.tax-detail-missing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tax-status-overview {
  display: grid;
  gap: 12px;
}

.tax-status-overview-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.tax-status-overview-head span {
  color: #0f172a;
  font-size: 15px;
  font-weight: 800;
}

.tax-status-overview-head small {
  color: #64748b;
  font-size: 12px;
}

.tax-status-group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tax-status-group-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
}

.tax-status-group-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #0f172a;
}

.tax-status-group-card header span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.tax-status-item-list {
  display: grid;
  gap: 8px;
}

.tax-status-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.tax-status-item.is-complete {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.tax-status-item.is-missing {
  border-color: #fecaca;
  background: #fff7f7;
}

.tax-status-item.is-unrecorded {
  border-color: #e5e7eb;
  background: #f9fafb;
}

.tax-status-item.is-problem {
  border-color: #fed7aa;
  background: #fff7ed;
}

.tax-status-item strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
}

.tax-status-item small {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
}

.tax-status-item-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.tax-status-action,
.missing-doc-button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.tax-refund-expanded-panel {
  gap: 16px;
}

.tax-detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.tax-detail-toolbar-actions,
.tax-detail-toolbar .tax-detail-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  justify-content: flex-start;
}

.tax-actions {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  flex-wrap: nowrap !important;
  width: auto !important;
  max-width: 100%;
}

.tax-actions button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: auto !important;
  flex: 0 0 auto;
}

.tax-overview-action,
.tax-package-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.tax-overview-action:hover,
.tax-package-button:hover {
  text-decoration: none;
}

.tax-refund-expanded-summary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.tax-refund-status-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #ffffff;
}

.tax-refund-status-summary > span {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.tax-status-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.tax-status-badge.is-not-ready {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.tax-status-badge.is-ready {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.tax-status-badge.is-problem {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.tax-status-badge.is-submitted {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.tax-completeness-meter {
  display: grid;
  gap: 5px;
  width: 240px;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
}

.tax-completeness-meter-head {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: baseline;
  justify-content: start;
  gap: 7px;
}

.tax-completeness-meter-head span,
.tax-completeness-meter-head small {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.tax-completeness-meter-head strong {
  color: #0f172a;
  font-size: 15px;
  line-height: 1;
}

.tax-completeness-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.tax-completeness-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.2s ease;
}

.tax-completeness-meter.is-complete .tax-completeness-track i {
  background: #16a34a;
}

.tax-completeness-meter.is-warning .tax-completeness-track i {
  background: #f97316;
}

.tax-completeness-meter.is-danger .tax-completeness-track i {
  background: #ef4444;
}

.tax-refund-expanded-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  gap: 16px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
}

.tax-refund-expanded-title {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.tax-refund-expanded-title h4 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.35;
  word-break: break-word;
}

.tax-refund-expanded-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #64748b;
  font-size: 12px;
}

.tax-refund-expanded-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.tax-refund-expanded-metrics > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
}

.tax-refund-expanded-metrics span,
.tax-refund-expanded-metrics small {
  color: #64748b;
  font-size: 12px;
}

.tax-refund-expanded-metrics strong {
  color: #0f172a;
  font-size: 20px;
  line-height: 1.1;
}

.tax-detail-workflow-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.user-drawer-panel {
  width: min(720px, 100%);
}

.user-drawer-form {
  margin: 0;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.user-drawer-form .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-drawer-form .form-actions {
  position: sticky;
  bottom: -22px;
  z-index: 2;
  margin: 18px -22px -22px;
  padding: 14px 22px;
  border-top: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.user-drawer-form .permission-groups {
  grid-template-columns: 1fr;
}

.tax-detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tax-detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.tax-detail-actions .primary-button,
.tax-detail-actions .secondary-button,
.tax-detail-actions .danger-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.tax-detail-summary > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px;
  font-size: 13px;
  color: #334155;
}

.tax-detail-section {
  display: grid;
  gap: 12px;
}

.customs-recognition-form .form-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.customs-recognition-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.customs-recognition-badge.is-success {
  color: #166534;
  background: #dcfce7;
}

.customs-recognition-badge.is-partial {
  color: #92400e;
  background: #fef3c7;
}

.customs-recognition-badge.is-failed {
  color: #991b1b;
  background: #fee2e2;
}

.customs-recognition-badge.is-manual {
  color: #1d4ed8;
  background: #dbeafe;
}

.customs-recognition-badge.is-empty {
  color: #475569;
  background: #e2e8f0;
}

.customs-recognition-message {
  margin: 0;
  color: #475569;
  font-size: 13px;
  white-space: pre-line;
}

.customer-shipping-docs-settings {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.customer-shipping-docs-settings h4 {
  margin: 0;
  font-size: 14px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #475569;
  font-size: 13px;
}

.document-type-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  color: #475569;
  font-size: 13px;
}

.document-type-checks > span {
  width: 100%;
  color: #334155;
  font-weight: 700;
}

.document-type-checks label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.shipping-notification-card {
  gap: 12px;
}

.shipping-notification-history {
  display: grid;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid #e2e8f0;
}

.shipping-docs-send-card {
  gap: 12px;
}

.customs-recognition-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.shipping-docs-modal[hidden] {
  display: none;
}

.shipping-docs-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 24px;
}

.shipping-docs-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.54);
}

.shipping-docs-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  width: min(760px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
}

.shipping-docs-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 16px 18px;
}

.shipping-docs-modal-header h3 {
  margin: 0;
  color: #0f172a;
}

.shipping-docs-modal-header p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 13px;
}

.shipping-docs-form {
  display: grid;
  gap: 16px;
  padding: 0 18px 18px;
}

.shipping-docs-confirm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.shipping-docs-confirm-grid div {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px 12px;
}

.shipping-docs-confirm-grid span,
.shipping-docs-file-list small {
  display: block;
  color: #64748b;
  font-size: 12px;
}

.shipping-docs-confirm-grid strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  word-break: break-word;
}

.shipping-docs-warning {
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  padding: 10px 12px;
  font-size: 13px;
}

.shipping-docs-file-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.shipping-docs-file-list li {
  display: grid;
  grid-template-columns: 24px minmax(120px, 0.4fr) minmax(160px, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 10px;
}

.shipping-docs-file-list li.is-ready span {
  color: #047857;
}

.shipping-docs-file-list li.is-missing span {
  color: #b45309;
}

.shipping-docs-form textarea {
  resize: vertical;
}

.tax-detail-drawer .file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tax-detail-drawer .file-actions a,
.tax-detail-drawer .file-actions button,
.tax-detail-drawer .row-actions button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
}

.tax-detail-drawer .file-actions button:not(.primary-button):not(.secondary-button):not(.danger-button) {
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--text);
}

.tax-detail-section h4 {
  margin: 0;
  font-size: 15px;
  color: #0f172a;
}

.domestic-logistics-drawer[hidden] {
  display: none;
}

.domestic-logistics-drawer {
  position: fixed;
  inset: 0;
  z-index: 72;
  display: flex;
  justify-content: flex-end;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
}

.drawer-panel {
  position: relative;
  z-index: 1;
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: -18px 0 42px rgba(15, 23, 42, 0.16);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.domestic-logistics-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 96vw;
  max-width: 1800px;
  height: 95vh;
  max-height: 95vh;
  padding: 22px 22px 0;
  overflow: hidden;
}

.domestic-logistics-scroll {
  display: grid;
  gap: 16px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 4px 18px;
}

.domestic-logistics-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.domestic-logistics-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.domestic-logistics-card-head h4 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
}

.domestic-logistics-card-head p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
}

.domestic-logistics-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.domestic-logistics-summary div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.domestic-logistics-summary span {
  color: #64748b;
  font-size: 12px;
}

.domestic-logistics-summary strong {
  overflow: hidden;
  color: #0f172a;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domestic-logistics-form {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  align-items: start;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.domestic-logistics-form > label {
  display: grid;
  gap: 7px;
  margin: 0;
  min-width: 0;
}

.domestic-logistics-form .wide,
.domestic-logistics-form .form-actions,
.domestic-transport-items {
  grid-column: 1 / -1;
}

.domestic-logistics-mode-row {
  width: min(320px, 100%);
}

.domestic-express-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(280px, 1.4fr);
  gap: 12px;
}

.domestic-transport-items {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
}

.domestic-transport-items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.domestic-transport-items-head div {
  display: grid;
  gap: 3px;
}

.domestic-transport-items-head strong {
  color: #0f172a;
  font-size: 14px;
}

.domestic-transport-items-head small {
  color: #64748b;
  font-size: 12px;
}

.domestic-transport-items-list {
  display: grid;
  gap: 8px;
}

.domestic-transport-table-head,
.domestic-transport-item-row {
  display: grid;
  grid-template-columns:
    minmax(130px, 160px)
    minmax(112px, 140px)
    minmax(112px, 140px)
    minmax(130px, 150px)
    minmax(120px, 160px)
    minmax(120px, 160px)
    minmax(160px, 220px)
    minmax(100px, 220px)
    minmax(142px, 160px);
  gap: 8px;
  align-items: center;
}

.domestic-transport-table-head {
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 750;
  padding: 9px 10px;
}

.domestic-transport-table-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.domestic-transport-item-row {
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
}

.domestic-transport-item-row label {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
}

.domestic-transport-item-row label span {
  display: none;
}

.domestic-transport-item-row input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 8px 9px;
}

.domestic-transport-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
}

.domestic-transport-row-actions button {
  min-height: 34px;
  padding: 0 9px;
  font-size: 12px;
  white-space: nowrap;
}

.domestic-remark-card textarea {
  width: 100%;
  min-height: 160px;
}

.domestic-logistics-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -22px;
  padding: 14px 22px;
  border-top: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.domestic-logistics-footer > span {
  color: #64748b;
  font-size: 12px;
}

.domestic-logistics-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.domestic-logistics-footer-actions button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.domestic-logistics-documents .tax-detail-doc-grid {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 240px;
  gap: 0;
  overflow: hidden;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
}

.domestic-document-table-head,
.domestic-document-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 180px minmax(0, 1fr) 240px;
}

.domestic-document-table-head {
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 750;
}

.domestic-document-table-head span,
.domestic-document-type,
.domestic-document-status,
.domestic-document-action {
  min-width: 0;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px;
}

.domestic-document-table-head span:not(:last-child),
.domestic-document-type,
.domestic-document-status {
  border-right: 1px solid #e2e8f0;
}

.domestic-document-row:last-child .domestic-document-type,
.domestic-document-row:last-child .domestic-document-status,
.domestic-document-row:last-child .domestic-document-action {
  border-bottom: 0;
}

.domestic-document-type,
.domestic-document-status,
.domestic-document-action {
  display: grid;
  gap: 8px;
  align-content: start;
  background: #fff;
}

.domestic-document-type > span,
.domestic-document-status > span,
.domestic-document-action > span {
  display: none;
}

.domestic-document-type strong,
.domestic-document-file strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #0f172a;
}

.domestic-document-file {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.domestic-document-file small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.domestic-document-file .file-actions {
  margin-top: 2px;
}

.domestic-document-action .supplier-doc-upload {
  width: 100%;
  min-height: 38px;
}

.domestic-document-empty {
  grid-column: 1 / -1;
}

.domestic-logistics-supplier-hint {
  grid-column: 1 / -1;
  margin: -6px 0 2px;
  color: #b45309;
}

.tax-remark-preview,
#domestic-remark-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #0f172a;
  font: 13px/1.78 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  margin: 8px 0 0;
  padding: 12px;
  min-height: 160px;
  resize: vertical;
  white-space: pre-wrap;
}

.domestic-logistics-form .form-actions {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.domestic-logistics-form .form-actions .primary-button,
.domestic-logistics-form .form-actions .secondary-button,
.domestic-logistics-form .form-actions button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.domestic-logistics-review .document-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: #64748b;
  font-size: 12px;
}

body.logistics-compact-layout .order-detail-panel {
  padding: 10px;
}

body.logistics-compact-layout .detail-grid {
  gap: 10px;
}

body.logistics-compact-layout .detail-block {
  gap: 8px;
}

body.logistics-compact-layout .compact-form {
  padding: 10px;
  border-radius: 8px;
}

body.logistics-compact-layout #logistics-form .form-grid {
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.logistics-compact-layout #logistics-form label,
body.logistics-compact-layout #logistics-form .form-field {
  gap: 4px;
}

body.logistics-compact-layout #logistics-form input,
body.logistics-compact-layout #logistics-form select,
body.logistics-compact-layout #logistics-form textarea {
  min-height: 34px;
  padding: 6px 8px;
  line-height: 1.35;
}

body.logistics-compact-layout #logistics-form textarea {
  min-height: 58px;
}

body.logistics-compact-layout #logistics-form .exchange-rate-meta {
  margin-top: 2px;
}

body.logistics-compact-layout #logistics-form .form-actions {
  margin-top: 6px;
}

body.logistics-compact-layout #logistics-table th,
body.logistics-compact-layout #logistics-table td {
  padding: 6px 8px;
  line-height: 1.35;
}

body.logistics-compact-layout .domestic-logistics-panel {
  width: min(1160px, 94vw);
  padding: 14px 16px 0;
}

body.logistics-compact-layout .domestic-logistics-panel .drawer-header {
  margin-bottom: 8px;
}

body.logistics-compact-layout .domestic-logistics-scroll {
  gap: 10px;
  max-height: 82vh;
  padding: 0 2px 10px;
}

body.logistics-compact-layout .domestic-logistics-card {
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  box-shadow: none;
}

body.logistics-compact-layout .domestic-logistics-card-head {
  gap: 8px;
}

body.logistics-compact-layout .domestic-logistics-card-head h4 {
  font-size: 14px;
}

body.logistics-compact-layout .domestic-logistics-card-head p {
  margin-top: 2px;
}

body.logistics-compact-layout .domestic-logistics-summary {
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
}

body.logistics-compact-layout .domestic-logistics-summary div {
  gap: 2px;
}

body.logistics-compact-layout .domestic-logistics-summary span {
  font-size: 11px;
}

body.logistics-compact-layout .domestic-logistics-summary strong {
  font-size: 13px;
}

body.logistics-compact-layout .domestic-logistics-form {
  gap: 10px;
}

body.logistics-compact-layout .domestic-logistics-form [hidden],
body.logistics-compact-layout .domestic-logistics-scroll [hidden] {
  display: none !important;
}

body.logistics-compact-layout .domestic-logistics-mode-row {
  width: min(260px, 100%);
}

body.logistics-compact-layout .domestic-express-fields {
  gap: 8px;
}

body.logistics-compact-layout .domestic-logistics-form > label,
body.logistics-compact-layout .domestic-express-fields label,
body.logistics-compact-layout .domestic-logistics-field {
  gap: 4px;
}

body.logistics-compact-layout #domestic-transport-type,
body.logistics-compact-layout .domestic-express-fields input,
body.logistics-compact-layout .domestic-transport-item-row input {
  min-height: 34px;
  padding: 6px 8px;
  line-height: 1.35;
}

body.logistics-compact-layout .domestic-transport-items {
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
}

body.logistics-compact-layout .domestic-transport-items-head {
  gap: 8px;
}

body.logistics-compact-layout .domestic-transport-items-head div {
  gap: 1px;
}

body.logistics-compact-layout .domestic-transport-items-list {
  gap: 8px;
}

body.logistics-compact-layout .domestic-transport-item-row {
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  grid-template-columns:
    minmax(96px, 1.05fr)
    minmax(96px, 1fr)
    minmax(96px, 1fr)
    minmax(112px, 1fr)
    minmax(96px, 1fr)
    minmax(96px, 1fr)
    minmax(126px, 1.15fr)
    minmax(96px, 1fr)
    auto;
}

body.logistics-compact-layout .domestic-transport-item-row label {
  gap: 4px;
}

body.logistics-compact-layout .domestic-transport-row-actions {
  gap: 6px;
}

body.logistics-compact-layout .domestic-transport-row-actions button {
  min-height: 32px;
  padding: 0 9px;
}

body.logistics-compact-layout .domestic-remark-card textarea,
body.logistics-compact-layout #domestic-remark-preview {
  min-height: 96px;
  margin-top: 4px;
  padding: 10px;
  line-height: 1.62;
}

body.logistics-compact-layout .domestic-logistics-documents .tax-detail-doc-grid {
  gap: 8px;
}

body.logistics-compact-layout .domestic-logistics-documents .tax-detail-document {
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
}

body.logistics-compact-layout .domestic-logistics-documents .uploaded-file-card,
body.logistics-compact-layout .domestic-logistics-documents .upload-empty-state {
  padding: 8px;
}

body.logistics-compact-layout .domestic-logistics-footer {
  gap: 10px;
  margin: 0 -16px;
  padding: 10px 16px;
}

body.logistics-compact-layout .domestic-logistics-footer-actions {
  gap: 8px;
}

body.logistics-compact-layout .domestic-logistics-footer-actions button {
  min-height: 34px;
  padding: 0 12px;
}

.expanded-transport-items {
  display: grid;
  gap: 10px;
}

.expanded-transport-item {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 12px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
}

.expanded-transport-item strong {
  grid-column: 1 / -1;
  color: #0f172a;
}

.expanded-transport-item span {
  min-width: 0;
  color: #334155;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.tax-detail-doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tax-detail-document,
.tax-detail-supplier {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.tax-detail-document.is-customs-entry {
  border-color: #93c5fd;
  background: #eff6ff;
}

.tax-detail-supplier {
  display: grid;
  gap: 10px;
}

.tax-logistics-invoice-list {
  display: grid;
  gap: 10px;
}

.tax-logistics-invoice-row {
  display: grid;
  gap: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.tax-logistics-invoice-meta {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(140px, 1.4fr) minmax(130px, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: #334155;
}

.tax-logistics-invoice-meta strong {
  color: #0f172a;
}

.pdf-preview-modal[hidden] {
  display: none;
}

.pdf-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 2.5vh 2.5vw;
}

.pdf-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.54);
}

.pdf-preview-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: 95vw;
  height: 95vh;
  overflow: hidden;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
}

.pdf-preview-header {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(220px, 1.4fr) auto;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 14px 16px;
}

.pdf-preview-header strong {
  display: block;
  color: #0f172a;
  font-size: 15px;
}

.pdf-preview-header span,
.pdf-preview-meta {
  color: #64748b;
  font-size: 12px;
}

.pdf-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.pdf-preview-meta b {
  color: #334155;
  font-weight: 700;
}

.pdf-preview-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  position: sticky;
  top: 0;
  z-index: 3;
}

.pdf-preview-actions .modal-close {
  position: static;
}

.pdf-preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  padding: 10px 16px;
}

.pdf-preview-toolbar .secondary-button.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
}

.pdf-preview-stage {
  position: relative;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  background: #dbe3ef;
}

.pdf-preview-panel.is-thumbnails-hidden .pdf-preview-stage {
  grid-template-columns: minmax(0, 1fr);
}

.pdf-preview-panel.is-thumbnails-hidden .pdf-preview-thumbnails {
  display: none;
}

.pdf-preview-thumbnails {
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 12px;
}

.pdf-preview-thumb-label {
  margin-bottom: 10px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.pdf-preview-thumb {
  display: grid;
  width: 100%;
  gap: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  padding: 8px;
  text-align: center;
}

.pdf-preview-thumb.is-active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

#pdf-preview-thumb-frame,
#pdf-preview-thumb-image {
  width: 100%;
  height: 168px;
  border: 0;
  border-radius: 6px;
  background: #eef2f7;
  object-fit: contain;
  pointer-events: none;
}

.pdf-preview-canvas {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #64748b;
}

#pdf-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #64748b;
}

#image-preview-frame {
  width: 100%;
  height: 100%;
  background: #1e293b;
  object-fit: contain;
  cursor: zoom-in;
}

.pdf-preview-error {
  position: absolute;
  inset: 24px;
  display: grid;
  place-content: center;
  gap: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  background: #fff;
  color: #334155;
  text-align: center;
  padding: 24px;
}

.pdf-preview-error[hidden] {
  display: none;
}

.pdf-preview-error strong {
  color: #0f172a;
  font-size: 16px;
}

.pdf-preview-error small {
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
}

.tax-missing-docs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

.missing-doc-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.missing-doc-button,
.missing-doc-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
}

.missing-doc-button {
  cursor: pointer;
}

.missing-doc-button:hover {
  border-color: #fdba74;
  background: #ffedd5;
  color: #9a3412;
}

.upload-target-highlight {
  position: relative;
  outline: 2px solid #2563eb;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.14);
  transition: outline-color 0.2s ease, box-shadow 0.2s ease;
  scroll-margin-top: 96px;
}

.order-search-option small,
.order-search-helper,
.order-search-empty {
  color: var(--muted);
  font-size: 12px;
}

.order-search-helper {
  margin: 0;
}

.order-search-empty {
  cursor: default;
}

.supplier-picker {
  position: relative;
}

.supplier-search-results {
  display: grid;
  margin-top: 6px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.supplier-search-results:empty {
  display: none;
}

.supplier-search-option,
.supplier-search-empty {
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid #edf0f5;
  background: #fff;
  color: var(--text);
  text-align: left;
  font-size: 12px;
}

.supplier-search-option {
  cursor: pointer;
}

.supplier-search-option:hover,
.supplier-search-option.is-keyboard-active {
  background: #eff6ff;
}

.supplier-search-option.is-keyboard-active {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.supplier-search-option:last-child,
.supplier-search-empty:last-child {
  border-bottom: 0;
}

.supplier-search-empty {
  color: var(--muted);
}

.supplier-selected {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--text);
  font-size: 13px;
}

.supplier-selected small {
  color: var(--muted);
  font-weight: 500;
}

.inline-filter {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
}

.inline-filter input {
  min-width: 320px;
}

.inline-filter.settings-filter input,
.inline-filter.settings-filter select {
  min-width: 160px;
}

.cost-item-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(110px, 0.8fr) minmax(90px, 0.6fr) minmax(110px, 0.8fr) minmax(120px, 0.8fr) minmax(150px, 1fr) 42px;
  gap: 10px;
  align-items: end;
}

.cost-item-row label span {
  font-size: 12px;
}

.cost-item-row .delete-cost-item {
  width: 42px;
  min-height: 40px;
  padding: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #edf0f5;
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  font-size: 13px;
}

th {
  color: #475467;
  background: #f8fafc;
  font-weight: 800;
}

.empty-row,
.empty-note {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 800;
}

.status.success {
  background: #e8f7ef;
  color: #067647;
}

.status.warning {
  background: #fff7e6;
  color: #a16207;
}

.status.danger {
  background: #fff1ed;
  color: #c2410c;
}

.status.neutral {
  background: #f3f4f6;
  color: #6b7280;
}

.status.muted {
  background: #f3f4f6;
  color: #6b7280;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.link-button {
  min-height: auto;
  border: 0;
  background: transparent;
  color: #0f5fbb;
  padding: 0;
  text-align: left;
  font-weight: 800;
}

.link-button:hover {
  color: #0f766e;
  text-decoration: underline;
}

.danger-text {
  color: #c2410c;
  font-weight: 800;
}

.chart-stack {
  display: grid;
  gap: 12px;
}

.chart-row,
.trend-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.9fr) minmax(160px, 1.4fr) auto;
  gap: 12px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf0f5;
}

.trend-row {
  grid-template-columns: minmax(110px, 0.5fr) minmax(220px, 1.5fr);
}

.chart-row:last-child,
.trend-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.chart-label {
  min-width: 0;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.chart-label small {
  display: block;
  margin-top: 3px;
  color: #667085;
  font-weight: 500;
}

.chart-track {
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.chart-track i,
.trend-bars i {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.chart-track i.blue,
.trend-bars i.blue {
  background: #2563eb;
}

.chart-track i.green,
.trend-bars i.green {
  background: #0f8a5f;
}

.chart-track i.red,
.trend-bars i.red {
  background: #c2410c;
}

.chart-track i.amber,
.trend-bars i.amber {
  background: #b7791f;
}

.trend-bars {
  display: grid;
  gap: 7px;
}

.trend-bars span {
  display: grid;
  grid-template-columns: minmax(60px, 1fr) minmax(120px, auto);
  gap: 10px;
  align-items: center;
}

.trend-bars span::before {
  content: "";
  display: none;
}

.line-chart {
  min-height: 330px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i,
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.trend-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.trend-grid line {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.trend-grid text,
.trend-axis text {
  fill: #94a3b8;
  font-size: 11px;
}

.trend-line polyline {
  fill: none;
  stroke: var(--line-color);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-line circle {
  fill: #fff;
  stroke: var(--line-color);
  stroke-width: 2.5;
}

.rank-list {
  display: grid;
  gap: 10px;
}

.rank-list.compact-rank {
  gap: 8px;
}

.rank-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 70px;
  padding: 12px;
  border: 1px solid #e5eaf2;
  border-radius: 14px;
  background: #fff;
}

.compact-rank .rank-item {
  min-height: 64px;
  padding: 10px;
}

.rank-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.rank-main {
  min-width: 0;
}

.rank-main strong {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.rank-main small {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.rank-value {
  min-width: 116px;
  text-align: right;
}

.rank-value strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
}

.rank-value small {
  display: block;
  margin-top: 4px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
}

.rank-value.positive strong {
  color: #0f8a5f;
}

.rank-value.negative strong,
.risk-item.is-danger .rank-value strong {
  color: #c2410c;
}

.risk-item.is-warning {
  border-color: #fde68a;
  background: #fffbeb;
}

.risk-item.is-danger {
  border-color: #fed7aa;
  background: #fff7ed;
}

.mini-progress {
  display: block;
  height: 6px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f7;
}

.mini-progress b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #10b981);
}

.mini-progress b.negative {
  background: linear-gradient(90deg, #fb923c, #c2410c);
}

.donut-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.donut-chart {
  display: grid;
  min-height: 220px;
  place-items: center;
}

.donut-ring {
  display: grid;
  width: 190px;
  height: 190px;
  place-items: center;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.donut-ring span {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.donut-ring strong {
  display: block;
  margin-top: 6px;
  color: #0f172a;
  font-size: 15px;
  font-weight: 800;
}

.cost-legend-item {
  grid-template-columns: 12px minmax(0, 1fr) auto;
  min-height: 50px;
}

.dashboard-empty {
  display: grid;
  min-height: 156px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: #64748b;
}

.dashboard-empty i {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent 42%, #cbd5e1 42% 58%, transparent 58%),
    linear-gradient(#e2e8f0, #f8fafc);
}

.dashboard-empty strong {
  color: #334155;
  font-size: 13px;
}

.dashboard-empty small {
  max-width: 280px;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.5;
}

.trend-bars i {
  height: 8px;
  background: #64748b;
}

.trend-bars em {
  color: #475467;
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.stat-list {
  display: grid;
  gap: 10px;
}

.stat-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 10px 0 14px;
  border-bottom: 1px solid #edf0f5;
}

.stat-row i {
  position: absolute;
  left: 0;
  bottom: 6px;
  height: 4px;
  border-radius: 999px;
  background: #0f766e;
}

.reminder-list {
  display: grid;
  gap: 10px;
}

.reminder-item {
  padding: 12px;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fffaf0;
}

.reminder-item.danger {
  border-left-color: var(--red);
  background: #fff4f0;
}

.reminder-item span {
  display: block;
  margin-top: 5px;
  color: #475467;
  font-size: 13px;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.export-card {
  min-height: 72px;
  text-align: left;
  font-weight: 800;
}

.report-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.report-tabs button {
  min-height: 36px;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 700;
}

.report-tabs button:hover {
  border-color: #93c5fd;
  color: #2563eb;
}

.report-tabs button.is-active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.report-query-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
}

.report-query-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.report-download-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #eff6ff;
}

.report-download-bar span {
  margin-right: auto;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 800;
}

.report-table-wrap {
  margin-top: 8px;
}

.table-sort-button {
  min-height: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.manual-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 20px;
  margin-bottom: 16px;
  padding: 26px;
  border: 1px solid #d7dee8;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.06), transparent 42%),
    #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.manual-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.manual-hero h3 {
  margin: 0;
  color: #0f172a;
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0;
}

.manual-hero p {
  margin: 10px 0 0;
  color: #475569;
  font-size: 15px;
  line-height: 1.7;
}

.manual-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.manual-meta-row span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.manual-hero-badge {
  display: grid;
  align-content: center;
  min-height: 150px;
  padding: 20px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
}

.manual-hero-badge strong {
  color: #0f172a;
  font-size: 22px;
  line-height: 1.25;
}

.manual-hero-badge small {
  margin-top: 8px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.manual-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}

.manual-search {
  display: grid;
  gap: 6px;
}

.manual-search span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.manual-search input {
  width: 100%;
  height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
  padding: 0 12px;
}

.manual-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.manual-flow {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.manual-flow article {
  position: relative;
  min-height: 92px;
  padding: 14px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.manual-flow article:not(:last-child)::after {
  content: "→";
  position: absolute;
  top: 50%;
  right: -10px;
  z-index: 1;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  transform: translateY(-50%);
}

.manual-flow strong,
.manual-flow small {
  display: block;
}

.manual-flow strong {
  color: #0f172a;
  font-size: 14px;
}

.manual-flow small {
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.manual-rule-card {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid #fed7aa;
  border-radius: 16px;
  background: #fff7ed;
}

.manual-rule-card span {
  color: #c2410c;
  font-size: 12px;
  font-weight: 900;
}

.manual-rule-card h4 {
  margin: 8px 0 0;
  color: #7c2d12;
  font-size: 18px;
  line-height: 1.4;
}

.manual-rule-card ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 0;
  padding-left: 18px;
  color: #7c2d12;
  font-size: 13px;
  line-height: 1.65;
}

.manual-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.manual-toc {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.manual-toc button {
  min-height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #475569;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.manual-toc button:hover,
.manual-toc button.is-active {
  background: #eff6ff;
  color: #2563eb;
}

.manual-content {
  display: grid;
  gap: 12px;
}

.manual-section-card {
  border: 1px solid #dbe3ee;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.045);
  overflow: hidden;
  scroll-margin-top: 18px;
}

.manual-section-card.is-search-match {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 12px 30px rgba(15, 23, 42, 0.045);
}

.manual-section-card summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 18px;
  color: #0f172a;
  cursor: pointer;
  list-style: none;
}

.manual-section-card summary::-webkit-details-marker {
  display: none;
}

.manual-section-card summary::after {
  content: "+";
  margin-left: auto;
  color: #64748b;
  font-size: 20px;
  font-weight: 700;
}

.manual-section-card[open] summary::after {
  content: "−";
}

.manual-section-card summary span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #f1f5f9;
  color: #2563eb;
  font-size: 13px;
  font-weight: 900;
}

.manual-section-card summary strong {
  font-size: 16px;
}

.manual-searchable {
  padding: 0 18px 18px 64px;
  color: #475569;
  font-size: 14px;
  line-height: 1.75;
}

.manual-searchable p {
  margin: 0 0 12px;
}

.manual-searchable ol,
.manual-searchable ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
}

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

.manual-section-grid > div {
  min-width: 0;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.manual-section-grid h5 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 13px;
}

.manual-entry-tip {
  margin-top: 12px !important;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ecfdf5;
  color: #047857;
  font-weight: 800;
  font-size: 13px;
}

.manual-highlight {
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  padding: 0 2px;
}

.manual-back-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  padding: 0 16px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.2);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

body.modal-open {
  overflow: hidden;
}

.login-modal[hidden] {
  display: none;
}

.login-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

#login-modal {
  place-items: stretch end;
  padding: 0;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
}

.login-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: 80vh;
  overflow: hidden;
  border: 1px solid #d9dee8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 56px rgba(15, 23, 42, 0.2);
  padding: 0;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #475467;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.profile-drawer {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(480px, 100vw);
  height: 100vh;
  border-left: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: -24px 0 56px rgba(15, 23, 42, 0.14);
}

.login-dialog-header {
  padding-right: 34px;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border: 1px solid #d1fae5;
  border-radius: 999px;
  background: #ecfdf3;
  color: #047857;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.login-dialog h3 {
  margin: 12px 0 6px;
  font-size: 22px;
}

.login-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.login-current {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  margin: 18px 0;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.login-current span,
.login-current small {
  color: #667085;
  font-size: 12px;
}

.login-current strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.profile-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin: 22px 24px 0;
  border: 1px solid #edf0f5;
  border-radius: 18px;
  background: #f8fafc;
  padding: 18px;
  padding-right: 48px;
}

.profile-card strong,
.profile-card small,
.profile-card span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card strong {
  color: #0f172a;
  font-size: 18px;
  font-weight: 750;
}

.profile-card small {
  margin-top: 3px;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.profile-card span {
  margin-top: 6px;
  color: #64748b;
  font-size: 13px;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  background: #1e3a8a;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}

.profile-body {
  min-height: 0;
  overflow-y: auto;
  padding: 28px 24px 24px;
}

.profile-form {
  border-top: 0;
  padding-top: 0;
}

.drawer-panel[hidden] {
  display: none;
}

.drawer-panel h3 {
  margin: 0 0 18px;
  color: #0f172a;
  font-size: 17px;
  font-weight: 750;
}

.profile-drawer .login-form {
  gap: 16px;
}

.profile-drawer label span {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.profile-drawer input,
.profile-drawer select {
  height: 40px;
  min-height: 40px;
  border-radius: 12px;
  border-color: #d9e1ec;
  background-color: #fff;
  color: #0f172a;
  font-size: 14px;
}

.profile-drawer select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 13px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.profile-drawer .primary-button {
  height: 40px;
  min-height: 40px;
  border-radius: 12px;
  padding: 0 18px;
}

.security-meta {
  display: grid;
  gap: 10px;
  margin-top: 24px;
  border-top: 1px solid #edf0f5;
  padding-top: 18px;
}

.security-meta div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #edf0f5;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px 14px;
}

.security-meta span {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.security-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0f172a;
  font-size: 13px;
  font-weight: 650;
}

.login-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid,
  .cost-item-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-main-row {
    grid-template-columns: minmax(130px, 160px) minmax(240px, 1fr) repeat(3, auto);
  }

  .cost-filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid,
  .dashboard-chart-grid,
  .dashboard-list-grid,
  .dashboard-two-col,
  .dashboard-three-col,
  .donut-layout,
  .settings-grid,
  .detail-grid,
  .manual-layout,
  .manual-rule-card,
  .manual-section-grid,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .manual-toc {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1199px) {
  .domestic-logistics-panel {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    padding: 18px 16px 0;
  }

  .domestic-logistics-scroll {
    padding-right: 0;
  }

  .domestic-transport-table-head,
  .domestic-document-table-head {
    display: none;
  }

  .domestic-transport-item-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
  }

  .domestic-transport-item-row label span {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-weight: 650;
  }

  .domestic-transport-row-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .domestic-logistics-documents .tax-detail-doc-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .domestic-document-row {
    grid-template-columns: 1fr;
    overflow: hidden;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
  }

  .domestic-document-type,
  .domestic-document-status,
  .domestic-document-action {
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .domestic-document-row:last-child .domestic-document-type,
  .domestic-document-row:last-child .domestic-document-status {
    border-bottom: 1px solid #e2e8f0;
  }

  .domestic-document-row .domestic-document-action {
    border-bottom: 0;
  }

  .domestic-document-type > span,
  .domestic-document-status > span,
  .domestic-document-action > span {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-weight: 650;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    transform: translateX(-104%);
    transition: transform 0.2s ease;
    box-shadow: 16px 0 40px rgba(15, 23, 42, 0.14);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 25;
    display: block;
    background: rgba(15, 23, 42, 0.34);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    margin-left: 0;
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    justify-content: stretch;
  }

  .mobile-nav-button {
    display: grid;
  }

  .top-actions {
    grid-column: 1 / -1;
    width: 100%;
    flex-wrap: wrap;
  }

  .account-button {
    flex: 1 1 140px;
  }

  .login-modal {
    padding: 16px;
  }

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

  .manual-hero,
  .manual-toolbar {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .manual-hero h3 {
    font-size: 26px;
  }

  .manual-hero-badge {
    min-height: 0;
  }

  .manual-toolbar-actions,
  .manual-toolbar-actions .secondary-button {
    width: 100%;
  }

  .manual-toolbar-actions .secondary-button {
    justify-content: center;
  }

  .manual-flow {
    grid-template-columns: repeat(8, 150px);
  }

  .manual-rule-card ul {
    grid-template-columns: 1fr;
  }

  .manual-searchable {
    padding: 0 14px 16px;
  }

  .manual-section-card summary {
    padding: 0 14px;
  }

  .manual-toc {
    grid-template-columns: 1fr;
  }

  .manual-back-top {
    right: 16px;
    bottom: 16px;
  }

  .metric-grid,
  .form-grid,
  .user-drawer-form .form-grid,
  .permission-groups,
  .cost-item-row,
  .document-grid,
  .uploaded-file-card,
  .installment-row,
  .order-search-row {
    grid-template-columns: 1fr;
  }

  .filter-main-row,
  .filter-advanced,
  .report-query-form,
  .cost-filter-grid,
  .cost-document-row,
  .domestic-transport-item-row,
  .expanded-transport-item,
  .domestic-express-fields,
  .domestic-logistics-summary,
  .domestic-logistics-documents .tax-detail-doc-grid,
  .domestic-logistics-form {
    grid-template-columns: 1fr;
  }

  .domestic-logistics-panel {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    padding: 18px 16px 0;
  }

  .domestic-logistics-scroll {
    max-height: 78vh;
  }

  .domestic-logistics-footer {
    align-items: flex-start;
    flex-direction: column;
    margin: 0 -16px;
    padding: 12px 16px;
  }

  .domestic-logistics-footer-actions,
  .domestic-logistics-footer-actions button {
    width: 100%;
  }

  .filters {
    position: static;
  }

  .cost-filter-panel summary {
    display: block;
  }

  .cost-filter-panel summary + form {
    margin-top: 12px;
  }

  .cost-filter-grid .wide {
    grid-column: auto;
  }

  .cost-filter-actions,
  .panel-title-actions,
  .cost-pagination {
    justify-content: flex-start;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1 1 0;
    padding: 0 8px;
  }

  .cost-drawer-panel,
  .cost-document-panel {
    width: 100%;
    border-left: 0;
  }

  .tax-refund-expanded-head,
  .tax-refund-expanded-metrics,
  .tax-status-group-grid {
    grid-template-columns: 1fr;
  }

  .tax-detail-toolbar {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .tax-detail-toolbar-actions,
  .tax-completeness-meter {
    width: 100%;
  }

  .tax-actions {
    width: auto !important;
  }

  .tax-actions button {
    width: auto !important;
  }

  .tax-status-overview-head,
  .tax-status-item,
  .tax-status-item-side {
    align-items: flex-start;
  }

  .tax-status-overview-head,
  .tax-status-item {
    grid-template-columns: 1fr;
  }

  .tax-status-item-side {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .filter-main-row button,
  .filter-advanced button,
  .report-query-actions button {
    width: 100%;
  }

  .report-query-actions,
  .report-download-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tax-refund-toolbar {
    grid-template-columns: 1fr;
  }

  .tax-refund-toolbar button,
  .pagination-bar button {
    width: 100%;
  }

  .pagination-bar {
    display: grid;
    grid-template-columns: 1fr;
    text-align: center;
  }

  .tax-detail-panel {
    width: 100%;
    padding: 18px;
  }

  .tax-detail-summary,
  .tax-detail-doc-grid {
    grid-template-columns: 1fr;
  }

  .tax-detail-hero,
  .tax-status-group-grid {
    grid-template-columns: 1fr;
  }

  .tax-status-overview-head {
    display: grid;
    gap: 4px;
  }

  .tax-status-item {
    grid-template-columns: 1fr;
  }

  .tax-status-item-side,
  .tax-detail-workflow-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .tax-logistics-invoice-meta {
    grid-template-columns: 1fr;
  }

  .pdf-preview-modal {
    padding: 0;
  }

  .pdf-preview-panel {
    width: 100vw;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .pdf-preview-header {
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px 12px;
  }

  .pdf-preview-meta {
    grid-column: 1 / -1;
  }

  .pdf-preview-toolbar {
    padding: 8px 10px;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .pdf-preview-toolbar .secondary-button {
    white-space: nowrap;
  }

  .pdf-preview-stage {
    grid-template-columns: 128px minmax(0, 1fr);
  }

  .pdf-preview-thumbnails {
    padding: 8px;
  }

  #pdf-preview-thumb-frame,
  #pdf-preview-thumb-image {
    height: 96px;
  }

  .dashboard-section-title {
    display: block;
  }

  .dashboard-section-title h3 {
    margin-top: 4px;
  }

  .rank-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .rank-value {
    grid-column: 2;
    min-width: 0;
    text-align: left;
  }

  .donut-chart {
    min-height: 190px;
  }

  .donut-ring {
    width: 170px;
    height: 170px;
  }

  .upload-queue-notice {
    top: auto;
    right: 14px;
    bottom: 14px;
    left: 14px;
    min-width: 0;
  }

  .chart-row,
  .trend-row,
  .trend-bars span {
    grid-template-columns: 1fr;
  }

  .metric {
    min-height: 118px;
  }
}

@media (max-width: 480px) {
  .tax-actions {
    flex-wrap: wrap !important;
  }
}

/* Logistics expense collaboration */
.logistics-expense-panel .panel-title-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.logistics-expense-drawer,
.logistics-invoice-drawer {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.logistics-expense-drawer .tax-detail-panel,
.logistics-invoice-drawer .tax-detail-panel {
  height: min(92vh, 900px);
  max-height: 95vh;
  overflow: hidden;
  border: 1px solid #d9e2ec;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  padding: 0;
}

.logistics-expense-drawer .tax-detail-panel {
  width: 96vw;
  max-width: 1400px;
}

.logistics-invoice-drawer .tax-detail-panel {
  width: min(96vw, 920px);
}

.logistics-expense-drawer .entry-form,
.logistics-invoice-drawer .entry-form {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.logistics-expense-drawer .form-header,
.logistics-invoice-drawer .form-header {
  flex: 0 0 auto;
  padding: 22px 24px 12px;
}

.logistics-expense-drawer .form-grid,
.logistics-invoice-drawer .form-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 24px 16px;
}

.logistics-expense-drawer .form-grid {
  grid-template-columns: minmax(320px, 2fr) minmax(220px, 1fr) minmax(160px, 180px);
  align-content: start;
}

.logistics-invoice-drawer .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.logistics-expense-search-field {
  min-width: 0;
}

.logistics-expense-drawer .form-actions,
.logistics-invoice-drawer .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  flex: 0 0 auto;
  justify-content: flex-end;
  margin: 0;
  padding: 14px 24px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 -10px 22px rgba(15, 23, 42, 0.06);
}

.logistics-expense-order-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--sidebar-soft);
  border-radius: 8px;
}

.logistics-expense-order-summary div {
  display: grid;
  gap: 4px;
}

.logistics-expense-order-summary span,
.logistics-expense-items small,
#logistics-expense-total {
  color: var(--muted);
  font-size: 12px;
}

.logistics-expense-items {
  overflow-x: hidden;
}

.logistics-expense-items .table-wrap {
  max-height: 320px;
  overflow-x: hidden;
}

.logistics-expense-items table {
  min-width: 0;
  table-layout: fixed;
}

.logistics-expense-items th,
.logistics-expense-items td {
  white-space: normal;
}

.logistics-expense-items th:nth-child(1),
.logistics-expense-items td:nth-child(1) {
  width: 190px;
}

.logistics-expense-items th:nth-child(2),
.logistics-expense-items td:nth-child(2) {
  width: 92px;
}

.logistics-expense-items th:nth-child(3),
.logistics-expense-items td:nth-child(3) {
  width: 124px;
}

.logistics-expense-items th:nth-child(4),
.logistics-expense-items td:nth-child(4) {
  width: 112px;
}

.logistics-expense-items th:nth-child(5),
.logistics-expense-items td:nth-child(5) {
  width: 136px;
}

.logistics-expense-items th:nth-child(7),
.logistics-expense-items td:nth-child(7) {
  width: 92px;
}

.logistics-expense-items input,
.logistics-expense-items select {
  width: 100%;
  min-width: 0;
}

.logistics-expense-items [data-remove-logistics-expense-item] {
  width: 100%;
  white-space: nowrap;
}

#logistics-expense-total {
  justify-self: end;
  width: fit-content;
  margin: 12px 0 0 auto;
  padding: 8px 14px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  font-size: 16px;
  font-weight: 800;
}

@media (max-width: 1199px) {
  .logistics-expense-drawer,
  .logistics-invoice-drawer {
    padding: 12px;
  }

  .logistics-expense-drawer .tax-detail-panel,
  .logistics-invoice-drawer .tax-detail-panel {
    width: 100%;
    max-width: none;
  }

  .logistics-expense-drawer .form-grid,
  .logistics-invoice-drawer .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .logistics-expense-search-field,
  .logistics-expense-drawer .wide,
  .logistics-invoice-drawer .wide {
    grid-column: 1 / -1;
  }

  .logistics-expense-items .table-wrap {
    overflow-x: auto;
  }

  .logistics-expense-items table {
    min-width: 920px;
  }
}

@media (max-width: 760px) {
  .logistics-expense-drawer,
  .logistics-invoice-drawer {
    padding: 0;
  }

  .logistics-expense-drawer .tax-detail-panel,
  .logistics-invoice-drawer .tax-detail-panel {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .logistics-expense-drawer .form-grid,
  .logistics-invoice-drawer .form-grid {
    grid-template-columns: 1fr;
    padding: 0 16px 14px;
  }

  .logistics-expense-drawer .form-header,
  .logistics-invoice-drawer .form-header {
    padding: 18px 16px 10px;
  }

  .logistics-expense-drawer .form-actions,
  .logistics-invoice-drawer .form-actions {
    padding: 12px 16px;
  }
}

.supplier-logistics-cost-types {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--sidebar-soft);
}

.supplier-logistics-cost-types h4 {
  margin: 0 0 8px;
}

body.logistics-compact-layout .logistics-expense-drawer,
body.logistics-compact-layout .logistics-invoice-drawer {
  padding: 12px;
}

body.logistics-compact-layout .logistics-expense-drawer .tax-detail-panel,
body.logistics-compact-layout .logistics-invoice-drawer .tax-detail-panel {
  height: min(88vh, 820px);
}

body.logistics-compact-layout .logistics-expense-drawer .form-header,
body.logistics-compact-layout .logistics-invoice-drawer .form-header {
  padding: 16px 18px 8px;
}

body.logistics-compact-layout .logistics-expense-drawer .form-grid,
body.logistics-compact-layout .logistics-invoice-drawer .form-grid {
  gap: 10px;
  padding: 0 18px 10px;
}

body.logistics-compact-layout .logistics-expense-drawer .form-grid {
  grid-template-columns: minmax(280px, 2fr) minmax(190px, 1fr) minmax(148px, 168px);
}

body.logistics-compact-layout .logistics-expense-drawer label,
body.logistics-compact-layout .logistics-invoice-drawer label,
body.logistics-compact-layout .logistics-expense-drawer .form-field,
body.logistics-compact-layout .logistics-invoice-drawer .form-field {
  gap: 4px;
}

body.logistics-compact-layout .logistics-expense-drawer input,
body.logistics-compact-layout .logistics-expense-drawer select,
body.logistics-compact-layout .logistics-expense-drawer textarea,
body.logistics-compact-layout .logistics-invoice-drawer input,
body.logistics-compact-layout .logistics-invoice-drawer select,
body.logistics-compact-layout .logistics-invoice-drawer textarea {
  min-height: 34px;
  padding: 6px 8px;
  line-height: 1.35;
}

body.logistics-compact-layout .logistics-expense-order-summary {
  gap: 8px;
  padding: 8px;
}

body.logistics-compact-layout .logistics-expense-order-summary div {
  gap: 2px;
}

body.logistics-compact-layout .logistics-expense-items .table-wrap {
  max-height: 260px;
}

body.logistics-compact-layout .logistics-expense-items th,
body.logistics-compact-layout .logistics-expense-items td {
  padding: 6px 8px;
  line-height: 1.35;
}

body.logistics-compact-layout #logistics-expense-total {
  margin-top: 8px;
  padding: 6px 12px;
  font-size: 14px;
}

body.logistics-compact-layout .logistics-expense-drawer .form-actions,
body.logistics-compact-layout .logistics-invoice-drawer .form-actions {
  padding: 10px 18px;
}

@media (max-width: 768px) {
  body.logistics-compact-layout #logistics-form .form-grid,
  body.logistics-compact-layout .domestic-transport-item-row,
  body.logistics-compact-layout .domestic-express-fields,
  body.logistics-compact-layout .domestic-logistics-summary,
  body.logistics-compact-layout .domestic-logistics-documents .tax-detail-doc-grid {
    grid-template-columns: 1fr;
  }

  body.logistics-compact-layout .domestic-logistics-panel {
    width: 100vw;
    padding: 16px 14px 0;
  }

  body.logistics-compact-layout .domestic-logistics-scroll {
    max-height: 78vh;
  }

  body.logistics-compact-layout .domestic-logistics-footer {
    align-items: flex-start;
    flex-direction: column;
    margin: 0 -14px;
    padding: 10px 14px;
  }

  body.logistics-compact-layout .domestic-logistics-footer-actions,
  body.logistics-compact-layout .domestic-logistics-footer-actions button {
    width: 100%;
  }

  body.logistics-compact-layout .logistics-expense-drawer,
  body.logistics-compact-layout .logistics-invoice-drawer {
    padding: 0;
  }

  body.logistics-compact-layout .logistics-expense-drawer .tax-detail-panel,
  body.logistics-compact-layout .logistics-invoice-drawer .tax-detail-panel {
    height: 100vh;
  }

  body.logistics-compact-layout .logistics-expense-drawer .form-grid,
  body.logistics-compact-layout .logistics-invoice-drawer .form-grid {
    grid-template-columns: 1fr;
    padding: 0 14px 10px;
  }

  body.logistics-compact-layout .logistics-expense-drawer .form-header,
  body.logistics-compact-layout .logistics-invoice-drawer .form-header {
    padding: 14px 14px 8px;
  }

  body.logistics-compact-layout .logistics-expense-drawer .form-actions,
  body.logistics-compact-layout .logistics-invoice-drawer .form-actions {
    padding: 10px 14px;
  }
}
