:root {
  --primary: #4f6ef7;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --topbar-bg: #1f2937;
  --sidebar-bg: #111827;
  --sidebar-text: #d1d5db;
  --content-bg: #ffffff;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --topbar-h: 56px;
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 64px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --scrollbar-size: 6px;
  --scrollbar-thumb: rgba(107, 114, 128, .28);
  --scrollbar-thumb-hover: rgba(107, 114, 128, .48);
  --scrollbar-track: transparent;
}

* { box-sizing: border-box; }

/* 全局滚动条：默认隐藏，滚动时由 .scrollbar-visible 显示 */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
*.scrollbar-visible {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
*::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
}
*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
*::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background-color .25s ease;
}
*.scrollbar-visible::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
}
*.scrollbar-visible::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}
*::-webkit-scrollbar-corner {
  background: transparent;
}
html, body {
  margin: 0; padding: 0; width: 100%; min-height: 100%;
  font-family: var(--font); font-size: 14px; color: var(--text); background: var(--content-bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 壳层 index.html（Grid 布局，避免 fixed + iframe 错位） ---------- */
html.shell-page {
  background: var(--sidebar-bg);
}
body.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--sidebar-bg);
  overscroll-behavior: none;
}
body.shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
}

.top-bar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--topbar-bg); color: #fff;
  z-index: 10;
}
.top-bar .brand { font-weight: 600; font-size: 16px; }
.top-bar .spacer { flex: 1; }
.top-bar button {
  background: transparent; border: 1px solid rgba(255,255,255,.25); color: #fff;
  padding: 6px 12px; border-radius: 4px; cursor: pointer;
}
.top-bar button:hover { background: rgba(255,255,255,.1); }

.sidebar {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  min-width: 0;
  background: var(--sidebar-bg);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: transparent transparent;
}
.sidebar.scrollbar-visible {
  scrollbar-color: rgba(255, 255, 255, .22) transparent;
}
.sidebar.scrollbar-visible::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, .22);
}
.sidebar.scrollbar-visible::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, .38);
}
#sidebar-nav {
  padding: 10px 0 18px;
  min-height: 100%;
  background: var(--sidebar-bg);
}
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-right: 11px;
  color: #94a3b8;
  vertical-align: middle;
  transition: color .18s ease, transform .18s ease;
}
.nav-icon svg { display: block; }
.nav-group {
  margin: 0 0 8px;
}
.nav-group-title {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 11px 18px 8px;
  font-size: 12px; color: #94a3b8;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: color .18s ease, background .18s ease;
}
.nav-group-title:hover,
.nav-group-title:focus-visible,
.nav-group.is-open .nav-group-title {
  color: #cbd5e1;
}
.nav-group-title:focus-visible {
  outline: 2px solid rgba(79, 110, 247, .7);
  outline-offset: -2px;
}
.nav-group-title .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-group-title .nav-icon {
  width: 20px;
  height: 20px;
  margin-right: 10px;
  color: #64748b;
}
.nav-group-chevron {
  width: 7px;
  height: 7px;
  margin: 0 4px 0 auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: .65;
  transform: rotate(-45deg);
  transition: transform .18s ease, opacity .18s ease;
}
.nav-group.is-open .nav-group-chevron {
  transform: rotate(45deg);
  opacity: 1;
}
.nav-children {
  position: relative;
  display: none;
  margin: 0 0 5px 27px;
  padding: 2px 0 3px 9px;
}
.nav-group.is-open > .nav-children { display: block; }
.nav-children::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: rgba(148, 163, 184, .16);
}
.nav-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px 10px 12px;
  margin: 2px 8px 2px 0;
  color: #cbd5e1;
  cursor: pointer;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.nav-item .nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover, .nav-item.active {
  background: rgba(79, 110, 247, .16); color: #fff; border-left-color: var(--primary);
  text-decoration: none;
}
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { color: #fff; }
.nav-item:hover .nav-icon { transform: translateX(1px); }

/* 二级菜单：目录与菜单保持清晰的层级关系 */
.nav-item.nav-level-0 {
  margin-left: 0;
}

/* 折叠侧栏：仅图标 + 悬停 tooltip */
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .nav-group-title { display: none; }
.sidebar.collapsed .nav-group { margin-bottom: 4px; }
.sidebar.collapsed .nav-children {
  display: block;
  margin: 0;
  padding: 0;
}
.sidebar.collapsed .nav-children::before { display: none; }
.sidebar.collapsed .nav-item {
  position: relative;
  justify-content: center;
  padding: 11px 0;
  margin: 2px 8px;
  border-left: none;
  border-radius: 6px;
}
.sidebar.collapsed .nav-item .nav-icon { margin-right: 0; }
.sidebar.collapsed .nav-item:hover,
.sidebar.collapsed .nav-item.active {
  border-left: none;
}
.sidebar.collapsed .nav-item:hover,
.sidebar.collapsed .nav-item:focus-visible {
  background: rgba(79, 110, 247, .22);
  color: #fff;
}
.sidebar.collapsed .nav-item:hover .nav-icon,
.sidebar.collapsed .nav-item:focus-visible .nav-icon {
  color: #fff;
}

/* 折叠侧栏浮动提示（fixed，避免被 overflow 裁切） */
.nav-tooltip {
  position: fixed;
  z-index: 10000;
  transform: translateY(-50%);
  padding: 9px 16px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.01em;
  border-radius: 8px;
  border-left: 4px solid var(--primary);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18), 0 0 0 1px rgba(15, 23, 42, .08);
  transition: opacity .12s ease, visibility .12s ease, transform .12s ease;
}
.nav-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}
.nav-tooltip::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-right-color: #fff;
}

.project-key-star {
  color: #f4b740;
  font-size: 1.05em;
  line-height: 1;
  vertical-align: -0.02em;
  text-shadow: 0 1px 2px rgba(180, 112, 0, .22);
}
.project-name-value { min-width: 0; overflow-wrap: anywhere; }

#main-iframe {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border: none;
  display: block;
  background: var(--content-bg);
}

/* ---------- iframe 内业务页：必须撑满 iframe 宽度 ---------- */
body:not(.shell) {
  width: 100%;
  min-width: 100%;
  overflow-x: auto;
}
body:not(.shell) .page-wrap {
  width: 100%;
  max-width: 100%;
  padding: 16px;
  min-height: 100%;
}
body:not(.shell) .card {
  width: 100%;
  max-width: 100%;
}
/* 列表/业务 iframe 页：去掉 page-wrap 最外层 card 边框（控制台保留卡片样式） */
body:not(.shell) .page-wrap:not(#dashboard-content) > .card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
}

