@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap");

:root {
  /* 字体规范 */
  --font-family-base: "Inter", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-size-h1: 32px;
  --font-size-h2: 24px;
  --font-size-h3: 20px;
  --font-size-body: 16px;
  --font-size-small: 14px;
  --font-size-note: 12px;
  --line-height-h1: 1.3;
  --line-height-h2: 1.4;
  --line-height-h3: 1.4;
  --line-height-body: 1.7;
  --line-height-small: 1.6;
  --line-height-note: 1.5;
  --font-weight-bold: 700;
  --font-weight-semibold: 600;
  --font-weight-medium: 500;
  --font-weight-regular: 400;
  --color-text-main: #222;
  --color-text-secondary: #666;
  --color-text-note: #999;

  --bg-page: #f3f6fb;
  --bg-card: #ffffff;
  --bg-nav: #10243e;
  --bg-nav-hover: rgba(255, 255, 255, 0.08);
  --text-main: #1d2735;
  --text-muted: #68768a;
  --brand: #1f5f8b;
  --brand-soft: #e9f1f8;
  --border: #d9e2ec;
  --border-strong: #b9c7d8;
  --success: #1b7f5b;
  --warning: #a96811;
  --danger: #b0423e;
  --radius: 10px;
  --shadow-soft: 0 8px 20px rgba(31, 42, 58, 0.06);
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.25rem;
  --app-nav-offset: 68px;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  /* 固定纵向滚动条占位，避免不同页面切换时导航与主体发生横向位移。 */
  overflow-y: auto;
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-main);
  background: linear-gradient(180deg, #f7f9fc 0%, var(--bg-page) 100%);
  padding-top: var(--app-nav-offset);
}

h1 {
  font-size: var(--font-size-h1);
  line-height: var(--line-height-h1);
  font-weight: var(--font-weight-bold);
}

h2 {
  font-size: var(--font-size-h2);
  line-height: var(--line-height-h2);
  font-weight: var(--font-weight-semibold);
}

h3 {
  font-size: var(--font-size-h3);
  line-height: var(--line-height-h3);
  font-weight: var(--font-weight-semibold);
}

p {
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  font-weight: var(--font-weight-regular);
}

.small-text {
  font-size: var(--font-size-small);
  line-height: var(--line-height-small);
  color: var(--color-text-secondary);
}

.note-text {
  font-size: var(--font-size-note);
  line-height: var(--line-height-note);
  color: var(--color-text-note);
}

button,
.nav-item {
  font-size: 14px;
  font-weight: var(--font-weight-medium);
}

.app-main {
  max-width: 1520px;
  padding-top: 0.15rem;
}

.navbar {
  background: linear-gradient(90deg, #10243e 0%, #0f172a 100%) !important;
  min-height: 68px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding-top: 0.38rem;
  padding-bottom: 0.38rem;
  left: 0;
  right: 0;
  width: 100%;
}

.topbar,
.navbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
}

.navbar .container-fluid {
  padding-left: 1.2rem;
  padding-right: 1.2rem;
}

.topbar-inner,
.navbar .container-fluid {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
}

.workbench-navbar-shell {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  flex-wrap: nowrap;
}

.navbar-brand.workbench-brand {
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.2;
  padding-top: 0;
  padding-bottom: 0;
  margin-right: 1.1rem;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-decoration: none;
}

.brand-area {
  flex: 0 0 auto;
}

.workbench-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.14rem;
}

.workbench-brand-eyebrow {
  font-size: 0.68rem;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(191, 219, 254, 0.78);
  font-weight: 600;
}

.workbench-brand-title {
  font-size: 1.12rem;
  line-height: 1.15;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
}

.workbench-navbar-collapse {
  align-items: center;
  justify-content: space-between;
  gap: 1.3rem;
}

.workbench-nav-center {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.nav-center {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.navbar-nav.workbench-nav-list {
  align-items: center;
  gap: 0.24rem;
  margin-bottom: 0;
  flex-wrap: nowrap;
}

.workbench-nav-list .nav-item {
  position: relative;
}

.nav-center .nav-item,
.navbar-nav .nav-item {
  flex: 0 0 auto;
}

.nav-link.workbench-nav-link {
  position: relative;
  color: rgba(226, 232, 240, 0.88) !important;
  border-radius: 10px;
  padding: 0 12px !important;
  margin-right: 0;
  min-height: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  font-size: 14px;
  font-weight: 500;
  flex: 0 0 auto;
  width: auto;
  min-width: max-content;
  white-space: nowrap;
  word-break: keep-all;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-center .nav-link,
.navbar-nav .nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  min-width: max-content;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  word-break: keep-all;
}

.nav-link.workbench-nav-link:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.workbench-nav-link.active {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(191, 219, 254, 0.08);
}

.nav-link.workbench-nav-link.active::before {
  content: "";
  position: absolute;
  left: 0.78rem;
  right: 0.78rem;
  bottom: 0.22rem;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa 0%, #3b82f6 100%);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.16), 0 2px 8px rgba(59, 130, 246, 0.25);
}

.nav-link.workbench-nav-link.dropdown-toggle {
  padding-right: 0.92rem !important;
}

.nav-link.workbench-nav-link.dropdown-toggle::after {
  margin-left: 0.45rem;
  vertical-align: 0.08em;
  border-top-width: 0.28em;
}

.workbench-tools {
  display: flex;
  align-items: center;
  gap: 0.82rem;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.nav-right {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 10px;
}

.workbench-context-tools,
.workbench-account-tools {
  display: inline-flex;
  align-items: center;
}

.global-order-form.workbench-context-form {
  margin: 0;
  display: inline-grid;
  grid-template-columns: auto minmax(0, 240px) auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.34rem 0.3rem 0.5rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.24);
}

.global-order-form.workbench-context-form::before {
  content: "当前订单";
  font-size: 0.72rem;
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(191, 219, 254, 0.76);
  white-space: nowrap;
}

.global-order-form.workbench-context-form .form-control,
.global-order-form.workbench-context-form .form-select {
  min-height: 40px;
  height: 40px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  line-height: 1.1;
  border-radius: 10px;
  border: 0;
  box-shadow: none;
}

.global-order-select,
.global-order-form.workbench-context-form .global-order-select {
  width: 240px;
}

.workbench-context-select {
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  font-size: 0.92rem;
}

.workbench-context-select:focus {
  box-shadow: 0 0 0 0.22rem rgba(96, 165, 250, 0.24);
}

.navbar .btn.btn-sm {
  line-height: 1.1;
}

.workbench-context-btn,
.workbench-account-btn {
  min-height: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.95rem;
  border-radius: 10px;
  font-weight: 600;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.workbench-context-btn {
  border-color: rgba(191, 219, 254, 0.24);
  background: rgba(255, 255, 255, 0.08);
}

.workbench-context-btn:hover,
.workbench-context-btn:focus {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(191, 219, 254, 0.42);
  color: #fff;
}

.workbench-account-tools {
  gap: 0.65rem;
}

.workbench-account-btn {
  border-color: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
}

.workbench-account-btn:hover,
.workbench-account-btn:focus,
.workbench-account-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(191, 219, 254, 0.34);
  color: #ffffff;
}

.workbench-user-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 0.68rem;
  padding: 0.34rem 0.78rem 0.34rem 0.42rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.workbench-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.workbench-user-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.02;
}

.workbench-user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f8fafc;
}

.workbench-user-role {
  font-size: 0.72rem;
  color: rgba(191, 219, 254, 0.78);
  margin-top: 0.12rem;
}

@media (max-width: 1280px) and (min-width: 993px) {
  .navbar .container-fluid {
    padding-left: 0.95rem;
    padding-right: 0.95rem;
  }

  .workbench-navbar-shell {
    gap: 1rem;
  }

  .navbar-brand.workbench-brand {
    margin-right: 0.7rem;
  }

  .workbench-brand-eyebrow {
    font-size: 0.62rem;
    letter-spacing: 0.18em;
  }

  .workbench-brand-title {
    font-size: 1.04rem;
  }

  .workbench-navbar-collapse {
    gap: 0.9rem;
  }

  .nav-center {
    gap: 0.3rem;
  }

  .navbar-nav.workbench-nav-list {
    gap: 0.06rem;
  }

  .nav-link.workbench-nav-link {
    min-height: 38px;
    height: 38px;
    padding: 0 10px !important;
    font-size: 0.88rem;
  }

  .nav-link.workbench-nav-link.active::before {
    left: 0.64rem;
    right: 0.64rem;
  }

  .nav-link.workbench-nav-link.dropdown-toggle {
    padding-right: 0.8rem !important;
  }

  .workbench-tools {
    gap: 0.58rem;
  }

  .global-order-form.workbench-context-form {
    grid-template-columns: auto minmax(0, 190px) auto;
    gap: 0.32rem;
    padding: 0.28rem 0.3rem 0.28rem 0.42rem;
  }

  .global-order-form.workbench-context-form::before {
    font-size: 0.68rem;
  }

  .global-order-select,
  .global-order-form.workbench-context-form .global-order-select {
    width: 190px;
  }

  .workbench-context-btn,
  .workbench-account-btn {
    min-height: 38px;
    height: 38px;
    padding: 0 0.82rem;
  }

  .workbench-account-tools {
    gap: 0.52rem;
  }

  .workbench-user-chip {
    min-height: 38px;
    gap: 0.56rem;
    padding: 0.28rem 0.68rem 0.28rem 0.38rem;
  }
}

.dropdown-menu {
  border: 1px solid rgba(203, 213, 225, 0.78);
  border-radius: 14px;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.14);
  padding: 0.42rem;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
}

.dropdown-divider {
  border-top-color: rgba(203, 213, 225, 0.78);
}

.dropdown-item {
  border-radius: 9px;
  padding: 0.52rem 0.72rem;
  font-size: 0.92rem;
  color: #1e293b;
}

