/* system-ui.css — 全站统一视觉底座（Admin + /workspace/） */
:root {
  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --border-color: #E2E8F0;
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --success-bg: #ECFDF5;
  --success-text: #059669;
  --warning-bg: #FFFBEB;
  --warning-text: #D97706;
  --danger-bg: #FEF2F2;
  --danger-text: #E11D48;
  --radius: 6px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-num: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "IBM Plex Mono", "SF Mono", Menlo, monospace;
}

/* ---------- Admin shell ---------- */
body, #container {
  background-color: var(--bg-page) !important;
  color: var(--text-main) !important;
  font-family: var(--font) !important;
}
#header {
  background: #0F172A !important;
  color: #FFFFFF !important;
  padding: 12px 24px !important;
  border-bottom: 1px solid #1E293B;
}
#header a:link,
#header a:visited { color: #F8FAFC !important; }
#branding h1,
#branding h1 a:link,
#branding h1 a:visited {
  color: #F8FAFC !important;
  font-weight: 600 !important;
  font-size: 16px !important;
}
/* 列表/详情砍掉纵向冗余：面包屑 + 页面大标题 */
body.change-list div.breadcrumbs,
body.change-form div.breadcrumbs { display: none !important; }
body.change-list #content > h1,
body.change-form #content > h1,
body.change-form #content > h2 { display: none !important; }
div.breadcrumbs {
  background: #FFFFFF !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 16px !important;
}
div.breadcrumbs a { color: var(--primary) !important; }
#content { padding: 12px 16px !important; }

/* 搜索 +「增加…」并入「动作」行（见 system-ui.js） */
body.change-list.ui-clist-actions-merged #toolbar,
body.change-list #toolbar.ui-clist-toolbar-hidden {
  display: none !important;
}
body.change-list #toolbar,
body.change-list #toolbar.ui-clist-topbar {
  margin: 0 0 8px !important;
  padding: 6px 8px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
  background: var(--bg-card) !important;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
body.change-list #changelist-form .actions,
body.change-list #changelist-form .actions.ui-clist-actions-row {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px !important;
  padding: 6px 8px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
  background: var(--bg-card) !important;
  float: none !important;
  width: auto !important;
}
body.change-list #changelist-form .actions label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
  font-size: 12px;
}
body.change-list #changelist-form .actions select {
  height: 28px !important;
  font-size: 12px !important;
}
body.change-list #changelist-form .actions button.button {
  height: 28px !important;
  padding: 0 12px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
}
body.change-list .ui-actions-right {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
body.change-list .ui-actions-search {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
body.change-list .ui-actions-search-input,
body.change-list #ui-actions-searchbar {
  height: 28px !important;
  font-size: 12px !important;
  min-width: 160px;
  width: 200px;
  max-width: 280px;
  padding: 0 8px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 6px !important;
  background: #fff !important;
}
body.change-list .ui-actions-search-btn {
  height: 28px !important;
  padding: 0 12px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
}
/* 默认 Django 简易搜索条；自定义多字段工具栏（.tx-toolbar）另行处理，避免 flex 把输入纵向撑高 */
body.change-list #changelist-search:not(:has(.tx-toolbar)) {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  margin: 0 !important;
}
body.change-list #changelist-search:not(:has(.tx-toolbar)) label { display: none; }
body.change-list #changelist-search:not(:has(.tx-toolbar)) input[type="text"],
body.change-list #searchbar {
  height: 28px !important;
  font-size: 12px !important;
  min-width: 200px;
  flex: 1 1 220px;
  max-width: 420px;
}
body.change-list #changelist-search input[type="submit"] {
  height: 28px !important;
  padding: 0 12px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
}
body.change-list #changelist-search:has(.tx-toolbar) {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  flex: none !important;
  box-sizing: border-box !important;
}
body.change-list #changelist-search:has(.tx-toolbar) label {
  display: block !important;
}
body.change-list #changelist-search:has(.tx-toolbar) input[type="text"],
body.change-list #changelist-search:has(.tx-toolbar) input[type="date"],
body.change-list #changelist-search:has(.tx-toolbar) input[type="search"],
body.change-list #changelist-search:has(.tx-toolbar) select {
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  padding: 0 8px !important;
  font-size: 12px !important;
  line-height: 26px !important;
}
body.change-list #toolbar .object-tools,
body.change-list .object-tools,
body.change-list .ui-actions-tools {
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}
body.change-list .object-tools li {
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
}
body.change-list .object-tools a,
body.change-list .object-tools a.addlink,
body.change-list .object-tools a.viewsitelink {
  background: var(--primary) !important;
  border: 1px solid var(--primary) !important;
  border-radius: 6px !important;
  color: #fff !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  height: 28px !important;
  line-height: 28px !important;
  padding: 0 12px !important;
  box-shadow: none !important;
  background-image: none !important;
  white-space: nowrap;
}
body.change-list .object-tools a:hover,
body.change-list .object-tools a.addlink:hover {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}
/* 无动作行时：增加按钮仍单独一行 */
body.change-list:not(.ui-clist-actions-merged) #content-main:not(:has(#toolbar)) > .object-tools {
  width: 100%;
  margin-bottom: 8px !important;
}
.module h2,
.inline-group h2,
fieldset.module h2 {
  background: #F8FAFC !important;
  color: var(--text-main) !important;
  border-bottom: 1px solid var(--border-color) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 10px 14px !important;
}
input[type=text],
input[type=password],
input[type=email],
input[type=url],
input[type=number],
input[type=search],
input[type=date],
textarea,
select,
.vTextField {
  border: 1px solid var(--border-color) !important;
  border-radius: 6px !important;
  font-size: 13px !important;
  color: var(--text-main) !important;
}
.button,
input[type=submit],
submit-row input,
a.button {
  background: var(--primary) !important;
  border: 1px solid var(--primary) !important;
  border-radius: 6px !important;
  color: #fff !important;
  box-shadow: none !important;
}
.button.default,
input[type=submit].default {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}
.button:hover,
input[type=submit]:hover,
a.button:hover {
  background: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}