.page-wrap { padding: 16px; min-height: 100%; width: 100%; }
.card {
  background: var(--card-bg); border-radius: 8px; border: 1px solid var(--border);
  padding: 16px; margin-bottom: 16px; width: 100%;
}
.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  /* 列表可能包含操作列，横向滚动条必须可见 */
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
.table-wrap::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
}
.table-wrap::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}
.table-scroll-hint { display: none; }
.card-title { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.card-header .card-title { margin: 0; flex: 1; }
.form-page-body .card:last-child { margin-bottom: 0; }

.search-bar {
  display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end;
  margin-bottom: 16px; width: 100%;
}
.search-bar .field {
  display: flex; flex-direction: column; gap: 4px;
  flex: 0 1 auto; min-width: 140px;
}
.search-bar label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.search-bar input, .search-bar select {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px;
  min-width: 140px; width: 100%; max-width: 220px;
}
.search-bar input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.search-bar select { height: 34px; min-height: 34px; box-sizing: border-box; }
.search-bar > .btn { flex: 0 0 auto; min-height: 34px; margin-bottom: 1px; }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar.toolbar-split { align-items: center; justify-content: space-between; }
.toolbar.toolbar-split .text-muted { flex: 1; min-width: 0; }
.btn {
  display: inline-block; padding: 6px 14px; border-radius: 4px; border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; line-height: 1.4;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { opacity: .9; color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled,
.btn.is-api-busy {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-link { border: none; background: none; color: var(--primary); padding: 0 6px; cursor: pointer; }
.btn-link.danger { color: var(--danger); }

.data-table { width: 100%; min-width: 640px; border-collapse: collapse; background: #fff; table-layout: auto; }
.data-table th, .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th.align-right, .data-table td.align-right { text-align: right; }
.data-table th.nowrap, .data-table td.nowrap { white-space: nowrap; }
.data-table th.action-column, .data-table td.action-column {
  width: 1%;
  min-width: max-content;
  white-space: nowrap;
}
.data-table td.action-column .btn-link {
  display: inline-block;
  vertical-align: middle;
}
.data-table th { background: #f9fafb; font-weight: 600; white-space: nowrap; }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--primary); }
.data-table tr:hover td { background: #f9fafb; }
.data-table .empty-row td { text-align: center; color: var(--text-muted); padding: 32px; }

/* 收款单选择弹窗：固定在弹窗宽度内，备注单行省略，避免横向拖动和换行 */
table.receipt-picker-table {
  min-width: 0;
  table-layout: fixed;
}
.receipt-picker-table th,
.receipt-picker-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.receipt-picker-table th:first-child,
.receipt-picker-table td:first-child {
  width: 56px;
  text-align: center;
}
.receipt-picker-table th:nth-child(2),
.receipt-picker-table td:nth-child(2) {
  width: 110px;
}
.receipt-picker-table th:nth-child(3),
.receipt-picker-table td:nth-child(3) {
  width: 130px;
}
.receipt-picker-table th:last-child,
.receipt-picker-table td:last-child {
  width: 180px;
}

.table-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; font-size: 13px; }
.table-pager button { padding: 4px 10px; }
.page-size-control { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.page-size-select { width: auto; min-width: 100px; height: 30px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 4px; background: #fff; color: var(--text); font: inherit; }
.page-size-select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  width: 100%;
}
.form-grid .full { grid-column: 1 / -1; }
/* 标题、说明等不要与 form-field 混在同一 grid 内 */
.form-grid > .card-title,
.form-grid > h3,
.form-grid > p { grid-column: 1 / -1; margin: 0 0 4px; }
.form-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.form-field label { font-size: 13px; color: var(--text-muted); }
.form-field label .req { color: var(--danger); }
.form-field input, .form-field select, .form-field textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; width: 100%;
  max-width: 100%;
}
.form-field input[type="radio"],
.form-field input[type="checkbox"] {
  width: auto; max-width: none; padding: 0; border: none; border-radius: 0;
}
.form-radio-group {
  display: flex;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
.form-radio-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  min-width: 0;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
  background: #fff;
  border-right: 1px solid var(--border);
  transition: background .15s, color .15s;
  user-select: none;
}
.form-radio-option:last-child { border-right: none; }
.form-radio-option:hover { background: #f9fafb; }
.form-radio-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.form-radio-option span {
  display: block;
  width: 100%;
  padding: 8px 6px;
  text-align: center;
}
.form-radio-option:has(input:checked) {
  background: #eef2ff;
  color: var(--primary);
  font-weight: 600;
}
.form-radio-option:has(input:focus-visible) span {
  outline: 2px solid rgba(79, 110, 247, .45);
  outline-offset: -2px;
}
.form-field textarea { min-height: 72px; resize: vertical; }
.form-hint {
  font-size: 13px; color: var(--text-muted); line-height: 1.55;
  background: #f9fafb; border: 1px solid var(--border); border-radius: 4px;
  padding: 10px 12px; margin-bottom: 12px;
}
.form-hint strong { color: var(--text); font-weight: 600; }
.form-hint ul { margin: 6px 0 0; padding-left: 18px; }
.form-hint li { margin: 3px 0; }
.form-hint code { font-size: 12px; background: #eef2ff; color: var(--primary); padding: 1px 5px; border-radius: 3px; }
.split-legend {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(90px, 0.8fr) minmax(100px, 1fr) minmax(100px, 1fr) auto;
  gap: 8px; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; padding: 0 2px;
}
#user-splits-wrap .split-legend {
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 1fr) auto;
}
.form-actions { margin-top: 20px; display: flex; gap: 8px; flex-wrap: wrap; }
.form-action-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  box-sizing: border-box;
  background: #fff;
  border-top: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}
.form-action-bar .btn {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.badge-success { background: #f6ffed; color: var(--success); border: 1px solid #b7eb8f; }
.badge-warning { background: #fffbe6; color: #d48806; border: 1px solid #ffe58f; }
.badge-danger { background: #fff2f0; color: var(--danger); border: 1px solid #ffccc7; }
.badge-default { background: #f5f5f5; color: var(--text-muted); border: 1px solid var(--border); }
.text-muted { color: var(--text-muted); font-size: 13px; }
.amount-received { color: var(--success); font-weight: 500; }
.amount-unpaid { color: var(--danger); font-weight: 500; }
.amount-depleted { color: var(--danger); font-weight: 600; }
.project-payment-progress { display: flex; align-items: center; gap: 8px; min-width: 140px; color: var(--primary); }
.project-payment-progress-track { flex: 1; min-width: 64px; height: 6px; overflow: hidden; border-radius: 3px; background: #eef2ff; }
.project-payment-progress-fill { display: block; height: 100%; border-radius: inherit; background: currentColor; }
.project-payment-progress-label { flex: 0 0 auto; min-width: 48px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.project-payment-progress.is-complete { color: var(--success); }
.badge-primary { background: #eef2ff; color: var(--primary); border: 1px solid #c7d2fe; }
.receipt-picker { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.receipt-picker #receiptDisplay { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-pool-warning { color: var(--danger); }
.receipt-select-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.receipt-select-actions > div { display: flex; gap: 8px; }

.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tabs .tab {
  padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--text-muted);
}
.tabs .tab:hover { color: var(--primary); }
.tabs .tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel iframe { width: 100%; min-height: 520px; border: none; }

.stat-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; width: 100%;
}
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { color: var(--text-muted); margin-top: 4px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.media-card {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fff;
}
.media-card .title { font-weight: 600; margin-bottom: 8px; }
.media-card .meta { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.media-card .actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.media-card img.thumb { max-width: 100%; max-height: 120px; border-radius: 4px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 20px 24px; border-left: 2px solid var(--border); margin-left: 8px; }
.timeline li::before {
  content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary); border: 2px solid #fff;
}
.timeline .time { font-size: 12px; color: var(--text-muted); }
.timeline .title { font-weight: 600; margin: 4px 0; }
.timeline .backfill { font-size: 11px; color: var(--warning); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden;
  overscroll-behavior: contain;
}
.modal-panel {
  display: flex;
  flex-direction: column;
  background: #fff; border-radius: 8px; max-width: 90vw; max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  width: 100%;
  box-sizing: border-box;
}
.modal-panel.sm { width: 480px; }
.modal-panel.md { width: 640px; }
.modal-panel.lg { width: 900px; }
.modal-panel.xl { width: 1100px; height: 90vh; }
.modal-panel.has-iframe {
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
}
.modal-body {
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
.modal-body.modal-body-iframe {
  flex: 1; min-height: 0; padding: 0; overflow: hidden;
}
.modal-body iframe { width: 100%; border: none; min-height: 400px; }
.modal-body.modal-body-iframe iframe {
  display: block; height: 100%; min-height: 0;
}
.modal-footer {
  width: 100%;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  box-sizing: border-box;
  background: #fff;
}
.modal-footer-inner {
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  box-sizing: border-box;
}
.modal-footer-inner .btn {
  margin: 0;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-body .form-field input,
.modal-body .form-field select,
.modal-body .form-field textarea,
.modal-body > select,
.modal-body > input,
.modal-body > textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* iframe 弹窗内页：铺满 iframe，表单区滚动，底栏固定 */
html.modal-page, html.modal-page body { height: 100%; margin: 0; }
html.modal-page body {
  overflow: hidden; background: var(--content-bg);
  display: flex; flex-direction: column;
}
html.modal-page .page-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}
html.modal-page .modal-page-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
}
html.modal-page .form-page-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  align-content: start;
}
/* 弹窗表单：与新增项目一致 — 双列、16px/20px 行距、内容顶对齐 */
html.modal-page .form-page-body.form-grid,
html.modal-page .form-page-body > .form-grid,
html.modal-page .form-page-body .card .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  width: 100%;
  align-content: start;
  align-items: start;
}
html.modal-page .form-page-body > .card {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  width: 100%;
}
html.modal-page .form-page-body > .card .card-title {
  margin: 0 0 4px;
}
html.modal-page .form-page-body > .card > .form-hint {
  margin: 0 0 4px;
}
/* 弹窗表单：仅 form-page-body 滚动，Markdown 编辑器随内容增高 */
html.modal-page .EasyMDEContainer .CodeMirror {
  min-height: 140px;
  height: auto !important;
}
html.modal-page .EasyMDEContainer .CodeMirror-scroll {
  overflow: visible !important;
  min-height: 140px;
  max-height: none !important;
}
/* 弹窗表单统一：底栏右对齐，按钮与列表页 .btn 同尺寸 */
html.modal-page .form-action-bar {
  margin-top: auto;
  width: 100%;
  justify-content: flex-end;
  padding: 10px 16px;
  background: transparent;
  border-top: 1px solid var(--border);
  box-shadow: none;
}
html.modal-page .form-action-bar .btn {
  flex: 0 0 auto;
  display: inline-block;
  width: auto;
  min-width: 0;
  padding: 6px 14px;
  font-size: 14px;
  line-height: 1.4;
}
html.modal-page .custom-field-row.form-grid {
  gap: 16px 20px;
  align-content: start;
  align-items: start;
  padding-top: 8px !important;
  margin-top: 8px !important;
}

/* iframe 弹窗：默认占视口 90% 高度，内容区 iframe 填满剩余空间 */
.modal-panel.has-iframe.sm,
.modal-panel.has-iframe.md,
.modal-panel.has-iframe.lg,
.modal-panel.has-iframe.xl {
  height: 90vh;
  max-height: 90vh;
}
.modal-panel.has-iframe .modal-body.modal-body-iframe {
  flex: 1;
  min-height: 0;
}
.modal-panel.has-iframe .modal-body.modal-body-iframe iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
}
.toast {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 3000;
  padding: 10px 20px; border-radius: 4px; color: #fff; font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--topbar-bg); }

.loading-mask {
  position: fixed; inset: 0; background: rgba(255,255,255,.6); z-index: 1500;
  display: flex; align-items: center; justify-content: center;
}

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  color: #182230;
  background: #f3f6fb;
}
.login-box {
  width: 400px;
  background: #fff;
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.login-box h1 { margin: 0 0 24px; font-size: 22px; text-align: center; }
.login-box .form-field { margin-bottom: 16px; }
.captcha-row { display: flex; gap: 8px; align-items: center; }
.captcha-row img { height: 38px; cursor: pointer; border-radius: 4px; border: 1px solid var(--border); }

/* ---------- 登录页：桌面分栏，手机单列 ---------- */
.login-page { display: grid; place-items: center; padding: 32px; }
.login-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(390px, 1fr);
  width: min(920px, 100%);
  min-height: 560px;
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(26, 43, 73, .16);
}
.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px;
  color: #fff;
  background: radial-gradient(ellipse at 20% 0%, rgba(114,146,255,.42), transparent 48%), linear-gradient(145deg, #172b54, #263f78 62%, #3557a1);
}
.login-brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; color: #fff; font-size: 22px; font-weight: 750; letter-spacing: -.04em; }
.login-brand:hover { color: #fff; text-decoration: none; }
.login-brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,.42); border-radius: 12px; background: rgba(255,255,255,.12); font-size: 17px; }
.login-intro-copy { max-width: 350px; margin: 48px 0; }
.login-eyebrow { margin: 0 0 12px; color: #71809a; font-size: 11px; font-weight: 750; letter-spacing: .14em; }
.login-intro .login-eyebrow { color: #a9c0ff; }
.login-intro h1 { margin: 0 0 16px; font-size: clamp(30px, 4vw, 42px); line-height: 1.2; letter-spacing: -.04em; }
.login-intro-copy > p:last-child { margin: 0; color: rgba(235,241,255,.78); font-size: 15px; line-height: 1.8; }
.login-intro-foot { color: rgba(235,241,255,.62); font-size: 12px; letter-spacing: .08em; }
.login-box {
  align-self: center;
  width: auto;
  margin: 0;
  padding: 54px 52px 46px;
  border-radius: 0;
  box-shadow: none;
}
.login-heading { margin-bottom: 30px; }
.login-heading .login-eyebrow { margin-bottom: 9px; color: #6176cc; }
.login-heading h2 { margin: 0; color: #172033; font-size: 27px; line-height: 1.3; letter-spacing: -.03em; }
.login-heading > p:last-child { margin: 9px 0 0; color: #7b8494; font-size: 14px; }
.login-box .form-field { margin-bottom: 19px; }
.login-box .form-field > label { display: block; margin-bottom: 8px; color: #384256; font-size: 13px; font-weight: 650; }
.login-box input[type="text"], .login-box input[type="password"] {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #dce2ec;
  border-radius: 10px;
  outline: 0;
  background: #fbfcfe;
  color: #182230;
  font-size: 15px;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.login-box input[type="text"]::placeholder, .login-box input[type="password"]::placeholder { color: #a2aabb; }
.login-box input[type="text"]:focus, .login-box input[type="password"]:focus { border-color: #6079e8; background: #fff; box-shadow: 0 0 0 3px rgba(79,110,247,.13); }
.login-box .captcha-row { gap: 12px; }
.login-box .captcha-row input { flex: 1; }
.login-box .captcha-row img { flex: 0 0 112px; width: 112px; height: 48px; border-color: #dce2ec; border-radius: 10px; object-fit: contain; background: #fff; }
.login-options { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 2px 0 22px; }
.remember-option { display: inline-flex; align-items: center; gap: 8px; color: #485366; font-size: 13px; cursor: pointer; }
.remember-option input { width: 16px; height: 16px; margin: 0; accent-color: #4f6ef7; }
.remember-hint { color: #929bab; font-size: 11px; }
.login-submit { width: 100%; min-height: 48px; border: 0; border-radius: 10px; font-size: 15px; font-weight: 700; box-shadow: 0 7px 16px rgba(79,110,247,.2); }
.login-secure-note { margin: 20px 0 0; color: #9aa3b2; font-size: 11px; text-align: center; }

.split-rows {
  border: 1px dashed var(--border); padding: 12px; border-radius: 4px;
  margin-bottom: 8px; min-height: 48px;
}
.split-rows:empty::before {
  content: '暂无分账行，请点击「添加行」';
  color: var(--text-muted); font-size: 13px;
}
.split-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(90px, 0.8fr) minmax(100px, 1fr) minmax(100px, 1fr) auto;
  gap: 8px; align-items: end; margin-bottom: 8px;
}
.split-row:last-child { margin-bottom: 0; }
.split-row select, .split-row input { width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; }
.split-row .btn-rm { white-space: nowrap; }
#user-splits .split-row {
  grid-template-columns: minmax(140px, 1fr) minmax(120px, 1fr) auto;
}
.split-summary { font-size: 13px; color: var(--text-muted); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  html.modal-page .form-page-body.form-grid,
  html.modal-page .form-page-body > .form-grid,
  html.modal-page .form-page-body .card .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
  }
  .split-row, #user-splits .split-row { grid-template-columns: 1fr; }
  .split-legend { display: none; }
}

.task-indent-1 td:first-child { padding-left: 28px; }
.task-indent-2 td:first-child { padding-left: 48px; }
.task-indent-3 td:first-child { padding-left: 68px; }

.view-toggle { margin-bottom: 12px; }
.view-toggle button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.chart-box { height: 320px; width: 100%; }

.recent-projects-table { min-width: 480px; }
.recent-projects-table tr.is-clickable { cursor: pointer; }
.recent-projects-table tr.is-clickable:hover td { background: #f3f4f6; }
@media (max-width: 768px) {
  .recent-projects-table { min-width: 0; width: 100%; display: block; }
  .recent-projects-table thead { display: none; }
  .recent-projects-table tbody { display: block; }
  .recent-projects-table tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 4px 0;
    background: #fff;
  }
  .recent-projects-table tr.empty-row {
    border: none;
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
  }
  .recent-projects-table tr.is-clickable:active { background: #f9fafb; }
  .recent-projects-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: none;
    text-align: right;
  }
  .recent-projects-table td::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
  }
  .recent-projects-table td[data-label="名称"] {
    font-weight: 600;
    color: var(--text);
  }
  .recent-projects-table td[data-label="操作"] .btn-link {
    padding: 4px 12px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    text-decoration: none;
  }
}

/* ---------- 用户分配角色 ---------- */
.role-assign-user {
  margin-bottom: 12px; padding: 10px 12px;
  background: #f9fafb; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px;
}
.role-assign-user-name { font-weight: 600; color: var(--text); }
.role-assign-user-meta { color: var(--text-muted); margin-left: 4px; }
.role-assign-hint {
  margin: 0 0 10px; padding: 8px 10px; font-size: 13px; color: #92400e;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px;
}
.role-assign-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px; font-size: 13px; color: var(--text-muted);
}
.role-assign-toolbar .spacer { flex: 1; }
.role-assign-count strong { color: var(--primary); font-weight: 600; }
.role-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
  padding: 2px;
}
.role-chip {
  position: relative;
  display: flex; flex-direction: row; align-items: center; gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.role-chip:hover:not(.disabled) {
  border-color: #c7d2fe; background: #fafbff;
}
.role-chip.selected {
  border-color: var(--primary);
  background: #eef2ff;
  box-shadow: 0 0 0 1px rgba(79, 110, 247, .15);
}
.role-chip.disabled {
  opacity: .55; cursor: not-allowed; background: #f9fafb;
}
.role-chip.locked {
  cursor: default; border-color: #c7d2fe;
}
.role-chip-tag {
  display: inline-block; margin-left: 4px; padding: 0 5px;
  font-size: 11px; font-weight: 500; color: var(--primary);
  background: #fff; border: 1px solid #c7d2fe; border-radius: 4px; vertical-align: 1px;
}
.role-chip-check {
  flex: 0 0 18px;
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--border); border-radius: 4px;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.role-chip.selected .role-chip-check {
  border-color: var(--primary); background: var(--primary);
  color: #fff;
}
.role-chip.selected .role-chip-check::after {
  content: '✓'; font-size: 12px; font-weight: 700; line-height: 1;
}
.role-chip-text {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0; flex: 1;
}
.role-chip-name { font-weight: 600; font-size: 14px; color: var(--text); line-height: 1.3; }
.role-chip-code { font-size: 12px; color: var(--text-muted); font-family: ui-monospace, monospace; line-height: 1.3; }
.role-chip .role-chip-input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.role-assign-empty {
  grid-column: 1 / -1; text-align: center; color: var(--text-muted);
  padding: 24px 12px;
}

/* ---------- 重点项目选择 ---------- */
.form-field label.key-project-toggle {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.form-field label.key-project-toggle:hover {
  border-color: #c7d2fe; background: #fafbff;
}
.form-field label.key-project-toggle:has(.key-project-input:checked) {
  border-color: var(--primary);
  background: #eef2ff;
  box-shadow: 0 0 0 1px rgba(79, 110, 247, .15);
}
.key-project-input {
  position: absolute; opacity: 0; pointer-events: none;
  width: 0; height: 0;
}
.key-project-check {
  flex: 0 0 22px;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--border); border-radius: 5px;
  background: #fff;
  transition: border-color .15s, background .15s;
}
.form-field label.key-project-toggle:has(.key-project-input:checked) .key-project-check {
  border-color: var(--primary); background: var(--primary); color: #fff;
}
.form-field label.key-project-toggle:has(.key-project-input:checked) .key-project-check::after {
  content: '✓'; font-size: 15px; font-weight: 700; line-height: 1;
}
.form-field label.key-project-toggle:has(.key-project-input:focus-visible) {
  outline: 2px solid rgba(79, 110, 247, .35); outline-offset: 2px;
}
.key-project-content {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.key-project-title {
  font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3;
}
.key-project-hint {
  font-size: 12px; color: var(--text-muted); line-height: 1.3;
}
.key-project-star {
  color: #f4b740; font-size: 17px; line-height: 1; margin-right: 4px;
}

/* ---------- 权限树：目录 / 菜单 / 按钮 ---------- */
.perm-legend {
  display: flex; flex-wrap: wrap; gap: 12px 20px;
  margin-bottom: 14px; padding: 10px 12px;
  background: #f9fafb; border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px;
}
.perm-legend-item {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.perm-legend-hint { color: var(--text-muted); font-size: 12px; }

.perm-tree-head {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) 72px minmax(120px, 1fr) minmax(120px, 1fr) auto;
  gap: 8px; padding: 8px 12px;
  background: #f3f4f6; border: 1px solid var(--border); border-radius: 6px 6px 0 0;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.perm-tree { list-style: none; padding-left: 0; margin: 0; }
.perm-tree .perm-tree {
  padding-left: 20px;
  margin-left: 10px;
  border-left: 2px dashed var(--border);
}
.perm-tree > li > .perm-row.perm-type-0 { margin-top: 4px; }
.perm-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) 72px minmax(120px, 1fr) minmax(120px, 1fr) auto;
  gap: 8px; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background .12s;
}
.perm-row:hover { background: #f9fafb; }
.perm-row.perm-type-0 {
  border-left-color: var(--primary);
  background: #fafbff;
  font-weight: 600;
}
.perm-row.perm-type-1 { border-left-color: var(--success); }
.perm-row.perm-type-2 {
  border-left-color: var(--warning);
  background: #fffdf5;
  font-size: 13px;
}
.perm-col-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.perm-col-name .perm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-type-icon {
  flex: 0 0 18px; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; line-height: 0;
}
.perm-type-icon svg { display: block; }
.perm-type-icon-0 { background: #eef2ff; color: var(--primary); }
.perm-type-icon-1 { background: #f6ffed; color: var(--success); }
.perm-type-icon-2 { background: #fffbe6; color: #d48806; }

.perm-type-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.perm-type-option {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 14px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.perm-type-option:hover {
  border-color: #c7d2fe; background: #fafbff;
}
.perm-type-option.selected {
  border-color: var(--primary);
  background: #eef2ff;
  box-shadow: 0 0 0 1px rgba(79, 110, 247, .12);
}
.perm-type-option .perm-type-icon {
  flex: 0 0 32px; width: 32px; height: 32px;
  border-radius: 8px;
}
.perm-type-option-label {
  font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2;
}
.form-field .perm-type-hint {
  margin: 8px 0 0; padding: 0;
  font-size: 12px; color: var(--text-muted); line-height: 1.5;
}
.perm-col-meta code {
  display: inline-block; max-width: 100%;
  background: #f3f4f6; padding: 2px 6px; border-radius: 3px;
  font-size: 12px; font-family: ui-monospace, monospace;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.perm-row.perm-type-2 .perm-col-meta code {
  background: #fff7e6; color: #ad6800; border: 1px solid #ffe58f;
}
.perm-col-path em {
  font-style: normal; font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block;
}
.perm-col-empty { color: #d1d5db; font-size: 12px; }
.perm-actions { text-align: right; white-space: nowrap; }

.perm-assign-tree .perm-row {
  grid-template-columns: minmax(160px, 1.4fr) 72px minmax(120px, 1fr) auto;
}
.perm-assign-tree .perm-col-check {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.perm-assign-tree .perm-col-check input { flex: 0 0 auto; margin: 0; }
.perm-assign-tree .perm-tree .perm-tree { border-left-color: #e5e7eb; }

@media (max-width: 900px) {
  .perm-tree-head { display: none; }
  .perm-row, .perm-assign-tree .perm-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name actions"
      "type type"
      "meta meta";
  }
  .perm-col-name { grid-area: name; }
  .perm-col-type { grid-area: type; }
  .perm-col-meta, .perm-col-path { grid-area: meta; }
  .perm-actions { grid-area: actions; }
}

/* ---------- 移动端：壳层抽屉 + 列表页布局 ---------- */
@media (max-width: 768px) {
  body.shell {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto minmax(0, 1fr);
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }

  .top-bar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    min-height: 48px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }
  .top-bar .brand {
    flex: 0 1 auto;
    min-width: 32px;
    max-width: 62px;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .top-bar .spacer {
    display: block;
    flex: 1 1 auto;
    min-width: 8px;
    width: auto;
    height: auto;
  }
  .top-bar #btn-toggle-sidebar,
  .top-bar #btn-switch-role,
  .top-bar #top-user-name,
  .top-bar #btn-logout { min-height: 44px; }
  .top-bar #btn-toggle-sidebar { width: 48px; min-width: 48px; flex: 0 0 48px; }
  .top-bar #btn-switch-role,
  .top-bar #top-user-name,
  .top-bar #btn-logout {
    flex: 0 1 auto;
    min-width: 48px;
    max-width: 88px;
    font-size: 11px;
    padding: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
  }
  .top-bar #btn-switch-role,
  .top-bar #btn-logout {
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    transition: background-color .15s ease, color .15s ease;
  }
  .top-bar #btn-switch-role { padding-right: 10px; padding-left: 10px; }
  .top-bar #btn-logout {
    flex: 0 0 48px;
    color: rgba(255, 255, 255, .88);
    background: rgba(255, 255, 255, .07);
  }
  #top-user-name {
    border: 0;
    border-radius: 0;
    padding-right: 4px;
    padding-left: 4px;
    background: transparent;
    box-sizing: border-box;
  }

  .sidebar {
    position: fixed;
    z-index: 1001;
    top: 0;
    left: 0;
    width: min(280px, 86vw);
    height: 100%;
    max-height: 100dvh;
    transform: translateX(-100%);
    transition: transform .25s ease;
    grid-column: unset;
    grid-row: unset;
    box-shadow: none;
  }
  body.shell.mobile-nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, .2);
  }
  body.shell.mobile-shell.mobile-nav-open .sidebar.collapsed .nav-group-title {
    display: flex;
  }
  body.shell.mobile-shell.mobile-nav-open .sidebar.collapsed .nav-children {
    display: none;
    margin: 0 0 5px 27px;
    padding: 2px 0 3px 9px;
  }
  body.shell.mobile-shell.mobile-nav-open .sidebar.collapsed .nav-group.is-open > .nav-children {
    display: block;
  }
  body.shell.mobile-shell.mobile-nav-open .sidebar.collapsed .nav-children::before {
    display: block;
  }
  body.shell.mobile-shell.mobile-nav-open .sidebar.collapsed .nav-item .nav-label,
  body.shell.mobile-shell.mobile-nav-open .sidebar.collapsed .nav-group-title .nav-label {
    display: block;
  }
  body.shell.mobile-shell .sidebar.collapsed .nav-item {
    justify-content: flex-start;
    padding: 10px 16px 10px 13px;
    margin: 0;
    border-radius: 0;
  }
  body.shell.mobile-shell .sidebar.collapsed .nav-item .nav-icon {
    margin-right: 10px;
  }

  #shell-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, .45);
  }
  body.shell.mobile-nav-open #shell-backdrop {
    display: block;
  }

  #main-iframe {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    max-width: 100vw;
  }
  .nav-group-title,
  .nav-item { min-height: 44px; }

  /* iframe 内列表/表单页 */
  html, body:not(.shell) {
    max-width: 100%;
    overflow-x: hidden;
  }
  body:not(.shell) .page-wrap,
  .page-wrap {
    padding: 10px;
    max-width: 100%;
    overflow-x: hidden;
  }
  html.modal-page .page-wrap,
  html.modal-page body {
    padding: 0;
    overflow: hidden;
  }
  html.modal-page .form-action-bar {
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 10px 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
    justify-content: flex-end;
    border-radius: 0;
    box-shadow: none;
  }
  html.modal-page .form-action-bar .btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    padding: 6px 14px;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
  }
  .card {
    padding: 12px;
    margin-bottom: 12px;
    max-width: 100%;
    overflow: hidden;
  }
  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .card-header .card-title { margin-bottom: 4px; }

  .search-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 12px;
  }
  .search-bar .field {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
  .search-bar input,
  .search-bar select {
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .search-bar > .btn {
    width: 100%;
    margin: 0;
    text-align: center;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .toolbar .btn { width: 100%; text-align: center; }
  .toolbar.view-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .toolbar.view-toggle #btn-add,
  .toolbar #btn-add {
    grid-column: 1 / -1;
    width: 100% !important;
    margin-left: 0 !important;
  }

  .card-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .media-card .actions {
    flex-direction: column;
    align-items: stretch;
  }
  .media-card .actions .btn { width: 100%; text-align: center; }

  .table-wrap {
    margin: 0;
    padding-bottom: 2px;
    border-radius: 6px;
    /* 列表保留可见的细横向滚动条，便于访问右侧操作列 */
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  }
  .table-wrap::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
  }
  .table-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 0 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-muted);
    background: #f9fafb;
    border: 1px dashed var(--border);
    border-radius: 6px;
  }
  .table-scroll-hint::before {
    content: '←';
    opacity: .5;
    font-size: 11px;
  }
  .table-scroll-hint::after {
    content: '→';
    opacity: .5;
    font-size: 11px;
  }
  .data-table { min-width: 520px; font-size: 13px; }
  .data-table th, .data-table td { padding: 8px 10px; }

  .table-pager {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding-top: 4px;
  }

  .tabs .tab { padding: 8px 12px; font-size: 13px; }
  .form-grid { grid-template-columns: 1fr; }
  html.modal-page .form-page-body.form-grid,
  html.modal-page .form-page-body > .form-grid,
  html.modal-page .form-page-body .card .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
  }
  .modal-mask { padding: 12px; align-items: center; }
  .modal-panel.sm,
  .modal-panel.md,
  .modal-panel.lg,
  .modal-panel.xl {
    width: 100%;
    max-width: none;
    margin: 0;
    max-height: calc(100dvh - 24px);
  }
  .modal-header,
  .modal-body,
  .modal-footer,
  .modal-footer-inner {
    padding-left: 16px;
    padding-right: 16px;
  }
  .modal-footer {
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
  }
  .modal-footer-inner {
    padding-top: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
  .modal-footer-inner {
    flex-direction: row;
    gap: 10px;
  }
  .modal-footer-inner .btn {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    text-align: center;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .modal-footer-inner .modal-cancel {
    order: 1;
  }
  .modal-footer-inner .btn-primary {
    order: 2;
  }
}

/* ---------- Flatpickr 日期时间选择 ---------- */
.flatpickr-calendar {
  font-family: var(--font);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
  font-weight: 600;
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange {
  background: var(--primary);
  border-color: var(--primary);
}
.flatpickr-day:hover {
  background: #eef2ff;
  border-color: #eef2ff;
}
.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:focus {
  background: #eef2ff;
}
input.js-date-field {
  background: #fff;
  cursor: pointer;
}
input.js-date-field:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 110, 247, .15);
}

/* Markdown 编辑器（EasyMDE） */
.form-field.full .EasyMDEContainer {
  width: 100%;
}
.EasyMDEContainer .CodeMirror {
  border: 1px solid var(--border);
  border-radius: 4px;
  min-height: 220px;
  font-size: 14px;
  line-height: 1.5;
}
.EasyMDEContainer .editor-toolbar {
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background: #f8fafc;
}
.EasyMDEContainer .editor-toolbar + .CodeMirror {
  border-top: none;
  border-radius: 0 0 4px 4px;
}
.EasyMDEContainer .editor-preview,
.EasyMDEContainer .editor-preview-side {
  background: #fff;
  padding: 12px;
}

/* Markdown 渲染 */
.markdown-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  word-break: break-word;
}
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin: 1em 0 0.5em;
  font-weight: 600;
  line-height: 1.3;
}
.markdown-body h1 { font-size: 1.5em; }
.markdown-body h2 { font-size: 1.3em; }
.markdown-body h3 { font-size: 1.15em; }
.markdown-body p { margin: 0.5em 0; }
.markdown-body ul, .markdown-body ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}
.markdown-body blockquote {
  margin: 0.5em 0;
  padding: 0.25em 0.75em;
  border-left: 3px solid var(--primary);
  color: #64748b;
  background: #f8fafc;
}
.markdown-body pre {
  margin: 0.75em 0;
  padding: 12px;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 6px;
  overflow: auto;
  font-size: 13px;
}
.markdown-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}
.markdown-body :not(pre) > code {
  padding: 0.15em 0.35em;
  background: #f1f5f9;
  border-radius: 3px;
  color: #c7254e;
}
.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.75em 0;
}
.markdown-body th, .markdown-body td {
  border: 1px solid var(--border);
  padding: 6px 10px;
}
.markdown-body th { background: #f8fafc; }
.markdown-body a { color: var(--primary); }
.markdown-body img { max-width: 100%; height: auto; }

/* MySQL Console */
.mysql-console-body {
  overflow: hidden;
  background: #fff;
}
.mysql-console {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 0;
  gap: 0;
  box-sizing: border-box;
}

/* ---- 连接栏 ---- */
.mysql-conn-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.mysql-conn-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  padding-right: 16px;
  border-right: 1px solid var(--border);
}
.mysql-brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #e0f2fe;
  color: #00758f;
}
.mysql-brand-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.mysql-conn-form {
  flex: 0 1 auto;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-width: 0;
}
.mysql-conn-fields {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.mysql-conn-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
}
.mysql-conn-field-host { width: 168px; }
.mysql-conn-field-port { width: 72px; }
.mysql-conn-field-user { width: 108px; }
.mysql-conn-field-pass { width: 108px; }
.mysql-conn-field-db { width: 148px; }
.mysql-conn-field-path { width: 280px; }
.mysql-field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.3;
}
.mysql-conn-field-file input[type="file"] {
  font-size: 12px;
  padding: 4px 0;
}
.mysql-conn-field input,
.mysql-conn-field select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  height: 32px;
  box-sizing: border-box;
}
.mysql-conn-field input::placeholder { color: #9ca3af; }
.mysql-conn-field input:focus,
.mysql-conn-field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79,110,247,.12);
}
.mysql-conn-field input:disabled,
.mysql-conn-field select:disabled {
  background: #f9fafb;
  color: var(--text-muted);
  cursor: not-allowed;
}
.mysql-conn-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: 4px;
}
.mysql-conn-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 13px;
  height: 32px;
  box-sizing: border-box;
}
.mysql-btn-disconnect {
  background: #fff !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.mysql-btn-disconnect:hover:not(:disabled) {
  background: #f9fafb !important;
  border-color: #d1d5db !important;
}
.mysql-conn-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  background: #f9fafb;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  margin-left: 4px;
  box-sizing: border-box;
}
.mysql-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  flex-shrink: 0;
}
.mysql-conn-status.connected {
  background: #f6ffed;
  border-color: #b7eb8f;
  color: #389e0d;
}
.mysql-conn-status.connected .mysql-status-dot {
  background: #52c41a;
  box-shadow: none;
  animation: mysql-pulse 2s ease-in-out infinite;
}
@keyframes mysql-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ---- 主区域 ---- */
.mysql-main {
  flex: 1;
  display: flex;
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

/* ---- 侧边栏 ---- */
.mysql-sidebar {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.mysql-sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  flex-shrink: 0;
}
.mysql-sidebar-head svg { opacity: .5; }
.mysql-tree-wrap {
  flex: 1;
  overflow: auto;
  padding: 8px 0;
}
.mysql-tree-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
}
.mysql-tree-empty p { margin: 0; font-size: 13px; }
.mysql-tree { list-style: none; padding: 0 8px; margin: 0; }
.mysql-tree-children {
  list-style: none;
  padding-left: 12px;
  margin: 0 0 0 10px;
  border-left: 1px solid #e8ecf0;
}
.mysql-tree-node {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: default;
  font-size: 13px;
  transition: background .12s;
  user-select: none;
}
.mysql-tree-node:hover { background: #f3f4f6; }
.mysql-tree-node.is-active-db {
  background: #f0f9ff;
  box-shadow: inset 3px 0 0 #60a5fa;
}
.mysql-tree-node.is-active-db .mysql-tree-label { color: #2563eb; font-weight: 600; }
.mysql-tree-node.is-active {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 var(--primary);
}
.mysql-tree-node.is-active .mysql-tree-label { color: var(--primary); font-weight: 600; }
.mysql-tree-toggle {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 3px;
  transition: transform .15s, background .12s;
}
.mysql-tree-toggle:hover { background: #e5e7eb; color: var(--text); }
.mysql-tree-toggle.placeholder { visibility: hidden; pointer-events: none; }
li.expanded > .mysql-tree-node > .mysql-tree-toggle { transform: rotate(90deg); }
.mysql-tree-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 11px;
}
.mysql-icon-db {
  background: #dbeafe;
  color: #2563eb;
}
.mysql-icon-db::after { content: '⛁'; font-size: 10px; }
.mysql-icon-table {
  background: #dcfce7;
  color: #16a34a;
}
.mysql-icon-table::after { content: '▦'; font-size: 10px; }
.mysql-icon-col {
  background: #fef9c3;
  color: #ca8a04;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.mysql-icon-col::after { content: '●'; font-size: 6px; }
.mysql-tree-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mysql-tree-selectable { cursor: pointer; }
.mysql-tree-selectable:hover { color: var(--primary); }
.mysql-tree-leaf { cursor: default; }
.mysql-col-type {
  font-size: 11px;
  color: var(--text-muted);
  font-style: normal;
  margin-left: 4px;
}
.empty-leaf {
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 8px 4px 32px;
  font-style: italic;
}

/* ---- 内容区 ---- */
.mysql-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #fff;
  overflow: hidden;
}
.mysql-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  flex-shrink: 0;
  padding: 0 12px;
}
.mysql-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.mysql-tab:hover { color: var(--text); }
.mysql-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: #fff;
}
.mysql-tab-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  padding: 14px 16px;
  overflow: hidden;
}
.mysql-tab-panel.active { display: flex; }