.dropdown-item.active,
.dropdown-item:active,
.dropdown-item:hover,
.dropdown-item:focus {
  background: #eff6ff;
  color: #0f172a;
}

@media (min-width: 992px) {
  .navbar .dropdown:hover > .dropdown-menu {
    display: block;
    margin-top: 0;
  }
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  background: var(--bg-card);
}

.card .card-body h6 {
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.table {
  border-color: var(--border);
  font-size: 0.93rem;
}

.table th {
  background: #edf2f8;
  color: #2a3b4f;
  border-color: var(--border);
  font-weight: 600;
  white-space: nowrap;
}

.table td {
  border-color: var(--border);
  vertical-align: middle;
}

.table-sm > :not(caption) > * > * {
  padding: 0.48rem 0.55rem;
}

.table tbody tr:hover {
  background: #f8fbff;
}

.import-preview-zebra tbody tr:nth-child(odd),
.import-preview-zebra tbody tr:nth-child(odd) td {
  background: #f8fbff !important;
}

.import-preview-zebra tbody tr:nth-child(even),
.import-preview-zebra tbody tr:nth-child(even) td {
  background: #e3ecf8 !important;
}

.import-preview-zebra tbody tr:nth-child(odd):hover,
.import-preview-zebra tbody tr:nth-child(odd):hover td,
.import-preview-zebra tbody tr:nth-child(odd):hover th {
  background: #f8fbff !important;
}

.import-preview-zebra tbody tr:nth-child(even):hover,
.import-preview-zebra tbody tr:nth-child(even):hover td,
.import-preview-zebra tbody tr:nth-child(even):hover th {
  background: #e3ecf8 !important;
}

.import-preview-table {
  width: 100%;
  min-width: 1100px;
  table-layout: fixed;
}

.import-preview-table th,
.import-preview-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-preview-table .import-preview-reason {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-preview-table .import-preview-summary {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-col-line { width: 72px; }
.import-col-status { width: 88px; }
.import-col-reason { width: 260px; }
.import-col-doc { width: 120px; }
.import-col-supplier { width: 160px; }
.import-col-summary { width: 240px; }
.import-col-qty { width: 96px; }
.import-col-price { width: 96px; }
.import-col-date { width: 116px; }
.import-col-action { width: 132px; }

.form-control,
.form-select {
  border-color: var(--border-strong);
  border-radius: 8px;
  min-height: 38px;
}

.form-control:focus,
.form-select:focus {
  border-color: #86a8c8;
  box-shadow: 0 0 0 0.18rem rgba(31, 95, 139, 0.14);
}

.btn {
  border-radius: 8px;
}

.action-btn-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35rem;
  align-items: center;
}

.action-btn-group form {
  margin: 0;
}

.action-btn {
  min-height: auto;
  min-width: 56px;
  padding: 0.25rem 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
  font-size: 0.875rem;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .action-btn-group {
    flex-wrap: wrap;
  }
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover {
  background: #184b6e;
  border-color: #184b6e;
}

.btn-outline-primary {
  color: var(--brand);
  border-color: #7fa3c3;
}

.btn-outline-primary:hover {
  background: var(--brand-soft);
  color: #154260;
  border-color: #6f96b8;
}

.alert {
  border-radius: 9px;
  border-width: 1px;
}

.alert-info {
  background: #eef5fc;
  border-color: #c8ddf1;
  color: #214a72;
}

.alert-success {
  background: #ecf8f2;
  border-color: #c6e9da;
  color: var(--success);
}

.alert-danger {
  background: #fff0ef;
  border-color: #f1c9c6;
  color: var(--danger);
}

.alert-warning {
  background: #fff8ec;
  border-color: #f2dfb7;
  color: var(--warning);
}

.badge {
  font-weight: 600;
}

.pagination .page-link {
  border-color: var(--border);
  color: #2f5578;
}

.pagination .page-item.active .page-link {
  background: var(--brand);
  border-color: var(--brand);
}

.text-muted {
  color: var(--text-muted) !important;
}

.order-context-card {
  border: 1px solid #cfe0f3;
  background: linear-gradient(180deg, #f6fbff 0%, #eef6ff 100%);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
}

.order-context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.55rem;
}

.order-context-title .label {
  color: #3a5f85;
  font-size: 0.9rem;
  margin-right: 0.5rem;
}

.order-context-title .value {
  font-size: 1.18rem;
  font-weight: 700;
  color: #1f3f62;
  letter-spacing: 0.2px;
}

.order-context-card .clear-link {
  font-size: 0.9rem;
  color: #2f5e92;
  text-decoration: none;
}

.order-context-card .clear-link:hover {
  text-decoration: underline;
}

.order-context-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.metric-box {
  background: #ffffff;
  border: 1px solid #d5e5f6;
  border-radius: 10px;
  padding: 0.42rem 0.55rem;
}

.metric-link {
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.metric-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(31, 95, 139, 0.12);
  border-color: #96b7d8;
}

.metric-name {
  font-size: 0.78rem;
  color: #5d7590;
  line-height: 1.2;
}

.metric-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #233d5c;
  line-height: 1.25;
  margin-top: 0.08rem;
}

.metric-box.metric-danger {
  border-color: #edc1bc;
  background: #fff6f5;
}

.metric-box.metric-danger .metric-name,
.metric-box.metric-danger .metric-value {
  color: #b13f38;
}

.receipt-kpi {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  min-height: 84px;
}

.receipt-kpi .name {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.receipt-kpi .value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: #24384f;
}

.receipt-kpi.is-danger {
  border-color: #f1c4c1;
  background: #fff4f3;
}

.receipt-kpi.is-danger .name,
.receipt-kpi.is-danger .value {
  color: #ae3b37;
}

/* Supplier doc dynamic preview */
.preview-card {
  border: 1px solid var(--border);
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.preview-title {
  font-size: 1rem;
  font-weight: 700;
  color: #24384f;
  line-height: 1.35;
}

.preview-subtitle {
  margin-top: 2px;
  font-size: 0.85rem;
  color: #5f738a;
  line-height: 1.45;
}

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

.preview-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fbfdff;
}

.preview-item.is-normal {
  border-color: #bbdfcf;
  background: #f2faf6;
}

.preview-item.is-abnormal {
  border-color: #efc8c5;
  background: #fff7f6;
}

.preview-item.is-pending {
  border-color: var(--border);
  background: #fbfdff;
}

.preview-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preview-item-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #2a4058;
}

.preview-item-values {
  margin-top: 7px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.82rem;
  color: #5e738a;
}

.preview-item-msg {
  margin-top: 7px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #2e425a;
}

.preview-abnormal {
  border: 1px solid #efc8c5;
  border-radius: 10px;
  background: #fff6f5;
  padding: 10px 12px;
}

.preview-abnormal-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #a13b37;
  margin-bottom: 5px;
}

.preview-abnormal ul {
  margin: 0;
  padding-left: 1rem;
}

.preview-abnormal li {
  color: #7f2f2c;
  line-height: 1.5;
}

@media (max-width: 1200px) {
  :root {
    --app-nav-offset: 80px;
  }

  .order-context-metrics {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
  }
}

@media (max-width: 768px) {
  :root {
    --app-nav-offset: 64px;
  }

  .app-main {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    padding-top: 0.25rem !important;
  }

  .order-context-metrics {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }

  .preview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 992px) {
  .navbar {
    min-height: 64px;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }

  .navbar .container-fluid {
    align-items: center;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .workbench-navbar-shell {
    gap: 0.6rem;
  }

  .workbench-navbar-collapse {
    width: 100%;
    padding-top: 0.7rem;
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* 移动端：子菜单缩进 + 左侧层级线，避免与父项同级 */
  .navbar-nav .dropdown-menu {
    margin-left: 0.55rem;
    padding-left: 0.6rem;
    border-left: 1px solid rgba(255, 255, 255, 0.16);
  }

  .navbar-nav .dropdown-item {
    padding-left: 0.55rem;
  }

  /* 移动端选中态：左侧竖条，不再用横贯整行的下划线 */
  .nav-link.workbench-nav-link.active::before {
    left: 0;
    right: auto;
    top: 7px;
    bottom: 7px;
    width: 3px;
    height: auto;
    border-radius: 3px;
  }

  /* 账号区不再拉满整行 */
  .workbench-account-btn {
    width: auto;
    justify-self: start;
  }

  .workbench-user-chip {
    width: fit-content;
    justify-self: start;
  }

  .workbench-nav-center {
    display: block;
  }

  .navbar-nav.workbench-nav-list {
    align-items: stretch;
    gap: 0.16rem;
  }

  .navbar-nav .nav-link.workbench-nav-link {
    width: 100%;
    justify-content: space-between;
  }

  .workbench-tools {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    margin-top: 0.4rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .workbench-context-tools,
  .workbench-account-tools {
    width: 100%;
  }

  .global-order-form.workbench-context-form {
    width: 100%;
    grid-template-columns: 1fr auto;
    gap: 0.35rem !important;
    margin-right: 0 !important;
    padding: 0.38rem;
  }

  .global-order-form.workbench-context-form::before {
    grid-column: 1 / -1;
    padding: 0 0.08rem 0.08rem 0.12rem;
  }

  .global-order-select,
  .global-order-form.workbench-context-form .global-order-select {
    width: 100% !important;
    min-width: 0;
  }

  .workbench-account-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    flex-wrap: wrap;
  }

  .workbench-account-btn,
  .workbench-user-chip {
    width: fit-content;
  }
}

@media (max-width: 576px) {
  body {
    font-size: 15px;
  }

  h2 {
    font-size: 1.35rem;
  }

  h3 {
    font-size: 1.15rem;
  }

  .card {
    border-radius: 9px;
  }

  .btn,
  .form-control,
  .form-select {
    font-size: 0.92rem;
  }

  .table {
    font-size: 0.86rem;
  }

  .table-sm > :not(caption) > * > * {
    padding: 0.42rem 0.45rem;
  }
}

/* shared mobile helpers */
.mobile-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

@media (max-width: 768px) {
  .mobile-two-col {
    grid-template-columns: 1fr;
  }

  .sticky-mobile-action {
    position: sticky;
    bottom: 0;
    z-index: 25;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    padding: 0.45rem;
    margin: 0 -0.5rem -0.5rem;
  }
}

/* Permission page workbench layout */
.perm-workbench {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
}

.perm-role-column {
  position: sticky;
  top: calc(var(--app-nav-offset) + 12px);
  align-self: start;
}

.perm-role-section + .perm-role-section {
  border-top: 1px dashed var(--border);
  padding-top: 0.65rem;
}

.perm-preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.perm-editor-toolbar {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #f8fbff;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.perm-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.perm-module-nav .perm-module-chip.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: #17466a;
}

.perm-panel-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: #f8fbff;
}

.perm-matrix {
  min-width: 1160px;
}

.perm-matrix th,
.perm-matrix td {
  text-align: center !important;
  white-space: nowrap;
}

.perm-matrix .perm-page-col {
  text-align: left !important;
  white-space: normal;
}

.perm-matrix thead th {
  vertical-align: middle;
}

.perm-page.perm-collapse-optional .perm-col-extra {
  display: none;
}

.perm-page.perm-collapse-optional .perm-col-extra-head {
  display: none;
}

.perm-role-select,
.perm-search {
  min-width: 220px;
}

.perm-sticky-bar {
  position: sticky;
  bottom: 0;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-soft);
  z-index: 15;
}

