* {
  box-sizing: border-box;
}
/* R2-051: only the two sales-directory title totals share the primary button colour. */
#employeeCount,
#historicalBoardSalesSidebar > .panel-header > .badge {
  color: #fff;
  background: var(--ui-color-primary);
  border-color: var(--ui-color-primary);
}
/* R2-008: long navigation must scroll inside the viewport, not stretch its grid row. */
@media (min-width: 761px) {
  body:is(.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell), .module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell)) {
    height: 100dvh;
    overflow: hidden;
  }

  body:is(.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell), .module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell)) #mainView {
    height: 100dvh;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  body:is(.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell), .module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell)) #mainView > .sidebar {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
}

/* Keep the existing stacked personnel layout below 1181px. */
@media (min-width: 1181px) {
  body.module-personnel-management:has(#personnelManagementView:not(.hidden)) {
    height: 100dvh;
    overflow: hidden;
  }

  body.module-personnel-management:has(#personnelManagementView:not(.hidden)) #mainView {
    height: 100dvh;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  body.module-personnel-management:has(#personnelManagementView:not(.hidden)) #mainView > .sidebar {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  body.module-personnel-management:has(#personnelManagementView:not(.hidden)) #mainView > .content {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.module-personnel-management:has(#personnelManagementView:not(.hidden)) #personnelManagementView {
    height: 100%;
  }
}


/* R2-007: give the sales map the remaining workspace width and height.
   The condition excludes list mode and all other modules. */
@media (min-width: 761px) {
  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) .main-view {
    min-width: 0;
  }

  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) .content {
    height: 100dvh;
    overflow: hidden;
  }

  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) #areaAssignmentModule,
  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) #areaAssignmentModule > .layout-grid {
    height: 100%;
    min-height: 0;
  }

  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) #areaAssignmentModule > .layout-grid {
    grid-template-columns: clamp(208px, 12vw, 224px) minmax(0, 1fr) clamp(250px, 18vw, 290px);
    align-items: stretch;
  }

  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) .employee-panel,
  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) .map-panel {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
  }

  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) .panel-header,
  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) .org-tree-search,
  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) #regionInfo {
    flex: 0 0 auto;
  }

  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) #employeeList {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    overflow: auto;
    overscroll-behavior: contain;
  }

  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.sales-amap-shell) .assignment-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
  }

  body.module-sales-assignment #mapCanvas.sales-amap-shell {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    padding: 0;
    overflow: hidden;
  }

  body.module-sales-assignment #mapCanvas.sales-amap-shell .sales-amap-frame {
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
    aspect-ratio: auto;
  }
}

/* R2-006: only the department map workspace fills the available viewport.
   List mode and the sales-assignment workspace retain their existing layout. */
@media (min-width: 761px) {
  body.module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell) .content {
    height: 100dvh;
    overflow: hidden;
  }

  body.module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell) #areaAssignmentModule,
  body.module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell) .department-scope-layout {
    height: 100%;
    min-height: 0;
  }

  body.module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell) .department-scope-layout {
    grid-template-columns: clamp(152px, 12vw, 210px) minmax(0, 1fr) clamp(254px, 22vw, 340px);
    align-items: stretch;
  }

  body.module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell) .department-panel,
  body.module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell) .map-panel {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
  }

  body.module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell) .panel-header {
    flex: 0 0 auto;
  }

  body.module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell) .department-list {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  body.module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden) #mapCanvas.department-amap-shell) .assignment-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
  }

  body.module-department-scope #mapCanvas.department-amap-shell {
    display: flex;
    min-height: 0;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
  }

  body.module-department-scope #mapCanvas.department-amap-shell .department-amap-frame {
    min-height: 0;
    height: auto;
    flex: 1 1 0;
    aspect-ratio: auto;
    margin-bottom: 0;
  }

  body.module-department-scope #mapCanvas.department-amap-shell .department-map-summary {
    min-width: 0;
    min-height: 0;
    max-height: min(30dvh, 260px);
    flex: 0 1 auto;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    overflow: auto;
    overscroll-behavior: contain;
  }
}

:root {
  --ui-font: Arial, "Microsoft YaHei", sans-serif;
  --ui-font-meta: 11px;
  --ui-font-table: 12px;
  --ui-font-body: 13px;
  --ui-font-control: 14px;
  --ui-font-section: 16px;
  --ui-line-compact: 1.35;
  --ui-line-body: 1.6;
  --ui-color-text: #172033;
  --ui-color-heading: #12314a;
  --ui-color-muted: #60768b;
  --ui-color-border: #d8e3eb;
  --ui-color-surface: #ffffff;
  --ui-color-subtle: #f8fafc;
  --ui-color-primary: #0f8f8c;
  --ui-color-primary-hover: #0d7977;
  --ui-color-primary-soft: #e8f5f3;
  --ui-color-primary-border: #79c5c1;
  --ui-color-link: #0b7f78;
  --ui-color-danger: #b42318;
  --ui-color-focus: #0f8f8c;
  --ui-space-1: 4px;
  --ui-space-2: 8px;
  --ui-space-3: 12px;
  --ui-space-4: 16px;
  --ui-space-5: 20px;
  --ui-space-6: 24px;
  --ui-radius-control: 5px;
  --ui-radius-card: 8px;
  --ui-radius-pill: 999px;
  --ui-control-height: 36px;
  --ui-control-width-xs: 88px;
  --ui-control-width-sm: 140px;
  --ui-control-width-md: 220px;
  --ui-control-width-lg: 360px;
  --ui-reading-width: 720px;
  --ui-table-cell-y: 8px;
  --ui-table-cell-x: 10px;
}

body {
  margin: 0;
  font-family: var(--ui-font);
  background: #f4f7fb;
  color: var(--ui-color-text);
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #e9eef6;
}

.login-card {
  width: 360px;
  padding: 28px;
  background: #fff;
  border: 1px solid #d9e2ef;
}

.login-title h1 {
  margin: 0 0 6px;
  font-size: 30px;
}

.login-title p {
  margin: 0 0 24px;
  color: #667085;
}

label {
  display: block;
  margin: 14px 0 6px;
}

input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
}

.primary-btn {
  width: 100%;
  height: 40px;
  margin-top: 18px;
  color: #fff;
  background: #0f8f8c;
  border: 0;
  cursor: pointer;
}

.secondary-btn {
  height: 34px;
  padding: 0 12px;
  background: #eef2f7;
  border: 1px solid #d0d7e2;
  cursor: pointer;
}

.link-btn {
  margin-top: 12px;
  padding: 0;
  color: #2463eb;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.message {
  min-height: 20px;
  margin-top: 12px;
  color: #b42318;
  font-size: 13px;
}

.main-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
}

.sidebar {
  background: #142033;
  color: #fff;
}

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