/* ---- 数据面板 ---- */
.mysql-data-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}
.mysql-data-title-wrap { min-width: 0; }
.mysql-data-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.mysql-data-subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.mysql-data-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.mysql-btn-tool {
  background: #f9fafb;
  border-color: var(--border);
  color: var(--text);
}
.mysql-btn-tool:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: var(--text);
}
.mysql-btn-danger {
  background: #fff;
  border-color: #fca5a5;
  color: var(--danger);
}
.mysql-btn-danger:hover {
  background: #fef2f2;
  border-color: var(--danger);
  color: var(--danger);
}
.mysql-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.mysql-hint svg { flex-shrink: 0; color: #d97706; }

/* ---- 表格 ---- */
.mysql-grid-wrap {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.mysql-grid {
  margin: 0;
  font-size: 12px;
  min-width: 100%;
}
.mysql-grid th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.mysql-grid td {
  padding: 7px 12px;
  border-bottom: 1px solid #f3f4f6;
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mysql-grid tbody tr:hover td { background: #f9fafb; }
.mysql-grid tbody tr:nth-child(even) td { background: #fafbfc; }
.mysql-grid tbody tr:nth-child(even):hover td { background: #f3f4f6; }
.mysql-col-select { width: 36px; text-align: center; }
.mysql-pk {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  color: #d97706;
  background: #fef3c7;
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 4px;
  vertical-align: middle;
  letter-spacing: 0;
  text-transform: none;
}
.mysql-null {
  color: #9ca3af;
  font-style: italic;
  font-size: 11px;
}
.mysql-cell-dirty { background: #fef9c3 !important; }
.mysql-cell-pk { background: #f8fafc !important; color: var(--text-muted); }
.mysql-cell-input {
  width: 100%;
  min-width: 80px;
  box-sizing: border-box;
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  outline: none;
}
.mysql-row-new td { background: #f0fdf4 !important; }
.mysql-row-deleted td { opacity: .45; text-decoration: line-through; }
.mysql-grid tbody tr.selected td { background: #eff6ff !important; }
.mysql-pager {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.mysql-pager-info strong { color: var(--text); font-weight: 600; }
.mysql-pager .page-size-control { flex-wrap: wrap; max-width: 100%; }
.mysql-pager-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mysql-pager-page {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: center;
}
.mysql-pager .btn { font-size: 12px; }

/* ---- SQL 面板 ---- */
.mysql-sql-toolbar {
  flex: 0 0 auto;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mysql-sql-toolbar .btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mysql-sql-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 4px;
}
.mysql-sql-editor-wrap {
  flex: 0 0 140px;
  margin-bottom: 10px;
}
.mysql-sql-editor {
  width: 100%;
  height: 140px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  box-sizing: border-box;
  background: #1e293b;
  color: #e2e8f0;
  outline: none;
  tab-size: 2;
  transition: border-color .15s, box-shadow .15s;
}
.mysql-sql-editor:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,110,247,.12);
}
.mysql-sql-editor::placeholder { color: #64748b; }
.mysql-sql-msg {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 10px;
  background: #f9fafb;
  border-radius: 6px;
  margin-bottom: 8px;
  border-left: 3px solid var(--primary);
}
.mysql-sql-msg:empty { display: none; }
#panel-sql .mysql-grid-wrap { flex: 1; }

@media (max-width: 900px) {
  .mysql-conn-bar { gap: 8px; padding: 8px 12px; }
  .mysql-conn-status { margin-left: 0; width: 100%; justify-content: center; }
  .mysql-sidebar { flex: 0 0 220px; }
}

/* ---------- 手机端：信息改为纵向卡片，不要求左右拖动 ---------- */
@media (max-width: 768px) {
  html, body:not(.shell) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }

  body:not(.shell) .page-wrap,
  .page-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 10px;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .card,
  body:not(.shell) .card {
    min-width: 0;
    max-width: 100%;
    padding: 12px;
    box-sizing: border-box;
  }

  .table-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .table-scroll-hint { display: none !important; }

  .data-table,
  .recent-projects-table,
  .acct-import-preview table {
    display: block;
    width: 100%;
    min-width: 0 !important;
    max-width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
    font-size: 14px;
  }
  .data-table thead,
  .acct-import-preview table thead { display: none; }
  .data-table tbody,
  .acct-import-preview table tbody {
    display: grid;
    gap: 10px;
    width: 100%;
  }
  .data-table tbody tr,
  .acct-import-preview table tbody tr {
    display: block;
    min-width: 0;
    margin: 0;
    padding: 2px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card-bg, #fff);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  }
  .data-table tbody tr:hover td { background: transparent; }
  .data-table td,
  .acct-import-preview table td {
    display: grid;
    grid-template-columns: minmax(76px, .38fr) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-width: 0;
    padding: 10px 0;
    border: 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .data-table td::before,
  .acct-import-preview table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: left;
    overflow-wrap: anywhere;
  }
  .data-table td[data-label=""]::before { display: none; }
  .data-table td[data-label="项目名称"] > .project-name-value,
  .data-table td[data-label="项目"] > .project-name-value {
    min-width: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }
  .recent-projects-table td[data-label="名称"] > .project-name-value {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }
  .data-table td > .badge,
  .acct-import-preview table td > .badge {
    justify-self: end;
    width: max-content;
    max-width: 100%;
  }
  .data-table td:last-child,
  .acct-import-preview table td:last-child { border-bottom: 0; }
  .data-table .empty-row,
  .acct-import-preview table .empty-row {
    padding: 14px;
    border: 1px dashed var(--border);
    background: transparent;
    box-shadow: none;
    color: var(--text-muted);
    text-align: center;
  }
  .data-table .empty-row td,
  .acct-import-preview table .empty-row td {
    display: block;
    padding: 8px;
    border: 0;
    text-align: center;
  }
  .data-table .empty-row td::before,
  .acct-import-preview table .empty-row td::before { content: none; }
  .data-table td.action-column {
    display: block;
    padding-top: 12px;
    text-align: left;
  }
  .data-table td.action-column::before {
    display: block;
    margin-bottom: 6px;
  }
  .data-table td.action-column .btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 2px 6px 2px 0;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    text-decoration: none;
  }
  .data-table td.action-column .btn-link.danger { border-color: #fecaca; }
  .recent-projects-table td[data-label="操作"] .btn-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  .data-table td input:not([type="checkbox"]),
  .data-table td select,
  .data-table td textarea { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
  .data-table td .mysql-cell-input { min-width: 0; }
  .data-table th.action-column,
  .data-table td.action-column { width: auto; }

  .table-pager {
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }
  .page-size-control { white-space: normal; flex-wrap: wrap; justify-content: center; }
  .page-size-select { min-height: 40px; }

  .search-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
  }
  .search-bar .field { width: 100%; min-width: 0; max-width: none; }
  .search-bar .field:only-of-type { grid-column: 1 / -1; }
  .search-bar label { white-space: normal; }
  .search-bar input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  .search-bar select {
    width: 100%; min-width: 0; max-width: none;
    height: 48px; min-height: 48px; box-sizing: border-box;
  }
  .search-bar input[type="checkbox"],
  .search-bar input[type="radio"],
  input[type="checkbox"],
  input[type="radio"] { width: 20px; height: 20px; min-height: 20px; padding: 0; }
  .search-bar > .btn {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    margin: 0;
    padding: 9px 10px;
    text-align: center;
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
  .toolbar .btn { width: 100%; min-width: 0; min-height: 44px; white-space: normal; }
  .toolbar #btn-add { grid-column: 1 / -1; }
  .toolbar.view-toggle { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acct-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .acct-toolbar h2 { grid-column: 1 / -1; width: auto; }
  .acct-toolbar > .btn { width: 100%; min-width: 0; min-height: 44px; white-space: normal; }

  .btn,
  button.btn,
  input[type="button"],
  input[type="submit"] { min-height: 42px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-field input,
  .form-field select,
  .form-field textarea,
  .modal-body > input,
  .modal-body > select,
  .modal-body > textarea { min-height: 44px; box-sizing: border-box; }
  .form-field textarea,
  .modal-body textarea { min-height: 96px; }

  .EasyMDEContainer,
  .EasyMDEContainer .CodeMirror {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .EasyMDEContainer .CodeMirror-scroll {
    width: 100%;
    max-width: 100%;
    margin-right: 0 !important;
    box-sizing: border-box;
  }

  .tabs,
  .mysql-tabs { flex-wrap: wrap; overflow: visible; }
  .tabs .tab,
  .mysql-tab { flex: 1 1 auto; justify-content: center; min-height: 44px; padding: 10px 12px; }
  .tab-content { min-width: 0; }

  .modal-mask { position: fixed; inset: 0; padding: 0; align-items: stretch; }
  .modal-panel,
  .modal-panel.sm,
  .modal-panel.md,
  .modal-panel.lg,
  .modal-panel.xl,
  .modal-panel.has-iframe.sm,
  .modal-panel.has-iframe.md,
  .modal-panel.has-iframe.lg,
  .modal-panel.has-iframe.xl {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .modal-header,
  .modal-body,
  .modal-footer-inner { padding-left: 14px; padding-right: 14px; }
  .modal-footer-inner { gap: 8px; }
  .modal-footer-inner .btn { min-height: 44px; }

  /* Database consoles become vertically scrollable on phones; their grids use the
     same labeled-card presentation as the rest of the application. */
  .mysql-console-body { overflow-x: hidden; overflow-y: auto !important; }
  .mysql-console { height: auto; min-height: 100dvh; }
  .mysql-conn-bar { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; padding: 12px; }
  .mysql-conn-brand { border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 10px; }
  .mysql-conn-form { width: 100%; display: block; }
  .mysql-conn-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .mysql-conn-field,
  .mysql-conn-field-host,
  .mysql-conn-field-port,
  .mysql-conn-field-user,
  .mysql-conn-field-pass,
  .mysql-conn-field-db,
  .mysql-conn-field-path { width: 100%; min-width: 0; }
  .mysql-conn-actions { display: flex; gap: 8px; margin-top: 10px; }
  .mysql-conn-actions .btn { flex: 1 1 0; min-height: 44px; }
  .mysql-main { display: flex; flex-direction: column; min-height: 0; overflow: visible; }
  .mysql-sidebar { flex: 0 0 auto; width: 100%; max-height: 24dvh; border: 0; border-bottom: 1px solid var(--border); }
  .mysql-tree-wrap { max-height: calc(24dvh - 42px); }
  .mysql-tree-node { min-height: 44px; }
  .mysql-tree-toggle { flex-basis: 44px; width: 44px; height: 44px; }
  .mysql-content { flex: 1 0 auto; min-height: 0; overflow: visible; }
  .mysql-tab-panel { display: none; min-height: 0; padding: 12px; overflow: visible; }
  .mysql-tab-panel.active { display: block; }
  .mysql-data-head { display: block; }
  .mysql-data-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 10px; }
  .mysql-data-toolbar .btn { min-height: 42px; white-space: normal; }
  .mysql-grid-wrap { flex: initial; max-height: none; overflow: visible; border: 0; }
  .mysql-grid td { max-width: none; white-space: normal; overflow: visible; text-overflow: clip; }
  .mysql-sql-editor-wrap { min-height: 140px; }
  .mysql-sql-toolbar { flex-wrap: wrap; }
  .mysql-pager { justify-content: center; }
}

@media (max-width: 420px) {
  .form-grid,
  html.modal-page .form-page-body.form-grid,
  html.modal-page .form-page-body > .form-grid,
  html.modal-page .form-page-body .card .form-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 360px) {
  .search-bar { grid-template-columns: minmax(0, 1fr); }
  .search-bar .field:only-of-type { grid-column: auto; }
  .mysql-conn-fields { grid-template-columns: minmax(0, 1fr); }
}

.receipt-sync-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  vertical-align: middle;
}
.receipt-sync-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.receipt-sync-slider {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: #cbd0d8;
  transition: background .18s ease;
}
.receipt-sync-slider::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  content: '';
  transition: transform .18s ease;
}
.receipt-sync-switch input:checked + .receipt-sync-slider { background: var(--primary, #526dff); }
.receipt-sync-switch input:checked + .receipt-sync-slider::after { transform: translateX(14px); }
.receipt-sync-switch input:focus-visible + .receipt-sync-slider { outline: 2px solid var(--primary, #526dff); outline-offset: 2px; }
.receipt-sync-list { margin: 0; }

.mydev-month-picker {
  position: fixed;
  z-index: 99999;
  width: 260px;
  padding: 10px;
  border: 1px solid #dfe4ed;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(23, 35, 58, .2);
}
.mydev-month-picker[hidden] { display: none; }
.mydev-month-picker-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; margin-bottom: 8px; text-align: center; }
.mydev-month-picker-head button,
.mydev-month-option {
  min-width: 0;
  min-height: 40px;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  background: #fff;
  color: #243047;
  cursor: pointer;
}
.mydev-month-picker-head button { font-size: 22px; line-height: 1; }
.mydev-month-picker-head strong { color: #26334a; font-size: 14px; }
.mydev-month-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.mydev-month-option { font-size: 13px; }
.mydev-month-option:hover { border-color: var(--primary); color: var(--primary); }
.mydev-month-option.is-selected { border-color: var(--primary); background: var(--primary); color: #fff; }
.mydev-month-option:disabled { opacity: .38; cursor: not-allowed; }
.mydev-month-picker button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
input.js-date-field[readonly], input.js-month-field[readonly], input.js-year-field[readonly] { cursor: pointer; }
.mydev-year-picker {
  position: fixed;
  z-index: 99999;
  width: 300px;
  padding: 10px;
  border: 1px solid #dfe4ed;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(23, 35, 58, .2);
}
.mydev-year-picker[hidden] { display: none; }
.mydev-year-picker-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; margin-bottom: 8px; text-align: center; }
.mydev-year-picker-head button,
.mydev-year-option,
.mydev-year-clear {
  min-width: 0;
  min-height: 40px;
  border: 1px solid #e3e8f0;
  border-radius: 8px;
  background: #fff;
  color: #243047;
  cursor: pointer;
}
.mydev-year-picker-head button { font-size: 22px; line-height: 1; }
.mydev-year-picker-head strong { color: #26334a; font-size: 14px; }
.mydev-year-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mydev-year-option { font-size: 12px; }
.mydev-year-option:hover { border-color: var(--primary); color: var(--primary); }
.mydev-year-option.is-selected { border-color: var(--primary); background: var(--primary); color: #fff; }
.mydev-year-option:disabled { opacity: .38; cursor: not-allowed; }
.mydev-year-clear { width: 100%; min-height: 36px; margin-top: 8px; color: #697386; font-size: 12px; }
.mydev-year-picker button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Cover system-bar regions with the scrim while keeping dialog content inside the safe area. */
@media (max-width: 768px) {
  .modal-mask {
    inset: 0;
    padding: var(--mydev-safe-top, env(safe-area-inset-top, 0px)) 0 var(--mydev-safe-bottom, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
  .modal-panel,
  .modal-panel.sm,
  .modal-panel.md,
  .modal-panel.lg,
  .modal-panel.xl,
  .modal-panel.has-iframe.sm,
  .modal-panel.has-iframe.md,
  .modal-panel.has-iframe.lg,
  .modal-panel.has-iframe.xl {
    height: 100%;
    max-height: 100%;
  }
  .login-page {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
    padding: calc(20px + var(--mydev-safe-top, env(safe-area-inset-top, 0px))) 16px calc(20px + var(--mydev-safe-bottom, env(safe-area-inset-bottom, 0px)));
  }
  .login-layout {
    grid-template-columns: minmax(0, 1fr);
    width: min(460px, 100%);
    min-height: 0;
    margin: 0 auto;
    border-radius: 20px;
  }
  .login-intro { gap: 0; padding: 22px 24px; }
  .login-brand { font-size: 19px; }
  .login-brand-mark { width: 32px; height: 32px; border-radius: 10px; }
  .login-intro-copy { margin: 24px 0 0; }
  .login-intro h1 { margin-bottom: 8px; font-size: 26px; }
  .login-intro-copy > p:last-child { font-size: 13px; }
  .login-intro-foot { display: none; }
  .login-box { padding: 28px 24px 25px; }
  .login-heading { margin-bottom: 24px; }
  .login-heading h2 { font-size: 23px; }
  .login-box .form-field { margin-bottom: 16px; }
  .login-options { margin-bottom: 18px; }
}

@media (max-width: 360px) {
  .login-page { padding-left: 12px; padding-right: 12px; }
  .login-intro { padding: 18px 20px; }
  .login-box { padding: 24px 20px 22px; }
  .login-options { align-items: flex-start; }
  .remember-hint { flex-basis: 100%; padding-left: 24px; }
}

/* Touch-first behavior: keep tap targets generous without disabling page gestures. */
@media (pointer: coarse) {
  html { -webkit-tap-highlight-color: transparent; }

  a[href],
  button,
  select,
  input[type="button"],
  input[type="submit"],
  [role="button"],
  [data-action],
  .btn,
  .nav-item,
  .nav-group-title,
  .tabs .tab,
  .form-radio-option,
  .role-chip,
  .key-project-toggle,
  .perm-type-option,
  .mysql-tree-node,
  .mysql-tree-toggle,
  .mysql-tab,
  .flatpickr-day,
  .mydev-month-option,
  .mydev-year-option,
  .acct-group > summary,
  .acct-exclusions summary,
  .btn-link {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
  }

  input,
  textarea,
  [contenteditable="true"] {
    -webkit-touch-callout: default;
    -webkit-user-select: text !important;
    user-select: text !important;
    touch-action: auto;
  }

  button,
  input[type="button"],
  input[type="submit"],
  [role="button"],
  .btn,
  .btn-link,
  .tabs .tab,
  .form-radio-option,
  .role-chip,
  .perm-type-option,
  .mysql-tree-toggle,
  .mysql-tab,
  .mydev-month-picker-head button,
  .mydev-month-option,
  .mydev-year-picker-head button,
  .mydev-year-option,
  .mydev-year-clear,
  .table-pager button,
  .mysql-pager .btn {
    min-height: 48px;
  }

  .btn,
  .btn-link,
  .tabs .tab,
  .mydev-month-option,
  .mydev-year-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .flatpickr-day {
    height: 44px;
    min-height: 44px;
    max-width: 44px;
    line-height: 42px;
  }
  .flatpickr-time input {
    height: 40px;
    min-height: 40px !important;
    line-height: 40px;
    -webkit-touch-callout: none;
    -webkit-user-select: none !important;
    user-select: none !important;
    touch-action: manipulation;
  }
  .flatpickr-current-month input.cur-year,
  .flatpickr-current-month .flatpickr-monthDropdown-months {
    height: auto !important;
    min-height: 0 !important;
    line-height: 1 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  .mysql-tree-toggle,
  button.acct-star { min-width: 48px; }
  .data-table td.action-column .btn-link { min-height: 48px; }
  .mydev-month-picker-head,
  .mydev-year-picker-head { grid-template-columns: 48px 1fr 48px; }

  .top-bar #btn-toggle-sidebar,
  .modal-close {
    min-width: 48px;
    min-height: 48px;
  }

  .top-bar #btn-toggle-sidebar,
  .top-bar #btn-switch-role,
  .top-bar #top-user-name,
  .top-bar #btn-logout,
  .modal-footer-inner .btn,
  html.modal-page .form-action-bar .btn {
    min-height: 48px;
  }

  .form-field input,
  .form-field select,
  .form-field textarea,
  .modal-body > input,
  .modal-body > select,
  .modal-body > textarea {
    min-height: 48px;
  }

  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    min-height: 48px;
  }

  .btn:active:not(:disabled),
  button:active:not(:disabled),
  [role="button"]:active,
  .nav-item:active,
  .tabs .tab:active,
  .role-chip:active:not(.disabled),
  .perm-type-option:active,
  .flatpickr-day:active,
  .mydev-month-option:active:not(:disabled),
  .mydev-year-option:active:not(:disabled) {
    filter: brightness(.94);
    transition: filter .08s ease;
  }
  .btn-link:active,
  summary:active,
  button.acct-star:active:not(:disabled) {
    filter: brightness(.94);
    transition: filter .08s ease;
  }
}

/* Hover styling should not stick after a tap on touch-only devices. */
@media (hover: none) and (pointer: coarse) {
  a[href]:hover { text-decoration: none; }
  .top-bar button:hover { background: transparent; }
  .btn:hover { border-color: var(--border); color: var(--text); }
  .btn-primary:hover { border-color: var(--primary); color: #fff; opacity: 1; }
  .nav-item:hover:not(.active) {
    background: transparent;
    color: #cbd5e1;
    border-left-color: transparent;
    transform: none;
  }
  .data-table th.sortable:hover { color: inherit; }
  .data-table tr:hover td { background: transparent; }
  .form-radio-option:hover { background: #fff; }
  .tabs .tab:hover:not(.active) { color: var(--text-muted); }
  .role-chip:hover:not(.disabled):not(.selected) {
    border-color: var(--border);
    background: #fff;
  }
  .form-field label.key-project-toggle:hover:not(:has(.key-project-input:checked)) {
    border-color: var(--border);
    background: #fff;
  }
  .perm-row:hover:not(.perm-type-0) { background: transparent; }
  .perm-type-option:hover:not(.selected) {
    border-color: var(--border);
    background: #fff;
  }
  .flatpickr-day:hover:not(.selected):not(.startRange):not(.endRange) {
    border-color: transparent;
    background: transparent;
  }
  .mydev-month-option:hover:not(.is-selected),
  .mydev-year-option:hover:not(.is-selected) {
    border-color: var(--border);
    color: var(--text);
  }
  .mysql-tree-node:hover:not(.is-active-db) { background: transparent; }
  .mysql-tree-toggle:hover { background: transparent; color: inherit; }
  .mysql-tree-selectable:hover { color: inherit; }
  .mysql-tab:hover { color: inherit; }
}