@media (max-width: 992px) {
  .perm-workbench {
    grid-template-columns: 1fr;
  }

  .perm-role-column {
    position: static;
  }

  .perm-preset-grid {
    grid-template-columns: 1fr;
  }

  .perm-role-select,
  .perm-search {
    min-width: 0;
    width: 100%;
  }

  .perm-editor-toolbar {
    position: sticky;
    top: calc(var(--app-nav-offset) + 8px);
    z-index: 8;
  }
}

/* Order overview */
.order-overview-page .section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2a3b4f;
  margin-bottom: 0.75rem;
}

.order-overview-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.order-overview-selector {
  min-width: 320px;
}

.order-overview-selector .d-flex {
  align-items: stretch;
}

.order-overview-order-label {
  color: #415c78;
  font-weight: 600;
  min-width: 52px;
}

.order-overview-selector .form-select {
  min-height: 44px;
}

.order-overview-selector .btn {
  min-height: 44px;
  min-width: 86px;
  white-space: nowrap;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}

.order-overview-header .order-header-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.order-overview-header .order-header-grid > div {
  min-width: 0;
}

.order-overview-header .label {
  display: block;
  font-size: 0.82rem;
  color: #6b7f95;
  margin-bottom: 0.1rem;
}

.order-overview-header .value {
  display: block;
  font-size: 1.08rem;
  font-weight: 600;
  color: #22384f;
}

.overview-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.overview-kpi-card {
  text-decoration: none;
  color: inherit;
  background: #f8fbff;
  border: 1px solid #d9e5f2;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
}

.overview-kpi-card .kpi-label {
  font-size: 0.88rem;
  color: #5f7389;
}

.overview-kpi-card .kpi-value {
  margin-top: 0.3rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1f3e61;
  line-height: 1.1;
}

.overview-kpi-card.is-danger {
  background: #fff3f2;
  border-color: #efcac6;
}

.overview-kpi-card.is-danger .kpi-label,
.overview-kpi-card.is-danger .kpi-value {
  color: #ad3d37;
}

.overview-kpi-card.is-warning {
  background: #fff9ef;
  border-color: #efd8aa;
}

.overview-kpi-card.is-warning .kpi-label,
.overview-kpi-card.is-warning .kpi-value {
  color: #9f6816;
}

.todo-list {
  padding-left: 1rem;
}

.todo-list li {
  margin-bottom: 0.45rem;
  line-height: 1.55;
}

.todo-list a {
  text-decoration: none;
  color: #254f78;
}

.todo-list a:hover {
  text-decoration: underline;
}

.cost-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 0.75rem;
}

.cost-item {
  border: 1px solid #dde6f2;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #f9fbfe;
}

.cost-label {
  font-size: 0.82rem;
  color: #667b91;
  margin-bottom: 0.2rem;
}

.cost-value {
  font-size: 1.08rem;
  font-weight: 600;
  color: #294560;
}

.progress-stage-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 0.7rem;
}

.stage-item {
  border-radius: 10px;
  border: 1px solid #dde6f2;
  padding: 0.62rem 0.72rem;
  background: #f8fbff;
}

.stage-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #2e4761;
  margin-bottom: 0.22rem;
}

.stage-status {
  font-size: 0.82rem;
  color: #5f7488;
}

.stage-complete {
  background: #effaf4;
  border-color: #cfe7d8;
}

.stage-complete .stage-status {
  color: #1e7959;
}

.stage-in_progress {
  background: #fff9ef;
  border-color: #efdfbc;
}

.stage-in_progress .stage-status {
  color: #98661b;
}

.stage-not_started {
  background: #f7f9fc;
  border-color: #dde5ef;
}

@media (max-width: 1199px) {
  .order-overview-header .order-header-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

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

  .progress-stage-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }
}