/* ---------- Tables: Admin + workspace（高密度） ---------- */
#changelist table#result_list,
.ui-table {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-color) !important;
  box-shadow: none;
  border-collapse: separate !important;
  border-spacing: 0;
  /* visible：否则 sticky 左列随表一起横滑 */
  overflow: visible;
  table-layout: fixed;
}
#changelist table#result_list thead th,
.ui-table thead th {
  background: #F8FAFC !important;
  color: #475569 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 8px !important;
  border-bottom: 1px solid var(--border-color) !important;
  text-transform: none !important;
  white-space: nowrap;
}
#changelist table#result_list tbody td,
#changelist table#result_list tbody th,
.ui-table tbody td {
  padding: 6px 8px !important;
  border-bottom: 1px solid #F1F5F9 !important;
  font-size: 12px !important;
  vertical-align: middle !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
#changelist table#result_list tbody tr:hover,
.ui-table tbody tr:hover {
  background-color: #F8FAFC !important;
}

.num-col,
#result_list td.field-estimated_amount_display,
#result_list td.field-received_amount_display,
#result_list td.field-pending_amount_display,
#result_list td.field-received_ratio_display,
#result_list td.field-invoiced_amount_display,
#result_list th.column-estimated_amount_display,
#result_list th.column-received_amount_display,
#result_list th.column-pending_amount_display,
#result_list th.column-received_ratio_display,
#result_list th.column-invoiced_amount_display {
  font-variant-numeric: tabular-nums !important;
  text-align: right !important;
  font-family: var(--font-num) !important;
  font-weight: 500;
}

/* 项目名等仍可省略；T5 在 change_list 固定列内细字换行 */
#result_list th.column-name,
#result_list td.field-name,
#result_list th.column-name_display,
#result_list td.field-name_display,
#result_list th.column-partner_compact_display,
#result_list td.field-partner_compact_display,
#result_list th.column-get_owners_display,
#result_list td.field-get_owners_display {
  max-width: 150px !important;
  width: 150px;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