.system-title {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.system-title strong {
  display: block;
  margin-bottom: 6px;
  font-size: 22px;
}

.system-title span {
  color: #cbd5e1;
  font-size: 13px;
}

.module-menu {
  padding: 10px;
}

.module-item {
  width: 100%;
  display: block;
  margin-bottom: 6px;
  padding: 10px 12px;
  text-align: left;
  color: #dbe4f0;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}

.module-item.enabled.active {
  color: #fff;
  background: #0f8f8c;
}

.module-item.disabled {
  color: #7b8798;
  cursor: not-allowed;
}

.content {
  min-width: 0;
  padding: 14px;
}

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

.topbar h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.topbar p {
  margin: 0;
  color: #667085;
}

.layout-grid {
  display: grid;
  grid-template-columns: 260px minmax(560px, 1fr) clamp(290px, 23vw, 350px);
  gap: 12px;
  align-items: start;
}

/* Historical orders database v3 */
.historical-order-file-input { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.historical-order-commandbar,
.historical-order-panel,
.historical-order-upload-card { border: 1px solid #d8e3eb; border-radius: 10px; background: #fff; box-shadow: 0 10px 28px rgba(21,52,79,.07); }
.historical-order-commandbar,
.historical-order-upload-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; padding: 17px 20px; }
.historical-order-commandbar h3 { margin: 0 0 5px; color: #15344f; font-size: 20px; }
.historical-order-commandbar p,
.historical-order-upload-card p { margin: 0; color: #60768b; font-size: 13px; line-height: 1.55; }
.historical-order-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.historical-order-danger-outline,
.historical-order-danger-fill { min-height: 36px; border: 1px solid #bd3a3a; border-radius: 7px; padding: 8px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.historical-order-danger-outline { background: #fff; color: #a93232; }
.historical-order-danger-fill { background: #bd3a3a; color: #fff; }
.historical-order-danger-outline:disabled { cursor: not-allowed; opacity: .52; }
.historical-order-panel { padding: 20px; }
.historical-order-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.historical-order-metrics article { min-width: 0; border: 1px solid #d8e3eb; border-radius: 8px; padding: 11px 13px; background: #f9fbfc; }
.historical-order-metrics span { display: block; color: #60768b; font-size: 11px; }
.historical-order-metrics strong { display: block; overflow: hidden; margin-top: 4px; color: #15344f; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.historical-order-profile-note,
.historical-order-query-tip { margin-bottom: 14px; border-left: 3px solid #15948e; padding: 9px 12px; background: #f2faf9; color: #4d687c; font-size: 12px; line-height: 1.6; }
.historical-order-table-wrap { max-height: 590px; overflow: auto; border: 1px solid #d8e3eb; border-radius: 8px; }
.historical-order-field-table { max-height: 680px; }
.historical-order-table-wrap table { min-width: 100%; border-collapse: separate; border-spacing: 0; }
.historical-order-table-wrap th,
.historical-order-table-wrap td { border-right: 1px solid #e8eef2; border-bottom: 1px solid #e8eef2; padding: 9px 11px; color: #29465d; font-size: 12px; text-align: left; white-space: nowrap; }
.historical-order-table-wrap th { position: sticky; top: 0; z-index: 1; background: #edf3f6; color: #365267; }
.historical-order-table-wrap tbody tr:hover td { background: #f3faf9; }
.historical-order-table-wrap tbody tr.is-selected td { background: #eef9f7; }
.historical-row-select-cell { width: 42px; min-width: 42px; max-width: 42px; padding-right: 8px!important; padding-left: 8px!important; text-align: center!important; }
.historical-row-select-cell input { width: 16px; height: 16px; margin: 0; accent-color: #15948e; cursor: pointer; }
.historical-order-table-wrap .is-number { text-align: right; font-variant-numeric: tabular-nums; }
.historical-order-table-wrap .is-center { text-align: center; font-variant-numeric: tabular-nums; }
.historical-order-table-wrap .is-amount { color: #225ac7; font-weight: 700; }
.historical-order-empty { height: 120px; color: #76899a!important; text-align: center!important; }
.historical-order-table-footer { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 12px; color: #60768b; font-size: 12px; }
.historical-order-table-footer > div { display: flex; gap: 8px; }
.historical-order-table-footer > span:last-child { text-align: right; }
.historical-order-query-builder { border: 1px solid #dce7ed; border-radius: 9px; padding: 14px; background: #f8fbfc; }
.historical-order-query-builder-title { display: flex; align-items: center; justify-content: flex-start; gap: 50px; margin-bottom: 12px; }
.historical-order-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.historical-query-actions { align-items: center; flex-wrap: nowrap; }
.historical-query-actions button,
.historical-query-actions .primary-btn {
  display: inline-flex;
  flex: 0 0 132px;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 132px;
  min-width: 132px;
  height: 36px;
  min-height: 36px;
  margin: 0;
  padding: 0 12px;
  line-height: 1;
  white-space: nowrap;
}
.historical-order-result-heading > div { display: flex; align-items: baseline; gap: 10px; color: #15344f; }
.historical-order-result-heading span { color: #60768b; font-size: 12px; }
.historical-order-condition-list { display: grid; gap: 9px; }
.historical-order-condition { display: grid; grid-template-columns: 220px 150px minmax(220px, 380px) 36px; gap: 8px; width: min(100%, 810px); }
.historical-order-condition select,
.historical-order-condition input { min-width: 0; width: 100%; border: 1px solid #cbd8e0; border-radius: 6px; padding: 8px 9px; background: #fff; color: #203f56; font: inherit; }
.historical-order-condition-remove { border: 1px solid #dbc4c4; border-radius: 6px; background: #fff; color: #a93232; font-size: 20px; cursor: pointer; }
.historical-order-query-tip { margin: 11px 0 0; }
.historical-order-query-empty { display: grid; min-height: 150px; place-content: center; color: #708397; text-align: center; }
.historical-order-divider { height: 1px; margin: 20px 0 16px; background: #d8e3eb; }
.historical-order-upload-card > div:first-child { min-width: 0; }
.historical-order-upload-card span { display: block; color: #15948e; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.historical-order-upload-card strong { display: block; margin: 5px 0; overflow: hidden; color: #15344f; font-size: 17px; text-overflow: ellipsis; white-space: nowrap; }
.historical-order-stat-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.historical-order-stat-grid article { min-width: 0; }
.historical-order-stat-grid h4 { margin: 0 0 9px; color: #27475d; font-size: 14px; }
.historical-order-upload-progress { margin-top: 14px; }
.historical-order-upload-progress-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.historical-order-upload-progress-heading span { color: #15948e; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.historical-order-upload-progress-heading h3 { margin: 3px 0 5px; color: #15344f; font-size: 20px; }
.historical-order-upload-progress-heading p { margin: 0; color: #60768b; font-size: 13px; line-height: 1.55; }
.historical-order-upload-progress-heading small { flex: none; color: #6f8292; font-size: 11px; }
.historical-order-upload-summary-strip { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 14px; border: 1px solid #d8e3eb; border-radius: 8px; padding: 10px 13px; background: #f6fafb; color: #60768b; font-size: 12px; }
.historical-order-upload-summary-strip strong { color: #15344f; font-size: 14px; }
.historical-order-upload-progress-grid { display: block; }
.historical-order-upload-progress-grid article { width: 100%; max-width: 100%; min-width: 0; }
.historical-order-upload-progress-grid h4 { margin: 0 0 9px; color: #27475d; font-size: 14px; }
.historical-order-upload-operation-layout { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: 14px; align-items: start; }
.historical-order-upload-operation-layout > article { min-width: 0; }
.historical-order-upload-operation-layout h4 { margin: 0 0 9px; color: #27475d; font-size: 14px; line-height: 20px; }
.historical-order-operation-log .historical-order-table-wrap { max-height: 520px; }
.historical-order-operation-log table { min-width: 980px; }
.historical-order-operation-log td:nth-child(4) { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.historical-order-operation-badge { display: inline-flex; min-width: 42px; justify-content: center; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 700; }
.historical-order-operation-badge.is-upload { background: #def4ef; color: #0c766e; }
.historical-order-operation-badge.is-delete { background: #fde8e8; color: #a13030; }
.historical-order-upload-progress-grid .historical-order-table-wrap { max-height: 520px; }
.historical-order-upload-yearly-table { width: 100%; max-width: 100%; }
.historical-order-upload-yearly-table table { width: 100%; min-width: 760px; }
.historical-sales-upload-yearly-table table { min-width: 1120px; }
.historical-sales-operation-log table { min-width: 1320px; }
.historical-order-upload-yearly-table th { text-align: center; }
.historical-order-upload-yearly-table tfoot th,
.historical-order-upload-yearly-table tfoot td { border-top: 2px solid #9bb7c6; background: #edf5f7; color: #15344f; font-weight: 700; }
.historical-order-upload-progress-empty { display: grid; min-height: 220px; place-items: center; align-content: center; gap: 8px; color: #60768b; text-align: center; }
.historical-order-upload-progress-empty strong { color: #15344f; font-size: 17px; }
.historical-order-upload-progress-empty p { margin: 0 0 4px; }
.historical-order-warning { border: 1px solid #efd5a5; border-radius: 7px; padding: 11px 12px; background: #fff7e8; color: #815516; font-size: 12px; line-height: 1.6; }
.historical-order-loading { display: grid; min-height: 280px; place-content: center; border: 1px solid #d8e3eb; border-radius: 10px; background: #fff; color: #60768b; }
.historical-order-modal-backdrop { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 24px; background: rgba(16,36,51,.46); }
.historical-order-modal { width: min(680px,94vw); overflow: hidden; border: 1px solid #d8e3eb; border-radius: 10px; background: #fff; box-shadow: 0 24px 80px rgba(17,39,56,.28); }
.historical-order-modal header,
.historical-order-modal footer { padding: 16px 20px; }
.historical-order-modal header { border-bottom: 1px solid #d8e3eb; }
.historical-order-modal h3 { margin: 0; color: #15344f; font-size: 19px; }
.historical-order-modal header p { margin: 7px 0 0; color: #60768b; font-size: 12px; }
.historical-order-modal-body { padding: 18px 20px; }
.historical-order-modal-body p { margin: 0 0 13px; color: #60768b; line-height: 1.65; }
.historical-order-modal footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; border-top: 1px solid #d8e3eb; }
.historical-order-modal footer button { width: auto; min-width: 112px; height: 38px; margin: 0; border-radius: 6px; padding: 0 20px; white-space: nowrap; }
.historical-order-modal footer .primary-btn { min-width: 160px; }
.historical-query-limit-modal { width: min(560px, 94vw); }
.historical-order-modal footer button:disabled { cursor: not-allowed !important; opacity: .58; }
.historical-order-modal footer .primary-btn:disabled { background: #88aaa9; }
.historical-order-duplicate-modal { width: min(1480px,96vw); }
.historical-order-duplicate-modal .historical-order-modal-body { padding: 14px 16px; }
.historical-order-duplicate-table { max-height: 62vh; }
.historical-order-duplicate-table table { min-width: 4100px; }
.historical-order-duplicate-table th,
.historical-order-duplicate-table td { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.historical-order-duplicate-table th:first-child,
.historical-order-duplicate-table td:first-child { position: sticky; left: 0; z-index: 3; min-width: 98px; background: #f5fafb; }
.historical-order-duplicate-table thead th:first-child { z-index: 5; }
.historical-order-duplicate-next { margin-top: 0; }
.historical-order-validation-list { display: grid; gap: 8px; }
.historical-order-validation-list > div { display: flex; justify-content: space-between; gap: 18px; border: 1px solid #d8e3eb; border-radius: 7px; padding: 10px 12px; }
.historical-order-validation-list b { color: #29465d; font-size: 13px; }
.historical-order-validation-list span { color: #0f706c; font-size: 12px; text-align: right; }
.historical-order-validation-list .is-warning span { color: #a45b18; }
.historical-order-toast { position: fixed; right: 26px; bottom: 26px; z-index: 10020; display: none; max-width: 560px; border-radius: 8px; padding: 12px 16px; background: #173c50; color: #fff; box-shadow: 0 12px 34px rgba(21,52,79,.22); }
.historical-order-toast.show { display: block; }
.historical-order-toast.is-error { background: #9d3030; }

@media (max-width: 1100px) {
  .historical-order-metrics,
  .historical-order-stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .historical-order-upload-operation-layout { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 760px) {
  .historical-order-commandbar,
  .historical-order-upload-card { align-items: stretch; flex-direction: column; }
  .historical-order-actions { justify-content: flex-start; }
  .historical-order-query-builder-title { align-items: stretch; flex-direction: column; gap: 12px; }
  .historical-query-actions { flex-wrap: wrap; }
  .historical-order-metrics,
  .historical-order-stat-grid { grid-template-columns: 1fr; }
  .historical-order-upload-progress-heading { align-items: stretch; flex-direction: column; }
  .historical-order-condition { grid-template-columns: 1fr; }
  .historical-order-condition-remove { min-height: 36px; }
}

.layout-grid.department-scope-layout {
  grid-template-columns: clamp(172px, 12vw, 210px) minmax(560px, 1fr) clamp(290px, 22vw, 340px);
  gap: 10px;
}

.department-scope-layout .department-list {
  padding: 6px;
}

.department-scope-layout .department-row {
  margin-bottom: 5px;
  padding: 8px;
}

.department-scope-layout .department-row strong {
  font-size: 14px;
  line-height: 1.35;
}

.department-scope-layout .department-row span {
  margin-top: 3px;
  font-size: 11px;
}

.panel {
  background: #fff;
  border: 1px solid #d9e2ef;
}

.panel-header {
  height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e3e8f0;
}

.panel-header h2 {
  margin: 0;
  font-size: 16px;
}

.badge {
  padding: 2px 8px;
  color: #2463eb;
  background: #e8f0ff;
  border: 1px solid #c6dafc;
}

.employee-list {
  max-height: calc(100vh - 132px);
  overflow: auto;
  padding: 8px;
}

.employee-row {
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 6px;
  text-align: left;
  background: #fff;
  border: 1px solid #d9e2ef;
  cursor: pointer;
}

.employee-row.active {
  border-color: #0f8f8c;
  background: #e8f5f3;
}

.employee-row small {
  display: block;
  margin-top: 3px;
  color: #667085;
}

.map-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-controls button {
  width: 28px;
  height: 28px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}

.map-canvas {
  min-height: 520px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  overflow: auto;
  background: #f8fafc;
}

.region-tile {
  min-height: 86px;
  padding: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
}

.region-tile:hover {
  border-color: #2463eb;
}

.region-tile.selected {
  color: #fff;
  background: #0f8f8c;
  border-color: #174ebf;
}

.assignment-panel {
  padding-bottom: 14px;
}

.assignment-panel h3 {
  margin: 16px 14px 8px;
  font-size: 14px;
}

.selected-employee,
.selected-region-list,
.manual-rows,
.audit-log {
  margin: 10px 14px;
}

.selected-employee {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #d9e2ef;
}

.selected-region-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding: 8px 10px;
  background: #edf4ff;
  border: 1px solid #c6dafc;
}

.remove-region {
  width: 22px;
  height: 22px;
  color: #b42318;
  background: #fff;
  border: 1px solid #f3b8b2;
}

.empty {
  color: #667085;
}

.manual-row {
  display: grid;
  grid-template-columns: 1fr 26px;
  gap: 6px;
  margin-bottom: 8px;
}

.manual-row .valid {
  color: #12805c;
  line-height: 38px;
  text-align: center;
}

.manual-row .invalid {
  color: #b42318;
  line-height: 38px;
  text-align: center;
}

.submit-btn {
  width: calc(100% - 28px);
  margin-left: 14px;
  margin-right: 14px;
}

.audit-log {
  min-height: 64px;
  padding: 10px;
  color: #667085;
  background: #f8fafc;
  border: 1px solid #d9e2ef;
  font-size: 13px;
} 

.submit-note {
  margin: 12px 0 8px;
  padding: 8px 10px;
  border: 1px solid #f3d08a;
  background: #fff8e6;
  color: #7a4d00;
  font-size: 13px;
  line-height: 1.5;
}

.audit-log-item {
  padding: 7px 0;
  border-bottom: 1px solid #e4eaf2;
}

.audit-log-item:last-child {
  border-bottom: 0;
}

.audit-log-item strong {
  display: inline-block;
  min-width: 34px;
  color: var(--ui-color-link);
}

.audit-log-item span {
  display: block;
  margin-top: 3px;
  color: #344054;
}

.audit-log-item small {
  display: block;
  margin-top: 3px;
  color: #667085;
}

.employee-selectors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 6px 0;
}

.employee-selectors select {
  width: 100%;
  height: 30px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #344054;
  font-size: 13px;
}


.region-browser {
  min-height: 520px;
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.region-browser-column {
  min-width: 0;
  background: #ffffff;
  border: 1px solid #d9e2ef;
  overflow: auto;
}

.region-browser-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  font-weight: 700;
  background: #f8fafc;
  border-bottom: 1px solid #d9e2ef;
}

.region-browser-empty {
  padding: 14px 12px;
  color: #667085;
}

.region-browser-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
  padding: 8px;
  border-bottom: 1px solid #eef2f7;
}

.region-browser-row.selected {
  background: #edf4ff;
}

.region-browser-main {
  min-width: 0;
  padding: 8px;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.region-browser-main strong,
.region-browser-main small {
  display: block;
}

.region-browser-main small {
  margin-top: 3px;
  color: #667085;
}

.region-browser-main .region-owner-line {
  color: #475569;
  font-weight: 600;
  line-height: 1.35;
}

.region-browser-add {
  min-width: 52px;
  padding: 0 8px;
  color: #174ebf;
  background: #ffffff;
  border: 1px solid #c6dafc;
  cursor: pointer;
}

.region-browser-add:hover,
.region-browser-main:hover {
  background: #f3f7ff;
}

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


.department-scope-panel {
  margin: 10px 14px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #d9e2ef;
}

.department-scope-panel h3 {
  margin: 0 0 8px;
}

.department-scope-panel select {
  width: 100%;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.scope-status {
  margin-top: 8px;
  color: #475467;
  font-size: 12px;
}


.department-list {
  max-height: calc(100vh - 132px);
  overflow: auto;
  padding: 8px;
}

.department-row {
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 6px;
  text-align: left;
  background: #fff;
  border: 1px solid #d9e2ef;
  cursor: pointer;
}

.department-row strong,
.department-row span {
  display: block;
}

.department-row span {
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
}

.department-row.active {
  border-color: #0f8f8c;
  background: #e8f5f3;
}

body.module-department-scope #selectedRegionTitle,
body.module-department-scope #selectedRegionList,
body.module-department-scope #submitNote,
body.module-department-scope #submitAssignmentBtn {
  display: none;
}

body.module-department-scope .region-browser {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

body.module-department-scope .region-browser-column:nth-child(3) {
  display: none;
}

.confirm-modal.hidden {
  display: none;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.confirm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
}

.confirm-modal__dialog {
  position: relative;
  width: min(720px, calc(100vw - 48px));
  max-height: min(78vh, 760px);
  background: #ffffff;
  border: 1px solid #d7e0ef;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.24);
  display: flex;
  flex-direction: column;
}

.confirm-modal__header {
  padding: 18px 22px 12px;
  border-bottom: 1px solid #e6edf7;
}

.confirm-modal__title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.4;
}

.confirm-modal__body {
  padding: 16px 22px;
  overflow: auto;
  color: #172033;
  font-size: 15px;
  line-height: 1.7;
}

.confirm-modal__body p {
  margin: 0 0 10px;
}

.confirm-modal__body p:last-child {
  margin-bottom: 0;
}

.confirm-modal__footer {
  padding: 14px 22px 18px;
  border-top: 1px solid #e6edf7;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.primary-button,
.secondary-button {
  min-width: 96px;
  height: 38px;
  border: 1px solid #cbd7ea;
  background: #f8fbff;
  color: #17304d;
  cursor: pointer;
  font-size: 14px;
}

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

.primary-button:focus,
.secondary-button:focus {
  outline: 2px solid var(--ui-color-focus);
  outline-offset: 2px;
}

.department-submit-primary {
  background: var(--ui-color-primary) !important;
  border-color: var(--ui-color-primary) !important;
  color: #ffffff !important;
  font-weight: 700;
}

.department-select-readonly {
  background: #f8fafc;
  color: #0f172a;
  cursor: default;
}

.region-list-inline-status {
  display: inline-block;
  margin-left: 12px;
  color: #64748b;
  font-size: 13px;
  font-weight: 400;
}

#departmentScopeStatus {
  font-size: 14px;
  line-height: 1.6;
  color: #334155;
}

#departmentScopeStatus:not(:empty) {
  margin-top: 10px;
}

.department-page-hidden {
  display: none !important;
}

.department-submit-primary {
  background: var(--ui-color-primary) !important;
  border-color: var(--ui-color-primary) !important;
  color: #ffffff !important;
  font-weight: 700;
}

.department-select-readonly {
  background: #f8fafc !important;
  color: #0f172a !important;
  cursor: default !important;
}

.region-list-inline-status {
  display: inline-block;
  margin-left: 12px;
  color: #64748b;
  font-size: 13px;
  font-weight: 400;
}

#departmentScopeStatus {
  font-size: 15px;
  line-height: 1.6;
  color: #334155;
}

#departmentScopeStatus:not(:empty) {
  margin-top: 10px;
}

.configured-department-region {
  background: var(--ui-color-primary-soft) !important;
  border-left: 3px solid var(--ui-color-primary) !important;
}

.department-unconfigured-panel {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #dbe6f5;
  background: #f8fbff;
}

.department-unconfigured-title {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.department-unconfigured-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 150px;
  overflow: auto;
}

.department-unconfigured-item {
  padding: 4px 8px;
  border: 1px solid #cfe0f6;
  background: #ffffff;
  color: #1e3a5f;
  font-size: 13px;
  line-height: 1.4;
}

.department-unconfigured-empty,
.department-unconfigured-more {
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.department-unconfigured-panel {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #dbe6f5;
  background: #f8fbff;
}

.department-unconfigured-title {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.department-unconfigured-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 150px;
  overflow: auto;
}

.department-unconfigured-item {
  padding: 4px 8px;
  border: 1px solid #cfe0f6;
  background: #ffffff;
  color: #1e3a5f;
  font-size: 13px;
  line-height: 1.4;
}

.department-unconfigured-empty,
.department-unconfigured-more {
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.configured-department-region {
  background: var(--ui-color-primary-soft) !important;
  border-left: 3px solid var(--ui-color-primary) !important;
}

.configured-department-region .region-name,
.configured-department-region strong {
  color: var(--ui-color-link) !important;
}

.configured-department-region,
.region-item.configured-department-region,
.region-row.configured-department-region,
.region-card.configured-department-region,
li.configured-department-region,
div.configured-department-region {
  background: var(--ui-color-primary-soft) !important;
  border-left: 4px solid var(--ui-color-primary) !important;
  box-shadow: inset 0 0 0 1px var(--ui-color-primary-border) !important;
}

.configured-department-region * {
  background-color: transparent !important;
}

.configured-department-region strong,
.configured-department-region .region-name,
.configured-department-region div:first-child {
  color: var(--ui-color-link) !important;
  font-weight: 800 !important;
}

.configured-department-region-full {
  background: var(--ui-color-primary-soft) !important;
  border-left: 4px solid var(--ui-color-primary) !important;
  box-shadow: inset 0 0 0 1px var(--ui-color-primary-border) !important;
}

.configured-department-region-partial {
  background: #fff7ed !important;
  border-left: 4px solid #f97316 !important;
  box-shadow: inset 0 0 0 1px #fed7aa !important;
}

.configured-department-region-full *,
.configured-department-region-partial * {
  background-color: transparent !important;
}

.configured-department-region-full strong,
.configured-department-region-full .region-name {
  color: var(--ui-color-link) !important;
  font-weight: 800 !important;
}

.configured-department-region-partial strong,
.configured-department-region-partial .region-name {
  color: #7c2d12 !important;
  font-weight: 800 !important;
}

.region-list-header-status {
  display: inline-block;
  margin-left: 32px;
  color: #64748b;
  font-size: 13px;
  font-weight: 400;
  line-height: 24px;
  vertical-align: baseline;
}

.configured-department-region-full {
  background: var(--ui-color-primary-soft) !important;
  border-left: 4px solid var(--ui-color-primary) !important;
  box-shadow: inset 0 0 0 1px var(--ui-color-primary-border) !important;
}

.configured-department-region-partial {
  background: #fff7ed !important;
  border-left: 4px solid #f97316 !important;
  box-shadow: inset 0 0 0 1px #fed7aa !important;
}

.configured-department-region-full .region-browser-main,
.configured-department-region-partial .region-browser-main {
  background: transparent !important;
}

.configured-department-region-full strong {
  color: #0f2f6f !important;
  font-weight: 800 !important;
}

.configured-department-region-partial strong {
  color: #7c2d12 !important;
  font-weight: 800 !important;
}

.region-list-header-status {
  display: inline-block;
  margin-left: 32px;
  color: #64748b;
  font-size: 13px;
  font-weight: 400;
  line-height: 24px;
  vertical-align: baseline;
  text-align: left;
}

.region-view-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.region-view-toggle button {
  min-width: 48px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #344054;
  cursor: pointer;
}

.region-view-toggle button.active {
  color: #174ebf;
  background: #edf4ff;
  border-color: #8bb8ff;
  font-weight: 700;
}

.department-map-preview {
  min-height: calc(100vh - 168px);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  align-content: start;
  overflow: auto;
  background: #f8fafc;
}

.department-map-preview-notice {
  grid-column: 1 / -1;
  padding: 10px 12px;
  color: #475467;
  background: #ffffff;
  border: 1px solid #d9e2ef;
}

.department-map-region {
  min-height: 68px;
  padding: 9px 10px;
  background: #ffffff;
  border: 1px solid #d9e2ef;
}

.department-map-region strong,
.department-map-region span,
.department-map-region small {
  display: block;
}

.department-map-region strong {
  font-size: 14px;
  line-height: 1.35;
}

.department-map-region span {
  margin-top: 4px;
  color: #475467;
  font-size: 12px;
  line-height: 1.4;
}

.department-map-region small {
  margin-top: 5px;
  color: #667085;
  font-size: 11px;
  line-height: 1.4;
}

.department-map-region.full {
  border-color: #8bb8ff;
  background: #edf4ff;
}

.department-map-region.partial {
  border-color: #f7c873;
  background: #fff8e5;
}

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

.department-amap-shell {
  display: block;
}

.department-amap-frame {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 9 / 6;
  margin-bottom: 14px;
  overflow: hidden;
  background: #eef2f7;
  border: 1px solid #d9e2ef;
}

.department-amap-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, 0.16) 1px, transparent 1px),
    #f8fafc;
  background-size: 36px 36px;
}

.department-amap-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  color: #344054;
  background: rgba(248, 250, 252, 0.82);
}

.department-amap-empty strong,
.department-amap-empty span {
  display: block;
}

.department-map-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}

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

.department-amap-empty.hidden {
  display: none;
}

.department-amap-frame .amap-logo,
.department-amap-frame .amap-copyright {
  pointer-events: none;
}

.department-amap-load-status {
  position: absolute;
  top: 10px;
  right: 10px;
  left: auto;
  z-index: 2;
  max-width: calc(55% - 20px);
  padding: 6px 10px;
  color: #344054;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #d9e2ef;
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
}

.department-amap-load-status:empty {
  display: none;
}

.department-amap-return {
  position: absolute;
  top: 50px;
  right: 10px;
  z-index: 3;
  height: 30px;
  padding: 0 12px;
  border: 1px solid #9fb3c8;
  background: rgba(255, 255, 255, 0.94);
  color: #1f4e79;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.department-amap-return:hover {
  border-color: #2b6f8a;
  color: #0f766e;
}

.department-amap-return.hidden {
  display: none;
}

.department-amap-legend {
  position: absolute;
  left: 10px;
  top: 10px;
  bottom: auto;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  max-width: calc(45% - 20px);
  padding: 8px 10px;
  color: #344054;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d9e2ef;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.10);
  font-size: 12px;
  line-height: 1.3;
  pointer-events: none;
}

.department-amap-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.department-amap-legend-item i {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(52, 79, 102, 0.46);
}

.department-amap-legend-item i.selected {
  background: #94a3b8;
  border-color: #64748b;
}

.department-amap-legend-item i.assigned {
  background: linear-gradient(135deg, #6fbeb2 0 25%, #f08787 25% 50%, #4da8da 50% 75%, #ffd66b 75% 100%);
}

.department-amap-legend-item i.unassigned {
  background: #FF0000;
  border-color: #B42318;
}

.department-amap-load-status.warning {
  color: #92400e;
  background: rgba(255, 248, 229, 0.95);
  border-color: #f7c873;
}



.department-effective-box {
  margin: 8px 0 10px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid #d9e2ef;
}

.department-effective-label {
  margin-bottom: 6px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.department-effective-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
}

.department-effective-tabs button {
  min-width: 0;
  height: 28px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475467;
  cursor: pointer;
}

.department-effective-tabs button.active {
  border-color: #0f8f8c;
  background: #e8f5f3;
  color: #0f766e;
  font-weight: 700;
}

.department-effective-box input[type="date"] {
  width: 100%;
  height: 32px;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

.department-effective-box input[type="date"]:disabled {
  color: #94a3b8;
  background: #f1f5f9;
  cursor: not-allowed;
}

.region-info {
  margin: 10px 14px 0;
  padding: 8px 10px;
  color: #475467;
  background: #f8fafc;
  border: 1px solid #d9e2ef;
  font-size: 13px;
  line-height: 1.5;
}

.sales-assignment-delta {
  margin: 8px 14px 10px;
  padding: 9px 10px;
  color: #344054;
  background: #f7faf9;
  border: 1px solid #cfe4df;
  font-size: 13px;
  line-height: 1.65;
}

.sales-scope-full {
  border-left: 3px solid #5ca79c;
  background: #f4faf8;
}

.sales-scope-partial {
  border-left: 3px solid #d8a44c;
  background: #fffaf0;
}

.sales-scope-outside {
  opacity: 0.48;
  background: #f8fafc;
}

.sales-region-conflict {
  border-left-color: #b96b72;
  background: #fff7f7;
}

.region-browser-add:disabled {
  color: #94a3b8;
  background: #f1f5f9;
  border-color: #d9e2ef;
  cursor: not-allowed;
}

.sales-amap-shell {
  display: block;
  padding: 0;
  overflow: hidden;
}

.sales-amap-frame {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 9 / 6;
  overflow: hidden;
  background: #eef2f7;
  border: 1px solid #d9e2ef;
}

.sales-amap-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #f8fafc;
}

.sales-amap-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  color: #344054;
  background: rgba(248, 250, 252, 0.86);
  z-index: 4;
}

.sales-amap-empty strong,
.sales-amap-empty span {
  display: block;
}

.sales-amap-empty.hidden {
  display: none;
}

.sales-amap-load-status {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  max-width: calc(100% - 170px);
  padding: 6px 10px;
  color: #344054;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #d9e2ef;
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
}

.sales-amap-load-status.warning {
  color: #92400e;
  border-color: #f0c36d;
  background: rgba(255, 249, 235, 0.96);
}

.sales-amap-return {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  height: 30px;
  padding: 0 12px;
  color: #0f766e;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #8ebdb7;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.sales-amap-return.hidden {
  display: none;
}

@media (max-width: 1500px) {
  .main-view {
    grid-template-columns: 176px minmax(0, 1fr);
  }

  .layout-grid {
    grid-template-columns: 230px minmax(500px, 1fr) 310px;
    gap: 10px;
  }

  .content {
    padding: 12px;
  }

  .module-item {
    padding: 9px 10px;
  }

  .department-amap-frame {
    min-height: 0;
    height: auto;
  }

  .department-amap-canvas {
    min-height: 0;
  }

  .sales-amap-frame {
    min-height: 0;
    height: auto;
  }

  .sales-amap-canvas {
    min-height: 0;
  }
}

/* LEADS interaction color alignment v144.
   Scope is limited to first-party controls and selection surfaces. Map palettes,
   data-series colors and semantic error/warning/success states remain unchanged. */
.region-tile:hover,
.region-tile.selected {
  border-color: var(--ui-color-primary);
}

.selected-region-item,
.region-browser-row.selected {
  border-color: var(--ui-color-primary-border);
  background: var(--ui-color-primary-soft);
}

.region-browser-add,
.department-amap-return {
  color: var(--ui-color-link);
  border-color: var(--ui-color-primary-border);
}

.region-browser-add:hover,
.region-browser-main:hover,
.department-amap-return:hover {
  color: var(--ui-color-link);
  border-color: var(--ui-color-primary);
  background: #f2faf9;
}

.primary-button,
.department-submit-primary,
#departmentScopeConflictModal button {
  color: #fff !important;
  border-color: var(--ui-color-primary) !important;
  background: var(--ui-color-primary) !important;
}

.primary-button:hover:not(:disabled),
.department-submit-primary:hover:not(:disabled),
#departmentScopeConflictModal button:hover:not(:disabled) {
  border-color: var(--ui-color-primary-hover) !important;
  background: var(--ui-color-primary-hover) !important;
}

.primary-button:focus,
.secondary-button:focus,
#departmentScopeConflictModal button:focus {
  outline-color: var(--ui-color-focus);
}

.screening-push-candidate-table tbody tr:focus-visible,
.screening-backup-table tbody tr:focus-visible {
  outline: 2px solid var(--ui-color-focus) !important;
  outline-offset: -2px;
}

.region-view-toggle button.active {
  color: var(--ui-color-link);
  border-color: var(--ui-color-primary-border);
  background: var(--ui-color-primary-soft);
}

.configured-department-region-full {
  border-left-color: var(--ui-color-primary) !important;
  background: var(--ui-color-primary-soft) !important;
  box-shadow: inset 0 0 0 1px var(--ui-color-primary-border) !important;
}

.department-map-region.full {
  border-color: var(--ui-color-primary-border);
  background: var(--ui-color-primary-soft);
}

/* These selectors are emitted by later module scripts, so important is needed
   to keep first-party link/toggle colors aligned without editing those modules. */
.historical-board-business-value a {
  color: var(--ui-color-link) !important;
}

.historical-board-tree-toggle {
  color: var(--ui-color-link) !important;
  border-color: var(--ui-color-primary-border) !important;
}

@media (max-width: 1200px) {
  .layout-grid {
    grid-template-columns: 220px minmax(460px, 1fr) 290px;
  }

  .topbar h1 {
    font-size: 21px;
  }
}

.org-tree-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 10px 6px;
  padding: 0 10px;
  height: 36px;
  color: #7a8798;
  background: #f3f6fa;
  border: 1px solid #dce4ee;
  border-radius: 7px;
}

.org-tree-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #243244;
  background: transparent;
  font-size: 13px;
}

.employee-list {
  padding: 4px 8px 10px;
}

.org-tree-root,
.org-tree-business,
.org-tree-department,
.org-tree-section {
  margin: 1px 0;
}

.org-tree-node,
.org-tree-member {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.org-tree-node {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 5px 8px;
  color: #26364a;
  border-radius: 6px;
}

.org-tree-section-button.active {
  color: #0f766e;
  background: #dff4f1;
  box-shadow: inset 3px 0 0 #15958f;
}

.org-tree-node:hover,
.org-tree-node:focus-visible {
  background: #edf4f7;
}

.org-tree-root-button {
  color: #12263c;
}

.org-tree-business-button {
  padding-left: 14px;
  color: #1b354d;
}

.org-tree-department-button {
  padding-left: 28px;
  color: #203b53;
}

.org-tree-section-button {
  padding-left: 42px;
  color: #334a62;
}

.org-tree-node small {
  min-width: 22px;
  text-align: center;
  color: #7a8798;
  font-size: 11px;
}

.org-tree-toggle {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  color: #32819b;
  border: 1px solid #88afbe;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.org-tree-member {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 5px 8px 5px 70px;
  color: #2d3c4e;
  border-radius: 6px;
}

.org-tree-member:hover {
  background: #f1f6f8;
}

.org-tree-depth-1 {
  padding-left: 28px;
}

.org-tree-depth-3 {
  padding-left: 52px;
}

.org-tree-depth-4 {
  padding-left: 70px;
}

.org-tree-readonly {
  cursor: default;
}

.org-tree-leader {
  cursor: default;
  background: #f5f8fa;
}

.org-tree-leader:hover {
  background: #f5f8fa;
}

.org-tree-leader .org-tree-avatar {
  background: #537f9b;
}

.org-tree-member.active {
  color: #ffffff;
  background: #168f8b;
}

.org-tree-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: 0;
  color: #ffffff;
  background: #6aa8a4;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.org-tree-member strong,
.org-tree-member small {
  display: block;
}

.org-tree-member small {
  margin-top: 2px;
  color: #7a8798;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-tree-member.active small {
  color: rgba(255, 255, 255, 0.82);
}

.org-tree-empty {
  padding: 18px 10px;
  color: #7a8798;
  text-align: center;
  font-size: 13px;
}

.sales-effective-box {
  margin: 8px 14px 10px;
  background: #f8fbfb;
  border-color: #cfe4df;
}

.sales-effective-hint {
  margin-top: 6px;
  color: #667085;
  font-size: 11px;
}

.department-unconfigured-panel {
  margin: 14px;
  background: #f8fbfb;
  border-color: #d3e5e2;
}

.department-unconfigured-item {
  color: #355b61;
  border-color: #cfe1df;
  border-radius: 4px;
}

.department-unconfigured-panel.has-unconfigured {
  background: #fff9dc;
  border-color: #efd98a;
}

.department-unconfigured-panel.has-unconfigured .department-unconfigured-title {
  color: #7a5712;
}

.department-unconfigured-panel.has-unconfigured .department-unconfigured-item {
  color: #ff0000;
  background: #fffdf5;
  border-color: #e9c96e;
  font-weight: 600;
}

.department-unconfigured-panel.has-unconfigured .department-unconfigured-more {
  color: #ff0000;
}

.department-region-list-mode {
  display: grid !important;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) !important;
  grid-auto-flow: row;
  gap: 12px;
}

.department-region-list-mode > .region-browser-column {
  grid-column: auto !important;
  display: block !important;
  min-width: 0;
}

#mapCanvas.region-browser:not(.department-region-browser) {
  min-width: 600px;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) !important;
  grid-auto-flow: column;
  overflow-x: auto;
}

/* 外销担当列表模式固定保持“省级 | 市级 | 区县级”三列。
   使用独立状态类，避免通用窄屏规则或模块切换残留把三级列表压成纵向堆叠。 */
#mapCanvas.sales-region-list-mode {
  display: grid !important;
  min-width: 600px;
  grid-template-columns: repeat(3, minmax(180px, 1fr)) !important;
  grid-auto-flow: column !important;
  align-items: stretch;
  overflow-x: auto;
}

#mapCanvas.sales-region-list-mode > .region-browser-column {
  display: block !important;
  min-width: 0;
  grid-column: auto !important;
}

.sales-map-action-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 24px;
}

.sales-map-action-modal.hidden {
  display: none;
}

.sales-map-action-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 32, 48, 0.42);
  backdrop-filter: blur(2px);
}

.sales-map-action-dialog {
  position: relative;
  width: min(520px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #ffffff;
  border: 1px solid #d7e2e8;
  border-radius: 10px;
  box-shadow: 0 22px 60px rgba(15, 32, 48, 0.24);
}

.sales-map-action-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #e5ebf0;
}

.sales-map-action-kicker {
  margin-bottom: 4px;
  color: #168f8b;
  font-size: 12px;
  font-weight: 700;
}

.sales-map-action-header h3 {
  margin: 0;
  color: #172b3d;
  font-size: 18px;
}

.sales-map-action-close {
  width: 30px;
  height: 30px;
  color: #667085;
  background: #f5f7fa;
  border: 1px solid #dce4eb;
  border-radius: 6px;
  cursor: pointer;
}

.sales-map-action-body {
  padding: 16px 20px 10px;
}

.sales-map-action-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  background: #f6f9fb;
  border: 1px solid #dce6ec;
  border-radius: 7px;
}

.sales-map-action-summary > div {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 10px;
  font-size: 13px;
}

.sales-map-action-summary span {
  color: #718096;
}

.sales-map-action-summary strong {
  color: #263b4d;
  font-weight: 600;
}

.sales-map-action-target {
  display: block;
  margin-bottom: 6px;
  color: #34495b;
  font-size: 12px;
  font-weight: 700;
}

#salesMapTargetEmployee {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  color: #263b4d;
  background: #ffffff;
  border: 1px solid #cfdbe3;
  border-radius: 5px;
}

.sales-map-action-note,
.sales-map-action-message {
  color: #667085;
  font-size: 12px;
  line-height: 1.55;
}

.sales-map-action-note {
  margin-top: 10px;
}

.sales-map-action-message {
  min-height: 18px;
  margin: 0 20px 10px;
  color: #9a5b17;
}

.sales-map-action-footer {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 18px;
  border-top: 1px solid #e8edf1;
}

.sales-map-action-footer button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.sales-map-action-footer .primary-btn {
  width: auto;
  min-width: 112px;
  height: 34px;
  margin-top: 0;
  padding: 0 16px;
}

.sales-map-action-footer .danger {
  color: #a94442;
  border-color: #dfb8b5;
  background: #fff7f6;
}

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

  .employee-list {
    max-height: 380px;
  }
}

/* 外销担当区域配置始终保持“人员 / 地图 / 配置”三栏关系。
   窄窗口改为页面横向滚动，不再把地图挤到人员列表下方。 */
body.module-sales-assignment .main-view {
  min-width: 1320px;
}

@media (max-width: 900px) {
  body.module-sales-assignment .layout-grid {
    grid-template-columns: 220px minmax(600px, 1fr) 290px;
    gap: 10px;
  }

  body.module-sales-assignment .employee-list {
    max-height: calc(100vh - 220px);
  }
}

.personnel-management-view {
  display: grid;
  grid-template-columns: clamp(320px, 21vw, 390px) minmax(760px, 1fr);
  gap: 12px;
  align-items: start;
}

.personnel-management-view.hidden { display: none; }
.personnel-tree-panel { min-width: 0; }
.personnel-org-tree { max-height: calc(100vh - 292px); min-height: 470px; overflow: auto; padding: 6px 8px; }
.personnel-org-tree .personnel-org-node { min-height: 42px; font-size: 15px; }
.personnel-org-tree .personnel-org-node strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.personnel-org-tree .org-tree-level-button-1 { padding-left: 8px; color: #12263c; }
.personnel-org-tree .org-tree-level-button-2 { padding-left: 18px; color: #17314a; }
.personnel-org-tree .org-tree-level-button-3 { padding-left: 30px; background: #f3f7f9; color: #1b354d; }
.personnel-org-tree .org-tree-level-button-4 { padding-left: 42px; color: #203b53; }
.personnel-org-tree .org-tree-level-button-5 { padding-left: 56px; color: #334a62; }
.personnel-org-tree .org-tree-depth-1 { padding-left: 28px; }
.personnel-org-tree .org-tree-depth-2 { padding-left: 42px; }
.personnel-org-tree .org-tree-depth-3 { padding-left: 56px; }
.personnel-org-tree .org-tree-depth-4,
.personnel-org-tree .org-tree-depth-5 { padding-left: 72px; }
.personnel-inactive-button { width: calc(100% - 24px); min-height: 38px; margin: 8px 12px 12px; border: 1px solid #168f8b; border-radius: 5px; color: #fff; background: #168f8b; font-size: 13px; cursor: pointer; }
.personnel-inactive-button:hover { color: #fff; border-color: #117b78; background: #117b78; }
.personnel-workspace-panel { min-width: 0; }
.personnel-workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 8px 14px; border-bottom: 1px solid #dce5ec; }
.personnel-workspace-header h2 { margin: 0; font-size: 17px; white-space: nowrap; }
.personnel-workspace-tabs { display: flex; gap: 6px; }
.personnel-workspace-tabs button { min-height: 34px; padding: 5px 14px; border: 1px solid #cad7e1; border-radius: 4px; color: #41586e; background: #fff; font-size: 13px; cursor: pointer; }
.personnel-workspace-tabs button:hover { border-color: #75aeba; color: #14768a; }
.personnel-workspace-tabs button.active { color: #fff; border-color: #168f8b; background: #168f8b; }
.personnel-workspace-pane.hidden { display: none; }
.personnel-list-summary { min-height: 38px; padding: 10px 14px; color: #526a7e; background: #f7fafb; border-bottom: 1px solid #e2e9ef; font-size: 13px; }
.personnel-table-wrap { max-height: calc(100vh - 205px); min-height: 610px; overflow: auto; }
.personnel-info-table, .organization-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.personnel-info-table thead, .organization-table thead { position: sticky; top: 0; z-index: 2; background: #eef4f7; }
.personnel-info-table th, .personnel-info-table td, .organization-table th, .organization-table td { padding: 10px 9px; border-bottom: 1px solid #e1e8ed; color: #2a3f52; text-align: left; vertical-align: middle; font-size: 12px; overflow-wrap: anywhere; }
.personnel-info-table th, .organization-table th { color: #395267; font-weight: 700; }
.personnel-info-table th:nth-child(1) { width: 8%; }
.personnel-info-table th:nth-child(2) { width: 7%; }
.personnel-info-table th:nth-child(3) { width: 18%; }
.personnel-info-table th:nth-child(4) { width: 10%; }
.personnel-info-table th:nth-child(5) { width: 11%; }
.personnel-info-table th:nth-child(6) { width: 18%; }
.personnel-info-table th:nth-child(7) { width: 12%; }
.personnel-info-table th:nth-child(8) { width: 16%; }
.personnel-info-table tbody tr { cursor: pointer; }
.personnel-info-table tbody tr:hover { background: #edf6f7; }
.personnel-info-table tbody tr.inactive { color: #7d8894; background: #fafafa; }
.personnel-info-table td strong { font-size: 13px; }
.inactive-mark { display: block; margin-top: 2px; color: #b35353; font-size: 10px; }
.personnel-table-empty { height: 180px; color: #7a8998 !important; text-align: center !important; }
.personnel-change-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 8px 14px; color: #5b6f82; background: #f7fafb; border-bottom: 1px solid #e2e9ef; font-size: 12px; }
.personnel-change-toolbar .primary-btn { width: auto; min-width: 112px; margin: 0 0 0 auto; padding: 0 20px; }
.organization-table-wrap { max-height: 440px; overflow: auto; }
.organization-table th:nth-child(1) { width: 14%; }
.organization-table th:nth-child(2) { width: 24%; }
.organization-table th:nth-child(3) { width: 24%; }
.organization-table th:nth-child(4), .organization-table th:nth-child(5) { width: 9%; }
.organization-table th:nth-child(6) { width: 20%; }
.organization-table tr.selected { background: #edf6f7; }
.link-btn { margin-right: 8px; padding: 2px 4px; border: 0; color: #14768a; background: transparent; cursor: pointer; }
.link-btn.danger { color: #b54d4d; }
.protected-label { color: #6e7f8d; }
.organization-edit-form { margin: 14px; padding: 14px; border: 1px solid #d6e2e8; background: #f9fbfc; }
.organization-edit-form h3 { margin: 0 0 12px; font-size: 15px; }
.personnel-log-section { margin: 14px; border-top: 1px solid #dde6ec; }
.personnel-log-section h3 { margin: 14px 0 8px; font-size: 14px; }
.personnel-detail-empty { min-height: 310px; padding: 16px; color: #718096; }
.personnel-detail { padding: 2px 14px 16px; }
.personnel-detail-grid { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 9px 10px; align-items: center; }
.personnel-detail-grid label { color: #63788d; font-size: 13px; white-space: nowrap; }
.personnel-detail-grid input, .personnel-detail-grid select, .personnel-detail-grid textarea { width: 100%; min-height: 34px; padding: 6px 8px; border: 1px solid #cfdbe3; border-radius: 5px; color: #263b4d; background: #fff; }
.personnel-detail-grid textarea { min-height: 62px; resize: vertical; }
.personnel-detail-grid input[readonly] { background: #f4f7fa; color: #718096; }
.personnel-detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; gap: 8px; margin-top: 15px; }
.personnel-detail-actions .primary-btn { width: auto; min-width: 112px; margin: 0; padding: 0 20px; }
.personnel-detail-actions .danger { color: #a94442; border-color: #dfb8b5; background: #fff7f6; }
.personnel-deactivation-block { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; max-width: 390px; }
.personnel-deactivation-block small { color: #718096; font-size: 11px; line-height: 1.45; text-align: right; }
.personnel-detail-message { min-height: 20px; margin-top: 10px; color: #9a5b17; font-size: 12px; }
.personnel-checkbox { display: flex; align-items: center; gap: 6px; color: #2a3f52 !important; }
.personnel-checkbox input { width: auto; min-height: 0; }

@media (max-width: 1180px) {
  .personnel-management-view { grid-template-columns: 1fr; }
  .personnel-org-tree { max-height: 430px; min-height: 0; }
  .personnel-table-wrap { max-height: 650px; min-height: 420px; }
  .personnel-workspace-header { align-items: flex-start; flex-direction: column; }
  .personnel-workspace-tabs { flex-wrap: wrap; }
}

/* Database workspace v1: isolated from organization and sales-area modules. */
.database-nav-group { margin-bottom: 6px; }
.database-module-item { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.database-module-item > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.database-nav-toggle { display: inline-grid; flex: 0 0 18px; width: 18px; height: 18px; place-items: center; border: 1px solid rgba(181, 214, 225, .8); border-radius: 3px; color: #a9d8df; font-size: 14px; line-height: 1; }
.database-module-item.active .database-nav-toggle { border-color: rgba(255,255,255,.78); color: #fff; }
.database-nav-domains { margin: 2px 0 8px 8px; padding-left: 8px; border-left: 1px solid rgba(169, 216, 223, .25); }
.database-nav-domain-group { margin: 2px 0; }
.database-nav-domain { width: 100%; min-height: 34px; display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 7px; padding: 6px 7px; color: #cdd9e8; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 5px; cursor: pointer; }
.database-nav-domain:hover { color: #fff; background: rgba(255,255,255,.07); }
.database-nav-domain.active { color: #fff; border-color: rgba(77, 205, 196, .36); background: rgba(15, 143, 140, .28); }
.database-nav-domain > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.database-nav-domain small { color: #8ba1b8; font-size: 10px; }
.database-nav-objects { padding: 2px 0 3px 26px; }
.database-nav-object { width: 100%; min-height: 29px; display: grid; grid-template-columns: 8px minmax(0, 1fr); align-items: center; gap: 7px; padding: 4px 5px; color: #9fb0c3; text-align: left; background: transparent; border: 0; border-radius: 4px; cursor: pointer; }
.database-nav-object:hover, .database-nav-object.active { color: #fff; background: rgba(255,255,255,.08); }
.database-nav-object > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.database-object-dot { width: 6px; height: 6px; border-radius: 50%; background: #728296; }
.database-object-dot.is-online { background: #49c9a8; box-shadow: 0 0 0 2px rgba(73,201,168,.14); }
.database-object-dot.is-sandbox { background: #e7b55e; }
.database-nav-empty { padding: 5px; color: #718299; font-size: 10px; }

.database-management-view { min-width: 0; }
.database-commandbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 12px; padding: 18px 20px; color: #f7fbfc; border-radius: 10px; background: linear-gradient(115deg, #17354a 0%, #145f68 60%, #168f8b 100%); box-shadow: 0 10px 28px rgba(22, 55, 74, .14); }
.database-eyebrow { margin-bottom: 5px; color: #9edfd8; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.database-commandbar h2 { margin: 0 0 5px; font-size: 24px; letter-spacing: .02em; }
.database-commandbar p { margin: 0; color: #d3e7e8; font-size: 12px; }
.database-commandbar-actions { display: flex; align-items: center; gap: 8px; }
.database-commandbar .secondary-btn { color: #164c55; border-color: rgba(255,255,255,.6); border-radius: 5px; background: rgba(255,255,255,.94); }
.database-readonly-badge { padding: 7px 10px; color: #d9efed; border: 1px solid rgba(255,255,255,.34); border-radius: 999px; font-size: 11px; font-weight: 700; }

.database-summary-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.database-summary-card { min-width: 0; padding: 13px 15px; border: 1px solid #dce6eb; border-radius: 8px; background: #fff; box-shadow: 0 3px 12px rgba(23, 53, 74, .04); }
.database-summary-card span, .database-summary-card small { display: block; color: #698093; font-size: 11px; }
.database-summary-card strong { display: block; margin: 5px 0 3px; overflow: hidden; color: #17354a; font-size: 21px; text-overflow: ellipsis; white-space: nowrap; }
.database-summary-skeleton { grid-column: 1 / -1; min-height: 78px; display: grid; place-items: center; color: #708397; border: 1px dashed #cbd8e0; border-radius: 8px; background: #fff; }

.database-workspace-panel { min-height: 640px; overflow: hidden; border-radius: 9px; }
.database-view-tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid #dce6eb; background: #f8fbfc; }
.database-view-tabs button { min-width: 92px; height: 38px; padding: 0 14px; color: #526b7e; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; background: transparent; cursor: pointer; }
.database-view-tabs button:hover { color: #147c80; background: #eef7f7; }
.database-view-tabs button.active { color: #116e72; border-color: #cbdde1; background: #fff; font-weight: 700; }
.database-view-status { min-height: 35px; padding: 10px 15px 7px; color: #6d8293; background: #fff; font-size: 11px; }
.database-view-content { min-height: 550px; padding: 8px 16px 18px; outline: none; }
.database-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 7px 0 14px; }
.database-section-heading span { color: #168f8b; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.database-section-heading h3 { margin: 4px 0 0; color: #18364b; font-size: 17px; }
.database-section-heading > small { color: #748899; font-size: 11px; }
.database-legend { display: flex; gap: 12px; color: #6b8091; font-size: 11px; }
.database-legend span { display: inline-flex; align-items: center; gap: 5px; color: inherit; font-size: inherit; letter-spacing: normal; text-transform: none; }
.database-legend i { width: 8px; height: 8px; border-radius: 50%; background: #8696a5; }
.database-legend i.is-online { background: #20a77e; }
.database-legend i.is-sandbox { background: #d99d35; }

.database-architecture-canvas { position: relative; display: grid; grid-template-columns: .9fr .9fr 1.12fr 1.12fr .95fr; gap: 32px; align-items: center; min-height: 310px; padding: 22px; overflow: hidden; border: 1px solid #d6e3e7; border-radius: 10px; background-color: #f8fbfb; background-image: radial-gradient(#d6e5e7 1px, transparent 1px); background-size: 18px 18px; }
.database-flow-column { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; min-width: 0; }
.database-flow-column.has-arrow::after { content: "→"; position: absolute; top: 50%; right: -27px; transform: translateY(-50%); color: #76a6ac; font-size: 22px; font-weight: 400; }
.database-layer-node { min-height: 116px; display: flex; flex-direction: column; align-items: flex-start; padding: 13px; text-align: left; border: 1px solid #d1dee4; border-radius: 8px; background: rgba(255,255,255,.96); box-shadow: 0 6px 18px rgba(34, 65, 83, .06); cursor: pointer; }
.database-layer-node:hover, .database-layer-node:focus-visible { border-color: #4ba9a6; box-shadow: 0 8px 22px rgba(20, 122, 126, .14); outline: 2px solid rgba(22,143,139,.18); outline-offset: 1px; }
.database-layer-node.is-online { border-top: 4px solid #20a77e; }
.database-layer-node.is-sandbox { border-top: 4px solid #d99d35; }
.database-layer-code { color: #168f8b; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.database-layer-node strong { margin-top: 5px; color: #19394e; font-size: 14px; }
.database-layer-node small { margin-top: 2px; color: #668093; font: 10px Consolas, monospace; }
.database-layer-metric { margin-top: auto; padding-top: 8px; color: #556f82; font-size: 10px; }
.database-layer-node em { margin-top: 5px; color: #9a6815; font-size: 10px; font-style: normal; }
.database-layer-node.is-online em { color: #13795c; }
.database-architecture-note { margin-top: 10px; padding: 10px 12px; color: #5f7385; border-left: 3px solid #d99d35; background: #fff9ed; font-size: 11px; line-height: 1.55; }
.database-layer-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.database-layer-details article { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border: 1px solid #e0e8ec; border-radius: 6px; background: #fff; }
.database-layer-details article > span { display: grid; place-items: center; min-height: 40px; color: #14787c; border-radius: 5px; background: #eaf6f5; font-size: 10px; font-weight: 800; }
.database-layer-details strong { color: #264257; font-size: 12px; }
.database-layer-details p { margin: 3px 0 0; color: #6d8191; font-size: 10px; line-height: 1.45; }

.database-identity-chain { display: grid; grid-template-columns: minmax(170px, 1fr) auto minmax(190px, 1fr) auto minmax(170px, 1fr); align-items: center; gap: 10px; margin-bottom: 14px; padding: 16px; border: 1px solid #d7e4e8; border-radius: 8px; background: #f7fbfb; }
.database-identity-chain div { padding: 12px; border: 1px solid #d2e0e5; border-radius: 6px; background: #fff; }
.database-identity-chain div.is-core { color: #fff; border-color: #168f8b; background: #168f8b; }
.database-identity-chain small, .database-identity-chain strong { display: block; }
.database-identity-chain small { margin-bottom: 4px; color: #6f8494; font-size: 10px; }
.database-identity-chain .is-core small { color: #d8f1ef; }
.database-identity-chain strong { overflow-wrap: anywhere; font: 12px Consolas, monospace; }
.database-identity-chain > span { color: #5c8f96; font-size: 11px; white-space: nowrap; }
.database-relation-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.database-relation-card { min-width: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 7px; padding: 11px; border: 1px solid #e0e8ec; border-radius: 6px; background: #fff; }
.database-relation-card code { overflow: hidden; color: #27465b; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.database-relation-card > span { display: flex; flex-direction: column; align-items: center; color: #668393; font-size: 9px; }
.database-relation-card > span b { color: #168f8b; font-size: 15px; }
.database-relation-card > small { grid-column: 1 / -1; color: #8393a1; font-size: 9px; }
.database-table-block { margin-top: 14px; border: 1px solid #dbe5e9; border-radius: 7px; overflow: hidden; }
.database-table-title { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; color: #365166; background: #f3f8f9; font-size: 11px; }
.database-table-title span { color: #758998; }
.database-table-scroll { max-height: 310px; overflow: auto; }
.database-catalog-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.database-catalog-table th, .database-catalog-table td { padding: 8px 10px; border-top: 1px solid #e4eaed; color: #52697b; text-align: left; vertical-align: top; font-size: 10px; overflow-wrap: anywhere; }
.database-catalog-table th { position: sticky; top: 0; z-index: 1; color: #395469; background: #f9fbfc; }
.database-catalog-table code { color: #1f5666; font-size: 10px; }
.database-table-empty { height: 80px; color: #82909c !important; text-align: center !important; }

.database-profile-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.database-profile-card { min-width: 0; min-height: 164px; display: flex; flex-direction: column; align-items: stretch; padding: 12px; text-align: left; border: 1px solid #dbe5e9; border-radius: 7px; background: #fff; cursor: pointer; }
.database-profile-card:hover, .database-profile-card.active { border-color: #4aa7a5; box-shadow: 0 6px 18px rgba(20, 122, 126, .1); }
.database-profile-status { align-self: flex-start; margin-bottom: 7px; padding: 3px 6px; color: #687d8e; border-radius: 999px; background: #eef2f4; font-size: 9px; }
.database-profile-status.is-online { color: #116d53; background: #e7f6ef; }
.database-profile-status.is-sandbox { color: #8a5d12; background: #fff2d9; }
.database-profile-card > strong { overflow: hidden; color: #203e53; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.database-profile-card > code { margin-top: 3px; overflow: hidden; color: #6f8494; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.database-profile-bar { height: 5px; margin: 12px 0 8px; overflow: hidden; border-radius: 999px; background: #edf2f4; }
.database-profile-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #168f8b, #62bbb5); }
.database-profile-card > div:not(.database-profile-bar) { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.database-profile-card b { color: #173b50; font-size: 16px; }
.database-profile-card small { color: #8393a0; font-size: 9px; }
.database-profile-card p { margin: auto 0 0; padding-top: 8px; color: #6f8393; font-size: 9px; line-height: 1.4; }
.database-profile-footnote { margin-top: 10px; color: #758999; font-size: 10px; }

.database-quality-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.database-quality-card { min-width: 0; padding: 12px; border: 1px solid #dce5e9; border-top: 4px solid #8a99a6; border-radius: 7px; background: #fff; }
.database-quality-card.is-online { border-top-color: #20a77e; }
.database-quality-card.is-warning { border-top-color: #c9822a; }
.database-quality-card.is-planned { border-top-color: #d99d35; }
.database-quality-card > div:first-child { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.database-quality-card strong { color: #264256; font-size: 11px; }
.database-quality-card > div:first-child span { color: #6d8292; font-size: 9px; letter-spacing: normal; text-transform: none; }
.database-quality-value { display: flex; align-items: baseline; gap: 6px; margin: 11px 0 7px; }
.database-quality-value b { color: #17394e; font-size: 20px; }
.database-quality-value small { color: #8595a2; font-size: 9px; }
.database-quality-card p { margin: 0; color: #6e8190; font-size: 9px; line-height: 1.45; }
.database-safeguard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.database-safeguard-grid article { padding: 12px; border: 1px solid #dde7ea; border-radius: 6px; background: #f9fbfc; }
.database-safeguard-grid span { color: #168f8b; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.database-safeguard-grid strong { display: block; margin-top: 5px; color: #2c475b; font-size: 12px; }
.database-safeguard-grid p { margin: 5px 0 0; color: #6d8191; font-size: 10px; line-height: 1.5; }
.database-empty-state { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: #728696; text-align: center; border: 1px dashed #cfdae0; border-radius: 8px; background: #fafcfd; }
.database-empty-state.is-error { color: #9b3c37; border-color: #e3c1be; background: #fff8f7; }
.database-empty-state .secondary-btn { margin-top: 8px; }

@media (max-width: 1380px) {
  .database-architecture-canvas { grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 24px; padding: 16px; overflow-x: auto; }
  .database-flow-column.has-arrow::after { right: -20px; }
  .database-profile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .database-quality-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .database-summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .database-relation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .database-profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .database-layer-details, .database-safeguard-grid { grid-template-columns: 1fr; }
  .database-identity-chain { grid-template-columns: 1fr; }
  .database-identity-chain > span { transform: rotate(90deg); justify-self: center; }
}

@media (max-width: 720px) {
  .main-view,
  body.module-database .main-view { display: block; }
  .sidebar,
  body.module-database .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 210;
    width: min(82vw, 300px);
    height: 100vh;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 160ms ease;
    box-shadow: 10px 0 28px rgba(15, 23, 42, 0.22);
  }
  .main-view.mobile-nav-open .sidebar { transform: translateX(0); }
  .mobile-nav-toggle {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 220;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #c9d8e2;
    border-radius: 7px;
    background: #ffffff;
    color: #174a56;
    font-size: 21px;
    line-height: 1;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.14);
  }
  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(15, 23, 42, 0.34);
  }
  .main-view.mobile-nav-open .mobile-nav-backdrop { display: block; }
  .content,
  body.module-database .content { padding: 56px 9px 9px; }
  .database-commandbar { align-items: flex-start; flex-direction: column; }
  .database-commandbar-actions { width: 100%; justify-content: space-between; }
  .database-summary-cards, .database-relation-grid, .database-profile-grid, .database-quality-grid { grid-template-columns: 1fr; }
  .database-view-tabs { overflow-x: auto; }
  .database-view-tabs button { min-width: 88px; }
  .database-section-heading { align-items: flex-start; flex-direction: column; }
  .database-architecture-canvas { grid-template-columns: 1fr; gap: 28px; overflow: visible; }
  .database-flow-column.has-arrow::after { content: "↓"; top: auto; right: 50%; bottom: -26px; transform: translateX(50%); }
  .database-table-title { align-items: flex-start; flex-direction: column; }
}

.screening-pool-v2-heading,
.screening-pool-v2-upload-actions,
.screening-pool-v2-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.screening-upload-progress {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid #c8e6e3;
  border-radius: 6px;
  background: #f2fbfa;
  color: #174a56;
}

.screening-upload-progress progress {
  width: 100%;
  height: 10px;
  accent-color: #159a93;
}

.screening-upload-progress small {
  color: #607b86;
}

.screening-pool-v2-heading {
  margin-bottom: 12px;
}

.screening-pool-v2-heading h3,
.screening-pool-v2-heading p {
  margin: 0;
}

.screening-threshold-control {
  display: flex;
  align-items: end;
  gap: 8px;
}

.screening-threshold-control label {
  display: grid;
  gap: 4px;
  color: #466078;
}

.screening-threshold-control input {
  width: 108px;
}

.screening-pool-v2-table {
  min-height: 420px;
  max-height: calc(100vh - 430px);
}

.screening-pool-v2-table table {
  min-width: 1500px;
}

.screening-pool-v2-upload-actions,
.screening-pool-v2-confirm {
  justify-content: flex-start;
  margin: 14px 0;
}

.screening-pool-review-table pre {
  max-width: 520px;
  max-height: 120px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  font: inherit;
}

.customer-registry-orders-modal {
  width: min(1500px, calc(100vw - 32px));
  max-width: none;
}

.customer-registry-orders-modal .historical-order-modal-body {
  padding: 12px;
}

.customer-registry-orders-modal .foundation-table-scroll {
  max-height: calc(100vh - 240px);
}

.customer-registry-orders-modal table {
  min-width: 2200px;
}
.foundation-section-heading,
.foundation-card-title,
.foundation-action-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.foundation-section-heading {
  margin: 2px 0 16px;
}

.foundation-section-heading span,
.foundation-card-title span,
.foundation-action-card > div > span {
  color: #0d9488;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.foundation-section-heading h3,
.foundation-card-title h3,
.foundation-action-card h3 {
  margin: 5px 0 4px;
  color: #12314a;
  font-size: 18px;
}

.foundation-section-heading p,
.foundation-action-card p {
  margin: 0;
  color: #647b8f;
  font-size: 13px;
}

.foundation-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.foundation-metric-card,
.foundation-card {
  border: 1px solid #dbe7ee;
  border-radius: 10px;
  background: #fff;
}

.foundation-metric-card {
  padding: 14px 16px;
}

.foundation-metric-card span,
.foundation-metric-card small {
  display: block;
  color: #71879a;
  font-size: 12px;
}

.foundation-metric-card strong {
  display: block;
  margin: 5px 0 3px;
  color: #12314a;
  font-size: 22px;
}

.foundation-card {
  padding: 16px;
  margin-bottom: 14px;
  min-width: 0;
}

.foundation-card h4 {
  margin: 0 0 12px;
  color: #17364f;
  font-size: 15px;
}

.foundation-two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  gap: 14px;
}

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

.foundation-filter-row.model-active-form {
  grid-template-columns: minmax(280px, 1fr) auto;
}

.model-active-form .primary-btn {
  width: auto;
  min-width: 0;
  margin-top: 0;
  padding: 0 20px;
  white-space: nowrap;
}

.model-switch-confirm__dialog {
  width: min(560px, calc(100vw - 48px));
  border-radius: 12px;
}

.foundation-table-scroll {
  max-width: 100%;
  overflow: auto;
  border: 1px solid #e1eaf0;
  border-radius: 8px;
}

.foundation-table-scroll table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  color: #29465e;
  font-size: 12px;
}

.foundation-table-scroll th,
.foundation-table-scroll td {
  padding: 9px 10px;
  border-right: 1px solid #e5edf2;
  border-bottom: 1px solid #e5edf2;
  text-align: left;
  white-space: nowrap;
}

.foundation-table-scroll th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef5f7;
  color: #24445d;
}

.foundation-table-scroll .is-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.foundation-query-table {
  max-height: 520px;
}

.model-sample-card {
  display: flex;
  flex-direction: column;
  min-height: max(520px, calc(100dvh - 170px));
  margin-bottom: 0;
}

.model-sample-table {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: none;
}

.customer-registry-field-table table {
  width: 100%;
  min-width: 1180px;
}

.customer-registry-field-table .customer-registry-sample {
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-registry-query-table {
  max-height: 560px;
}

.customer-registry-query-table table {
  min-width: 7600px;
}

.customer-registry-query-table th,
.customer-registry-query-table td {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-registry-query-table .customer-registry-select-cell {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  padding: 6px;
  background: #edf3f6;
  text-align: center;
}

.customer-registry-query-table tbody .customer-registry-select-cell {
  z-index: 1;
  background: #fff;
}

.customer-registry-query-table tbody tr.is-selected td {
  background: #edf9f7;
}

.customer-registry-query-table tbody tr.is-selected .customer-registry-select-cell {
  background: #dff3f0;
}

.customer-registry-query-actions {
  flex-wrap: nowrap;
}

.customer-registry-query-actions .secondary-btn,
.customer-registry-query-actions .primary-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 132px;
  height: 36px;
  margin: 0;
  padding: 0 18px;
  white-space: nowrap;
}

.customer-registry-query-actions .primary-btn {
  min-width: 112px;
}

.customer-registry-manual-review-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #e7c98b;
  border-radius: 8px;
  background: #fff9ed;
  color: #664b1c;
}

.customer-registry-manual-review-banner div {
  display: grid;
  gap: 3px;
}

.customer-registry-manual-review-banner strong {
  color: #9b5b0b;
  font-size: 15px;
}

.customer-registry-manual-review-banner span,
.customer-registry-manual-review-banner small {
  font-size: 12px;
}

.customer-registry-manual-review-cell {
  position: sticky;
  left: 42px;
  z-index: 2;
  width: 360px;
  min-width: 360px;
  max-width: 360px !important;
  background: #fff9ed !important;
  white-space: normal;
}

.customer-registry-manual-review-cell strong,
.customer-registry-manual-review-cell span {
  display: block;
}

.customer-registry-backup-heading {
  margin-bottom: 12px;
}

.customer-registry-backup-table {
  max-height: calc(100vh - 420px);
  min-height: 280px;
}

.customer-registry-backup-table table {
  min-width: 1480px;
}

.customer-registry-backup-table td,
.customer-registry-backup-table th {
  padding-top: 7px;
  padding-bottom: 7px;
  vertical-align: top;
}

.customer-registry-backup-reason {
  width: 420px;
  min-width: 420px;
  max-width: 420px;
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.customer-registry-disposition-field {
  display: grid;
  grid-template-columns: 88px minmax(180px, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
}

.customer-registry-disposition-field select {
  width: min(320px, 100%);
  min-height: 38px;
  border: 1px solid #c8d7e4;
  border-radius: 6px;
  background: #fff;
  color: #0b3550;
  padding: 0 10px;
  font: inherit;
}

.screening-pool-v3-overview {
  display: grid;
  gap: 14px;
}

.screening-pool-v3-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.screening-threshold-card {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid #cfe1e5;
  border-left: 4px solid #15958f;
  border-radius: 8px;
  background: #f4fbfa;
}

.screening-threshold-card > div:first-child {
  min-width: 300px;
}

.screening-threshold-card span,
.screening-threshold-card p {
  color: #567185;
}

.screening-threshold-card strong {
  display: block;
  margin: 3px 0;
  color: #153d57;
  font-size: 22px;
}

.screening-threshold-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.screening-threshold-card.is-terminal {
  border-left-color: #b17825;
  background: #fff9ed;
}

.screening-settings-panel { padding: 18px; }
.screening-settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.screening-setting-box { display: flex; min-width: 0; min-height: 230px; flex-direction: column; justify-content: space-between; gap: 18px; border: 1px solid #d8e3eb; border-radius: 10px; padding: 18px; background: #f8fbfc; }
.screening-setting-box > div:first-child > span { color: #15948e; font-size: 12px; font-weight: 700; letter-spacing: .05em; }
.screening-setting-box > div:first-child > strong { display: block; margin: 8px 0; color: #15344f; font-size: 28px; line-height: 1; }
.screening-setting-box p { margin: 0; color: #60768b; font-size: 13px; line-height: 1.65; }
.screening-setting-control { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 9px; }
.screening-setting-control label { display: grid; gap: 5px; color: #60768b; font-size: 12px; }
.screening-setting-control input { width: 132px; border: 1px solid #cbd8e0; border-radius: 6px; padding: 8px 9px; background: #fff; color: #203f56; font: inherit; }

.screening-push-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.screening-push-controls label {
  display: grid;
  gap: 4px;
  color: #466078;
  font-size: 12px;
}

.screening-push-controls input {
  width: 110px;
}

@media (max-width: 1100px) {
  .screening-pool-v3-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .screening-threshold-card {
    align-items: stretch;
    flex-direction: column;
  }
  .screening-push-controls {
    justify-content: flex-start;
  }
  .screening-settings-grid {
    grid-template-columns: 1fr;
  }
}

.customer-registry-manual-review-cell strong {
  color: #9b5b0b;
  margin-bottom: 3px;
}

.customer-registry-manual-review-cell span {
  color: #5b6874;
  line-height: 1.45;
}

.customer-registry-query-table tbody tr.is-selected .customer-registry-manual-review-cell {
  background: #f8f1df !important;
}

.customer-registry-manual-review-button {
  border-color: #d7a552;
  color: #8f5707;
}

.customer-registry-page-loading {
  color: #168f8b !important;
  font-weight: 700;
}

.customer-registry-table-footer {
  display: flex;
  min-width: max-content;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 0;
  color: #60768b;
  font-size: 12px;
  line-height: 30px;
  white-space: nowrap;
}

.customer-registry-table-footer .foundation-page-jump,
.customer-registry-table-footer .foundation-page-jump input,
.customer-registry-table-footer .secondary-btn {
  font-size: 12px;
}

.customer-registry-table-footer .foundation-page-jump input {
  width: 52px;
  height: 30px;
}

.customer-registry-table-footer .secondary-btn {
  min-height: 30px;
  padding: 5px 12px;
}

.customer-registry-upload-operation-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.customer-registry-upload-stage-note {
  margin: 0 12px 12px;
  padding: 9px 12px;
  border: 1px solid #cfe1e8;
  border-radius: 6px;
  background: #f2f8fa;
  color: #47657a;
  font-size: 12px;
}

.customer-registry-upload-stage-note.is-risk {
  border-color: #f0c7aa;
  background: #fff7f1;
  color: #b85e25;
}

.customer-registry-validation-list {
  display: grid;
  gap: 9px;
}

.customer-registry-validation-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #d7e3ea;
  border-radius: 7px;
  color: #34536b;
}

.customer-registry-validation-list .is-pass {
  color: #087d78;
}

.customer-registry-validation-list .is-risk {
  color: #c25f20;
}

.customer-registry-validation-note {
  margin: 13px 0 0 !important;
  padding: 10px 12px;
  border-left: 3px solid #159b96;
  background: #f2f9f8;
}

.customer-registry-quality-table {
  max-height: 620px;
}

.customer-registry-quality-table table {
  width: 100%;
  min-width: 840px;
}

.customer-registry-quality-table th {
  text-align: center;
}

.customer-registry-quality-table td:nth-child(n+3) {
  text-align: right;
}

.customer-registry-quality-table tbody tr[data-customer-quality-field] {
  cursor: pointer;
}

.customer-registry-quality-table tbody tr[data-customer-quality-field]:hover td,
.customer-registry-quality-table tbody tr[data-customer-quality-field]:focus td {
  background: #eefafa;
}

.customer-cleaning-manual-modal {
  width: min(780px, calc(100vw - 32px));
}

.customer-cleaning-manual-body {
  display: grid;
  gap: 16px;
}

.customer-cleaning-manual-field {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  align-items: start;
  gap: 8px 16px;
}

.customer-cleaning-manual-field > label {
  align-self: start;
  margin: 0;
  padding-top: 0;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  white-space: nowrap;
}

.customer-cleaning-manual-field input,
.customer-cleaning-manual-field textarea,
.customer-cleaning-manual-field select {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
}

.customer-cleaning-manual-field textarea {
  min-height: 72px;
}

.customer-cleaning-manual-field small {
  grid-column: 2;
  color: #60758a;
}

@media (max-width: 720px) {
  .customer-cleaning-manual-field {
    grid-template-columns: 1fr;
  }
  .customer-cleaning-manual-field > label {
    padding-top: 0;
    white-space: normal;
  }
  .customer-cleaning-manual-field small {
    grid-column: 1;
  }
}

.customer-quality-rate {
  display: inline-block;
  min-width: 68px;
  padding: 3px 8px;
  border-radius: 999px;
  text-align: center;
  font-weight: 700;
}

.customer-quality-rate.is-complete,
.customer-quality-rate.is-low {
  background: #e5f5f1;
  color: #087d78;
}

.customer-quality-rate.is-medium {
  background: #fff4da;
  color: #a96a08;
}

.customer-quality-rate.is-high {
  background: #fde9e5;
  color: #bb4e3c;
}

.customer-registry-upload-operation-layout > article {
  min-width: 0;
}

.customer-registry-upload-operation-layout h4 {
  margin: 0 0 9px;
  color: #27475d;
  font-size: 14px;
  line-height: 20px;
}

.customer-registry-upload-statistics .foundation-table-scroll,
.customer-registry-operation-log .foundation-table-scroll {
  max-height: 520px;
}

.customer-registry-upload-statistics table {
  min-width: 980px;
}

.customer-registry-operation-log table {
  min-width: 940px;
}

.customer-registry-upload-statistics th,
.customer-registry-upload-statistics td,
.customer-registry-operation-log th,
.customer-registry-operation-log td {
  text-align: center;
}

.customer-registry-upload-statistics td:nth-child(2),
.customer-registry-operation-log td:nth-child(2),
.customer-registry-operation-log td:nth-child(4) {
  max-width: 230px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.foundation-workflow {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 24px;
  color: #36536a;
  font-size: 13px;
}

.foundation-policy-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #0f9c95;
  background: #effafa;
  color: #45667d;
  font-size: 12px;
}

.foundation-workflow-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.foundation-workflow-strip div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 10px;
  border: 1px solid #dce9ee;
  border-radius: 9px;
  background: #f8fbfc;
  color: #36536a;
  font-size: 12px;
}

.foundation-workflow-strip b {
  display: inline-grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #15968f;
  color: #fff;
}

.foundation-filter-row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) minmax(140px, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin: 14px 0;
}

.foundation-filter-row label {
  display: grid;
  gap: 5px;
  color: #4e687d;
  font-size: 12px;
}

.foundation-filter-row input,
.foundation-filter-row select {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #ccdbe4;
  border-radius: 7px;
  background: #fff;
  color: #17364f;
}

.foundation-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: #647b8f;
  font-size: 12px;
}

.foundation-pager-total {
  color: #526b7e;
  font-variant-numeric: tabular-nums;
}

.foundation-pager-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

#databaseViewContent table th,
#databaseViewContent table td {
  padding-top: 7px;
  padding-bottom: 7px;
  line-height: 1.25;
}

.foundation-page-jump {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  color: #5d7485;
  font-size: 13px;
}

.foundation-page-jump input {
  width: 58px;
  height: 30px;
  border: 1px solid #cfdde6;
  border-radius: 4px;
  text-align: center;
}

.database-operation-progress {
  width: min(680px, calc(100% - 48px));
  margin: 90px auto;
  padding: 24px;
  border: 1px solid #d4e3e8;
  border-radius: 10px;
  background: #fff;
  color: #24465c;
  box-shadow: 0 8px 26px rgba(20, 64, 84, .08);
}

.database-operation-progress strong { display: block; margin-bottom: 14px; }
.database-operation-progress p { margin: 10px 0 0; color: #6b8294; font-size: 13px; }
.database-operation-progress-track { height: 10px; overflow: hidden; border-radius: 999px; background: #e7eff2; }
.database-operation-progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#118d89,#18aaa2); transition: width .35s ease; }

.foundation-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #dff5f1;
  color: #08786f;
  font-size: 11px;
  font-weight: 700;
}

.foundation-status.reserved {
  background: #fff1ce;
  color: #986516;
}

.foundation-definition-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.foundation-definition-list div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #edf2f5;
}

.foundation-definition-list dt {
  color: #70869a;
}

.foundation-definition-list dd {
  margin: 0;
  color: #17364f;
  overflow-wrap: anywhere;
}

.foundation-metric-pairs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.foundation-metric-pairs div {
  padding: 12px;
  border-radius: 8px;
  background: #f2f8f9;
}

.foundation-metric-pairs span,
.foundation-metric-pairs strong {
  display: block;
}

.foundation-metric-pairs span {
  color: #6b8295;
  font-size: 11px;
}

.foundation-metric-pairs strong {
  margin-top: 4px;
  color: #0b7f78;
  font-size: 20px;
}

.model-metric-section + .model-metric-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #dfe9ee;
}

.model-metric-section h5,
.model-metric-guide h5 {
  margin: 0 0 9px;
  color: #496579;
  font-size: 12px;
}

.model-metric-guide {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 8px;
  background: #f7fafb;
}

.model-metric-guide dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.model-metric-guide dl div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
}

.model-metric-guide dt {
  color: #0b7f78;
  font-size: 11px;
  font-weight: 800;
}

.model-metric-guide dd,
.model-metric-guide p {
  margin: 0;
  color: #5f7789;
  font-size: 11px;
  line-height: 1.55;
}

.model-metric-guide p {
  margin-top: 9px;
}

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

.foundation-policy-grid div {
  padding: 13px;
  border-radius: 8px;
  background: #f5f9fb;
}

.foundation-policy-grid span {
  color: #0d8e87;
  font-size: 12px;
  font-weight: 800;
}

.foundation-policy-grid p {
  margin: 6px 0 0;
  color: #49657a;
  font-size: 12px;
  line-height: 1.65;
}

@media (max-width: 1180px) {
  .foundation-metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .foundation-two-column,
  .foundation-policy-grid,
  .customer-registry-upload-operation-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .foundation-metric-grid,
  .foundation-filter-row {
    grid-template-columns: 1fr;
  }
  .foundation-section-heading,
  .foundation-card-title,
  .foundation-action-card {
    flex-direction: column;
  }
  .model-sample-card {
    min-height: 640px;
  }
  .foundation-pager {
    align-items: flex-start;
    flex-direction: column;
  }
  .foundation-pager-controls {
    flex-wrap: wrap;
    margin-left: 0;
  }
  .foundation-filter-row.model-active-form {
    grid-template-columns: 1fr;
  }
}
.historical-customer-intro { margin-bottom: 12px; }
.historical-customer-metrics { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.historical-customer-stat-tree {
  display: grid; grid-template-columns: 160px 720px; gap: 0; justify-content: center;
  align-items: center; width: min(100%, 1040px); min-height: 290px; box-sizing: border-box;
  margin: 0 auto 14px; padding: 22px 34px;
  border: 1px solid #d8e3eb; border-radius: 8px; background: #fff;
  overflow-x: auto;
}
.historical-customer-tree-root,
.historical-customer-tree-status,
.historical-customer-tree-status-label,
.historical-customer-tree-role,
.historical-customer-tree-role-label,
.historical-customer-tree-leaves > div {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  min-width: 0; color: #163c55; font-size: 15px;
}
.historical-customer-tree-root { position: relative; padding: 12px 40px 12px 4px; font-size: 18px; font-weight: 700; white-space: nowrap; }
.historical-customer-tree-root::after { content: ""; position: absolute; left: 100%; top: 50%; width: 40px; border-top: 2px solid #6f999a; }
.historical-customer-tree-root strong { color: #087f7a; font-size: 22px; }
.historical-customer-tree-statuses { position: relative; display: grid; gap: 36px; width: 680px; box-sizing: border-box; padding-left: 40px; }
.historical-customer-tree-statuses::before { content: ""; position: absolute; left: 0; top: 22px; bottom: 90px; border-left: 2px solid #6f999a; }
.historical-customer-tree-status { position: relative; min-height: 44px; font-weight: 700; }
.historical-customer-tree-status::before { content: ""; position: absolute; right: 100%; top: 50%; width: 40px; border-top: 2px solid #6f999a; }
.historical-customer-tree-status > strong,
.historical-customer-tree-status-label strong,
.historical-customer-tree-role strong,
.historical-customer-tree-role-label strong,
.historical-customer-tree-leaves strong { color: #0b6373; font-size: 16px; font-weight: 700; }
.historical-customer-tree-status.is-closed { width: 220px; white-space: nowrap; }
.historical-customer-tree-status.is-operating { display: grid; grid-template-columns: 190px 410px; gap: 40px; width: 640px; align-items: center; }
.historical-customer-tree-status-label { font-weight: 700; white-space: nowrap; }
.historical-customer-tree-roles { position: relative; display: grid; gap: 18px; width: 410px; box-sizing: border-box; padding-left: 36px; }
.historical-customer-tree-roles::before { content: ""; position: absolute; left: 0; top: 44px; bottom: 20px; border-left: 2px solid #6f999a; }
.historical-customer-tree-role { position: relative; min-height: 40px; font-weight: 600; white-space: nowrap; }
.historical-customer-tree-role::before { content: ""; position: absolute; right: 100%; top: 50%; width: 36px; border-top: 2px solid #6f999a; }
.historical-customer-tree-role.is-end-user { display: grid; grid-template-columns: 145px 190px; gap: 30px; width: 365px; align-items: center; }
.historical-customer-tree-role-label { position: relative; font-weight: 600; white-space: nowrap; }
.historical-customer-tree-role-label::after { content: ""; position: absolute; left: 100%; top: 50%; width: 30px; border-top: 2px solid #6f999a; }
.historical-customer-tree-leaves { position: relative; display: grid; gap: 16px; width: 190px; box-sizing: border-box; padding-left: 30px; }
.historical-customer-tree-leaves::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; border-left: 2px solid #6f999a; }
.historical-customer-tree-leaves > div { position: relative; min-height: 36px; white-space: nowrap; }
.historical-customer-tree-leaves > div::before { content: ""; position: absolute; right: 100%; top: 18px; width: 30px; border-top: 2px solid #6f999a; }
.historical-customer-stat-tree strong { flex: 0 0 auto; color: #0b5d78; font-size: 16px; }
.historical-customer-rule-note {
  margin: 12px 0; padding: 10px 12px; border-left: 3px solid #119b95;
  background: #f0f9f8; color: #31546a; font-size: 13px; line-height: 1.55;
}
.historical-customer-profile-grid { display: grid; grid-template-columns: minmax(320px, .7fr) minmax(620px, 1.3fr); gap: 14px; }
.historical-customer-profile-grid > article { min-width: 0; }
.historical-customer-profile-grid h4,
.historical-order-panel > h4 { margin: 10px 0 8px; color: #0b3655; }
.historical-customer-table { min-height: 380px; max-height: calc(100vh - 430px); }
.historical-customer-table th { position: sticky; top: 0; white-space: nowrap; }
.historical-customer-table td { height: 34px; padding: 6px 8px; vertical-align: top; }
.historical-customer-table tr { cursor: default; }
.historical-customer-table tr:hover { background: #eaf8f7; }
.historical-customer-address { min-width: 220px; max-width: 360px; white-space: normal; overflow-wrap: anywhere; line-height: 1.45; }
.historical-customer-sort {
  float: right; margin-left: 6px; padding: 0; border: 0; background: transparent;
  color: #8aa0ad; font-size: 10px; line-height: 18px; cursor: pointer;
}
.historical-customer-sort.is-active { color: #078e89; }
.historical-customer-active,
.historical-customer-geo { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: 12px; white-space: nowrap; }
.historical-customer-active.is-yes,
.historical-customer-geo.is-located { color: #08766f; background: #e2f6f3; }
.historical-customer-active.is-no { color: #6c7780; background: #eef2f4; }
.historical-customer-active.is-pending { color: #9a5c00; background: #fff3d8; }
.historical-customer-geo.is-manual_review { color: #9a5c00; background: #fff3d8; }
.historical-customer-geo.is-pending { color: #536c7b; background: #edf3f6; }
.historical-customer-geo.is-failed { color: #b42e2e; background: #fdeaea; }
.historical-customer-quality-table { max-height: calc(100vh - 460px); }
.historical-customer-log-query { margin-bottom: 12px; }
.historical-customer-log-query .historical-order-actions { display: grid; grid-template-columns: 170px minmax(240px, 360px) 112px; gap: 8px; width: min(100%, 658px); }
.historical-customer-log-query select,
.historical-customer-log-query input,
.historical-customer-log-query button { box-sizing: border-box; width: 100%; min-width: 0; margin: 0; }
.historical-customer-log-table { max-height: calc(100vh - 390px); }
.historical-customer-log-table table { min-width: 1320px; table-layout: fixed; }
.historical-customer-log-table th:nth-child(1) { width: 76px; }
.historical-customer-log-table th:nth-child(2) { width: 120px; }
.historical-customer-log-table th:nth-child(3) { width: 210px; }
.historical-customer-log-table th:nth-child(4) { width: 180px; }
.historical-customer-log-table th:nth-child(5) { width: 170px; }
.historical-customer-log-table th:nth-child(6) { width: 88px; }
.historical-customer-log-table th:nth-child(7) { width: 330px; }
.historical-customer-log-table th:nth-child(8) { width: 100px; }
.historical-customer-log-table th:nth-child(9) { width: 150px; }
.historical-customer-log-table td { overflow: hidden; text-overflow: ellipsis; }
.historical-customer-log-table td:nth-child(3),
.historical-customer-log-detail { white-space: pre-wrap !important; overflow-wrap: anywhere; word-break: break-word; line-height: 1.45; text-overflow: clip !important; }
.historical-customer-log-table td:nth-child(3) { white-space: normal !important; overflow-wrap: anywhere; word-break: break-word; line-height: 1.45; text-overflow: clip !important; }
.historical-customer-backup-metrics { grid-template-columns: repeat(5, minmax(140px, 1fr)); }
.historical-customer-restore-status { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: 12px; white-space: nowrap; }
.historical-customer-restore-status.is-restored { color: #08766f; background: #e2f6f3; }
.historical-customer-restore-status.is-pending { color: #9a5c00; background: #fff3d8; }
.historical-customer-order-modal { width: min(1500px, 94vw); }

/* Customer inbox v98 */
.inbox-shell {
  display: grid;
  grid-template-columns: 170px 330px minmax(0, 1fr);
  min-height: max(640px, calc(100vh - 255px));
  overflow: hidden;
  border: 1px solid #d7e2e8;
  border-radius: 10px;
  background: #fff;
}
.inbox-folders { padding: 14px 10px; border-right: 1px solid #dce6eb; background: #f5f8fa; }
.inbox-folders-title { display: flex; align-items: center; justify-content: space-between; padding: 5px 9px 14px; color: #5f7584; font-size: 12px; }
.inbox-folders-title strong { color: #0d7977; font-size: 13px; }
.inbox-folders > button { display: grid; grid-template-columns: 22px minmax(0,1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 40px; margin: 2px 0; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: #294b5e; text-align: left; cursor: pointer; }
.inbox-folders > button:hover { background: #e8f1f3; }
.inbox-folders > button.active { color: #087a77; background: #dff1f0; font-weight: 700; box-shadow: inset 3px 0 #0b918d; }
.inbox-folders > button strong { min-width: 22px; padding: 2px 6px; border-radius: 999px; color: #5f7584; background: #e5ecef; font-size: 10px; text-align: center; }
.inbox-folders > button.active strong { color: #087a77; background: #fff; }
.inbox-folder-icon { color: #6d8390; text-align: center; }
.inbox-messages { min-width: 0; border-right: 1px solid #dce6eb; background: #fff; }
.inbox-messages > header { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #dce6eb; }
.inbox-messages h3,.inbox-customer-list-heading h3 { margin: 0; color: #133c52; font-size: 17px; }
.inbox-messages header p,.inbox-customer-list-heading p { margin: 3px 0 0; color: #718594; font-size: 11px; }
.inbox-messages .secondary-btn { width: auto; min-width: 58px; margin: 0; }
.inbox-message-list { max-height: calc(100vh - 325px); overflow: auto; }
.inbox-message { display: grid; grid-template-columns: 8px minmax(0,1fr) auto; gap: 9px; width: 100%; min-height: 92px; padding: 13px 12px; border: 0; border-bottom: 1px solid #e7edef; background: #fff; color: #284b5f; text-align: left; cursor: pointer; }
.inbox-message:hover { background: #f4f9fa; }
.inbox-message.active { background: #e8f5f4; box-shadow: inset 3px 0 #0b918d; }
.inbox-message-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: transparent; }
.inbox-message.unread .inbox-message-dot { background: #0d918c; }
.inbox-message-copy { display: block; min-width: 0; }
.inbox-message-copy strong,.inbox-message-copy small,.inbox-message-copy em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-message-copy strong { color: #173f54; font-size: 13px; }
.inbox-message.unread .inbox-message-copy strong { font-weight: 800; }
.inbox-message-copy small { margin-top: 7px; color: #5f7584; font-size: 11px; }
.inbox-message-copy em { margin-top: 7px; color: #0c807c; font-size: 10px; font-style: normal; }
.inbox-message time { color: #80919b; font-size: 9px; white-space: nowrap; }
.inbox-reading-pane { min-width: 0; overflow: auto; background: #fbfdfe; }
.inbox-empty { display: grid; min-height: 440px; place-content: center; padding: 30px; color: #708493; text-align: center; }
.inbox-empty.compact { min-height: 260px; }
.inbox-empty strong { color: #3e5d6d; font-size: 15px; }
.inbox-empty p { margin: 8px 0 0; font-size: 12px; }
.inbox-customer-list-heading { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px; border-bottom: 1px solid #dce6eb; background: #fff; }
.inbox-customer-list-heading > span { padding: 4px 9px; border-radius: 999px; color: #087a77; background: #e0f2f1; font-size: 11px; font-weight: 700; }
.inbox-customer-list { padding: 10px; }
.inbox-customer-row { display: grid; grid-template-columns: minmax(0,1fr) 72px; gap: 12px; width: 100%; min-height: 84px; margin-bottom: 8px; padding: 12px 14px; border: 1px solid #dce7ec; border-radius: 8px; background: #fff; color: #25495c; text-align: left; cursor: pointer; }
.inbox-customer-row:hover,.inbox-customer-row.active { border-color: #65bcb8; background: #eef9f8; }
.inbox-customer-main,.inbox-customer-main strong,.inbox-customer-main small,.inbox-customer-main em { display: block; min-width: 0; }
.inbox-customer-main strong { overflow: hidden; color: #153f55; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.inbox-customer-main small { margin-top: 5px; color: #647c8b; font-size: 11px; }
.inbox-customer-main em { margin-top: 5px; overflow: hidden; color: #708493; font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.inbox-customer-side { align-self: center; text-align: right; }
.inbox-customer-side b { display: block; color: #0a8581; font-size: 16px; }
.inbox-customer-side small { display: inline-block; margin-top: 5px; padding: 2px 6px; border-radius: 999px; color: #596f7d; background: #edf2f4; font-size: 9px; }
.inbox-detail { min-height: 100%; background: #fff; }
.inbox-detail > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 18px; border-bottom: 1px solid #dce6eb; }
.inbox-detail-kicker { color: #0d8985; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.inbox-detail h3 { margin: 7px 0 4px; color: #123d53; font-size: 21px; }
.inbox-detail header p { margin: 0; color: #6b7f8d; font-size: 12px; }
.inbox-score { flex: 0 0 auto; min-width: 82px; padding: 10px; border-radius: 8px; color: #fff; background: #0d8f8a; text-align: center; }
.inbox-score strong,.inbox-score span { display: block; }
.inbox-score strong { font-size: 22px; }
.inbox-score span { margin-top: 2px; font-size: 9px; }
.inbox-reason { margin: 16px 24px 0; padding: 12px 14px; border-left: 3px solid #0d918c; border-radius: 0 7px 7px 0; background: #eef8f7; }
.inbox-reason strong { color: #1b4a5d; font-size: 12px; }
.inbox-reason p { margin: 5px 0 0; color: #59717f; font-size: 11px; line-height: 1.6; }
.inbox-handled-note { margin: 12px 24px 0; padding: 9px 12px; border-radius: 6px; color: #5f6972; background: #f1f4f6; font-size: 11px; }
.inbox-detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; margin: 16px 24px; overflow: hidden; border: 1px solid #d9e4e9; border-radius: 8px; background: #d9e4e9; }
.inbox-detail-field { min-height: 68px; padding: 11px 13px; background: #fff; }
.inbox-detail-field.wide { grid-column: 1 / -1; }
.inbox-detail-field span { display: block; color: #6d8190; font-size: 10px; }
.inbox-detail-field strong { display: block; margin-top: 6px; color: #183f54; font-size: 12px; font-weight: 600; line-height: 1.6; word-break: break-word; }
.inbox-detail-actions { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 13px 24px; border-top: 1px solid #dce6eb; background: rgba(255,255,255,.96); box-shadow: 0 -7px 18px rgba(26,58,74,.06); }
.inbox-detail-actions button,.inbox-detail-actions .primary-btn,.inbox-modal footer button,.inbox-modal footer .primary-btn { width: auto; min-width: 76px; height: 34px; margin: 0; padding: 0 16px; }
.inbox-modal { position: fixed; inset: 0; z-index: 10100; display: grid; place-items: center; padding: 22px; background: rgba(13,35,50,.52); }
.inbox-modal-card { width: min(620px,calc(100vw - 36px)); overflow: hidden; border-radius: 10px; background: #fff; box-shadow: 0 24px 80px rgba(12,34,48,.32); }
.inbox-modal-card > header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #dce6eb; }
.inbox-modal-card h3 { margin: 0; color: #153f54; font-size: 18px; }
.inbox-modal-card header button { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; color: #5f7584; background: #edf2f4; font-size: 20px; cursor: pointer; }
.inbox-modal-body { padding: 18px 20px; }
.inbox-modal-body > p { margin: 0 0 16px; color: #5f7584; font-size: 12px; line-height: 1.6; }
.inbox-modal-body fieldset { margin: 14px 0 0; padding: 0; border: 0; }
.inbox-modal-body legend { margin-bottom: 8px; color: #294b5e; font-size: 12px; font-weight: 700; }
.inbox-choice-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.inbox-choice-grid label { cursor: pointer; }
.inbox-choice-grid input { position: absolute; opacity: 0; pointer-events: none; }
.inbox-choice-grid span { display: inline-flex; min-height: 34px; align-items: center; padding: 0 12px; border: 1px solid #cddbe2; border-radius: 6px; color: #38586a; background: #fff; font-size: 12px; }
.inbox-choice-grid input:checked + span { color: #fff; border-color: #0d918c; background: #0d918c; }
.inbox-negative-option { display: flex; align-items: flex-start; gap: 11px; padding: 14px; border: 1px solid #d8e4e9; border-radius: 8px; background: #f8fbfc; cursor: pointer; }
.inbox-negative-option input { margin-top: 3px; }
.inbox-negative-option span,.inbox-negative-option strong,.inbox-negative-option small { display: block; }
.inbox-negative-option strong { color: #294b5e; font-size: 12px; }
.inbox-negative-option small { margin-top: 5px; color: #6d8190; font-size: 10px; line-height: 1.5; }
.inbox-forward-select { display: grid; gap: 7px; color: #294b5e; font-size: 12px; }
.inbox-forward-select select { width: 100%; height: 40px; padding: 0 10px; border: 1px solid #cbd9e1; border-radius: 6px; background: #fff; }
.inbox-modal-card > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px 17px; border-top: 1px solid #dce6eb; }
@media (max-width: 1180px) {
  .inbox-shell { grid-template-columns: 145px 290px minmax(420px,1fr); overflow-x: auto; }
}
@media (max-width: 760px) {
  .inbox-shell { display: block; min-height: 620px; overflow: visible; }
  .inbox-folders { display: flex; gap: 5px; overflow-x: auto; border-right: 0; border-bottom: 1px solid #dce6eb; }
  .inbox-folders-title { display: none; }
  .inbox-folders > button { flex: 0 0 auto; width: auto; min-width: 105px; }
  .inbox-messages { border-right: 0; border-bottom: 1px solid #dce6eb; }
  .inbox-message-list { max-height: 290px; }
  .inbox-detail-grid { grid-template-columns: 1fr; margin-inline: 12px; }
  .inbox-detail-field.wide { grid-column: auto; }
  .inbox-detail > header,.inbox-detail-actions { padding-inline: 14px; }
  .inbox-detail-actions { flex-wrap: wrap; }
}
.historical-customer-order-modal .historical-order-modal-body { max-height: 68vh; overflow: auto; }
.historical-customer-order-modal table { min-width: 1200px; }

@media (max-width: 1280px) {
  .historical-customer-metrics { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .historical-customer-backup-metrics { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .historical-customer-profile-grid { grid-template-columns: 1fr; }
  .historical-customer-stat-tree { grid-template-columns: 160px 720px; justify-content: start; }
}

@media (max-width: 760px) {
  .historical-customer-log-query .historical-order-actions { grid-template-columns: 1fr; width: 100%; }
  .historical-customer-stat-tree { display: block; min-height: 0; padding: 14px; }
  .historical-customer-tree-root,
  .historical-customer-tree-statuses,
  .historical-customer-tree-status.is-operating,
  .historical-customer-tree-roles,
  .historical-customer-tree-role.is-end-user,
  .historical-customer-tree-leaves { display: grid; grid-template-columns: 1fr; gap: 10px; padding-left: 0; }
  .historical-customer-tree-root::after,
  .historical-customer-tree-statuses::before,
  .historical-customer-tree-status::before,
  .historical-customer-tree-roles::before,
  .historical-customer-tree-role::before,
  .historical-customer-tree-leaves::before,
  .historical-customer-tree-leaves > div::before { display: none; }
}

/* LEADS shared interface system v143
   Keep layout rules explicit so login, maps, wide tables and dialogs can opt in to
   full-width behavior without making every business control span its container. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

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

button,
input,
select,
textarea,
label {
  margin: 0;
}

input,
select,
textarea {
  max-width: 100%;
  color: var(--ui-color-text);
}

input {
  width: auto;
}

select {
  width: auto;
  min-height: var(--ui-control-height);
  padding: 0 30px 0 10px;
  border: 1px solid var(--ui-color-border);
  border-radius: var(--ui-radius-control);
  background: var(--ui-color-surface);
}

textarea {
  width: min(100%, var(--ui-reading-width));
  min-height: 84px;
  padding: 9px 10px;
  border: 1px solid var(--ui-color-border);
  border-radius: var(--ui-radius-control);
  line-height: var(--ui-line-body);
  resize: vertical;
}

main.content input[type="text"],
main.content input[type="search"],
main.content input[type="email"],
main.content input[type="password"] {
  max-width: var(--ui-control-width-lg);
}

main.content input[type="date"] {
  max-width: 156px;
}

main.content input[type="number"] {
  max-width: var(--ui-control-width-sm);
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  padding: 0;
  accent-color: var(--ui-color-primary);
}

.login-card > label {
  margin: 14px 0 6px;
}

.login-card > input,
.login-card > .primary-btn {
  width: 100%;
  max-width: none;
}

.login-card > .primary-btn {
  margin-top: 18px;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  width: auto;
  min-width: 76px;
  height: var(--ui-control-height);
  min-height: var(--ui-control-height);
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 14px;
  border-radius: var(--ui-radius-control);
  font-size: var(--ui-font-control);
  line-height: 1;
  white-space: nowrap;
}

.primary-btn {
  border: 1px solid var(--ui-color-primary);
  background: var(--ui-color-primary);
}

.primary-btn:hover:not(:disabled) {
  border-color: var(--ui-color-primary-hover);
  background: var(--ui-color-primary-hover);
}

.primary-btn.compact,
.secondary-btn.compact {
  min-width: 0;
  padding-inline: 12px;
}

.secondary-btn {
  border-color: var(--ui-color-border);
  background: var(--ui-color-subtle);
}

.primary-btn:disabled,
.secondary-btn:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="tab"]:focus-visible {
  outline: 2px solid var(--ui-color-focus);
  outline-offset: 2px;
}

.link-btn {
  margin: 0;
  padding: 2px 4px;
  color: #14768a;
}

.submit-btn {
  width: auto;
  min-width: 112px;
  margin: 12px 14px 0;
  padding-inline: 18px;
}

.panel-header {
  min-height: 44px;
  height: auto;
  padding: 8px 12px;
}

.panel-header h2,
.personnel-workspace-header h2,
.database-section-heading h3,
.foundation-section-heading h3,
.foundation-card-title h3,
.foundation-action-card h3 {
  color: var(--ui-color-heading);
  font-size: var(--ui-font-section);
  line-height: var(--ui-line-compact);
}

.foundation-section-heading p,
.foundation-action-card p,
.historical-order-commandbar p,
.historical-order-upload-card p {
  color: var(--ui-color-muted);
  font-size: var(--ui-font-body);
  line-height: var(--ui-line-body);
}

.historical-order-actions,
.historical-query-actions,
.screening-pool-v2-upload-actions,
.screening-pool-v2-confirm,
.foundation-inline-actions,
.table-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--ui-space-2);
}

.historical-order-query-builder-title {
  gap: var(--ui-space-3);
}

.historical-query-actions button,
.historical-query-actions .primary-btn,
.customer-registry-query-actions .secondary-btn,
.customer-registry-query-actions .primary-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  height: var(--ui-control-height);
  min-height: var(--ui-control-height);
  margin: 0;
  padding: 0 14px;
}

.foundation-filter-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--ui-space-2);
  margin: var(--ui-space-3) 0;
}

.foundation-filter-row label {
  flex: 0 1 var(--ui-control-width-md);
  gap: var(--ui-space-1);
  margin: 0;
  color: #4e687d;
  font-size: var(--ui-font-table);
}

.foundation-filter-row label:first-child {
  flex-basis: var(--ui-control-width-lg);
}

.foundation-filter-row input,
.foundation-filter-row select {
  width: 100%;
  max-width: var(--ui-control-width-md);
  min-height: var(--ui-control-height);
  padding-block: 0;
}

.foundation-filter-row label:first-child input,
.foundation-filter-row label:first-child select,
.foundation-filter-row > input:first-child,
.foundation-filter-row > select:first-child {
  max-width: var(--ui-control-width-lg);
}

.foundation-filter-row > button,
.foundation-filter-row > .primary-btn,
.foundation-filter-row > .secondary-btn {
  align-self: flex-end;
}

.foundation-filter-row.model-active-form {
  display: flex;
}

.foundation-table-scroll,
.historical-order-table-wrap,
.database-table-scroll,
.system-monitor-table-wrap {
  max-width: 100%;
  border-color: var(--ui-color-border);
  border-radius: var(--ui-radius-card);
}

.foundation-table-scroll th,
.foundation-table-scroll td,
.historical-order-table-wrap th,
.historical-order-table-wrap td,
.personnel-info-table th,
.personnel-info-table td,
.organization-table th,
.organization-table td,
.database-catalog-table th,
.database-catalog-table td {
  padding: var(--ui-table-cell-y) var(--ui-table-cell-x);
  border-color: #e5edf2;
  font-size: var(--ui-font-table);
  line-height: var(--ui-line-compact);
  vertical-align: middle;
}

.foundation-table-scroll th,
.historical-order-table-wrap th,
.personnel-info-table th,
.organization-table th,
.database-catalog-table th {
  color: #365267;
  background: #eef4f7;
  font-weight: 700;
}

.foundation-pager,
.historical-order-table-footer,
.customer-registry-table-footer {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--ui-space-2) var(--ui-space-3);
  margin-top: var(--ui-space-3);
  color: var(--ui-color-muted);
  font-size: var(--ui-font-table);
  line-height: var(--ui-control-height);
}

.foundation-pager-controls,
.historical-order-table-footer > div,
.customer-registry-table-footer > div {
  display: flex;
  align-items: center;
  gap: var(--ui-space-2);
  margin-left: 0;
}

.foundation-page-jump {
  font-size: var(--ui-font-table);
  line-height: var(--ui-control-height);
}

.database-empty-state,
.historical-order-query-empty,
.historical-order-loading,
.personnel-detail-empty,
.inbox-empty {
  min-height: 180px;
  color: #718096;
  font-size: var(--ui-font-body);
  line-height: var(--ui-line-body);
}

.personnel-tree-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.personnel-inactive-button {
  width: auto;
  min-height: var(--ui-control-height);
  align-self: flex-start;
  margin: 8px 12px 12px;
  padding: 0 14px;
  white-space: nowrap;
}

.personnel-change-toolbar {
  justify-content: flex-start;
}

.personnel-change-toolbar .primary-btn {
  margin-left: 0;
}

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

.personnel-deactivation-block {
  align-items: flex-start;
}

.personnel-deactivation-block small {
  text-align: left;
}

.personnel-management-view {
  min-height: 0;
  height: calc(100dvh - 24px);
}

.personnel-management-view > .panel,
.personnel-workspace-panel,
#personnelListView {
  min-height: 0;
  height: 100%;
}

.personnel-workspace-panel,
#personnelListView {
  display: flex;
  flex-direction: column;
}

.personnel-workspace-pane {
  min-height: 0;
  overflow: auto;
}

.personnel-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.personnel-org-tree {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

body.module-database {
  height: 100dvh;
  overflow: hidden;
}

body.module-database .main-view {
  height: 100dvh;
  min-height: 0;
}

body.module-database .sidebar {
  height: 100dvh;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

body.module-database .content {
  height: 100dvh;
  overflow: hidden;
}

.database-management-view {
  display: flex;
  height: calc(100dvh - 24px);
  min-height: 0;
  flex-direction: column;
}

.database-management-view.hidden {
  display: none;
}

.database-summary-cards {
  flex: 0 0 auto;
}

.database-workspace-panel {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.database-tabs-toolbar {
  display: flex;
  min-width: 0;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: var(--ui-space-2);
  padding: 8px 10px 0;
  border-bottom: 1px solid var(--ui-color-border);
  background: #f8fbfc;
}

.database-view-tabs {
  min-width: 0;
  max-width: calc(100% - 84px);
  flex: 0 1 auto;
  overflow-x: auto;
  padding: 0;
  border-bottom: 0;
  scrollbar-width: thin;
}

.database-view-tabs button {
  min-width: 0;
  height: var(--ui-control-height);
  padding: 0 12px;
  font-size: var(--ui-font-body);
}

.database-refresh-btn {
  flex: 0 0 auto;
  align-self: center;
  margin-bottom: 7px;
}

.database-view-status {
  min-height: 0;
  flex: 0 0 auto;
  padding: 7px 12px;
  font-size: var(--ui-font-meta);
}

.database-view-status:empty,
.database-view-status.hidden {
  display: none;
}

.database-view-content {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px 12px 14px;
}

body.module-database .foundation-table-scroll,
body.module-database .historical-order-table-wrap,
body.module-database .database-table-scroll {
  max-height: min(58dvh, 620px);
  overflow: auto;
}

body.module-database .customer-registry-query-table,
body.module-database .screening-pool-v2-table,
body.module-database .screening-push-settings-table {
  overflow: auto;
}

.database-view-content.model-library-sample-content {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 10px;
}

.database-view-content.model-library-sample-content .model-sample-card {
  display: flex;
  min-height: 0;
  height: 100%;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.database-view-content.model-library-sample-content .foundation-card-title,
.database-view-content.model-library-sample-content .foundation-filter-row,
.database-view-content.model-library-sample-content .foundation-pager {
  flex: 0 0 auto;
}

body.module-database .database-view-content.model-library-sample-content .model-sample-table {
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
}

@media (max-width: 760px) {
  .foundation-filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .foundation-filter-row label,
  .foundation-filter-row label:first-child {
    width: min(100%, var(--ui-control-width-lg));
    flex-basis: auto;
  }

  .foundation-filter-row input,
  .foundation-filter-row select {
    width: 100%;
  }

  .personnel-management-view {
    height: auto;
  }

  body.module-database .content {
    height: 100dvh;
    padding: 56px 9px 9px;
  }

  .database-management-view {
    height: calc(100dvh - 65px);
  }

  .database-tabs-toolbar {
    align-items: center;
    padding-inline: 8px;
  }

  .database-view-tabs button {
    flex: 0 0 auto;
    min-width: 78px;
  }

  .database-view-content.model-library-sample-content {
    overflow: auto;
  }

  .database-view-content.model-library-sample-content .model-sample-card {
    min-height: 640px;
    height: auto;
    overflow: visible;
  }
}

/* R2-010: shared spacing for the four visible settings workspaces only. */
body:is(.module-personnel-management:has(#personnelManagementView:not(.hidden)), .module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)), .module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden)), .module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden))) {
  --settings-space: 8px;
  --settings-directory-width: clamp(240px, 18vw, 290px);
}

body:is(.module-personnel-management:has(#personnelManagementView:not(.hidden)), .module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)), .module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden)), .module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden))) #mainView > .content {
  padding: var(--settings-space);
}

body:is(.module-personnel-management:has(#personnelManagementView:not(.hidden)), .module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)), .module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden)), .module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden))) :is(#personnelManagementView, .permission-workspace, #areaAssignmentModule > .layout-grid) {
  gap: var(--settings-space);
}

body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) #mainView { min-width: 0; }
body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) #personnelPermissionsView:not(.hidden) {
  min-height: 0;
  padding: 0;
}

@media (min-width: 1181px) {
  body.module-personnel-management:has(#personnelManagementView:not(.hidden)) #personnelManagementView {
    grid-template-columns: var(--settings-directory-width) minmax(0, 1fr);
  }
}

/* The existing stacked permission layout remains below 1001px. */
@media (min-width: 1001px) {
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) { height: 100dvh; overflow: hidden; }
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) #mainView {
    height: 100dvh;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) #mainView > .sidebar {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) #mainView > .content {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) #personnelPermissionsView:not(.hidden) {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: auto;
  }
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) #accessPermissionMessage { flex: 0 0 auto; }
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) .permission-workspace {
    flex: 1 1 0;
    min-height: 0;
    grid-template-columns: var(--settings-directory-width) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
  }
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) :is(.permission-directory, .permission-matrix-panel) {
    display: flex;
    flex-direction: column;
    position: static;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: none;
    overflow: hidden;
  }
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) :is(.permission-directory, .permission-matrix-panel) > :is(.access-panel-title, .org-tree-search) {
    flex: 0 0 auto;
  }
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) :is(#permissionDirectoryTree, .permission-matrix-scroll) {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow: auto;
    overscroll-behavior: contain;
  }
  /* The log view replaces the matrix; its filters and pagination stay reachable. */
  body.module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)) .permission-log-panel { flex: 0 0 auto; }
}

@media (max-width: 720px) {
  /* Keep room for the existing mobile navigation button. */
  body:is(.module-personnel-management:has(#personnelManagementView:not(.hidden)), .module-personnel-permissions:has(#personnelPermissionsView:not(.hidden)), .module-sales-assignment:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden)), .module-department-scope:has(#areaAssignmentModule:not(.hidden) > .layout-grid:not(.hidden))) #mainView > .content { padding-top: 56px; }
}

/* R2-011: a single signed-in viewport, independently scrolling navigation. */
html body:has(#app > #mainView:not(.hidden)) {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}
html body:has(#app > #mainView.hidden) {
  height: auto;
  min-height: 100dvh;
  overflow: auto;
}
body:has(#mainView:not(.hidden)) #app > #mainView {
  --workspace-gap: 8px;
  height: 100dvh;
  min-height: 0;
  min-width: 0;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}
body:has(#mainView:not(.hidden)) #app > #mainView > .sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
#app > #mainView > .sidebar > .system-title { flex: 0 0 auto; }
#app > #mainView > .sidebar > #moduleMenu {
  flex: 1 1 0;
  min-height: 0;
  padding: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
#app > #mainView > .sidebar > .sidebar-footer {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(142, 190, 211, .2);
  background: #0d1b2f;
}
#logoutBtn {
  width: min(100%, 140px);
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid #4ba4a7;
  border-radius: 4px;
  color: #e2f5f4;
  background: #143b49;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
#logoutBtn:hover:not(:disabled) { background: #0f8f8c; color: #fff; }
#logoutBtn:focus-visible { outline: 2px solid #68d5ca; outline-offset: 2px; }
#logoutBtn:disabled { opacity: .65; cursor: wait; }
#logoutMessage { margin: 0; color: #ffd4ce; font-size: 12px; overflow-wrap: anywhere; }
#logoutMessage:empty { display: none; }
@media (min-width: 721px) {
  #mainView.leads-sidebar-collapsed > .sidebar > .sidebar-footer { visibility: hidden; }
}
body:has(#mainView:not(.hidden)) #app > #mainView > main.content {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: none;
  padding: 8px;
  gap: 8px;
  overflow: auto;
  overscroll-behavior: contain;
}
/* Custom modules hide the inner grid rather than the old region wrapper. */
#mainView > main.content > #areaAssignmentModule:not(:has(> .layout-grid:not(.hidden))) {
  display: none;
}
#mainView > main.content > .topbar { flex: 0 0 auto; margin-bottom: 0; gap: 8px; }
@media (min-width: 761px) {
  #mainView > main.content > #areaAssignmentModule:has(> .layout-grid:not(.hidden)) {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
  }
  #mainView #areaAssignmentModule > .layout-grid:not(.hidden) {
    height: 100%;
    min-height: 0;
    gap: 8px;
    align-items: stretch;
    overflow: auto;
  }
  #mainView #areaAssignmentModule > .layout-grid > .panel:not(.hidden) {
    min-height: 0;
    height: 100%;
    overflow: auto;
  }
  #mainView #areaAssignmentModule > .layout-grid > .map-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #mainView #areaAssignmentModule .map-panel > :not(#mapCanvas) { flex: 0 0 auto; }
  #mainView #areaAssignmentModule #mapCanvas.region-browser {
    flex: 1 1 0;
    min-height: 0;
    gap: 8px;
  }
}
#mainView #areaAssignmentModule :is(.layout-grid, .department-map-summary) { gap: 8px; }
@media (min-width: 1181px) {
  #mainView > main.content > #personnelManagementView:not(.hidden) {
    flex: 1 1 0;
    height: 100%;
    min-height: 0;
  }
}
@media (min-width: 1001px) {
  #mainView > main.content > #personnelPermissionsView:not(.hidden) {
    flex: 1 1 0;
    height: 100%;
    min-height: 0;
  }
}
@media (max-width: 1180px) {
  #mainView > main.content > #personnelManagementView:not(.hidden) {
    flex: 0 0 auto;
    height: auto;
    min-height: 100%;
  }
}
@media (max-width: 1000px) {
  #mainView > main.content > #personnelPermissionsView:not(.hidden) {
    flex: 0 0 auto;
    height: auto;
    min-height: 100%;
  }
}
@media (max-width: 720px) {
  body:has(#mainView:not(.hidden)) #app > #mainView > main.content { padding-top: 56px; }
}

/* R2-011: module interiors; append after existing styles.
   The shared shell owns main.content padding:8px and its bounded height.
   Visible guards are required because custom modules leave hidden siblings in DOM. */

#databaseManagementView:not(.hidden) {
  height: 100%;
  min-height: 0;
  flex: 1 1 0;
  gap: 0;
}
#databaseManagementView:not(.hidden) > .database-summary-cards {
  gap: 8px;
  margin: 0 0 8px;
}
#databaseManagementView:not(.hidden) > .database-workspace-panel {
  min-height: 0;
  margin: 0;
}
#databaseManagementView:not(.hidden) .database-tabs-toolbar { gap: 8px; padding: 8px 8px 0; }
#databaseManagementView:not(.hidden) .database-view-status { padding: 8px; }
#databaseManagementView:not(.hidden) #databaseViewContent { padding: 8px; }
#databaseManagementView:not(.hidden) :is(.database-relation-grid, .database-profile-grid, .database-quality-grid, .historical-order-metrics) { gap: 8px; }

/* Keep ordinary multi-card database dashboards scrolling as before.
   Only the archive's single list/detail workbench receives the extra flex chain. */
#databaseManagementView:not(.hidden) #databaseViewContent:has(> :is(.signed-history-shell, .signed-history-detail)) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#databaseManagementView:not(.hidden) :is(.signed-history-shell, .signed-history-detail) {
  flex: 1 0 auto;
  min-height: 100%;
  gap: 8px;
}
#databaseManagementView:not(.hidden) .signed-history-heading { padding-bottom: 0; }
#databaseManagementView:not(.hidden) .signed-history-query { gap: 8px; padding: 8px; }
#databaseManagementView:not(.hidden) .signed-history-table-wrap { max-height: none; }
#databaseManagementView:not(.hidden) .signed-history-detail-header { gap: 8px; padding: 8px; }
#databaseManagementView:not(.hidden) .signed-history-detail-content { padding-bottom: 8px; }

#systemMonitorView:not(.hidden) {
  height: 100%;
  min-height: 0;
  flex: 1 1 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
#systemMonitorView:not(.hidden) > #systemMonitorContent {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  gap: 8px;
}
#systemMonitorView:not(.hidden) #systemMonitorContent > * { flex: 0 0 auto; }
#systemMonitorView:not(.hidden) #systemMonitorContent > .system-monitor-panel:last-child { flex: 1 0 auto; }
#systemMonitorView:not(.hidden) :is(.system-monitor-metric-row, .system-monitor-resource-grid) { gap: 8px; }
#systemMonitorView:not(.hidden) .system-monitor-server-hero { margin-bottom: 0; }
#systemMonitorView:not(.hidden) .system-monitor-panel-heading { gap: 8px; margin-bottom: 8px; }
#systemMonitorView:not(.hidden) .system-monitor-filters { gap: 8px; margin-bottom: 8px; }
#systemMonitorView:not(.hidden) .system-monitor-pagination { gap: 8px; margin-top: 8px; }

/* Do not use .access-page here: personnel permissions share that class. */
#systemIntroView:not(.hidden) {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  flex: 1 1 0;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
#systemIntroView:not(.hidden) > .system-intro-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  flex: 1 0 auto;
}
#systemIntroView:not(.hidden) .leads-home-hero {
  min-height: 0;
  flex: 1 0 auto;
}
#systemIntroView:not(.hidden) :is(.intro-detail-layout, .feedback-workspace) {
  min-height: 0;
  flex: 1 0 auto;
  gap: 8px;
}
#systemIntroView:not(.hidden) .intro-content-grid { gap: 8px; }
#systemIntroView:not(.hidden) .feedback-card-list { gap: 8px; }

/* At desktop widths, two columns share one frame and scroll independently.
   Existing <=1000px stacked layouts retain natural height and parent scrolling. */
@media (min-width: 1001px) {
  #systemIntroView:not(.hidden):not(.system-intro-home-view) > .system-intro-content {
    height: 100%;
    min-height: 0;
    flex: 1 1 0;
    overflow: hidden;
  }
  #systemIntroView:not(.hidden) :is(.intro-detail-layout, .feedback-workspace) {
    height: 100%;
    min-height: 0;
    flex: 1 1 0;
    align-items: stretch;
    overflow: hidden;
  }
  #systemIntroView:not(.hidden) :is(.intro-detail-nav, .intro-detail-content, .feedback-submit-panel) {
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }
  #systemIntroView:not(.hidden) .feedback-log-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  #systemIntroView:not(.hidden) .feedback-log-panel > .access-panel-title { flex: 0 0 auto; }
  #systemIntroView:not(.hidden) .feedback-card-list {
    min-height: 0;
    max-height: none;
    flex: 1 1 0;
    overflow: auto;
    align-content: start;
  }
}

/* A short/narrow viewport keeps the natural flow so filters and pagination stay
   reachable. Normal desktop lists use the available remainder for table scroll. */
@media (min-width: 1001px) and (min-height: 640px) {
  #systemMonitorView:not(.hidden) > #systemMonitorContent:has(> .system-monitor-login-panel) {
    height: 100%;
    min-height: 0;
  }
  #systemMonitorView:not(.hidden) #systemMonitorContent > .system-monitor-login-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 0;
  }
  #systemMonitorView:not(.hidden) .system-monitor-login-panel > * { flex: 0 0 auto; }
  #systemMonitorView:not(.hidden) .system-monitor-login-panel > .system-monitor-table-wrap {
    min-height: 0;
    max-height: none;
    flex: 1 1 0;
    overflow: auto;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent:has(> :is(.signed-history-shell, .signed-history-detail)) { overflow: hidden; }
  #databaseManagementView:not(.hidden) :is(.signed-history-shell, .signed-history-detail) {
    height: 100%;
    min-height: 0;
    flex: 1 1 0;
  }
  #databaseManagementView:not(.hidden) :is(.signed-history-shell, .signed-history-detail) > * { flex: 0 0 auto; }
  #databaseManagementView:not(.hidden) :is(.signed-history-table-wrap, .signed-history-detail-content) {
    min-height: 0;
    max-height: none;
    flex: 1 1 0;
    overflow: auto;
    overscroll-behavior: contain;
  }
}

/* Single query workbenches: historical orders/sales, enterprise registry,
   historical customers and current screening-pool queries share the condition
   list. JobList has its own query box. These direct-child contracts exclude
   statistics, multi-card profiles, upload workflows and modal tables. */
#databaseManagementView:not(.hidden) #databaseViewContent:has(> .historical-order-panel > .historical-order-query-builder > .historical-order-condition-list, > .historical-order-panel > .joblist-query-box) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 8px;
}
#databaseManagementView:not(.hidden) #databaseViewContent > .historical-order-panel:has(> .historical-order-query-builder > .historical-order-condition-list, > .joblist-query-box) {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-height: 100%;
  gap: 8px;
  padding: 8px;
}
#databaseManagementView:not(.hidden) #databaseViewContent > .historical-order-panel:has(> .historical-order-query-builder > .historical-order-condition-list, > .joblist-query-box) > * {
  flex: 0 0 auto;
}
#databaseManagementView:not(.hidden) #databaseViewContent > .historical-order-panel:has(> .historical-order-query-builder > .historical-order-condition-list, > .joblist-query-box) > :is(.historical-order-divider, .historical-order-result-heading, .historical-order-metrics, .historical-order-table-footer, .joblist-query-box, .joblist-pagination) {
  margin-top: 0;
  margin-bottom: 0;
}
@media (min-width: 1001px) and (min-height: 640px) {
  #databaseManagementView:not(.hidden) #databaseViewContent > .historical-order-panel:has(> .historical-order-query-builder > .historical-order-condition-list, > .joblist-query-box) {
    flex: 1 1 0;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent > .historical-order-panel:has(> .historical-order-query-builder > .historical-order-condition-list, > .joblist-query-box) > :is(.historical-order-table-wrap, .joblist-result-table, .historical-order-query-empty) {
    height: auto;
    min-height: 120px;
    max-height: none;
    flex: 1 1 0;
    overflow: auto;
    overscroll-behavior: contain;
  }
}

/* R2-011: customer management pages. Append after the common 8px frame rules.
   ID specificity also overrides the later styles injected by customer_lifecycle_v1.js.
   Keep map behavior and narrow-screen stacking unchanged. */
#databaseManagementView.customer-lifecycle-compact-chrome #databaseViewContent {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow: auto;
}

#databaseManagementView.customer-lifecycle-compact-chrome #databaseViewContent > .historical-order-panel {
  box-sizing: border-box;
  min-width: 0;
  flex: 1 0 auto;
  margin: 0;
  padding: 8px;
}

#databaseManagementView.customer-lifecycle-compact-chrome .historical-order-panel > .historical-order-commandbar {
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
}

#databaseManagementView.customer-lifecycle-compact-chrome .historical-order-panel > .historical-order-metrics {
  gap: 8px;
  margin-bottom: 8px;
}

#databaseManagementView.customer-lifecycle-compact-chrome .historical-order-panel > .historical-order-query-tip:last-child {
  margin-bottom: 0;
}

#databaseManagementView.customer-lifecycle-compact-chrome .historical-board-shell,
#databaseManagementView.customer-lifecycle-compact-chrome .historical-board-map-layout {
  gap: 8px;
}

#databaseManagementView.customer-lifecycle-compact-chrome .historical-board-shell > .historical-board-main {
  padding: 8px;
}

#databaseManagementView.customer-lifecycle-compact-chrome .historical-board-main-detail .historical-board-detail {
  padding-bottom: 8px;
}

#databaseManagementView.customer-lifecycle-compact-chrome .inbox-folders,
#databaseManagementView.customer-lifecycle-compact-chrome .inbox-customer-list {
  padding: 8px;
}

@media (min-width: 981px) {
  /* Use the available parent height instead of the old viewport - 16px formulas. */
  #databaseManagementView.customer-lifecycle-compact-chrome #databaseViewContent > .historical-board-shell,
  #databaseManagementView.customer-lifecycle-compact-chrome #databaseViewContent > .lifecycle-viewport-panel {
    height: auto;
    min-height: 0;
    flex: 1 1 0;
  }

  #databaseManagementView.customer-lifecycle-compact-chrome .historical-board-main,
  #databaseManagementView.customer-lifecycle-compact-chrome .lifecycle-viewport-panel {
    overflow: auto;
  }

  #databaseManagementView.customer-lifecycle-compact-chrome .lifecycle-viewport-panel > .foundation-table-scroll {
    flex: 1 0 180px;
    max-height: none;
    overflow: auto;
  }

  #databaseManagementView.customer-lifecycle-compact-chrome .lifecycle-viewport-panel > :not(.foundation-table-scroll) {
    flex-shrink: 0;
  }
}

@media (min-width: 761px) {
  #databaseManagementView.customer-lifecycle-compact-chrome #databaseViewContent > .inbox-shell {
    height: auto;
    min-height: 0;
    flex: 1 1 0;
    grid-template-rows: minmax(0, 1fr);
  }

  #databaseManagementView.customer-lifecycle-compact-chrome .inbox-folders {
    min-height: 0;
    overflow: auto;
  }

  #databaseManagementView.customer-lifecycle-compact-chrome .inbox-messages > header,
  #databaseManagementView.customer-lifecycle-compact-chrome .inbox-messages > .historical-order-pagination {
    flex-shrink: 0;
  }
}

/* R2-012: database toolbar and field-profile workbenches.
   R2-011 matched query controls and intentionally excluded profiles; these
   profiles are single field tables, so their leaf panels also need to stretch. */
#databaseManagementView:not(.hidden) > .database-workspace-panel > .database-tabs-toolbar {
  align-items: flex-end;
  gap: 8px;
}
#databaseManagementView:not(.hidden) .database-tabs-toolbar > .database-view-tabs {
  min-width: 0;
  max-width: none;
  flex: 1 1 auto;
  overflow-x: auto;
}
#databaseManagementView:not(.hidden) .database-view-tabs > button {
  height: 40px;
  min-width: 88px;
  flex: 0 0 auto;
  padding-inline: 14px;
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
}
#databaseManagementView:not(.hidden) .database-tabs-toolbar > #databaseRefreshBtn {
  height: 40px;
  min-height: 40px;
  flex: 0 0 auto;
  align-self: flex-end;
  margin: 0 0 0 auto;
  padding-inline: 16px;
  font-size: 14px;
}

/* Exact rendered contracts: orders/sales/registry/historical-customer profiles
   use historical-order-field-table; JobList uses joblist-image-table. */
#databaseManagementView:not(.hidden) #databaseViewContent:has(> .historical-order-panel > :is(.historical-order-field-table, .joblist-image-table)) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 8px;
}
#databaseManagementView:not(.hidden) #databaseViewContent:has(> .historical-order-panel > :is(.historical-order-field-table, .joblist-image-table)) > .historical-order-commandbar {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px;
}
#databaseManagementView:not(.hidden) #databaseViewContent > .historical-order-panel:has(> :is(.historical-order-field-table, .joblist-image-table)) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 0 auto;
  gap: 8px;
  padding: 8px;
}
#databaseManagementView:not(.hidden) #databaseViewContent > .historical-order-panel:has(> :is(.historical-order-field-table, .joblist-image-table)) > * {
  flex: 0 0 auto;
  margin-top: 0;
  margin-bottom: 0;
}
@media (min-width: 1001px) and (min-height: 640px) {
  #databaseManagementView:not(.hidden) #databaseViewContent > .historical-order-panel:has(> :is(.historical-order-field-table, .joblist-image-table)) {
    flex: 1 1 0;
    overflow: auto;
    overscroll-behavior: contain;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent > .historical-order-panel > :is(.historical-order-field-table, .joblist-image-table) {
    height: auto;
    min-height: 120px;
    max-height: none;
    flex: 1 1 0;
    overflow: auto;
    overscroll-behavior: contain;
  }
}

/* Served v5 cleaned view: the heading is a direct child only in cleaned mode;
   pending strategies keep their existing layout. */
#databaseManagementView:not(.hidden) #databaseViewContent:has(> .customer-cleaning-query > .customer-cleaning-toolbar) {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#databaseManagementView:not(.hidden) #databaseViewContent > .customer-cleaning-query:has(> .customer-cleaning-toolbar) {
  height: auto;
  min-height: 0;
  flex: 1 0 auto;
  gap: 8px;
}
#databaseManagementView:not(.hidden) #databaseViewContent > .customer-cleaning-query:has(> .customer-cleaning-toolbar) > :is(.customer-cleaning-toolbar, .customer-cleaning-control-grid, .customer-cleaning-footer) {
  flex: 0 0 auto;
  margin-top: 0;
  margin-bottom: 0;
}
@media (min-width: 1001px) and (min-height: 640px) {
  #databaseManagementView:not(.hidden) #databaseViewContent > .customer-cleaning-query:has(> .customer-cleaning-toolbar) {
    flex: 1 1 0;
    overflow: auto;
    overscroll-behavior: contain;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent > .customer-cleaning-query:has(> .customer-cleaning-toolbar) > .customer-cleaning-table {
    height: auto;
    min-height: 120px;
    max-height: none;
    flex: 1 1 0;
    overflow: auto;
  }
}

/* R2-012: acknowledge registry entry without delaying fast responses. */
#databaseManagementView:not(.hidden) .registry-entry-loading {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 24px 8px;
  color: #284b63;
}
#databaseManagementView:not(.hidden) .registry-entry-loading p { margin: 0; }
#databaseManagementView:not(.hidden) .registry-entry-loading.is-slow {
  border-color: #92cdcf;
  background: #f0f9f9;
}
.registry-entry-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #d3e8eb;
  border-top-color: #149393;
  border-radius: 50%;
  animation: registry-entry-spin 900ms linear infinite;
}
@keyframes registry-entry-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .registry-entry-spinner { animation: none; }
}

/* R2-013: upload controls belong to the statistics heading. */
#databaseManagementView:not(.hidden) .historical-order-upload-progress-heading {
  align-items: flex-start;
  gap: 8px;
}
#databaseManagementView:not(.hidden) .historical-upload-heading-tools,
#databaseManagementView:not(.hidden) .historical-upload-heading-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
#databaseManagementView:not(.hidden) .historical-upload-heading-tools {
  margin-left: auto;
  text-align: right;
}
#databaseManagementView:not(.hidden) .historical-upload-heading-actions .historical-order-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
#databaseManagementView:not(.hidden) .historical-upload-selected-file {
  overflow-wrap: anywhere;
  max-width: min(440px, 100%);
}


/* R2-027: shared single-table pages. The earlier query rule only covered
   historical-order-table-wrap; registry inactive/review/backup pages use
   foundation-table-scroll, and screening custom tabs have no query builder.
   Require a direct table plus pagination, so dashboards, cards and modals do
   not inherit the fill layout. Hidden custom module siblings stay excluded. */
#databaseManagementView:not(.hidden) #databaseViewContent:has(> .historical-order-panel > :is(.historical-order-table-wrap,.foundation-table-scroll) ~ .historical-order-table-footer){display:flex;flex-direction:column;gap:8px;min-height:0}
#databaseManagementView:not(.hidden) #databaseViewContent:has(> .historical-order-panel > :is(.historical-order-table-wrap,.foundation-table-scroll) ~ .historical-order-table-footer)>*{flex:0 0 auto}
#databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-panel:has(> :is(.historical-order-table-wrap,.foundation-table-scroll) ~ .historical-order-table-footer){display:flex;flex-direction:column;gap:8px;padding:8px;flex:1 0 auto;min-height:0}
#databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-panel:has(> :is(.historical-order-table-wrap,.foundation-table-scroll) ~ .historical-order-table-footer)>*{flex:0 0 auto;min-width:0}
#databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-panel:has(> :is(.historical-order-table-wrap,.foundation-table-scroll) ~ .historical-order-table-footer)>.historical-order-table-footer{margin:0;gap:8px}
#databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-panel:has(> :is(.historical-order-table-wrap,.foundation-table-scroll) ~ .historical-order-table-footer)>.historical-order-metrics{margin:0;gap:8px}
#databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-commandbar{margin:0;padding:8px}
#databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-commandbar p{max-width:none}
@media(min-width:1001px) and (min-height:640px){
 #databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-panel:has(> :is(.historical-order-table-wrap,.foundation-table-scroll) ~ .historical-order-table-footer){flex:1 1 0;min-height:240px;overflow:auto;overscroll-behavior:contain}
 #databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-panel:has(> :is(.historical-order-table-wrap,.foundation-table-scroll) ~ .historical-order-table-footer)>:is(.historical-order-table-wrap,.foundation-table-scroll){height:auto;min-height:120px;max-height:none;flex:1 1 0;overflow:auto;overscroll-behavior:contain}
}


/* R2-028: screening upload's two history tables share the remaining height.
   This visible, direct-child guard excludes other upload modules and modals. */
#databaseManagementView:not(.hidden) #databaseViewContent:has(>.screening-upload-workspace){display:flex;flex-direction:column;min-height:0;gap:8px}
#databaseManagementView:not(.hidden) .screening-upload-workspace{display:flex;flex-direction:column;flex:1 0 auto;min-width:0;min-height:100%;gap:8px}
#databaseManagementView:not(.hidden) .screening-upload-workspace>*{flex:0 0 auto;min-width:0;margin:0}
#databaseManagementView:not(.hidden) .screening-upload-workspace .foundation-inline-actions{display:flex;flex-wrap:nowrap;gap:8px}
#databaseManagementView:not(.hidden) .screening-upload-workspace .foundation-inline-actions button{width:auto;flex:0 0 auto}
#databaseManagementView:not(.hidden) .screening-upload-history{display:flex;flex-direction:column;gap:8px;padding:8px}
#databaseManagementView:not(.hidden) .screening-upload-history>.historical-order-upload-progress-heading{flex:0 0 auto;margin:0;gap:8px}
#databaseManagementView:not(.hidden) .screening-upload-history>.customer-registry-upload-operation-layout{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;min-width:0}
#databaseManagementView:not(.hidden) .screening-upload-history>.customer-registry-upload-operation-layout>article{display:flex;flex-direction:column;min-width:0;gap:8px}
#databaseManagementView:not(.hidden) .screening-upload-history h4{flex:0 0 auto;margin:0}
@media(min-width:1001px) and (min-height:640px){
 #databaseManagementView:not(.hidden) .screening-upload-workspace{min-height:0;flex:1 1 0;overflow:auto}
 #databaseManagementView:not(.hidden) .screening-upload-workspace>.screening-upload-history{min-height:260px;flex:1 1 0;overflow:hidden}
 #databaseManagementView:not(.hidden) .screening-upload-history>.customer-registry-upload-operation-layout{flex:1 1 0;min-height:0}
 #databaseManagementView:not(.hidden) .screening-upload-history>.customer-registry-upload-operation-layout>article{min-height:0;overflow:hidden}
 #databaseManagementView:not(.hidden) .screening-upload-history .foundation-table-scroll{height:auto;min-height:120px;max-height:none;flex:1 1 0;overflow:auto;overscroll-behavior:contain}
}
@media(max-width:1000px){
 #databaseManagementView:not(.hidden) .screening-upload-history>.customer-registry-upload-operation-layout{grid-template-columns:1fr}
}

/* R2-029: carry remaining workspace height through upload grids into both tables. */
@media(min-width:1001px) and (min-height:640px){
 #databaseManagementView:not(.hidden) .screening-upload-history>.customer-registry-upload-operation-layout{align-items:stretch;grid-template-rows:minmax(0,1fr)}
 #databaseManagementView:not(.hidden) #databaseViewContent:has(>.historical-order-upload-progress){display:flex;flex-direction:column;gap:8px;min-height:0}
 #databaseManagementView:not(.hidden) #databaseViewContent:has(>.historical-order-upload-progress)>*{flex:0 0 auto;margin-top:0;margin-bottom:0}
 #databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-upload-progress{display:flex;flex-direction:column;gap:8px;flex:1 1 0;min-height:280px;padding:8px;overflow:auto}
 #databaseManagementView:not(.hidden) .historical-order-upload-progress>:is(.historical-order-upload-operation-layout,.customer-registry-upload-operation-layout){flex:1 1 0;min-height:0;align-items:stretch;grid-template-rows:minmax(0,1fr)}
 #databaseManagementView:not(.hidden) .historical-order-upload-progress :is(.historical-order-upload-operation-layout,.customer-registry-upload-operation-layout)>article{display:flex;flex-direction:column;gap:8px;min-height:0;min-width:0}
 #databaseManagementView:not(.hidden) .historical-order-upload-progress h4{flex:0 0 auto;margin:0}
 #databaseManagementView:not(.hidden) .historical-order-upload-progress :is(.foundation-table-scroll,.historical-order-table-wrap){flex:1 1 0;height:auto;min-height:120px;max-height:none;overflow:auto;overscroll-behavior:contain}
}

/* Single-table quality/review pages do not necessarily have a pagination footer. */
@media(min-width:1001px) and (min-height:640px){
 #databaseManagementView:not(.hidden) #databaseViewContent:has(>.historical-order-panel>:is(.customer-registry-quality-table,.screening-pool-review-table)){display:flex;flex-direction:column;gap:8px;min-height:0}
 #databaseManagementView:not(.hidden) #databaseViewContent:has(>.historical-order-panel>:is(.customer-registry-quality-table,.screening-pool-review-table))>*{flex:0 0 auto;margin:0}
 #databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-panel:has(>:is(.customer-registry-quality-table,.screening-pool-review-table)){display:flex;flex-direction:column;gap:8px;flex:1 1 0;min-height:220px;overflow:auto;padding:8px}
 #databaseManagementView:not(.hidden) #databaseViewContent>.historical-order-panel>:is(.customer-registry-quality-table,.screening-pool-review-table){flex:1 1 0;min-height:120px;max-height:none;overflow:auto}
 /* Both cleaned and pending pages share this structure; their toolbar depth differs. */
 #databaseManagementView:not(.hidden) #databaseViewContent:has(>.customer-cleaning-query){display:flex;flex-direction:column;min-height:0}
 #databaseManagementView:not(.hidden) #databaseViewContent>.customer-cleaning-query{display:flex;flex-direction:column;flex:1 1 0;min-height:0;overflow:auto}
 #databaseManagementView:not(.hidden) #databaseViewContent>.customer-cleaning-query>*{flex:0 0 auto}
 #databaseManagementView:not(.hidden) #databaseViewContent>.customer-cleaning-query>.customer-cleaning-table{flex:1 1 0;height:auto;min-height:120px;max-height:none;overflow:auto}
 /* Keep both log tables usable while allowing the workbench to scroll on shorter screens. */
 #databaseManagementView:not(.hidden) #databaseViewContent:has(>.customer-cleaning-logs){display:flex;flex-direction:column;min-height:0}
 #databaseManagementView:not(.hidden) #databaseViewContent>.customer-cleaning-logs{display:flex;flex-direction:column;flex:1 1 0;min-height:0;gap:8px;overflow:auto}
 #databaseManagementView:not(.hidden) .customer-cleaning-logs>*{flex:0 0 auto}
 #databaseManagementView:not(.hidden) .customer-cleaning-logs>.customer-cleaning-log-event-table{flex:2 1 0;min-height:120px;max-height:none;overflow:auto}
 #databaseManagementView:not(.hidden) .customer-cleaning-logs>.customer-cleaning-log-run-table{flex:1 1 0;min-height:120px;max-height:none!important;overflow:auto}
}

/* R2-029 integrated leaf workspaces. */

/* R2-029 candidate suggestion only: actual single-table leaves with unused height. */
@media (min-width:1001px) and (min-height:640px) {
  /* The message's customer list scrolls independently, keeping its own pager visible. */
  #databaseManagementView:not(.hidden) .inbox-reading-pane:has(> .inbox-customer-list) {
    display:flex;
    flex-direction:column;
    min-height:0;
    overflow:hidden;
  }
  #databaseManagementView:not(.hidden) .inbox-reading-pane:has(> .inbox-customer-list) > :not(.inbox-customer-list) {
    flex:0 0 auto;
  }
  #databaseManagementView:not(.hidden) .inbox-reading-pane > .inbox-customer-list {
    flex:1 1 0;
    min-height:0;
    overflow:auto;
  }
  /* Quality cards retain natural height; only their final conflict table consumes the remainder. */
  #databaseManagementView:not(.hidden) #databaseViewContent:has(> .historical-customer-quality-panel) {
    display:flex;
    flex-direction:column;
    min-height:0;
    overflow:hidden;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent:has(> .historical-customer-quality-panel) > .historical-customer-quality-heading {
    flex:0 0 auto;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent > .historical-customer-quality-panel {
    display:flex;
    flex:1 1 0;
    min-height:0;
    flex-direction:column;
    overflow:hidden;
  }
  #databaseManagementView:not(.hidden) .historical-customer-quality-panel > :not(.historical-customer-quality-table) {
    flex:0 0 auto;
  }
  #databaseManagementView:not(.hidden) .historical-customer-quality-panel > .historical-customer-quality-table {
    flex:1 1 0;
    min-height:0;
    max-height:none;
    overflow:auto;
  }

  /* Direct tables occur only on the board's orders/visits tabs. Other detail forms still scroll naturally. */
  #databaseManagementView:not(.hidden) .historical-board-detail:has(> .foundation-table-scroll) {
    display:flex;
    flex-direction:column;
    overflow:hidden;
  }
  #databaseManagementView:not(.hidden) .historical-board-detail:has(> .foundation-table-scroll) > :not(.foundation-table-scroll) {
    flex:0 0 auto;
  }
  #databaseManagementView:not(.hidden) .historical-board-detail > .foundation-table-scroll {
    flex:1 1 0;
    min-height:0;
    max-height:none;
    overflow:auto;
  }

  /* The archive contacts/contracts tabs contain a single table; work and audit pages keep their multi-section flow. */
  #databaseManagementView:not(.hidden) .signed-history-detail:has([data-signed-history-tab="contacts"].active, [data-signed-history-tab="contracts"].active) > .signed-history-detail-content {
    display:flex;
    flex-direction:column;
    overflow:hidden;
  }
  #databaseManagementView:not(.hidden) .signed-history-detail:has([data-signed-history-tab="contacts"].active, [data-signed-history-tab="contracts"].active) > .signed-history-detail-content > :not(.foundation-table-scroll) {
    flex:0 0 auto;
  }
  #databaseManagementView:not(.hidden) .signed-history-detail:has([data-signed-history-tab="contacts"].active, [data-signed-history-tab="contracts"].active) > .signed-history-detail-content > .foundation-table-scroll {
    flex:1 1 0;
    min-height:0;
    max-height:none;
    overflow:auto;
  }
}

@media (min-width: 1181px) {
/* R2-029 suggestions only: verified against actual renderer offline fixtures. */
#personnelManagementView:not(.hidden) #organizationChangeView:not(.hidden):not(:has(.organization-edit-form)) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
#personnelManagementView:not(.hidden) #organizationChangeView:not(:has(.organization-edit-form)) > :is(.personnel-change-toolbar, .personnel-log-section) {
  flex: 0 0 auto;
}
#personnelManagementView:not(.hidden) #organizationChangeContent:not(:has(.organization-edit-form)) {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
}
#personnelManagementView:not(.hidden) #organizationChangeContent:not(:has(.organization-edit-form)) > .organization-table-wrap {
  flex: 1 1 auto;
  height: 0;
  min-height: 120px;
  max-height: none;
  overflow: auto;
}


}

#mainView > main.content > #personnelPermissionsView:not(.hidden):has(> .permission-log-panel) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: auto;
}
body.module-personnel-permissions #personnelPermissionsView:not(.hidden) > .permission-log-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
#personnelPermissionsView:not(.hidden) .permission-log-panel > :is(.permission-log-title, .permission-log-filters, .permission-log-pagination) { flex: 0 0 auto; }
#personnelPermissionsView:not(.hidden) .permission-log-table-scroll {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: none;
  overflow: auto;
}

#systemMonitorView:not(.hidden) #systemMonitorContent:has(> .system-monitor-server-hero) { height: 100%; min-height: 0; }
#systemMonitorView:not(.hidden) #systemMonitorContent:has(> .system-monitor-server-hero) > .system-monitor-panel:last-child {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 160px;
}
#systemMonitorView:not(.hidden) #systemMonitorContent:has(> .system-monitor-server-hero) > .system-monitor-panel > .system-monitor-panel-heading { flex: 0 0 auto; }
#systemMonitorView:not(.hidden) #systemMonitorContent:has(> .system-monitor-server-hero) > .system-monitor-panel > .system-monitor-table-wrap {
  flex: 1 1 auto;
  min-height: 80px;
  max-height: none;
  overflow: auto;
}

/* Proposed R2-029 fix. Scope: actual JobList upload card only. */
@media (min-width: 761px) {
  #databaseManagementView:not(.hidden) #databaseViewContent:has(> .historical-order-panel > .joblist-upload-card) {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent > .historical-order-panel:has(> .joblist-upload-card),
  #databaseManagementView:not(.hidden) #databaseViewContent .joblist-upload-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    gap: 8px;
    padding: 8px;
    margin: 0;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent .joblist-upload-card > :not(.joblist-upload-history):not(.foundation-table-scroll) {
    flex: 0 0 auto;
    margin-top: 0;
    margin-bottom: 0;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent .joblist-upload-card > .foundation-table-scroll {
    flex: 0 1 160px;
    height: auto;
    min-height: 112px;
    max-height: 200px;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent .joblist-upload-history {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 143px;
    gap: 8px;
    margin: 0;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent .joblist-upload-history > h4 {
    flex: 0 0 auto;
    margin: 0;
  }
  #databaseManagementView:not(.hidden) #databaseViewContent .joblist-upload-history > .foundation-table-scroll {
    flex: 1 1 0;
    height: auto;
    min-height: 112px;
    max-height: none;
    overflow: auto;
  }
}

/* R2-032: customer-board map presentation, preserving circles, point colors and viewport geometry. */
#historicalCustomerMap .historical-board-cluster {
  background: rgba(255, 253, 248, .97);
  color: #5b351b;
  border-color: #c97735;
  box-shadow: 0 2px 8px rgba(89, 55, 28, .18), 0 0 0 1px rgba(255, 255, 255, .72);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .85);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
#historicalCustomerMap .historical-board-cluster:hover {
  background: #fff1da;
  border-color: #a8511c;
  box-shadow: 0 3px 10px rgba(89, 55, 28, .24), 0 0 0 2px rgba(255, 255, 255, .9);
}
#historicalCustomerMap .historical-board-cluster.is-residual {
  background: rgba(255, 251, 243, .97);
  color: #725336;
  border-color: #b99068;
  border-style: dashed;
}
#historicalCustomerMap .historical-board-cluster.active {
  background: #ffedd5;
  color: #7c2d12;
  border-color: #9a3412;
  outline: 3px solid rgba(249, 115, 22, .3);
  outline-offset: 2px;
}
#historicalCustomerMap .historical-board-cluster:focus-visible {
  outline: 3px solid #7c2d12;
  outline-offset: 3px;
}
#historicalCustomerMap .historical-board-map-legend:not(.is-status) {
  background: rgba(255, 253, 249, .96);
  border-color: #dfcbb5;
  color: #665143;
  box-shadow: 0 2px 8px rgba(89, 55, 28, .1);
}
#historicalCustomerMap .historical-board-map-legend:not(.is-status) strong {
  color: #5b351b;
}
#boardMapMode :is(.historical-board-map-scope-button, .historical-board-map-panel-reopen, .historical-board-map-control) {
  color: #4b443e;
  background: rgba(255, 253, 249, .96);
  border-color: #d9c7b5;
  box-shadow: 0 2px 8px rgba(65, 48, 34, .12);
}
#boardMapMode .historical-board-map-scope-button :is(span, strong) {
  color: #5b4637;
}
#boardMapMode :is(.historical-board-map-scope-button, .historical-board-map-panel-reopen, .historical-board-map-control):hover {
  background: #fff1df;
  border-color: #c97735;
}
#boardMapMode :is(.historical-board-map-scope-button, .historical-board-map-panel-reopen, .historical-board-map-control, [data-board-map-panel-toggle]):focus-visible {
  outline: 2px solid #a8511c;
  outline-offset: 2px;
}
#boardMapMode .historical-board-map-control {
  width: auto;
  min-width: 32px;
  height: 32px;
  margin: 0;
  padding: 0 10px;
  border-width: 1px;
  border-style: solid;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
}


/* R2-033: compact map-level navigation; does not occupy the map grid. */
#boardMapMode .historical-board-map-navigation {
  position: absolute;
  top: 58px;
  left: 12px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 24px);
  padding: 5px 8px;
  border: 1px solid #dfcbb5;
  border-radius: 7px;
  background: rgba(255, 253, 248, .97);
  color: #5b351b;
  box-shadow: 0 2px 8px rgba(92, 55, 24, .09);
  font-size: 12px;
  line-height: 1.4;
}
#boardMapMode .historical-board-map-navigation [data-board-map-back] {
  flex: 0 0 auto;
  min-height: 28px;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid #cead89;
  border-radius: 5px;
  background: #fffdf8;
  color: #6f3c1b;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}
#boardMapMode .historical-board-map-navigation [data-board-map-back]:hover:not(:disabled) {
  border-color: #a8511c;
  background: #fff1da;
}
#boardMapMode .historical-board-map-navigation [data-board-map-back]:focus-visible {
  outline: 2px solid #7c2d12;
  outline-offset: 2px;
}
#boardMapMode .historical-board-map-navigation [data-board-map-back]:disabled {
  color: #8b8176;
  border-color: #ddd5cb;
  background: #f5f2ed;
  cursor: default;
}
#boardMapMode .historical-board-map-navigation [data-board-map-level-label] {
  min-width: 0;
  font-weight: 600;
}

#boardMapMode .historical-board-map-note [data-board-map-coarse-index] {
  display: inline;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0 2px;
  padding: 0 2px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #85451e;
  font: inherit;
  line-height: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
#boardMapMode .historical-board-map-note [data-board-map-coarse-index]:hover {
  color: #7c2d12;
  background: #fff1da;
}
#boardMapMode .historical-board-map-note [data-board-map-coarse-index]:focus-visible {
  outline: 2px solid #7c2d12;
  outline-offset: 2px;
}

/* R2-035: customer board query controls and map-side customer list only. */
#databaseManagementView .historical-board-region-filter select {
  width: 112px;
  font-size: 13px;
  min-width: 0;
  padding-left: 8px;
}
#databaseManagementView .historical-board-search {
  gap: 6px;
}
#databaseManagementView .historical-board-search input {
  width: clamp(160px, 16vw, 220px);
}
#boardMapMode .historical-board-map-customer-list {
  min-height: 0;
  padding: 8px;
  gap: 5px;
  grid-auto-rows: min-content;
}
#boardMapMode .historical-board-map-customer {
  height: 58px;
  min-height: 58px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 34px 14px;
  gap: 2px 8px;
  padding: 3px 8px;
  align-content: start;
}
#boardMapMode .historical-board-map-customer strong {
  grid-column: 1 / -1;
  grid-row: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 17px;
  max-height: 34px;
}
#boardMapMode .historical-board-map-customer small {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  line-height: 14px;
}
#boardMapMode .historical-board-map-customer em {
  grid-column: 2;
  grid-row: 2;
  line-height: 14px;
  white-space: nowrap;
}
#boardMapMode .historical-board-map-panel-header,
#boardMapMode .historical-board-map-panel-footer {
  flex: 0 0 auto;
}
@media (min-width: 981px) {
  #boardMapMode .historical-board-map-layout:not(.historical-board-map-panel-collapsed) {
    grid-template-columns: minmax(0, 1fr) clamp(280px, 22vw, 360px);
  }
}

/* R2-036: customer-board organization root, personal pins and server-sort controls. */
.historical-board-shell .historical-board-sales-root{display:flex;align-items:center;gap:8px;min-height:36px;margin:0 0 8px;padding:4px 8px;border-bottom:1px solid #dbe7ec;border-radius:4px;background:#f3f8fa}
.historical-board-shell .historical-board-sales-root.active{background:#e5f3f2;color:#087d79}
.historical-board-shell .historical-board-sales-root .historical-board-org-name{flex:1;min-width:0;margin:0;padding:4px 0;font-size:14px}
.historical-board-shell .historical-board-customer-table th .historical-board-sort{display:inline-flex;align-items:center;justify-content:space-between;gap:5px;width:auto;min-width:0;height:34px;margin:0;padding:0;border:0;border-radius:3px;background:transparent;color:inherit;font:inherit;font-weight:600;white-space:nowrap;cursor:pointer}
.historical-board-shell .historical-board-sort-arrows{display:flex;flex-direction:column;gap:2px;color:#9aabb4}
.historical-board-shell .historical-board-sort-arrows i{font-size:8px;line-height:8px;font-style:normal}
.historical-board-shell .historical-board-sort-arrows i.active{color:#087d79}
.historical-board-shell .historical-board-pin{display:inline-flex;align-items:center;vertical-align:middle;color:#bd700c}
.historical-board-shell .historical-board-pin svg{width:16px;height:16px;fill:currentColor}
.historical-board-shell .historical-board-customer-table tr.is-pinned td{background:#fffaf0}
.historical-board-shell .historical-board-customer-table tr.is-pinned.selected td{background:#e6f4f1}
.historical-board-shell .historical-board-customer-table tr.is-pinned:has(+tr:not(.is-pinned)) td{border-bottom:2px solid #e8d6ad}
.historical-board-shell .historical-board-search [data-board-pin-toggle]{min-width:58px;flex:0 0 auto}

/* Orders remain visible above the independent paginated JobList fallback. */
#databaseManagementView .historical-board-detail:has(> .historical-board-joblist) > .foundation-table-scroll {flex:0 0 auto;max-height:112px;}
#databaseManagementView:not(.hidden) .historical-board-detail:has(> .historical-board-joblist) > .historical-board-joblist {display:flex;flex:1 1 0;min-height:0;flex-direction:column;gap:8px;overflow:hidden;}
#databaseManagementView .historical-board-joblist > h4 {margin:0;flex:0 0 auto;}
#databaseManagementView .historical-board-joblist > .foundation-table-scroll {flex:1 1 0;min-height:0;max-height:none;overflow:auto;}
#databaseManagementView .historical-board-joblist > .historical-board-list-footer {flex:0 0 auto;}

/* R2-047: compact customer-board filters and a shared map footer row.
   Scoped above runtime-injected styles; does not alter other modules. */
#databaseViewContent .historical-board-shell .historical-board-primarybar {
  gap: 8px;
  padding-bottom: 8px;
}

#databaseViewContent .historical-board-shell .historical-board-filter-stack {
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
  gap: 4px;
}

#databaseViewContent .historical-board-shell .historical-board-status-select {
  flex-wrap: nowrap;
  min-width: 0;
  max-width: 100%;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  padding: 2px;
}

#databaseViewContent .historical-board-shell .historical-board-status-select > .historical-board-filterlabel {
  flex: 0 0 auto;
  margin-right: 2px;
  font-size: 12px;
  white-space: nowrap;
}

#databaseViewContent .historical-board-shell .historical-board-status-button {
  flex: 0 0 auto;
  gap: 4px;
  height: 28px;
  min-height: 28px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

#databaseViewContent .historical-board-shell .historical-board-status-button strong {
  padding-left: 4px;
  font-size: 12px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

#databaseViewContent .historical-board-shell .historical-board-status-select > small {
  flex: 0 0 auto;
  font-size: 11px;
  white-space: nowrap;
}

#databaseViewContent .historical-board-shell .historical-board-map-note {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
  margin: 8px 0 0;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.5;
}

#databaseViewContent .historical-board-shell .historical-board-map-note-text {
  flex: 1 1 300px;
  min-width: 0;
  overflow-wrap: anywhere;
}

#databaseViewContent .historical-board-shell .historical-board-map-time {
  flex: 0 0 auto;
  max-width: 100%;
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 700px) {
  #databaseViewContent .historical-board-shell .historical-board-map-time {
    flex-shrink: 1;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* R2-048: one-line customer-board query and compact pagination only.
   Keep overflow local; leave customer-table typography and map gestures intact. */
#databaseViewContent .historical-board-shell .historical-board-querybar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 6px 2px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}
#databaseViewContent .historical-board-shell .historical-board-region-filter,
#databaseViewContent .historical-board-shell .historical-board-search {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  min-width: max-content;
  margin: 0;
  white-space: nowrap;
}
#databaseViewContent .historical-board-shell .historical-board-region-filter {
  flex: 0 0 auto;
}
#databaseViewContent .historical-board-shell .historical-board-search {
  flex: 1 0 auto;
}
#databaseViewContent .historical-board-shell .historical-board-querybar .historical-board-filterlabel {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1.25;
}
#databaseViewContent .historical-board-shell .historical-board-querybar input,
#databaseViewContent .historical-board-shell .historical-board-querybar select,
#databaseViewContent .historical-board-shell .historical-board-querybar button,
#databaseViewContent .historical-board-shell .historical-board-mode button {
  box-sizing: border-box;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}
#databaseViewContent .historical-board-shell .historical-board-region-filter select {
  flex: 0 0 84px;
  width: 84px;
}
#databaseViewContent .historical-board-shell .historical-board-search input {
  flex: 1 1 120px;
  width: 120px;
  min-width: 112px;
  max-width: 180px;
}
#databaseViewContent .historical-board-shell .historical-board-search button {
  flex: 0 0 auto;
  width: auto;
  min-width: 38px;
}
#databaseViewContent .historical-board-shell .historical-board-scope-note {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 0 6px;
  font-size: 11px;
  line-height: 22px;
}
#databaseViewContent .historical-board-shell .historical-board-mode {
  flex: 0 0 auto;
  gap: 4px;
}
#databaseViewContent .historical-board-shell .historical-board-mode button {
  width: auto;
  padding: 0 8px;
}
#databaseViewContent .historical-board-shell .historical-board-list-footer.historical-board-pagination {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  padding: 4px 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}
#databaseViewContent .historical-board-shell .historical-board-pagination-controls {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
#databaseViewContent .historical-board-shell .historical-board-pagination-controls > span {
  font-size: 11px;
}
#databaseViewContent .historical-board-shell .historical-board-pagination button,
#databaseViewContent .historical-board-shell .historical-board-pagination input {
  box-sizing: border-box;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.25;
}
#databaseViewContent .historical-board-shell .historical-board-pagination .foundation-page-jump {
  gap: 3px;
  margin: 0;
  font-size: 12px;
  line-height: 1.25;
}
#databaseViewContent .historical-board-shell .historical-board-pagination .foundation-page-jump input {
  width: 44px;
  padding: 0 2px;
}
#databaseViewContent .historical-board-shell .historical-board-list-time {
  flex: 0 0 auto;
  margin-left: auto;
  text-align: right;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* R2-049: business data overview, confined to its active workspace. */
#databaseManagementView.database-overview-workspace > .database-summary-cards,
#databaseManagementView.database-overview-workspace .database-tabs-toolbar,
#databaseManagementView.database-overview-workspace .database-view-status,
#databaseManagementView.database-overview-workspace .database-commandbar {
  display: none !important;
}
#databaseManagementView.database-overview-workspace #databaseViewContent {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
#databaseManagementView.database-overview-workspace .database-overview {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  color: #193b51;
}
.database-overview .database-overview-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 4px 4px 8px;
  border-bottom: 1px solid #dce7ec;
}
.database-overview .database-overview-heading h2 {margin:0 0 4px;font-size:21px;line-height:1.4;}
.database-overview .database-overview-heading p {margin:0;color:#607889;font-size:13px;line-height:1.5;}
/* R2-052: one static four-input flow, with two independent library notes. */
/* One business diagram: source lanes converge without hiding intermediate steps. */
.database-overview .database-overview-body {display:flex;flex:1 1 0;flex-direction:column;justify-content:flex-start;gap:8px;min-width:0;min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 4px 8px;}
.database-overview .database-flow-canvas {flex:1 0 auto;min-width:1000px;min-height:480px;display:flex;justify-content:center;align-items:center;}
.database-overview .database-detailed-flow {display:block;width:100%;height:auto;max-height:calc(100vh - 170px);min-height:480px;font-family:inherit;}
.database-detailed-flow text {text-anchor:middle;fill:#274c60;}
.database-detailed-flow .db-flow-columns text {font-size:14px;font-weight:600;fill:#758d9a;letter-spacing:1px;}
.database-detailed-flow .db-flow-lane > rect {fill:#f7fafb;stroke:#e1ebef;stroke-width:1;}
.database-detailed-flow .db-flow-lane.is-screening > rect {fill:#f5f9fc;}
.database-detailed-flow .db-flow-lane.is-bulk > rect {fill:#f8f7fb;}
.database-detailed-flow .db-flow-lane.is-proactive > rect {fill:#fcfaf6;}
.database-detailed-flow .db-flow-lane-number {font-size:14px;font-weight:700;fill:#8da5b1;}
.database-detailed-flow .db-flow-lane-title {font-size:15px;font-weight:700;text-anchor:start;fill:#476778;}
.database-detailed-flow .db-flow-destination-bg {fill:#f2f8f8;stroke:#d9e8e8;}
.database-detailed-flow .db-flow-node > rect {fill:#fff;stroke:#c5d8e1;stroke-width:1.2;}
.database-detailed-flow .db-flow-node.is-history > rect {stroke:#8bbeb9;fill:#f0f8f7;}
.database-detailed-flow .db-flow-node.is-screening > rect {stroke:#a0bfd7;fill:#edf5fb;}
.database-detailed-flow .db-flow-node.is-bulk > rect {stroke:#b7acd2;fill:#f4f1fa;}
.database-detailed-flow .db-flow-node.is-proactive > rect {stroke:#d9be8e;fill:#fff8ec;}
.database-detailed-flow .db-flow-node.is-board > rect {fill:#0e918e;stroke:#0e918e;}
.database-detailed-flow .db-flow-node.is-board text {fill:#fff;}
.database-detailed-flow .db-flow-node.is-archive > rect {fill:#e8f3f3;stroke:#80b5b3;stroke-width:1.5;}
.database-detailed-flow .db-flow-title {font-size:20px;font-weight:650;}
.database-detailed-flow .db-flow-detail {font-size:14px;fill:#688393;}
.database-detailed-flow .db-flow-edge {fill:none;stroke:#5f919a;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;}
.database-detailed-flow marker path {fill:none;stroke:#5f919a;stroke-width:1.5;stroke-linejoin:round;}
.database-detailed-flow .db-flow-edge.is-main {stroke-width:2;}
.database-detailed-flow .db-flow-edge-label {font-size:12px;fill:#668791;paint-order:stroke;stroke:#fff;stroke-width:4px;stroke-linejoin:round;}
.database-detailed-flow .db-flow-card-divider {stroke:#a3cdce;fill:none;stroke-width:1;}
.database-detailed-flow .is-board .db-flow-card-divider {stroke:#5fb4b2;}
.database-detailed-flow .db-flow-archive-note text {font-size:13px;fill:#688b90;}
.database-overview .database-independent-libraries {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;width:100%;margin:0 auto;flex:none;}
.database-overview .database-independent-libraries p {display:flex;flex-wrap:wrap;gap:6px 12px;margin:0;padding:10px 16px;border:1px solid #dce7ec;border-radius:6px;background:#fafcfd;color:#607889;font-size:13px;line-height:1.5;}
.database-overview .database-independent-libraries strong {color:#24465a;}
.customer-registry-upload-statistics-heading {display:flex;flex:0 0 auto;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:4px 12px;}
.customer-registry-upload-statistics-heading h4 {margin:0;}
.customer-registry-upload-statistics-heading small {margin-left:auto;color:#6f8292;font-size:11px;text-align:right;}
@media (max-width:760px) {
  .database-overview .database-overview-body {justify-content:flex-start;}
  .database-overview .database-independent-libraries {grid-template-columns:1fr;}
}

/* R2-064: viewport-centered page dialogs, above existing module overlays. */
.leads-system-dialog { position:fixed; inset:0; margin:auto; width:min(560px,calc(100vw - 32px)); max-width:none; max-height:calc(100dvh - 32px); padding:0; overflow:hidden; border:1px solid #d7e0e9; border-radius:10px; background:#fff; color:#17304d; box-shadow:0 24px 80px rgba(15,35,50,.28); z-index:20000; }
.leads-system-dialog[open] { display:flex; flex-direction:column; }
.leads-system-dialog::backdrop { background:rgba(15,35,50,.48); }
.leads-system-dialog__header { display:flex; align-items:center; justify-content:space-between; gap:16px; flex:0 0 auto; padding:16px 20px; border-bottom:1px solid #e1eaf0; }
.leads-system-dialog__header h2 { margin:0; color:#15344f; font-size:18px; font-weight:700; line-height:1.45; }
.leads-system-dialog__header .leads-system-dialog__close { flex:0 0 30px; width:30px; min-width:30px; height:30px; margin:0; padding:0; border:0; border-radius:4px; background:transparent; color:#60768b; font-size:24px; line-height:1; }
.leads-system-dialog__body { min-height:0; padding:20px; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; color:#405d70; font-size:14px; line-height:1.75; }
.leads-system-dialog__footer { display:flex; flex:0 0 auto; justify-content:flex-end; gap:10px; padding:14px 20px; border-top:1px solid #e1eaf0; }
.leads-system-dialog__footer button { width:auto; min-width:88px; height:34px; margin:0; padding:0 16px; border-radius:5px; font-size:14px; }
.leads-system-dialog button:focus-visible { outline:2px solid #008f88; outline-offset:2px; }

/* R2-138: sales map focus workspace; keep the original list/department layouts. */
.sales-map-workspace-control { display: none; }
#salesAssignmentEffectiveBox .department-effective-tabs {
  display: flex;
  flex-wrap: wrap;
}
#salesAssignmentEffectiveBox .department-effective-tabs button {
  flex: 1 0 auto;
  padding: 0 8px;
  font-size: 13px;
  white-space: nowrap;
}
@media (min-width: 981px) {
  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) #mapCanvas.sales-amap-shell) #mainView #areaAssignmentModule > .layout-grid.sales-map-workspace {
    position: relative;
    isolation: isolate;
    grid-template-columns: minmax(0, 1fr) clamp(304px, 22vw, 360px);
    overflow: hidden;
  }
  body.module-sales-assignment:has(#areaAssignmentModule:not(.hidden) #mapCanvas.sales-amap-shell) #mainView #areaAssignmentModule > .layout-grid.sales-map-config-collapsed {
    grid-template-columns: minmax(0, 1fr) 40px;
  }
  #mainView #areaAssignmentModule > .sales-map-workspace > .employee-panel {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 212;
    width: min(380px, calc(100% - 32px));
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-100%);
    box-shadow: 0 18px 48px rgba(15, 45, 62, .28);
  }
  #mainView #areaAssignmentModule > .sales-map-people-open > .employee-panel {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
  }
  #mainView #areaAssignmentModule > .sales-map-config-collapsed > .assignment-panel { display: none; }
  #areaAssignmentModule .sales-map-workspace > .map-panel > .panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  #areaAssignmentModule .sales-map-workspace .sales-map-workspace-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #cbd9e1;
    border-radius: 6px;
    background: #fff;
    color: #0b817c;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
  }
  #areaAssignmentModule .sales-map-workspace #salesMapPeopleToggle {
    order: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    margin-right: auto;
  }
  #areaAssignmentModule .sales-map-workspace .region-view-toggle { order: 2; }
  #areaAssignmentModule .sales-map-workspace #regionPanelTitle { flex: 0 0 auto; }
  #areaAssignmentModule .sales-map-workspace #salesMapPeopleBackdrop {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 205;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(16, 47, 63, .18);
    cursor: default;
  }
  #areaAssignmentModule .sales-map-people-open #salesMapPeopleBackdrop { display: block; }
  #areaAssignmentModule .sales-map-workspace #salesMapAssignmentReopen { display: none; }
  #areaAssignmentModule .sales-map-config-collapsed #salesMapAssignmentReopen {
    display: flex;
    height: 100%;
    width: 40px;
    writing-mode: vertical-rl;
    letter-spacing: 3px;
  }
  #areaAssignmentModule .sales-map-workspace #employeeList {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow: auto;
  }
  #areaAssignmentModule .sales-map-workspace #employeeList .org-tree-node > span:not(.org-tree-toggle),
  #areaAssignmentModule .sales-map-workspace #employeeList .org-tree-member small,
  #areaAssignmentModule .sales-map-workspace #employeeList .org-tree-member strong {
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }
}

/* R2-139: readable inbox message/customer lists and customer detail. */
.inbox-shell .inbox-messages h3,
.inbox-shell .inbox-customer-list-heading h3 { font-size: 18px; line-height: 1.4; }
.inbox-shell .inbox-messages header p,
.inbox-shell .inbox-customer-list-heading p,
.inbox-shell .inbox-customer-list-heading > span { font-size: 13px; line-height: 1.5; }
.inbox-shell .inbox-message {
  grid-template-columns: 8px minmax(0, 1fr);
  row-gap: 7px;
  min-height: 112px;
}
.inbox-shell .inbox-message-copy strong { font-size: 15px; line-height: 1.5; }
.inbox-shell .inbox-message-copy small { font-size: 14px; line-height: 1.5; }
.inbox-shell .inbox-message-copy em { font-size: 12px; line-height: 1.5; }
.inbox-shell .inbox-message time { grid-column: 2; font-size: 12px; line-height: 1.4; }
.inbox-shell .inbox-customer-main strong { font-size: 16px; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.inbox-shell .inbox-customer-main small { font-size: 14px; line-height: 1.5; }
.inbox-shell .inbox-customer-main em { font-size: 13px; }
.inbox-shell .inbox-customer-side b { font-size: 18px; font-variant-numeric: tabular-nums; }
.inbox-shell .inbox-customer-side small { font-size: 12px; }
.inbox-shell .inbox-detail-kicker { font-size: 13px; }
.inbox-shell .inbox-detail h3 { font-size: 24px; line-height: 1.4; }
.inbox-shell .inbox-detail header p { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.inbox-shell .inbox-score strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.inbox-shell .inbox-score span { font-size: 12px; }
.inbox-shell .inbox-detail-field span { font-size: 13px; line-height: 1.5; }
.inbox-shell .inbox-detail-field strong { font-size: 14px; line-height: 1.65; }
.inbox-shell .inbox-handled-note { font-size: 13px; line-height: 1.6; }
.inbox-shell .inbox-detail-actions button { font-size: 14px; }
.inbox-modal .inbox-modal-body > p,
.inbox-modal .inbox-modal-body legend,
.inbox-modal .inbox-choice-grid span,
.inbox-modal .inbox-forward-select { font-size: 14px; line-height: 1.5; }
.inbox-modal .inbox-forward-select select,
.inbox-modal .inbox-forward-select input,
.inbox-modal .inbox-forward-select textarea { font-size: 14px; }
.inbox-modal .inbox-modal-card { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.inbox-modal .inbox-modal-card > header,
.inbox-modal .inbox-modal-card > footer { flex: 0 0 auto; }
.inbox-modal .inbox-modal-body { min-height: 0; overflow-y: auto; }
.inbox-modal .inbox-forward-select[hidden] { display: none; }
.inbox-modal .inbox-choice-grid input:focus-visible + span { outline: 2px solid #0d918c; outline-offset: 2px; }