@media (max-width: 767px) {
  .order-overview-selector {
    width: 100%;
    min-width: 0;
  }

  .order-overview-selector .btn {
    min-width: 74px;
  }

  .order-overview-order-label {
    min-width: 46px;
  }

  .order-overview-header .order-header-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .overview-kpi-grid,
  .cost-grid,
  .progress-stage-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

/* Receipt Board */
.receipt-board-page .section-title {
  font-size: 16px;
  font-weight: 700;
  color: #223a57;
  margin-bottom: 10px;
}

.receipt-board-head,
.receipt-board-filter,
.receipt-board-meta {
  border-radius: 12px;
}

.receipt-board-filter .form-control,
.receipt-board-filter .form-select {
  min-height: 36px;
}

.receipt-kpi {
  min-height: 78px;
  padding: 9px 11px;
}

.receipt-kpi .name {
  font-size: 12px;
}

.receipt-kpi .value {
  font-size: 24px;
}

.receipt-overdue-card {
  border: 1px solid #f1c9c6;
  background: #fff8f7;
}

.receipt-overdue-card .card-header {
  background: #fff3f1;
  border-bottom: 1px solid #f1c9c6;
}

.receipt-board-table-wrap {
  overflow-x: auto;
}

.receipt-board-table th {
  background: #dbe4ef;
  color: #21384f;
  font-weight: 700;
}

.receipt-board-table .main-row td {
  background: #f8fbff;
}

.receipt-board-table .main-row.row-alt td {
  background: #e3ecf8;
}

/* 采购单列表表头分层样式：需要在桌面端和移动端同时生效 */
.po-fixed-table {
  min-width: 920px;
}

.po-fixed-table thead .po-top-meta-row th {
  background: #f6f9fd !important;
  --bs-table-bg: #f6f9fd;
  --bs-table-accent-bg: #f6f9fd;
  box-shadow: inset 0 -12px 0 #ffffff !important;
  border-bottom: 0 !important;
  padding-bottom: 1rem !important;
}

.po-fixed-table thead .po-column-header-row th {
  background: #e9f0f7 !important;
  --bs-table-bg: #e9f0f7;
  --bs-table-accent-bg: #e9f0f7;
  border-top: 0 !important;
}

/* keep zebra colors exactly same as purchase order list;
   status emphasis stays on badges, not row background */

.receipt-board-table tbody tr:hover {
  background: inherit;
}

.receipt-drawer {
  background: #f7faff;
  border-top: 1px dashed #c4d7ea;
}

@media (max-width: 768px) {
  .receipt-kpi .value {
    font-size: 20px;
  }

  .receipt-board-filter .btn {
    min-width: 72px;
  }

  .receipt-board-table th,
  .receipt-board-table td {
    white-space: nowrap;
  }
}

.badge-time-pending {
  background: #8b5cf6;
  color: #ffffff;
}

/* ===== Mobile adaptation: global ===== */
.app-main .table-responsive {
  -webkit-overflow-scrolling: touch;
}

.app-main .table th,
.app-main .table td {
  vertical-align: middle;
}

.app-main .pagination {
  gap: 0.25rem;
}

.app-main .pagination .page-link {
  border-radius: 8px;
}

.auto-table-wrap {
  margin-bottom: 0.75rem;
}

.workbench-filter .form-control,
.workbench-filter .form-select {
  min-height: 38px;
}

.workbench-table th,
.workbench-table td {
  white-space: nowrap;
}

.nop-action-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.nop-action-group form {
  margin: 0;
}

.nop-action-group .btn {
  min-width: 56px;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
}

.bulk-header-grid .form-control,
.bulk-header-grid .form-select {
  min-height: 36px;
}

.bulk-edit-toolbar {
  row-gap: 0.45rem;
}

.account-role-select {
  min-width: 110px;
}

.account-active-select {
  min-width: 90px;
}

@media (max-width: 1200px) {
  .app-main {
    max-width: 100%;
  }
}

@media (max-width: 992px) {
  .navbar-brand.workbench-brand {
    margin-right: 0.35rem;
  }

  .navbar .navbar-toggler {
    padding: 0.28rem 0.52rem;
    border-color: rgba(191, 219, 254, 0.42);
    border-radius: 11px;
  }

  .navbar-nav .dropdown-menu {
    border: 0;
    box-shadow: none;
    padding: 0.18rem 0 0.24rem;
    background: transparent;
    backdrop-filter: none;
  }

  .navbar-nav .dropdown-item {
    color: #dbe4f0;
    border-radius: 8px;
    padding: 0.42rem 0.78rem;
    margin-top: 0.1rem;
  }

  .navbar-nav .dropdown-item.active,
  .navbar-nav .dropdown-item:hover,
  .navbar-nav .dropdown-item:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
  }

  .order-context-card {
    padding: 0.7rem 0.8rem;
  }

  .order-context-head {
    align-items: flex-start;
    gap: 0.3rem;
    flex-direction: column;
  }

  .order-context-metrics {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .metric-box {
    min-height: 60px;
    padding: 0.45rem 0.55rem;
  }

  .metric-name {
    font-size: 0.78rem;
  }

  .metric-value {
    font-size: 1.2rem;
  }

  .app-main .d-flex.justify-content-between.align-items-center.mb-3 {
    row-gap: 0.5rem;
  }

  .app-main .btn {
    white-space: nowrap;
  }

  .workbench-filter [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .workbench-filter .col-md-1,
  .workbench-filter .col-md-2 {
    flex: 0 0 50%;
    max-width: 50%;
  }

  .workbench-table {
    min-width: 980px;
  }

  .bulk-edit-toolbar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #bulkTable {
    min-width: 1080px;
  }

  #rowCheckDrawer {
    width: min(94vw, 420px);
    right: calc(-1 * min(94vw, 420px));
  }

  .perm-toolbar .card-body {
    align-items: stretch !important;
  }

  .perm-role-select,
  .perm-search {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .app-main {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    padding-bottom: 0.8rem !important;
  }

  .app-main h3 {
    font-size: 1.18rem;
  }

  .app-main h4 {
    font-size: 1.05rem;
    margin-bottom: 0.35rem;
  }

  .app-main .alert {
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.55rem;
  }

  .app-main .card {
    border-radius: 9px;
  }

  .app-main .card-body {
    padding: 0.7rem;
  }

  .app-main .row.g-2,
  .app-main .row.g-3 {
    --bs-gutter-x: 0.6rem;
    --bs-gutter-y: 0.6rem;
  }

  .app-main .table {
    font-size: 0.84rem;
  }

  .app-main .table th,
  .app-main .table td {
    padding: 0.38rem 0.42rem;
  }

  .workbench-filter .col-md-1,
  .workbench-filter .col-md-2 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .sticky-mobile-action {
    position: sticky;
    bottom: 0;
    z-index: 35;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.45rem;
    margin: 0 -0.15rem 0.5rem;
  }

  .receipt-board-head .d-flex,
  .receipt-board-filter .row,
  .order-overview-head {
    row-gap: 0.5rem;
  }

  .receipt-kpi {
    min-height: 72px;
  }

  .receipt-kpi .value {
    font-size: 1.2rem;
  }

  .receipt-board-table {
    min-width: 1160px;
  }

  .receipt-board-table .dropdown .btn {
    min-width: 68px;
  }

  .order-overview-page .accordion-button {
    padding: 0.62rem 0.68rem;
    font-size: 0.9rem;
  }

  #orderSwitchContainer {
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.3rem;
    gap: 0.35rem !important;
  }

  .order-switch-group {
    display: inline-flex !important;
  }

  .order-switch-btn {
    max-width: 190px;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  .receipt-board-page .table-responsive,
  .perm-page .table-responsive {
    margin: 0 -0.2rem;
  }
}

@media (max-width: 576px) {
  body {
    font-size: 14px;
  }

  .workbench-brand-eyebrow {
    display: none;
  }

  .workbench-brand-title {
    font-size: 1rem;
    max-width: calc(100vw - 120px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .global-order-form.workbench-context-form {
    grid-template-columns: 1fr !important;
  }

  .global-order-form.workbench-context-form .btn,
  .workbench-account-btn {
    width: 100%;
    justify-content: center;
  }

  .workbench-account-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .workbench-user-chip {
    width: 100%;
  }

  .app-main .btn {
    font-size: 0.88rem;
    padding: 0.34rem 0.62rem;
  }

  .order-context-metrics {
    grid-template-columns: 1fr;
  }

  .overview-kpi-grid,
  .cost-grid,
  .progress-stage-grid {
    grid-template-columns: 1fr !important;
  }

  .account-role-select,
  .account-active-select {
    min-width: 0;
    width: 100%;
  }
}


/* Workflow blockers */
.workflow-blockers {
  border: 1px solid #f0d89b;
  background: #fff8e8;
}

.workflow-blockers .btn {
  border-radius: 999px;
}

button[disabled],
input[type='submit'][disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Payment detail */
.payment-head-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 0.65rem;
}

.payment-head-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f9fbfe;
  padding: 0.58rem 0.72rem;
}

.payment-head-item .label {
  display: block;
  font-size: 0.8rem;
  color: #667d95;
  margin-bottom: 0.08rem;
}

.payment-head-item .value {
  display: block;
  font-size: 1.03rem;
  font-weight: 600;
  color: #25405c;
  line-height: 1.25;
}

.payment-risk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.62rem;
}

.payment-risk-card {
  text-decoration: none;
  border: 1px solid #d7e4f2;
  border-radius: 10px;
  background: #f7fbff;
  padding: 0.6rem 0.72rem;
  color: #27435f;
}

.payment-risk-card .name {
  display: block;
  font-size: 0.82rem;
  color: #60788f;
}

.payment-risk-card .value {
  display: block;
  margin-top: 0.12rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.payment-risk-card.is-danger {
  background: #fff4f3;
  border-color: #efc7c4;
}

.payment-risk-card.is-danger .name,
.payment-risk-card.is-danger .value {
  color: #ab3d38;
}

.payment-risk-card.is-warning {
  background: #fff9ef;
  border-color: #f0debc;
}

.payment-risk-card.is-warning .name,
.payment-risk-card.is-warning .value {
  color: #99651a;
}

.payment-risk-card:hover {
  background: #edf5fd;
}

.payment-help summary {
  cursor: pointer;
  color: #4d647d;
  font-size: 0.88rem;
  user-select: none;
}

.payment-detail-table td,
.payment-detail-table th {
  white-space: nowrap;
}

.payment-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.28);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.payment-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.payment-drawer {
  position: fixed;
  top: var(--app-nav-offset);
  right: -460px;
  width: min(460px, 96vw);
  height: calc(100vh - var(--app-nav-offset));
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 24px rgba(21, 35, 53, 0.14);
  z-index: 1045;
  transition: right 0.2s ease;
  display: flex;
  flex-direction: column;
}

.payment-drawer.open {
  right: 0;
}

.payment-drawer-head {
  border-bottom: 1px solid var(--border);
  padding: 0.62rem 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.payment-drawer-body {
  padding: 0.8rem;
  overflow-y: auto;
}

@media (max-width: 992px) {
  .payment-head-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .payment-risk-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 768px) {
  .payment-head-grid,
  .payment-risk-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .payment-detail-table {
    min-width: 1020px;
  }

  .payment-drawer {
    top: auto;
    right: 0;
    left: 0;
    width: 100%;
    bottom: -100%;
    height: 76vh;
    border-left: 0;
    border-top: 1px solid var(--border);
    box-shadow: 0 -10px 24px rgba(21, 35, 53, 0.14);
    transition: bottom 0.2s ease;
  }

  .payment-drawer.open {
    bottom: 0;
  }
}

.empty-state {
  border: 1px dashed #cfd8e3;
  border-radius: 10px;
  background: #f8fafc;
}

.empty-state-title {
  font-weight: 600;
  color: #2b3a4c;
}

.empty-state-desc {
  color: #6c7a8d;
  font-size: 14px;
}

/* AI analytics */
.ai-analytics-page,
.ai-config-page {
  max-width: 1280px;
}

.ai-workbench-grid {
  display: grid;
  grid-template-columns: 440px minmax(0, 1fr);
  gap: 0.8rem;
  align-items: flex-start;
}

.ai-left-col,
.ai-right-col {
  min-width: 0;
}

.ai-assistant-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
}

.ai-head-actions {
  display: flex;
  align-items: center;
}

.ai-runtime-dropdown summary {
  list-style: none;
  cursor: pointer;
  color: #3f5f82;
  font-size: 0.9rem;
  user-select: none;
}

.ai-runtime-dropdown summary::-webkit-details-marker {
  display: none;
}

.ai-runtime-panel {
  margin-top: 0.45rem;
  border: 1px solid #dce5ef;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.55rem 0.65rem;
  min-width: 300px;
}

.ai-ask-card .ai-question-input {
  min-height: 132px;
  font-size: 1rem;
}

.ai-input-hint {
  color: #5d7388;
}

.ai-example-group {
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #f9fbfe;
  padding: 0.55rem 0.65rem;
  height: 100%;
}

.ai-section-summary,
.ai-fold-header {
  cursor: pointer;
  user-select: none;
}

.ai-fold-card .ai-fold-header {
  font-weight: 600;
  color: #395a7f;
  background: #f8fbff;
}

.ai-fold-card[open] .ai-fold-header {
  border-bottom: 1px solid var(--border);
}

.ai-example-group-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #27415d;
  margin-bottom: 0.35rem;
}

.ai-example-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ai-example-link {
  justify-content: flex-start;
  text-align: left;
  font-size: 0.85rem;
  color: #2e537b;
  text-decoration: none;
  padding: 0.12rem 0;
}

.ai-example-link:hover {
  color: #1e456d;
  text-decoration: underline;
}

.ai-scope-item {
  border: 1px solid #dce7f2;
  border-radius: 10px;
  background: #f8fbff;
  padding: 0.6rem 0.72rem;
}

.ai-scope-item .scope-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #2c4460;
  margin-bottom: 0.2rem;
}

.ai-scope-item .scope-desc {
  font-size: 0.86rem;
  color: #5c7187;
  line-height: 1.5;
}