#result_list td.field-t5_project_name_display {
  white-space: normal !important;
  overflow: hidden !important;
  text-overflow: clip !important;
}
#result_list td.field-name a,
#result_list td.field-name_display a,
#result_list td.field-code a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* ---------- KPI / filters / badges（Compact） ---------- */
.ui-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.ui-kpi-card {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: var(--radius);
  padding: 8px 14px;
  min-height: 0;
  max-height: 52px;
  height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  background: #F1F5F9 !important;
}
.ui-kpi-grid .ui-kpi-card:nth-child(1) { background: #EEF2FF !important; }
.ui-kpi-grid .ui-kpi-card:nth-child(2) { background: #ECFEFF !important; }
.ui-kpi-grid .ui-kpi-card:nth-child(3) { background: #ECFDF5 !important; }
.ui-kpi-grid .ui-kpi-card:nth-child(4) { background: #FFF7ED !important; }
.ui-kpi-grid .ui-kpi-card:nth-child(5) { background: #F5F3FF !important; }
.ui-kpi-title {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
  font-weight: 500;
  line-height: 1.2;
}
.ui-kpi-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-num) !important;
  line-height: 1.2;
  text-align: left;
}

.ui-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 0 8px;
}
.ui-select-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 0 0 8px;
  font-size: 12px;
  color: #334155;
}
.ui-select-filters label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  font-weight: 500;
  flex: 0 0 auto;
  white-space: nowrap;
}
.ui-select-filters select {
  height: 26px;
  max-width: 168px;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  background: #fff;
  color: #0F172A;
  font-size: 12px;
  padding: 0 6px;
}
.ui-project-search-row {
  flex-wrap: nowrap;
  align-items: flex-start;
  margin-bottom: 8px;
  padding-right: 84px;
}
.ui-project-search-row > * {
  flex: 0 0 auto;
}
.ui-search-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.ui-search-with-sales {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.ui-project-search-row .ui-inline-search {
  width: 220px;
  min-width: 160px;
  height: 26px;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 12px;
  background: #fff;
  color: #0F172A;
  flex: 0 0 220px;
}
.ui-project-search-row .ui-result-count {
  color: #64748B;
  font-size: 12px;
  white-space: nowrap;
}
.ui-project-search-row .ui-add-project {
  margin-left: auto;
  background: var(--primary) !important;
  color: #fff !important;
  font-weight: 600;
  height: 26px;
  padding: 0 12px;
  text-decoration: none !important;
}
.ui-project-search-row .ui-add-project:hover {
  background: var(--primary-hover, var(--primary)) !important;
  color: #fff !important;
}
.ui-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: #F1F5F9 !important;
  border: none !important;
  box-shadow: none !important;
  color: #334155;
  text-decoration: none !important;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  height: 26px;
  box-sizing: border-box;
}
.ui-pill:hover { background: #E2E8F0 !important; color: #0F172A; }
.ui-pill.active {
  background: #0F172A !important;
  color: #FFFFFF !important;
  border: none !important;
}
.ui-pill .n,
.ui-pill .ui-pill-count {
  color: #6366F1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ui-pill.active .n,
.ui-pill.active .ui-pill-count { color: #C7D2FE; }
.ui-pill.ghost {
  margin-left: auto;
  background: #F1F5F9;
}

.ui-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.ui-badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.ui-badge-success { background: var(--success-bg); color: var(--success-text); }
.ui-badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.ui-badge-neutral { background: #F1F5F9; color: #475569; }
.ui-badge-primary { background: #EEF2FF; color: #4338CA; }

/* ---------- Form controls / select2 ---------- */
select,
.select2-container--default .select2-selection--single {
  height: 32px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 6px !important;
  background-color: #FFFFFF !important;
  font-size: 13px !important;
  color: var(--text-main) !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 30px !important;
  color: var(--text-main) !important;
  padding-left: 8px !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 30px !important;
}

/* ---------- Workspace chrome ---------- */
.ui-shell {
  min-height: 100vh;
  background: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font);
}
.ui-topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: #0F172A;
  color: #F8FAFC;
  border-bottom: 1px solid #1E293B;
}
.ui-topbar a { color: #CBD5E1; text-decoration: none; font-size: 13px; }
.ui-topbar a:hover,
.ui-topbar a.active { color: #FFFFFF; }
.ui-topbar .brand { font-weight: 600; font-size: 14px; color: #fff; margin-right: 8px; }
.ui-topbar .spacer { margin-left: auto; }
.ui-topbar .nav-cta {
  background: var(--primary);
  color: #fff !important;
  padding: 4px 12px;
  border-radius: 6px;
}
.ui-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}
.ui-toolbar input,
.ui-toolbar select,
.ui-toolbar button {
  height: 30px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #fff;
  padding: 0 10px;
}
.ui-toolbar button.primary,
.ui-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  cursor: pointer;
}
.ui-toolbar button.ghost,
.ui-btn-ghost {
  background: #fff;
  color: var(--text-main);
  cursor: pointer;
}
.ui-main {
  padding: 12px 16px 24px;
}
.ui-table-wrap {
  overflow: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.ui-table-wrap .ui-table {
  border: 0 !important;
  box-shadow: none;
  border-radius: 0;
}

/* Side panel */
.ui-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--border-color);
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.08);
  z-index: 1002;
  transform: translateX(100%);
  transition: transform .18s ease;
  display: flex;
  flex-direction: column;
}
.ui-drawer.open { transform: translateX(0); }
.ui-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--border-color);
}
.ui-drawer-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ui-drawer-body label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.ui-drawer-body .ui-combo-filter {
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  color: var(--text-main);
}
.ui-drawer-body .ui-combo-select,
.ui-drawer-body select.ui-combo-select {
  min-height: 120px;
  max-height: 180px;
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  padding: 4px;
  background: #fff;
}

/* Toast */
.ui-toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ui-toast {
  min-width: 180px;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #0F172A;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s, transform .18s;
}
.ui-toast.show { opacity: 1; transform: translateY(0); }
.ui-toast.success { background: #065F46; }
.ui-toast.error { background: #9F1239; }

.muted { color: var(--text-muted); }
.hot { color: var(--primary); font-weight: 600; }
.num-positive { color: var(--success-text) !important; font-weight: 600; }
.num-pending { color: var(--warning-text) !important; font-weight: 600; }
.danger { color: var(--danger-text); }
.ui-ellipsis {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

/* Workspace dense table extras */
.ui-table td input.cell,
.ui-table td input.name,
.ui-table td select.acq {
  height: 26px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  padding: 0 6px;
  background: #fff;
}
.ui-table td input.cell { width: 58px; }
.ui-table td input.name { width: 72px; }
.ui-table td select.acq { width: 64px; }
.ui-table tr.dirty td { background: var(--warning-bg) !important; }
.ui-table tr.need td:first-child { box-shadow: inset 3px 0 0 var(--danger-text); }
.ui-table .eff { font-size: 10px; color: var(--text-muted); margin-left: 2px; }
.ui-more { position: relative; display: inline-block; }
.ui-more-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  min-width: 72px;
  z-index: 3;
  box-shadow: var(--shadow-sm);
}
.ui-more.open .ui-more-menu { display: block; }
.ui-more-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  color: var(--text-main);
  border: 0;
  height: 28px;
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
}
.ui-rules-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}
.ui-rules-bar.collapsed .rules-body { display: none; }
.ui-shell-fill { flex: 1; overflow: auto; min-height: 0; display: flex; flex-direction: column; }
.ui-shell { display: flex; flex-direction: column; min-height: 100vh; }
.opacity-50 { opacity: 0.5; }
.pointer-events-none { pointer-events: none; }
.ui-drawer-title { font-size: 14px; font-weight: 700; color: var(--text-main); }
.ui-drawer-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ui-drawer-close {
  border: 0;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}