.ai-understood-card {
  border-color: #cfe0f2;
  background: #f5faff;
}

.ai-summary-card .summary-text {
  color: #223247;
  font-weight: 500;
}

.ai-result-wrap-card {
  min-height: 420px;
}

.ai-summary-main {
  border: 1px solid #d7e5f2;
  background: #f8fbff;
  border-radius: 10px;
  padding: 0.62rem 0.72rem;
}

.ai-summary-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #27445f;
}

.ai-summary-text {
  margin-top: 0.25rem;
  color: #223247;
  line-height: 1.65;
}

.ai-highlight-item {
  border: 1px solid #d6e4f2;
  border-radius: 9px;
  background: #f8fbff;
  padding: 0.42rem 0.5rem;
  color: #2a435f;
  font-size: 0.88rem;
}

.ai-summary-card .risk-note {
  color: #8f5f12;
}

.ai-condition-card {
  background: #fafcff;
}

.ai-result-card .table th,
.ai-result-card .table td {
  white-space: nowrap;
}

.ai-result-table th,
.ai-result-table td {
  white-space: nowrap;
}

.ai-inline-fold summary {
  cursor: pointer;
  user-select: none;
  color: #3e5f83;
  font-size: 0.88rem;
}

@media (max-width: 992px) {
  .ai-workbench-grid {
    grid-template-columns: 1fr;
  }

  .ai-assistant-head {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-runtime-panel {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 768px) {
  .ai-ask-card .ai-question-input {
    min-height: 116px;
  }

  .ai-result-wrap-card {
    min-height: 0;
  }

  .ai-result-card .table {
    min-width: 920px;
  }

  .ai-result-table {
    min-width: 920px;
  }
}

/* AI Chat V1 */
.ai-chat-page {
  max-width: 1500px;
  margin: 0 auto;
}

.ai-chat-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 0.75rem;
  align-items: start;
}

.ai-chat-sidebar,
.ai-chat-main,
.ai-chat-context {
  min-height: 78vh;
}

.ai-side-block {
  margin-top: 0.55rem;
}

.ai-side-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #2e4863;
  margin-bottom: 0.35rem;
}

.ai-session-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ai-session-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem;
}

.ai-session-item {
  display: block;
  min-width: 0;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  text-decoration: none;
  background: #f9fbff;
}

.ai-session-delete-btn {
  min-width: 42px;
  padding: 0.18rem 0.4rem;
  align-self: center;
  white-space: nowrap;
}

.ai-session-item .title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #2a415c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-session-item .meta {
  font-size: 0.78rem;
  color: #687d91;
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-session-item.active {
  border-color: #8fb3d7;
  background: #edf5fd;
}

.ai-direction-list {
  margin: 0;
  padding-left: 1rem;
  color: #5e7489;
  font-size: 0.83rem;
}

.ai-chat-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-chat-main-head {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  background: #fbfdff;
}

.ai-chat-stream {
  flex: 1;
  min-height: 48vh;
  max-height: calc(78vh - 165px);
  overflow-y: auto;
  padding: 0.8rem;
  background: linear-gradient(180deg, #f8fbff 0%, #f4f8fd 100%);
}

.ai-empty-state {
  border: 1px dashed #cad7e6;
  border-radius: 10px;
  background: #ffffff;
  padding: 0.8rem;
}

.ai-empty-state .empty-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2a425d;
}

.ai-empty-state .empty-subtitle {
  font-size: 0.84rem;
  color: #63798f;
  margin-top: 0.2rem;
}

.ai-error-box {
  border: 1px solid #efc7c4;
  background: #fff4f3;
  color: #aa3d37;
  border-radius: 9px;
  padding: 0.55rem 0.68rem;
  margin-bottom: 0.7rem;
}

.msg-row {
  display: flex;
  margin-bottom: 0.65rem;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-row.assistant {
  justify-content: flex-start;
}

.bubble {
  max-width: 88%;
  border-radius: 12px;
  padding: 0.6rem 0.72rem;
  box-shadow: 0 2px 8px rgba(25, 40, 60, 0.05);
}

.user-bubble {
  background: #1f5f8b;
  color: #fff;
}

.assistant-bubble {
  background: #fff;
  border: 1px solid #d8e4f1;
  color: #26384d;
}

.assistant-summary {
  font-size: 0.92rem;
  line-height: 1.6;
}

.assistant-understanding {
  margin-top: 0.2rem;
}

.assistant-highlights {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.38rem;
}

.assistant-highlights .highlight-item {
  background: #f8fbff;
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  font-size: 0.84rem;
}

.assistant-note {
  color: #795616;
}

.ai-chat-input-area {
  border-top: 1px solid var(--border);
  padding: 0.65rem 0.8rem;
  background: #fff;
}

.ai-chat-input-area .form-control {
  min-height: 92px;
}

.ai-query-selector {
  border: 1px solid #d8e4f1;
  border-radius: 8px;
  background: #f9fbff;
  padding: 0.45rem 0.55rem;
}

.ai-query-selector summary {
  cursor: pointer;
  user-select: none;
  color: #3a5d82;
  font-size: 0.86rem;
}

.ai-kv-list {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.82rem;
  color: #5f748a;
}

@media (max-width: 1280px) {
  .ai-chat-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .ai-chat-context {
    grid-column: span 2;
    min-height: auto;
  }
}

@media (max-width: 992px) {
  .ai-chat-page {
    max-width: 100%;
  }

  .ai-chat-layout {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .ai-chat-sidebar,
  .ai-chat-main,
  .ai-chat-context {
    min-height: auto;
  }

  .ai-chat-main {
    order: 1;
  }

  .ai-chat-sidebar {
    order: 2;
  }

  .ai-chat-context {
    order: 3;
  }

  .ai-chat-main-head {
    padding: 0.55rem 0.62rem;
  }

  .ai-chat-stream {
    min-height: 38vh;
    max-height: 56vh;
    padding: 0.62rem;
  }

  .ai-chat-input-area {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 0.55rem 0.62rem calc(0.55rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 12px rgba(19, 34, 52, 0.08);
  }

  .ai-chat-input-area .d-flex.justify-content-between {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.45rem;
  }

  .ai-chat-input-area .d-flex.gap-2 {
    width: 100%;
  }

  .ai-chat-input-area .d-flex.gap-2 .btn {
    flex: 1;
  }

  .ai-side-block {
    margin-top: 0.45rem;
  }

  .ai-session-list {
    max-height: 38vh;
    overflow-y: auto;
    padding-right: 0.1rem;
  }

  .ai-session-item {
    padding: 0.36rem 0.45rem;
  }

  .ai-session-item .title {
    font-size: 0.82rem;
  }

  .ai-session-item .meta {
    font-size: 0.74rem;
  }

  .ai-session-delete-btn {
    min-width: 40px;
    padding: 0.15rem 0.35rem;
    font-size: 0.76rem;
  }

  .assistant-suggest .d-flex {
    gap: 0.35rem !important;
  }

  .assistant-suggest .btn {
    font-size: 0.78rem;
    padding: 0.2rem 0.45rem;
  }

  .bubble {
    max-width: 96%;
    padding: 0.52rem 0.6rem;
  }
}

@media (max-width: 768px) {
  .ai-chat-main-head {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-chat-main-head h5 {
    font-size: 1rem;
  }

  .ai-chat-main-head .small {
    font-size: 0.75rem;
  }

  .msg-row {
    margin-bottom: 0.55rem;
  }

  .assistant-summary {
    font-size: 0.86rem;
    line-height: 1.5;
  }

  .assistant-highlights .highlight-item {
    font-size: 0.79rem;
    padding: 0.3rem 0.42rem;
  }

  .assistant-table-wrap .table {
    min-width: 860px;
  }

  .ai-chat-input-area .form-control {
    min-height: 82px;
    font-size: 0.9rem;
  }

  .ai-query-selector {
    padding: 0.4rem 0.5rem;
  }

  .ai-query-selector .row > [class*="col-"] {
    width: 100%;
    flex: 0 0 100%;
    max-width: 100%;
  }

  .ai-kv-list {
    font-size: 0.78rem;
  }

  .ai-empty-state {
    padding: 0.65rem;
  }

  .ai-empty-state .empty-title {
    font-size: 0.9rem;
  }

  .ai-empty-state .empty-subtitle {
    font-size: 0.8rem;
  }
}

@media (max-width: 576px) {
  .ai-chat-layout {
    gap: 0.45rem;
  }

  .ai-chat-main-head,
  .ai-chat-stream,
  .ai-chat-input-area,
  .ai-chat-sidebar .card-body,
  .ai-chat-context .card-body {
    padding-left: 0.52rem !important;
    padding-right: 0.52rem !important;
  }

  .ai-chat-stream {
    min-height: 34vh;
    max-height: 46vh;
  }

  .ai-session-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }

  .ai-session-delete-btn {
    width: 100%;
    min-width: 0;
  }

  .assistant-suggest .btn {
    width: 100%;
    text-align: left;
  }

  .ai-chat-input-area .d-flex.gap-2 .btn {
    min-height: 34px;
  }
}

/* Dashboard workbench */
.workbench-shell {
  display: flex;
  flex-direction: column;
  gap: 0.92rem;
  padding: 0.22rem 0 0.62rem;
}

.workbench-flash {
  margin-bottom: 0;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: var(--shadow-soft);
}

.workbench-hero,
.workbench-panel,
.shortcut-card,
.notice-compact {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(214, 224, 235, 0.88);
  border-radius: 20px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.06);
}

.workbench-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.18rem 1.75rem;
}

.hero-copy {
  min-width: 0;
}

.hero-title {
  font-size: 2rem;
  line-height: 1.18;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.35rem;
}

.hero-subtitle {
  color: #64748b;
  font-size: 0.94rem;
  line-height: 1.45;
}

.hero-summary {
  margin-top: 0.65rem;
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 42px;
  padding: 0.42rem 0.82rem;
  background: #f8fbff;
  border: 1px solid #dbe7f5;
  border-radius: 16px;
  color: #334155;
  flex-wrap: nowrap;
  white-space: nowrap;
  font-size: 0.92rem;
}

.summary-label {
  font-weight: 700;
  color: #2563eb;
}

.hero-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-self: center;
}