.ui-drawer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.ui-drawer-actions .ui-btn-primary {
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  cursor: pointer;
  font-size: 13px;
}
.ui-drawer-actions a { font-size: 12px; color: var(--primary); }
.ui-drawer-status { min-height: 18px; font-size: 12px; }
.ui-rules-bar .rules-body { display: contents; }
.ui-toolbar .w-search { width: 150px; }
.ui-empty-cell { padding: 2rem; text-align: center; }
.ui-table-wrap.fill {
  flex: 1;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
}
.ui-filter-bar.chrome {
  padding: 10px 16px;
  margin: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}
.ml-auto { margin-left: auto; }
.ui-split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - 48px);
  flex: 1;
}
@media (max-width: 900px) {
  .ui-split-grid { grid-template-columns: 1fr; }
}
.ui-pane {
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  padding: 16px;
  overflow: auto;
}
.ui-pane h2 { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.ui-pane textarea {
  width: 100%;
  min-height: 220px;
  font: inherit;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px;
}
.ui-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; align-items: center; }
.ui-kv {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 6px 8px;
  margin: 10px 0;
}
.ui-input-md { width: 180px; }
.ui-input-sm { width: 120px; }
.ui-input-full { width: 100%; }
.ui-mt { margin-top: 16px; }
.admin-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}
.admin-brand-bar h1 { margin: 0; font-weight: 600; font-size: 16px; letter-spacing: 0.5px; }
.admin-brand-nav { display: flex; gap: 16px; align-items: center; font-size: 13px; }
.admin-brand-nav a { color: #E2E8F0; text-decoration: none; }
.admin-brand-nav a.nav-cta {
  background: var(--primary);
  color: #fff !important;
  padding: 4px 12px;
  border-radius: 6px;
}

/* ============================================================
   Change form — 极高密度详情页
   ============================================================ */
body.change-form #content {
  max-width: 100% !important;
  width: auto !important;
  flex: 1 1 0% !important;
  min-width: 0 !important;
  padding: 12px 16px !important;
  box-sizing: border-box !important;
  /* clip 不建立滚动容器，吸顶栏才能相对页面滚动固定 */
  overflow-x: clip !important;
  overflow-y: visible !important;
}
body.change-form #content-main,
body.change-form .ui-change-main {
  max-width: 100% !important;
  width: 100% !important;
  float: none !important;
  box-sizing: border-box !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
}
body.change-form #content.colM {
  margin-right: 0 !important;
}

/* 1. 吸顶操作栏 */
body.change-form .ui-change-sticky {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 44px;
  margin: -12px -16px 12px;
  padding: 0 16px;
  background: #FFFFFF !important;
  border: none !important;
  border-bottom: 1px solid #E2E8F0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  box-sizing: border-box;
}
body.change-form .ui-change-sticky-title {
  display: block !important;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
body.change-form .ui-change-sticky-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  margin-left: auto;
}
body.change-form .ui-change-sticky .submit-row {
  position: static !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-align: right;
  display: flex !important;
  align-items: center;
  gap: 8px;
}
body.change-form .ui-change-sticky .submit-row p.deletelink-box { margin: 0; }
body.change-form .ui-change-sticky .submit-row input,
body.change-form .ui-change-sticky .submit-row a.deletelink,
body.change-form .ui-change-sticky .submit-row a.closelink {
  height: 30px !important;
  line-height: 28px !important;
  padding: 0 12px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  margin: 0 !important;
}
body.change-form .ui-change-sticky .submit-row input[name="_save"],
body.change-form .ui-change-sticky .submit-row input.default {
  background: #4F46E5 !important;
  border: 1px solid #4F46E5 !important;
  color: #fff !important;
  order: 2;
}
body.change-form .ui-change-sticky .submit-row input[name="_continue"] {
  background: #fff !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
}
/* 隐藏「保存并增加另一个」；全页只保留吸顶栏内的 submit-row */
body.change-form .submit-row { display: none !important; }
body.change-form .submit-row input[name="_addanother"] { display: none !important; }
body.change-form .ui-change-sticky .submit-row {
  display: flex !important;
}
body.change-form .inline-group .submit-row { display: none !important; }
body.change-form .ui-change-object-tools {
  margin: 0 0 0 auto !important;
  padding: 0 !important;
  float: none !important;
  display: flex;
  gap: 6px;
}
body.change-form .ui-change-object-tools a {
  height: 28px !important;
  line-height: 28px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
  border-radius: 6px !important;
  background: #F1F5F9 !important;
  color: #334155 !important;
  border: 1px solid var(--border-color) !important;
}

/* 2. 浅色分区 + 左 Label / 右 .ui-field-control 绝对对齐 */
html:has(body.change-form),
body.change-form {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}
body.change-form,
body.change-form #container {
  background: #F8FAFC !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