.hero-actions .btn {
  min-height: 42px;
  border-radius: 13px;
  padding: 0 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.metric-emphasis {
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1;
  margin: 0 0.12rem;
}

.metric-blue {
  color: #2563eb;
}

.metric-red {
  color: #dc2626;
}

.metric-orange {
  color: #ea580c;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.92rem;
}

.kpi-card {
  --kpi-color: #2563eb;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
  min-height: 146px;
  padding: 0.88rem 0.96rem 0.78rem;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(214, 224, 235, 0.86);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--kpi-color), color-mix(in srgb, var(--kpi-color) 60%, #ffffff));
}

.kpi-top {
  display: flex;
  align-items: center;
  gap: 0.72rem;
}

.kpi-title {
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}

.kpi-value {
  margin-top: 0.12rem;
  font-size: 1.94rem;
  line-height: 1;
  font-weight: 700;
  color: var(--kpi-color);
}

.kpi-desc {
  color: #7b8798;
  font-size: 0.88rem;
  min-height: 2.28em;
  line-height: 1.42;
}

.kpi-action {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  width: fit-content;
  padding: 0.38rem 0.72rem;
  border-radius: 11px;
  border: 1px solid color-mix(in srgb, var(--kpi-color) 28%, #ffffff);
  color: var(--kpi-color);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.86rem;
  background: color-mix(in srgb, var(--kpi-color) 8%, #ffffff);
}

.kpi-action:hover {
  background: color-mix(in srgb, var(--kpi-color) 14%, #ffffff);
  color: var(--kpi-color);
}

.kpi-blue {
  --kpi-color: #2563eb;
}

.kpi-red {
  --kpi-color: #ef4444;
}

.kpi-orange {
  --kpi-color: #f97316;
}

.kpi-purple {
  --kpi-color: #8b5cf6;
}

.kpi-green {
  --kpi-color: #16a34a;
}

.icon-circle {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.22rem;
  flex: 0 0 auto;
}

.icon-blue {
  color: #2563eb;
  background: #eaf1ff;
}

.icon-red {
  color: #ef4444;
  background: #feeaeb;
}

.icon-orange {
  color: #f97316;
  background: #fff2e8;
}

.icon-purple {
  color: #8b5cf6;
  background: #f2ecff;
}

.icon-green {
  color: #16a34a;
  background: #e9f9ee;
}

.icon-teal {
  color: #0f9fa8;
  background: #e8fbfb;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(320px, 1fr);
  gap: 0.92rem;
  align-items: start;
}

.workbench-grid-secondary {
  align-items: stretch;
}

.workbench-panel {
  padding: 0.96rem 1.08rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.58rem;
}

.panel-title {
  font-size: 1.08rem;
  font-weight: 700;
  color: #0f172a;
}

.panel-action {
  color: #2563eb;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}

.panel-caption {
  margin-bottom: 0.72rem;
  color: #7b8798;
  font-size: 0.88rem;
  line-height: 1.45;
}

.flow-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: start;
  justify-items: center;
  padding: 0.08rem 0.1rem 0;
}

.flow-track::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 20px;
  height: 2px;
  background: linear-gradient(90deg, #d9e5f1 0%, #e8eef6 100%);
  z-index: 0;
}

.flow-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.24rem;
  width: 100%;
  text-align: center;
  padding: 0 0.18rem;
}

.flow-step .icon-circle {
  width: 40px;
  height: 40px;
  background: #fff;
  box-shadow: 0 0 0 5px rgba(248, 250, 252, 0.98);
}

.flow-title {
  margin-top: 0.03rem;
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
}

.flow-meta {
  font-size: 0.84rem;
  color: #64748b;
}

.flow-submeta {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.25;
}

.flow-number {
  font-size: 1.4rem;
  line-height: 1.05;
  font-weight: 700;
  color: #0f172a;
}

.flow-step a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: #2563eb;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 0.68rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-blue {
  background: #eaf1ff;
  color: #2563eb;
}

.status-green {
  background: #e9f9ee;
  color: #15803d;
}

.status-orange {
  background: #fff1e8;
  color: #ea580c;
}

.status-purple {
  background: #f2ecff;
  color: #7c3aed;
}

.status-slate {
  background: #eef2f7;
  color: #64748b;
}

.risk-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.risk-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.66rem 0.82rem;
  border-radius: 16px;
  border: 1px solid rgba(225, 232, 240, 0.96);
  background: #fbfdff;
  text-decoration: none;
  color: inherit;
}

.risk-item:hover {
  border-color: #d1deee;
  background: #f7fbff;
}

.risk-level {
  min-width: 62px;
  padding: 0.24rem 0.55rem;
  border-radius: 999px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.risk-high {
  color: #dc2626;
  background: #fff0f1;
}

.risk-medium {
  color: #ea580c;
  background: #fff1e8;
}

.risk-low {
  color: #2563eb;
  background: #eaf1ff;
}

.risk-body {
  min-width: 0;
}

.risk-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
}

.risk-desc {
  color: #7b8798;
  font-size: 0.86rem;
  margin-top: 0.1rem;
  line-height: 1.4;
}

.risk-qty {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  justify-self: end;
}

.risk-item .bi-chevron-right {
  justify-self: end;
  color: #94a3b8;
}

.todo-list {
  display: flex;
  flex-direction: column;
  gap: 0.56rem;
}

.todo-item {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.68rem;
  padding: 0.72rem 0.82rem;
  border-radius: 16px;
  border: 1px solid rgba(225, 232, 240, 0.96);
  background: #fbfdff;
}

.todo-item .icon-circle {
  width: 38px;
  height: 38px;
  font-size: 1rem;
}

.todo-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
}

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

.todo-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
}

.todo-desc {
  margin-top: 0.1rem;
  font-size: 0.84rem;
  color: #7b8798;
  line-height: 1.4;
}

.todo-count {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  justify-self: end;
  min-width: 64px;
  text-align: right;
}

.todo-item .btn {
  min-width: 84px;
}

.recent-table-wrap {
  overflow-x: hidden;
}

.recent-table {
  width: 100%;
  table-layout: fixed;
  min-width: 0;
  margin-bottom: 0;
}

.recent-table .recent-col-type {
  width: 86px;
}

.recent-table .recent-col-doc {
  width: 108px;
}

.recent-table .recent-col-po {
  width: 92px;
}

.recent-table .recent-col-action {
  width: 56px;
}