body.change-form #content,
body.change-form .main > .content {
  background: #FFFFFF !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
body.change-form #container {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  min-width: 0 !important;
}
body.change-form .main {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
  min-width: 0 !important;
}
body.change-form .ui-change-body > fieldset.module,
body.change-form .ui-change-tab-panel > fieldset.module {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  padding: 0 0 2px !important;
  margin: 0 0 18px !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  float: none !important;
  overflow-x: hidden !important;
  min-width: 0 !important;
}
body.change-form .ui-change-body > fieldset.module > h2,
body.change-form .ui-change-tab-panel > fieldset.module > h2 {
  margin: 0 0 8px !important;
  padding: 0 0 0 6px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--text-main) !important;
  background: transparent !important;
  border: 0 !important;
  border-left: 3px solid #4F46E5 !important;
  line-height: 1.2;
}
body.change-form .ui-fieldset-grid {
  display: grid !important;
  /* 主要信息竖着读：一行一个字段，视线不用横着来回找 */
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  justify-items: start !important;
  align-items: center;
  box-sizing: border-box;
  min-width: 0 !important;
  overflow: hidden !important;
}
/* 单元格：仅 label + .ui-field-control */
body.change-form .ui-fieldset-grid > .ui-grid-cell,
body.change-form .ui-fieldset-grid > .form-row,
body.change-form .ui-fieldset-grid > div {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: 560px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-bottom: none !important;
  float: none !important;
  overflow: hidden !important;
  box-sizing: border-box;
  min-width: 0 !important;
  min-height: 30px !important;
}
body.change-form .form-row {
  border-bottom: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
body.change-form .ui-fieldset-grid > div.col-span-full,
body.change-form .ui-fieldset-grid > .col-span-full {
  grid-column: auto !important;
}
body.change-form .ui-fieldset-grid > .ui-grid-cell > label,
body.change-form .ui-fieldset-grid label,
body.change-form .aligned .ui-fieldset-grid label,
body.change-form .aligned label {
  float: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 3px !important;
  width: 92px !important;
  min-width: 92px !important;
  max-width: 92px !important;
  flex: 0 0 92px !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  color: #475569 !important;
  text-align: right !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: visible !important;
}
/* 统一右侧控件壳：打穿中间层，强制撑满列宽 */
body.change-form .ui-field-control {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}
body.change-form .ui-field-control .flex-container,
body.change-form .ui-field-control .fieldBox,
body.change-form .ui-field-control .form-multiline,
body.change-form .ui-field-control > div {
  display: flex !important;
  align-items: center !important;
  flex: 1 1 0% !important;
  min-width: 0 !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  box-sizing: border-box !important;
}
body.change-form .ui-field-control .related-widget-wrapper {
  float: none !important;
  display: flex !important;
  align-items: center !important;
  flex: 1 1 0% !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.change-form .ui-field-control input:not([type="checkbox"]):not([type="radio"]),
body.change-form .ui-field-control input.vDateField,
body.change-form .ui-field-control input.vTextField,
body.change-form .ui-field-control input.vIntegerField,
body.change-form .ui-field-control select,
body.change-form .ui-field-control textarea,
body.change-form .ui-field-control .related-widget-wrapper,
body.change-form .ui-field-control .select2-container,
body.change-form .ui-field-control .readonly,
body.change-form .aligned .ui-field-control input.vDateField,
body.change-form .aligned .ui-field-control input.vTextField {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 0% !important;
  box-sizing: border-box !important;
}
/* 覆盖 Django forms.css 的 20em / 5em 等固定宽（不依赖是否已包 .ui-field-control） */
body.change-form .aligned .form-row input,
body.change-form .aligned .form-row select,
body.change-form .aligned .form-row textarea,
body.change-form .form-row input,
body.change-form .form-row select,
body.change-form .form-row textarea,
body.change-form input.vTextField,
body.change-form input.vUUIDField,
body.change-form input.vIntegerField,
body.change-form input.vBigIntegerField,
body.change-form input.vDateField,
body.change-form input.vTimeField,
body.change-form select,
body.change-form textarea,
body.change-form .vLargeTextField,
body.change-form fieldset .fieldBox,
body.change-form .related-widget-wrapper,
body.change-form .related-widget-wrapper > select,
body.change-form .select2-container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}
body.change-form input[type="checkbox"],
body.change-form input[type="radio"] {
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
}
body.change-form .ui-field-control .datetimeshortcuts,
body.change-form .ui-fieldset-grid .datetimeshortcuts,
body.change-form .inline-group .tabular .datetimeshortcuts {
  display: inline-flex !important;
  align-items: center;
  flex: 0 0 auto;
  gap: 2px;
  margin-left: 6px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1;
}
body.change-form .datetimeshortcuts .date-icon,
body.change-form .datetimeshortcuts .clock-icon {
  display: inline-block !important;
  width: 16px !important;
  height: 16px !important;
  vertical-align: middle;
}
body.change-form .calendarbox,
body.change-form .clockbox {
  z-index: 1200 !important;
}
body.change-form .ui-field-control input[type="checkbox"] {
  flex: 0 0 auto !important;
  width: auto !important;
}
/* 字段只留底线，避免分区卡片再套一圈输入框 */
body.change-form .ui-field-control input:not([type="checkbox"]):not([type="radio"]),
body.change-form .ui-field-control select,
body.change-form .ui-field-control textarea,
body.change-form .ui-field-control .select2-selection--single {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid #E2E8F0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}
body.change-form .ui-field-control input:focus,
body.change-form .ui-field-control select:focus,
body.change-form .ui-field-control textarea:focus,
body.change-form .ui-field-control .select2-container--focus .select2-selection--single,
body.change-form .ui-field-control .select2-container--open .select2-selection--single {
  border: none !important;
  border-bottom: 1px solid #4F46E5 !important;
  outline: none !important;
  box-shadow: none !important;
}
/* 28px 超紧凑控件 */
body.change-form .ui-field-control input[type="text"],
body.change-form .ui-field-control input[type="number"],
body.change-form .ui-field-control input[type="email"],
body.change-form .ui-field-control input[type="url"],
body.change-form .ui-field-control input[type="password"],
body.change-form .ui-field-control input[type="date"],
body.change-form .ui-field-control select,
body.change-form .ui-field-control .vTextField,
body.change-form .ui-field-control .vIntegerField,
body.change-form .ui-field-control .vDateField,
body.change-form .ui-field-control textarea,
body.change-form .ui-field-control .vLargeTextField,
body.change-form .ui-field-control .select2-container .select2-selection--single,
body.change-form .select2-container--default .select2-selection--single {
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  padding: 2px 8px !important;
  font-size: 12px !important;
  line-height: 24px !important;
  box-sizing: border-box !important;
}
body.change-form .ui-field-control .select2-container .select2-selection--single .select2-selection__rendered {
  line-height: 26px !important;
  padding-left: 0 !important;
}
body.change-form .ui-field-control .select2-container .select2-selection--single .select2-selection__arrow {
  height: 26px !important;
}
body.change-form textarea:focus,
body.change-form .vLargeTextField:focus {
  height: 56px !important;
  min-height: 56px !important;
  max-height: none !important;
  line-height: 1.35 !important;
  transition: height 0.12s ease;
}
body.change-form form.ui-change-form,
body.change-form .ui-change-body,
body.change-form #content-main {
  width: 100% !important;
  max-width: 100% !important;
  float: none !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
}

/* 3. 去灰噪音 + 只读 28px 对齐 */
body.change-form .readonly,
body.change-form .form-row .readonly,
body.change-form .ui-fieldset-grid .readonly,
body.change-form input[readonly],
body.change-form input[disabled],
body.change-form select[disabled],
body.change-form textarea[readonly],
body.change-form textarea[disabled] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-weight: 600 !important;
  color: #0F172A !important;
  height: 28px !important;
  min-height: 28px !important;
  line-height: 28px !important;
  font-size: 12px !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 富只读面板（渠道/业主等内嵌 HTML 表）：取消 28px 单行裁切 */
body.change-form .ui-rich-readonly,
body.change-form .readonly:has(.ui-rich-readonly),
body.change-form .form-row .readonly:has(.ui-rich-readonly),
body.change-form .ui-fieldset-grid .readonly:has(.ui-rich-readonly),
body.change-form .ui-field-control .readonly:has(.ui-rich-readonly),
body.change-form .ui-field-control:has(.ui-rich-readonly) {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  line-height: 1.4 !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
  width: 100% !important;
  max-width: 100% !important;
}
body.change-form .ui-fieldset-grid > .ui-grid-cell:has(.ui-rich-readonly),
body.change-form .ui-fieldset-grid > .form-row:has(.ui-rich-readonly),
body.change-form .ui-fieldset-grid > div:has(.ui-rich-readonly),
body.change-form .ui-fieldset-grid > .col-span-full {
  grid-column: 1 / -1 !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: visible !important;
  min-height: 0 !important;
}
body.change-form .ui-rich-readonly {
  display: block;
  width: 100%;
  box-sizing: border-box;
}
body.change-form .ui-rich-readonly .ui-panel-scroll {
  max-height: 420px;
  overflow: auto;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  background: #fff;
}
body.change-form .ui-rich-readonly .ui-panel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: auto;
}
body.change-form .ui-rich-readonly .ui-panel-table th,
body.change-form .ui-rich-readonly .ui-panel-table td {
  border: 1px solid #E2E8F0;
  padding: 6px 8px;
  vertical-align: middle;
  white-space: nowrap;
}
body.change-form .ui-rich-readonly .ui-panel-table thead th {
  background: #F8FAFC;
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 600;
  color: #334155;
  text-align: left;
}
body.change-form .ui-rich-readonly .ui-panel-table td.num,
body.change-form .ui-rich-readonly .ui-panel-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
body.change-form .ui-rich-readonly .ui-panel-meta {
  margin: 8px 0 0;
  color: #64748B;
  font-size: 12px;
}
body.change-form .ui-rich-readonly .ui-panel-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 18px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #14532D;
  font-size: 13px;
  line-height: 1.5;
}
body.change-form .ui-rich-readonly .ui-panel-summary--invoice {
  background: #FFF7ED;
  border-color: #FED7AA;
  color: #9A3412;
}
body.change-form .ui-rich-readonly .ui-panel-summary .ui-stat {
  white-space: nowrap;
}
body.change-form .ui-rich-readonly .ui-panel-summary .ui-stat b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
body.model-corechannel.change-form .inline-group {
  overflow-x: auto;
  max-width: 100%;
}
body.change-form .help,
body.change-form p.help,
body.change-form div.help,
body.change-form .helptext {
  display: none !important;
}
body.change-form .ui-help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  width: 14px;
  height: 14px;
  font-size: 11px;
  line-height: 1;
  color: #94A3B8;
  cursor: help;
  position: relative;
  vertical-align: middle;
  font-style: normal;
}
body.change-form .ui-help-tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  min-width: 160px;
  max-width: 280px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #0F172A;
  color: #F8FAFC;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
  white-space: normal;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 60;
}
body.change-form .ui-help-tip:hover::after,
body.change-form .ui-help-tip:focus::after {
  opacity: 1;
}
/* 外键旁铅笔/加号仅 hover 弱显；日期选择见上方，不再藏起来 */
body.change-form .related-widget-wrapper-link {
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  flex-shrink: 0;
}
/* 平时不占位，避免窄列里外键框被铅笔/加号挤到只剩几个字 */
body.change-form .ui-fieldset-grid .related-widget-wrapper {
  position: relative;
}
body.change-form .ui-fieldset-grid .related-widget-wrapper-link {
  position: absolute;
  top: 2px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
body.change-form .ui-fieldset-grid .related-widget-wrapper .select2-container {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
body.change-form .form-row:hover .related-widget-wrapper-link,
body.change-form .ui-grid-cell:hover .related-widget-wrapper-link,
body.change-form .related-widget-wrapper:hover .related-widget-wrapper-link {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  opacity: 0.55;
  pointer-events: auto;
}
body.change-form .ui-field-control p.date,
body.change-form .ui-field-control p.datetime,
body.change-form .inline-group .tabular p.date,
body.change-form .inline-group .tabular p.datetime {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  margin: 0 !important;
  gap: 4px;
}
body.change-form .ui-field-control p.date input,
body.change-form .ui-field-control p.datetime input,
body.change-form .inline-group .tabular p.date input,
body.change-form .inline-group .tabular p.datetime input {
  width: auto !important;
  flex: 1 1 88px !important;
  min-width: 0 !important;
}

/* 4. Tabs */
body.change-form .ui-change-tabs-host {
  margin-top: 4px;
}
body.change-form .ui-change-tabs {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 8px;
  padding: 0;
  gap: 6px;
}
body.change-form .ui-change-tabs[hidden] { display: none !important; }
body.change-form .ui-change-tab-panel[hidden] { display: none !important; }
body.change-form .ui-change-tab-panel > .inline-group,
body.change-form .ui-change-tab-panel > fieldset.module {
  display: block;
  margin: 0;
  padding: 8px 12px !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 8px !important;
  background: #FFFFFF !important;
  overflow-x: auto !important;
  max-width: 100%;
}
body.change-form .ui-change-tab-panel > .inline-group {
  padding: 0 !important;
}
body.change-form .ui-tab-panel-heading {
  display: none !important;
}

/* 5. Inline 高密度 28px — 白底卡片 + 浅色表头 */
body.change-form .inline-group {
  margin: 0;
  padding: 0;
  background: #FFFFFF !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 8px !important;
}
body.change-form .inline-group .tabular thead th,
body.change-form .inline-group .tabular td {
  padding: 4px 8px !important;
  font-size: 12px !important;
  vertical-align: middle !important;
  line-height: 1.2;
}
body.change-form .inline-group .tabular thead th {
  background: #F8FAFC !important;
  color: #475569 !important;
  font-weight: 600 !important;
  border-bottom: 1px solid #E2E8F0 !important;
  white-space: nowrap;
}
/* 隐藏 original 列的 th+td，否则表头会整体错一位（关联公司对到角色等） */
body.change-form .inline-group .tabular thead th.original,
body.change-form .inline-group .tabular tbody td.original,
body.change-form .inline-group .tabular td.original p,
body.change-form .inline-group .tabular thead tr > th:first-child:empty {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
}
/* 外键 autocomplete：强制单行，避免链接换行把整行撑高、其它列垂直居中错位 */
body.change-form .inline-group .tabular .related-widget-wrapper {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 4px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 28px !important;
  max-height: 28px !important;
  overflow: hidden !important;
}
body.change-form .inline-group .tabular .related-widget-wrapper > select,
body.change-form .inline-group .tabular .related-widget-wrapper .select2-container {
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
}
body.change-form .inline-group .tabular .related-widget-wrapper-link {
  display: none !important;
}
body.change-form .inline-group .tabular input,
body.change-form .inline-group .tabular select,
body.change-form .inline-group .tabular textarea {
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  padding: 2px 8px !important;
  font-size: 12px !important;
  line-height: 24px !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
/* 明细表按内容排，窄屏横向滚动，避免列被压碎后表头和输入框错位 */
body.change-form .inline-group {
  overflow-x: auto;
  max-width: 100%;
}
body.change-form .inline-group .tabular {
  table-layout: auto !important;
  width: 100% !important;
  min-width: 0;
}
body.change-form .inline-group .tabular p.datetime {
  flex-wrap: nowrap !important;
  height: auto !important;
  min-height: 28px !important;
  line-height: 28px !important;
  overflow: visible !important;
}
body.change-form .inline-group .tabular p.datetime br {
  display: none !important;
}
body.change-form .inline-group .tabular p.datetime input {
  width: auto !important;
  flex: 1 1 88px !important;
  min-width: 0 !important;
  max-width: 148px !important;
}
/* 项目业主：搜索框和下拉要能看全名称，旁边保留「新增业主」弹窗 */
body.model-project.change-form .inline-group .tabular th.column-owner,
body.model-project.change-form .inline-group .tabular td.field-owner {
  min-width: 420px !important;
  width: 48% !important;
}
body.model-project.change-form .inline-group .tabular td.field-owner .related-widget-wrapper {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
  min-width: 400px !important;
}
body.model-project.change-form .inline-group .tabular td.field-owner .select2-container {
  min-width: 340px !important;
  width: 100% !important;
  flex: 1 1 auto !important;
}
body.model-project.change-form .inline-group .tabular td.field-owner a.add-related {
  display: inline-flex !important;
  align-items: center;
  flex: 0 0 auto;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: static !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  margin-left: 6px;
}
body.model-project .select2-dropdown {
  min-width: 520px !important;
}
body.model-project .select2-results__option {
  white-space: normal !important;
  line-height: 1.4 !important;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}
/* 交易分摊：项目搜索框要能看清项目名，否则下拉里没法选 */
body.model-transactionlog.change-form .inline-group .tabular th.column-project,
body.model-transactionlog.change-form .inline-group .tabular td.field-project {
  min-width: 480px !important;
  width: 48% !important;
}
body.model-transactionlog.change-form .inline-group .tabular td.field-project .related-widget-wrapper,
body.model-transactionlog.change-form .inline-group .tabular td.field-project .select2-container {
  min-width: 460px !important;
  width: 100% !important;
}
body.model-transactionlog .select2-dropdown {
  min-width: 640px !important;
}
body.model-transactionlog .select2-results__option {
  white-space: normal !important;
  line-height: 1.4 !important;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}
/* 渠道公司表才锁列宽；不要套到项目结算等其它明细表 */
body.model-corechannel.change-form .inline-group .tabular {
  table-layout: fixed !important;
  min-width: 0;
}
body.model-corechannel.change-form .inline-group .tabular td.field-partner,
body.model-corechannel.change-form .inline-group .tabular th.column-partner {
  width: 34% !important;
}
body.model-corechannel.change-form .inline-group .tabular td.field-role,
body.model-corechannel.change-form .inline-group .tabular th.column-role {
  width: 12% !important;
}
body.model-corechannel.change-form .inline-group .tabular td.field-region,
body.model-corechannel.change-form .inline-group .tabular th.column-region {
  width: 12% !important;
}
body.model-corechannel.change-form .inline-group .tabular td.field-memo,
body.model-corechannel.change-form .inline-group .tabular th.column-memo {
  width: 26% !important;
}
body.model-corechannel.change-form .inline-group .tabular td.field-is_active,
body.model-corechannel.change-form .inline-group .tabular th.column-is_active,
body.model-corechannel.change-form .inline-group .tabular td.delete,
body.model-corechannel.change-form .inline-group .tabular th:last-child {
  width: 8% !important;
}
body.change-form .inline-group .tabular input[name*="amount"],
body.change-form .inline-group .tabular input[name*="Amount"],
body.change-form .inline-group .tabular input[name*="rate"],
body.change-form .inline-group .tabular input[name*="money"],
body.change-form .inline-group .tabular td.field-allocated_amount input,
body.change-form .inline-group .tabular td.field-amount input {
  text-align: right !important;
  font-variant-numeric: tabular-nums !important;
  font-family: var(--font-num) !important;
}
body.change-form .inline-group .add-row a,
body.change-form .inline-group .add-row td a,
body.change-form .inline-related h3 .addlink,
body.change-form a.add-related {
  display: inline-flex !important;
  align-items: center;
  border: 1px dashed #CBD5E1 !important;
  padding: 4px 12px !important;
  border-radius: 6px !important;
  background: #fff !important;
  color: #475569 !important;
  font-size: 12px !important;
  text-decoration: none !important;
  margin: 8px 0 !important;
}
body.change-form .inline-group .add-row a:hover {
  border-color: #4F46E5 !important;
  color: #4F46E5 !important;
}

@media (max-width: 720px) {
  body.change-form .ui-change-sticky {
    height: auto;
    min-height: 48px;
    flex-wrap: wrap;
    padding: 8px 10px;
  }
}

/* 详情页禁止列表页残留的右侧 / 右下角 fixed 控件 */
body.change-form .project-filter-toggle { display: none !important; }
body.change-form .object-tools {
  float: none !important;
  position: static !important;
}
body.change-form button[style*="position: fixed"],
body.change-form a[style*="position: fixed"],
body.change-form .ui-pill[style*="position: fixed"] {
  display: none !important;
}