.recent-table thead th {
  border-bottom: 1px solid #dbe3ee;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 700;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-table tbody td {
  color: #1e293b;
  font-size: 0.9rem;
  border-bottom-color: #edf2f7;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-link,
.recent-text,
.recent-action {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.recent-link,
.recent-action {
  color: #2563eb;
  text-decoration: none;
}

.recent-link:hover,
.recent-action:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.recent-desc-cell {
  overflow: hidden;
}

.recent-desc {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-meta {
  margin-top: 0.14rem;
  font-size: 0.76rem;
  line-height: 1.2;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.92rem;
}

.shortcut-card {
  display: flex;
  flex-direction: column;
  padding: 0.84rem 0.9rem 0.76rem;
  height: 100%;
}

.shortcut-title {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.38rem;
  font-size: 1.08rem;
  font-weight: 700;
  color: #0f172a;
}

.shortcut-title .icon-circle {
  width: 38px;
  height: 38px;
  font-size: 0.96rem;
}

.shortcut-links {
  display: flex;
  flex-direction: column;
  gap: 0.24rem;
  margin-top: 0.58rem;
}

.shortcut-note {
  color: #7b8798;
  font-size: 0.83rem;
  line-height: 1.38;
  min-height: 2.2em;
}

.shortcut-link {
  display: inline-flex;
  align-items: center;
  gap: 0.58rem;
  padding: 0.46rem 0.64rem;
  border-radius: 12px;
  text-decoration: none;
  color: #334155;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  line-height: 1.3;
}

.shortcut-link:hover {
  background: #f3f8ff;
  color: #0f172a;
  transform: translateX(3px);
}

.shortcut-link i {
  color: #94a3b8;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 2rem 1rem;
  color: #64748b;
  text-align: center;
}

.empty-state i {
  font-size: 1.7rem;
  color: #94a3b8;
}

.empty-state.compact {
  min-height: 186px;
}

.empty-state p {
  margin: 0;
  font-size: 0.88rem;
  color: #7b8798;
}

.empty-state-action {
  margin-top: 0.38rem;
  min-width: 110px;
  min-height: 34px;
  padding: 0.3rem 0.72rem;
  font-size: 0.86rem;
}

.notice-compact {
  padding: 0.58rem 0.82rem;
  border-color: rgba(222, 229, 238, 0.8);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.notice-compact .panel-title {
  font-size: 0.98rem;
}

.notice-list {
  padding-left: 1.1rem;
  color: #475569;
  font-size: 0.84rem;
  line-height: 1.38;
}

.notice-list li + li {
  margin-top: 0.18rem;
}

.notice-danger-form {
  margin-top: 0.56rem;
}

.notice-danger-form .btn {
  min-height: 34px;
  padding: 0.3rem 0.72rem;
  font-size: 0.86rem;
}

@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 1200px) {
  .workbench-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .hero-summary {
    white-space: normal;
    flex-wrap: wrap;
  }

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

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

  .flow-track::before {
    display: none;
  }
}

@media (max-width: 900px) {
  .workbench-grid {
    grid-template-columns: 1fr;
  }

  .todo-item {
    grid-template-columns: auto auto minmax(0, 1fr) auto;
  }

  .todo-item .btn {
    grid-column: 3 / -1;
    justify-self: start;
  }
}

@media (max-width: 768px) {
  .workbench-hero,
  .workbench-panel,
  .shortcut-card,
  .notice-compact {
    border-radius: 16px;
  }

  .hero-title {
    font-size: 1.54rem;
  }

  .hero-summary {
    width: 100%;
    align-items: flex-start;
  }

  .kpi-grid,
  .shortcut-grid,
  .flow-track {
    grid-template-columns: 1fr;
  }

  .todo-item,
  .risk-item {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .todo-check,
  .todo-count,
  .risk-qty {
    display: none;
  }

  .todo-item .btn {
    grid-column: auto;
    width: 100%;
    min-width: 0;
  }
}


.dashboard-compact-shell > section + section {
  margin-top: 0.92rem;
}

.dashboard-hero-clean {
  padding-bottom: 0.9rem;
}

.dashboard-flow-panel {
  padding-top: 0.98rem;
  padding-bottom: 1rem;
}

.flow-number-mixed {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.18rem;
  white-space: nowrap;
  flex-wrap: nowrap;
}

.flow-warning {
  font-size: 0.86rem;
  font-weight: 600;
  color: #f97316;
  white-space: nowrap;
}

.focus-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.9fr);
  gap: 0.92rem;
  align-items: start;
}

.recent-abnormal-panel,
.shortcut-panel {
  height: 100%;
}

.shortcut-grid-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.shortcut-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.shortcut-head-icon {
  flex: 0 0 auto;
  margin-top: 0.22rem;
  font-size: 0.92rem;
  color: #94a3b8;
}

.shortcut-grid-compact .shortcut-card {
  padding: 0.78rem 0.86rem 0.72rem;
  min-height: 0;
}

.shortcut-grid-compact .shortcut-title {
  margin-bottom: 0;
  font-size: 1rem;
}

.shortcut-grid-compact .shortcut-note {
  min-height: auto;
  margin-top: 0.24rem;
}

.shortcut-grid-compact .shortcut-links {
  margin-top: 0.48rem;
}

.shortcut-grid-compact .shortcut-link {
  padding: 0.42rem 0.58rem;
}

.dashboard-notice-compact {
  margin-top: 0.92rem;
}

@media (max-width: 900px) {
  .focus-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   Dashboard V2 — Visual Enhancement Layer
   ======================================== */

/* --- Smooth micro-interactions for all dashboard cards --- */
.kpi-card,
.workbench-hero.dashboard-hero-clean,
.workbench-panel,
.shortcut-card,
.notice-compact {
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.28s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.22s ease;
}

/* --- Hero Section: gradient + depth --- */
.workbench-hero.dashboard-hero-clean {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #f0f4ff 100%) !important;
  border-color: rgba(37, 99, 235, 0.10) !important;
  position: relative;
  overflow: hidden;
}

.workbench-hero.dashboard-hero-clean::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -5%;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

.workbench-hero.dashboard-hero-clean::before {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.workbench-hero.dashboard-hero-clean .hero-copy {
  position: relative;
  z-index: 1;
}

.workbench-hero.dashboard-hero-clean .hero-actions {
  position: relative;
  z-index: 1;
}

.workbench-hero.dashboard-hero-clean .hero-title {
  font-size: 1.72rem;
  letter-spacing: -0.02em;
}

.workbench-hero.dashboard-hero-clean .hero-subtitle {
  margin-top: 0.35rem;
  font-size: 0.92rem;
  color: #64748b;
}

/* Hero greeting badge */
.hero-greeting {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.72rem;
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid rgba(37, 99, 235, 0.10);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #3b82f6;
  margin-bottom: 0.45rem;
  width: fit-content;
}

/* Hero gradient primary button */
.hero-actions .btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.hero-actions .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

/* Hero outline secondary button */
.hero-actions .btn-outline-secondary {
  border-color: rgba(100, 116, 139, 0.25) !important;
  color: #475569 !important;
  transition: all 0.22s ease;
}

.hero-actions .btn-outline-secondary:hover {
  background: rgba(100, 116, 139, 0.06) !important;
  border-color: rgba(100, 116, 139, 0.4) !important;
  color: #334155 !important;
}

/* --- KPI Cards: glass feel + depth --- */
.kpi-card {
  backdrop-filter: blur(12px);
}

.kpi-card::before {
  width: 5px;
  border-radius: 0 4px 4px 0;
  opacity: 0.85;
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.10);
}

.kpi-blue:hover  { border-color: rgba(37, 99, 235, 0.22) !important; }
.kpi-red:hover   { border-color: rgba(239, 68, 68, 0.22) !important; }
.kpi-orange:hover { border-color: rgba(249, 115, 22, 0.22) !important; }
.kpi-purple:hover { border-color: rgba(139, 92, 246, 0.22) !important; }
.kpi-green:hover  { border-color: rgba(22, 163, 74, 0.22) !important; }

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.kpi-desc {
  min-height: auto;
}

.kpi-action {
  transition: all 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.kpi-action:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--kpi-color) 16%, transparent);
}

/* KPI icon subtle bounce on card hover */
.kpi-card:hover .icon-circle {
  transform: scale(1.08);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Flow Track: colorful gradient connector --- */
.flow-track::before {
  height: 3px;
  background: linear-gradient(90deg,
    #dbeafe 0%, #e0e7ff 20%, #ede9fe 40%,
    #fce7f3 60%, #d1fae5 80%, #ccfbf1 100%);
  border-radius: 999px;
}

.flow-step .icon-circle {
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.flow-step:hover .icon-circle {
  transform: scale(1.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
}

.flow-step > a {
  transition: color 0.18s ease, transform 0.18s ease;
}

.flow-step > a:hover {
  transform: translateX(2px);
}

/* --- Panel: glass feel --- */
.workbench-panel {
  backdrop-filter: blur(12px);
}

/* --- Recent Table: hover gradient --- */
.recent-table tbody tr {
  transition: background-color 0.15s ease;
}

.recent-table tbody tr:hover {
  background: linear-gradient(90deg, #f8fbff 0%, #f0f7ff 100%) !important;
}

/* --- Shortcut Cards: hover lift --- */
.shortcut-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.10);
}

.shortcut-link {
  transition: all 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 12px;
}

.shortcut-link:hover {
  background: linear-gradient(135deg, #eff6ff 0%, #f8faff 100%) !important;
  transform: translateX(4px);
  color: #1e293b;
}

.shortcut-link:hover i {
  color: #3b82f6;
}

/* --- Empty State: refined --- */
.empty-state.compact {
  background: linear-gradient(180deg, #fafcff 0%, #f8fafc 100%);
}

.empty-state.compact i {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  padding: 0.65rem;
  border-radius: 999px;
  color: #3b82f6;
}

/* --- Notice: glass feel --- */
.notice-compact {
  backdrop-filter: blur(12px);
}

/* --- Status Pill: subtle scale on hover --- */
.status-pill {
  transition: transform 0.18s ease;
}

.flow-step:hover .status-pill {
  transform: scale(1.05);
}

/* --- Panel Header: tighter letter-spacing --- */
.panel-title {
  letter-spacing: -0.01em;
}

/* --- Focus Grid: slightly more gap --- */
.focus-grid {
  gap: 1rem;
}

/* ========================================
   Dashboard V2 — Responsive Adjustments
   ======================================== */
@media (max-width: 1400px) {
  .workbench-hero.dashboard-hero-clean::after {
    width: 200px;
    height: 200px;
  }
}

@media (max-width: 992px) {
  .workbench-hero.dashboard-hero-clean::after,
  .workbench-hero.dashboard-hero-clean::before {
    display: none;
  }

  .kpi-card:hover {
    transform: translateY(-2px);
  }
}

@media (max-width: 768px) {
  .kpi-card:hover,
  .shortcut-card:hover {
    transform: translateY(-2px);
  }

  .workbench-hero.dashboard-hero-clean .hero-title {
    font-size: 1.45rem;
  }
}

/* =======================================
   List Page V2 — Visual Enhancement Layer
   ======================================= */

/* --- Page Header: refined --- */
h3, h4 {
  letter-spacing: -0.01em;
}

/* --- Toolbar / Filter Bar --- */
.workbench-filter {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(214, 224, 235, 0.82);
  border-radius: 14px;
  padding: 0.72rem 0.88rem;
  backdrop-filter: blur(8px);
}

/* --- Table: enhanced header --- */
.table thead th {
  background: linear-gradient(180deg, #f1f5f9 0%, #e8eef6 100%) !important;
  color: #334155 !important;
  font-weight: 600 !important;
  font-size: 0.82rem !important;
  letter-spacing: 0.01em;
  text-transform: none !important;
  border-bottom: 2px solid #d1dbe8 !important;
  padding: 0.58rem 0.65rem !important;
  white-space: nowrap;
  position: relative;
}

.table thead th::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(203, 213, 225, 0.5) 50%, transparent 100%);
}

/* --- Table: smoother zebra + hover --- */
.table tbody tr {
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.table tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.04) !important;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.08);
}

.table tbody tr:nth-child(odd) td {
  background: #f8fafc !important;
}

.table tbody tr:nth-child(even) td {
  background: #f1f5f9 !important;
}

.table tbody tr:hover td {
  background: rgba(59, 130, 246, 0.06) !important;
}

/* --- Table: improved cell padding --- */
.table-sm > :not(caption) > * > * {
  padding: 0.52rem 0.62rem;
}

/* --- Action Buttons in Tables --- */
.table .btn-sm {
  border-radius: 8px;
  font-size: 0.8rem;
  padding: 0.28rem 0.62rem;
  transition: all 0.18s ease;
  font-weight: 500;
}

.table .btn-outline-secondary {
  border-color: rgba(148, 163, 184, 0.5);
  color: #475569;
}

.table .btn-outline-secondary:hover {
  background: #f1f5f9;
  border-color: rgba(148, 163, 184, 0.7);
  color: #1e293b;
}

.table .btn-outline-primary {
  border-color: rgba(59, 130, 246, 0.35);
  color: #3b82f6;
}

.table .btn-outline-primary:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.5);
  color: #1d4ed8;
}

.table .btn-outline-warning {
  border-color: rgba(245, 158, 11, 0.35);
  color: #d97706;
}

.table .btn-outline-warning:hover {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.5);
}

.table .btn-outline-danger {
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.table .btn-outline-danger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.45);
}

/* --- Pagination: enhanced --- */
.pagination {
  gap: 0.3rem;
}

.pagination .page-link {
  border-radius: 10px !important;
  border-color: rgba(203, 213, 225, 0.7) !important;
  color: #334155 !important;
  font-size: 0.88rem;
  padding: 0.38rem 0.72rem;
  transition: all 0.18s ease;
  font-weight: 500;
}

.pagination .page-link:hover {
  background: rgba(59, 130, 246, 0.06) !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
  color: #1d4ed8 !important;
  transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  font-weight: 600;
}

.pagination .page-item.disabled .page-link {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- Alert: refined --- */
.alert {
  border-radius: 12px !important;
  border-width: 1px !important;
  padding: 0.65rem 0.85rem !important;
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
}

.alert-info {
  background: rgba(239, 246, 255, 0.95) !important;
  border-color: rgba(191, 219, 254, 0.7) !important;
  color: #1e40af !important;
}

.alert-success {
  background: rgba(236, 253, 243, 0.95) !important;
  border-color: rgba(167, 243, 208, 0.7) !important;
  color: #14532d !important;
}

.alert-warning {
  background: rgba(255, 251, 235, 0.95) !important;
  border-color: rgba(253, 230, 138, 0.7) !important;
  color: #78350f !important;
}

.alert-danger {
  background: rgba(254, 242, 242, 0.95) !important;
  border-color: rgba(252, 165, 165, 0.7) !important;
  color: #991b1b !important;
}

/* --- Badge: refined --- */
.badge {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.25em 0.55em;
  border-radius: 6px;
  letter-spacing: 0.01em;
}

/* --- Empty State: enhanced --- */
.empty-state {
  border-radius: 14px !important;
  padding: 2.5rem 1.5rem !important;
}

.empty-state i {
  transition: transform 0.22s ease;
}

.empty-state:hover i {
  transform: scale(1.08);
}

/* --- Modal / Dialog: refined --- */
.modal-content {
  border-radius: 16px !important;
  border: none !important;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.2) !important;
  overflow: hidden;
}

.modal-header {
  padding: 0.82rem 1rem;
  border-bottom: 1px solid rgba(203, 213, 225, 0.6);
}

.modal-body {
  padding: 1rem 1.1rem;
}

.modal-footer {
  padding: 0.72rem 1rem;
  border-top: 1px solid rgba(203, 213, 225, 0.6);
}

/* --- Dropdown: refined --- */
.dropdown-menu {
  border-radius: 14px !important;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12) !important;
  border-color: rgba(203, 213, 225, 0.7) !important;
  padding: 0.38rem !important;
}

.dropdown-item {
  border-radius: 8px !important;
  padding: 0.42rem 0.65rem !important;
  font-size: 0.88rem !important;
  transition: background-color 0.12s ease;
}

/* =======================================
   Form Page V2 — Visual Enhancement Layer
   ======================================= */

/* --- Form Label: refined --- */
.form-label {
  font-weight: 600;
  font-size: 0.88rem;
  color: #334155;
  margin-bottom: 0.35rem;
  letter-spacing: 0.005em;
}

/* --- Form Control: enhanced focus --- */
.form-control:focus,
.form-select:focus {
  border-color: #60a5fa !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

/* --- Form Card/Section: refined --- */
.card .card-header {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid rgba(203, 213, 225, 0.6);
  padding: 0.65rem 0.88rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: #334155;
}

/* --- Input Group: refined --- */
.input-group-text {
  background: #f1f5f9;
  border-color: rgba(203, 213, 225, 0.7);
  color: #64748b;
  font-size: 0.88rem;
}

/* --- Card in form context --- */
form .card {
  border-radius: 14px;
  border-color: rgba(214, 224, 235, 0.8);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

/* --- Button primary in form context --- */
form .btn-primary,
.form-actions .btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

form .btn-primary:hover,
.form-actions .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

/* --- Form actions bar --- */
.form-actions {
  padding: 0.72rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* 主数据批量导入：选择文件、预览与结果使用一致的紧凑布局。 */
.master-import {
  margin: 1rem 0;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  min-width: 0;
}
.master-import-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem 1.5rem;
  margin-bottom: .875rem;
}
.master-import h5, .master-import h6 { margin: 0; color: var(--text-main); font-size: 1rem; }
.master-import-help { margin: .35rem 0 0; font-size: .85rem; color: var(--text-muted); overflow-wrap: anywhere; }
.master-import-form { display: flex; align-items: flex-start; gap: 1rem; }
.master-import-form > .btn { margin-top: 1.8rem; }
.master-import-file { flex: 1; min-width: 0; }
.master-import-file .form-control { width: 100%; min-width: 0; }
.master-import .btn { flex-shrink: 0; white-space: nowrap; }
.master-import .btn-primary { background: var(--brand); box-shadow: none; border: 1px solid var(--brand); }
.master-import .btn-primary:hover { background: var(--brand); box-shadow: none; transform: none; }
.master-import-rules { margin-top: .875rem; padding-top: .75rem; border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-muted); }
.master-import summary { cursor: pointer; color: var(--text-muted); width: fit-content; }
.master-import summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.master-import-rules p { margin: .5rem 0 0; }
.master-import-preview > .card-body { padding: 0; }
.master-import-meta { min-width: 0; max-width: 55%; overflow-wrap: anywhere; }
.master-import-stats { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding: .75rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: .9rem; color: var(--text-muted); }
.master-import-stats strong { margin-left: .25rem; color: var(--text-main); font-variant-numeric: tabular-nums; }
.master-import-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1rem 0; }
.master-import-data pre { max-width: 28rem; margin: .5rem 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: inherit; }
.master-import-result .table-responsive { margin: 1rem 0; }
.master-import-result table { min-width: 640px; }
.master-import-result th { white-space: nowrap; }
@media (max-width: 575.98px) {
  .master-import { padding: .875rem; }
  .master-import-heading, .master-import-form { flex-direction: column; align-items: stretch; }
  .master-import-meta { max-width: 100%; }
  .master-import-form > .btn { margin-top: 0; }
  .master-import-actions { flex-direction: column; }
  .master-import-actions .btn { width: 100%; }
  .master-import-heading > .btn { align-self: flex-start; }
}

/* 主数据录入任务页：列表仅保留入口，操作集中在独立页面。 */
.master-entry { max-width: 1080px; margin: 0 auto; }
.master-entry-header { margin-bottom: 1.25rem; }
.master-entry-back { display: inline-block; margin-bottom: .75rem; color: var(--text-muted); font-size: .875rem; }
.master-entry-header h4 { margin-bottom: 1rem; }
.master-entry .master-import-upload { padding: 0; border: 0; background: transparent; }
.master-entry .master-import-upload .master-import-heading { justify-content: flex-end; }
.master-entry .master-entry-form > .card-body { padding: 0; }

.master-entry-surface { padding: 1.5rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.master-entry-manual h5, .master-entry-import h5 { margin: 0 0 1rem; font-size: 1rem; color: var(--text-main); }
.master-entry-import { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.master-entry-import-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.master-entry-import-heading h5 { margin-bottom: 0; }
.master-entry-import .master-import-upload { margin: 0; }
@media (max-width: 575.98px) {
  .master-entry-surface { padding: 1rem; }
  .master-entry-import-heading { flex-wrap: wrap; }
}

/* 四入口 R2：移动端折叠导航换行（仅 Bootstrap 折叠断点以下生效，≥992px 桌面保持不变）。
   背景：.topbar-inner / .workbench-navbar-shell 的 flex-wrap:nowrap 会把展开后的 collapse
   挤在品牌与切换按钮右侧，390px 视口出现横向裁切。这里只允许外层换行：
   首行品牌 + 切换按钮，折叠内容独占整行并可纵向滚动；不改桌面导航与业务布局。 */
@media (max-width: 991.98px) {
  .navbar .container-fluid,
  .topbar-inner,
  .workbench-navbar-shell {
    flex-wrap: wrap;
    min-width: 0;
  }

  .navbar-brand.workbench-brand {
    order: 1;
    flex: 0 1 auto;
    min-width: 0;
    max-width: calc(100% - 3.75rem);
    margin-right: auto;
  }

  .workbench-brand-copy {
    min-width: 0;
  }

  .workbench-brand-title,
  .workbench-brand-eyebrow {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navbar .navbar-toggler {
    order: 2;
    margin-left: auto;
    flex: 0 0 auto;
  }

  .navbar-collapse,
  .workbench-navbar-collapse {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    max-height: calc(100vh - 5rem);
    max-height: calc(100dvh - 5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .workbench-nav-center,
  .nav-center {
    width: 100%;
    min-width: 0;
  }

  .navbar-nav.workbench-nav-list {
    width: 100%;
    min-width: 0;
    flex-wrap: wrap;
  }

  .navbar-nav .nav-link.workbench-nav-link,
  .nav-center .nav-link,
  .navbar-nav .nav-link {
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
  }

  .navbar-nav .dropdown-menu,
  .navbar-nav .dropdown-item {
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
  }
}
