:root {
  --bg: #0b1220;
  --bg-2: #101a2e;
  --panel: #152238;
  --panel-2: #1b2b46;
  --line: #2a3d5c;
  --text: #e8eef9;
  --muted: #93a4c3;
  --accent: #4f8cff;
  --danger: #ff6b7a;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  --radius: 14px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* 登录页 */
.login-page {
  height: 100%;
  min-height: 100%;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(79, 140, 255, 0.18), transparent 45%),
    radial-gradient(ellipse at 80% 80%, rgba(122, 224, 196, 0.12), transparent 40%),
    var(--bg);
}
.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-brand { text-align: center; }
.login-brand .logo {
  width: 52px; height: 52px; margin: 0 auto 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4f8cff, #7ae0c4);
  display: grid; place-items: center; font-weight: 700; color: #06213b; font-size: 22px;
}
.login-brand h1 { margin: 0; font-size: 22px; }
.login-brand p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field span { color: var(--muted); font-size: 13px; }
.field input {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
}
.field input:focus { border-color: var(--accent); }
.login-error { margin: 0; color: var(--danger); font-size: 13px; }
.login-btn { width: 100%; padding: 12px 14px; }

/* 加载页 */
.loading-page {
  height: 100%;
  min-height: 100%;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.loading-card {
  text-align: center;
  padding: 36px 40px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-width: min(360px, 100%);
}
.loading-card h2 { margin: 18px 0 8px; font-size: 20px; }
.loading-card p { margin: 0; color: var(--muted); font-size: 14px; }
.spinner {
  width: 42px; height: 42px; margin: 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  border: 0; border-radius: 8px; padding: 5px 10px;
  background: var(--accent); color: white; font-weight: 600;
  font-size: 12px; line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost.danger {
  background: transparent;
  border-color: rgba(255, 107, 122, 0.55);
  color: var(--danger);
}

.app {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
}
.sidebar {
  background: linear-gradient(180deg, #121d33, #0d1628);
  border-right: 1px solid var(--line);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  text-align: center;
}
.logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #4f8cff, #7ae0c4);
  display: grid; place-items: center; font-weight: 700; color: #06213b;
  font-size: 14px; flex: 0 0 auto;
}
.brand h1 {
  font-size: 11px;
  margin: 0;
  line-height: 1.25;
  word-break: break-all;
}
.brand p { display: none; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  text-decoration: none; color: var(--muted);
  padding: 8px 4px;
  border-radius: 8px;
  font-size: 11px;
  text-align: center;
  line-height: 1.25;
}
.nav a.active, .nav a:hover { background: var(--panel-2); color: var(--text); }
.hint {
  margin-top: auto;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  word-break: break-all;
}
.hint code { font-size: 8px; }

.excel-import-page {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1;
}
.excel-import-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.excel-import-toolbar .meta {
  color: var(--muted);
  font-size: 12px;
}
.excel-import-body.excel-luckysheet-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.excel-luckysheet-body .sub {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  flex-shrink: 0;
}
.luckysheet-host {
  position: relative;
  flex: 1;
  min-height: 420px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.excel-wb-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
  padding: 0 2px 4px;
}
.excel-wb-tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 180px;
  border: 1px solid var(--line);
  background: rgba(16, 26, 46, 0.75);
  color: var(--muted);
  border-radius: 6px;
  padding: 3px 6px 3px 8px;
  font-size: 11px;
  cursor: pointer;
}
.excel-wb-tab.active {
  background: rgba(79, 140, 255, 0.2);
  border-color: rgba(79, 140, 255, 0.55);
  color: var(--text);
}
.excel-wb-tab-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.excel-wb-tab-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1;
}
.excel-wb-tab-close:hover {
  color: var(--danger);
}
#luckysheet {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

/* 工具栏加高换行，取消「更多」弹窗 */
#luckysheet .luckysheet-wa-editor,
.luckysheet-wa-editor {
  height: auto !important;
  min-height: 40px !important;
  max-height: none !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  align-content: flex-start !important;
  gap: 2px 0;
  padding: 4px 8px 6px 4px !important;
  overflow: visible !important;
  box-sizing: border-box !important;
}
#luckysheet-icon-morebtn {
  display: none !important;
}
#luckysheet-icon-morebtn-div {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
/* 底部工作表栏始终可见 */
#luckysheet .luckysheet-sheet-area {
  z-index: 260 !important;
  visibility: visible !important;
  display: block !important;
  background: #fff !important;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  min-height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}
.topbar {
  flex-shrink: 0;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 26, 46, 0.96);
  position: relative;
  z-index: 20;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}
.topbar > strong {
  flex: 0 0 auto;
  font-size: 13px;
}
.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}
.topbar-right > span {
  flex: 0 0 auto;
  white-space: nowrap;
}
.topbar-right #logoutBtn {
  flex: 0 0 auto;
  padding: 2px 8px;
}
.status-bar {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-bar.bad { color: var(--danger); }
.content {
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1;
  padding: 6px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow);
}
.toolbar, .pager {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  align-items: center;
  min-height: 26px;
}
.toolbar {
  overflow: visible;
  position: relative;
  z-index: 12;
}
.pager {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.toolbar-actions {
  display: flex;
  gap: 2px;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}
.toolbar-actions > .btn,
.toolbar-more > .btn,
.pager > .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.toolbar .btn {
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 6px;
}
.toolbar-more {
  position: relative;
  flex: 0 0 auto;
  margin-left: 2px;
}
.toolbar-more-btn {
  padding: 3px 8px !important;
  font-size: 11px !important;
  line-height: 1.2;
}
.toolbar-more-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: auto;
  min-width: 168px;
  max-width: min(280px, 70vw);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #152238;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  z-index: 80;
}
.toolbar-more-menu[hidden] { display: none !important; }
.toolbar-more-menu .btn {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
}
.toolbar-more-menu .btn.ghost:hover {
  background: rgba(79, 140, 255, 0.12);
}
.toolbar .grow { flex: 1; min-width: 100px; }
.toolbar .meta, .pager span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.toolbar .meta { margin-left: auto; flex: 0 0 auto; }
.pager select {
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 6px;
  min-height: 0;
}
.list-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-height: 28px;
  padding: 0 2px;
}
.list-search-modes {
  display: inline-flex;
  gap: 0;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.list-search-mode {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
}
.list-search-mode.active {
  background: rgba(79, 140, 255, 0.18);
  color: var(--accent);
}
.list-search {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.list-search-bar input {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.list-search-bar input:focus { border-color: var(--accent); }
.list-search-hint {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 11px;
  white-space: nowrap;
}

.multi-split {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  --split-top: 55%;
}
.multi-pane {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.multi-pane-top {
  flex: 0 0 var(--split-top);
  max-height: var(--split-top);
}
.multi-pane-bottom {
  flex: 1 1 auto;
}
.multi-pane-caption {
  flex-shrink: 0;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: rgba(16, 26, 46, 0.65);
}
.multi-pane-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-gutter: stable;
}
.multi-pane-body.table-wrap {
  min-height: 0;
}
.multi-split .machine-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.multi-split .machine-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.multi-split-resizer {
  flex: 0 0 6px;
  cursor: row-resize;
  background: linear-gradient(180deg, transparent, rgba(79, 140, 255, 0.35), transparent);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}
.multi-split-resizer:hover,
body.resizing-split .multi-split-resizer {
  background: rgba(79, 140, 255, 0.55);
}
body.resizing-split {
  cursor: row-resize;
  user-select: none;
}
mark.search-hit {
  background: rgba(245, 197, 66, 0.55);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

/* 表头筛选：点「筛选」后表头变为下拉入口 */
.th-filter {
  padding: 0 !important;
  vertical-align: middle;
}
.th-filter-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 3px 6px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.th-filter-btn:hover { background: rgba(79, 140, 255, 0.12); }
.th-filter.open .th-filter-btn,
.th-filter.active .th-filter-btn { background: rgba(79, 140, 255, 0.16); }
.th-filter-label { font-size: 10px; color: var(--muted); font-weight: 600; line-height: 1.1; }
.th-filter-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.1;
}
.th-filter.active .th-filter-value { color: var(--accent); }

/* 下拉浮层：挂到 body，覆盖在表格上方，不被裁切 */
.filter-float {
  position: fixed;
  z-index: 2000;
  min-width: 220px;
  max-width: min(360px, calc(100vw - 24px));
  max-height: min(320px, calc(100vh - 24px));
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: flex;
  flex-direction: column;
}
.filter-float[hidden] { display: none !important; }
.filter-float-list { overflow: auto; flex: 1; margin-top: 4px; }
.filter-float-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 13px; cursor: pointer;
}
.filter-float-item:hover { background: rgba(255,255,255,0.06); }
.filter-float-empty { color: var(--muted); font-size: 12px; padding: 8px; }

/* 表格区域：内部滚动，表头吸顶 */
.table-wrap {
  width: 100%;
  min-width: 0;
  min-height: 200px;
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.toolbar,
.list-search-bar,
.online-bar,
.pager {
  flex-shrink: 0;
}
.col-check {
  width: 22px;
  text-align: center;
  vertical-align: middle;
}
.col-check input {
  cursor: pointer;
  width: 11px;
  height: 11px;
  margin: 0;
  vertical-align: middle;
}
.lend-preview {
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  flex-shrink: 1;
}
.lend-preview .data-table { margin: 0; }
.data-table.compact tr.activity-group-start td {
  border-top: 2px solid var(--accent);
}
.data-table th, .data-table td {
  text-align: left;
  padding: 0 6px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.05;
  white-space: nowrap;
  height: 11px;
}
.machine-table {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.machine-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table th {
  color: var(--muted);
  font-weight: 600;
  background: #132036;
  position: sticky;
  top: 0;
  z-index: 4;
  box-shadow: 0 1px 0 var(--line);
  height: 18px;
  padding: 0;
  font-size: 10px;
}
.machine-table th {
  position: sticky;
  overflow: visible;
  vertical-align: middle;
}
.machine-table .th-inner {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 18px;
  height: 100%;
  padding: 0 10px 0 5px;
  box-sizing: border-box;
}
.machine-table .th-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.machine-table th.col-check .th-inner {
  justify-content: center;
  padding: 0 8px 0 2px;
}
.col-resize {
  position: absolute;
  top: 0;
  right: 0;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  z-index: 8;
  user-select: none;
  touch-action: none;
}
.col-resize::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  right: 3px;
  width: 2px;
  border-radius: 1px;
  background: rgba(150, 175, 210, 0.55);
}
.col-resize:hover::after,
.col-resize.active::after,
body.resizing-col .col-resize.active::after {
  background: var(--accent);
  width: 3px;
  right: 2px;
}
body.resizing-col {
  cursor: col-resize !important;
  user-select: none !important;
}
.table-wrap.filter-mode .data-table th.th-filter {
  background: #152a48;
  top: 0;
  z-index: 4;
  height: auto;
  padding: 0;
}
.table-wrap.filter-mode .machine-table .th-inner {
  min-height: 28px;
  padding: 0 10px 0 0;
}
.table-wrap.filter-mode .machine-table .th-filter-btn {
  flex: 1;
  min-width: 0;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table tr.row-locked td {
  background: rgba(245, 197, 66, 0.22);
}
.data-table tr.row-locked:hover td {
  background: rgba(245, 197, 66, 0.34);
}
.data-table .empty { text-align: center; color: var(--muted); padding: 20px; }
.badge {
  display: inline-flex; align-items: center; padding: 0 5px; border-radius: 999px;
  font-size: 10px; font-weight: 600; line-height: 1.35;
}
.badge.ok { background: rgba(61,214,140,.16); color: #3dd68c; }
.badge.warn { background: rgba(245,197,66,.16); color: #f5c542; }
.badge.danger { background: rgba(255,107,122,.16); color: var(--danger); }
.badge.info { background: rgba(90,168,255,.16); color: #5aa8ff; }
.badge.muted { background: rgba(147,164,195,.16); color: var(--muted); }
select {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; outline: none; color: inherit;
}

.placeholder { padding: 40px 28px; }
.placeholder h2 { margin: 0 0 10px; }
.placeholder p { margin: 0; color: var(--muted); line-height: 1.6; }
.server-line { margin-top: 14px !important; color: var(--accent) !important; font-size: 13px; }
.server-line.bad { color: var(--danger) !important; }
.hint code { color: var(--text); }

.toast {
  position: fixed; right: 20px; bottom: 20px; background: #203454; border: 1px solid var(--line);
  padding: 12px 16px; border-radius: 12px; display: none; z-index: 30;
}
.toast.show { display: block; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(4, 8, 16, 0.62);
  display: flex; align-items: center; justify-content: center;
  z-index: 40; padding: 20px;
}
.modal {
  width: min(720px, 100%);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  max-height: min(88vh, 640px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.modal.modal-batch {
  padding: 10px 12px 8px;
  max-height: min(88vh, 680px);
  width: min(760px, 100%);
}
.modal.modal-import {
  padding: 4px 8px 4px;
  max-height: min(88vh, 560px);
  border-radius: 10px;
  width: min(640px, 100%);
}
.modal.modal-wide {
  width: 80vw;
  max-width: 80vw;
  max-height: min(90vh, 860px);
  padding: 12px 14px 10px;
}
.modal.modal-wide .modal-table-area,
.modal.modal-wide .lend-preview.modal-table-area {
  flex: 1 1 auto;
  min-height: 240px;
  max-height: none;
  width: 100%;
  overflow: auto;
}
.modal.modal-wide .data-table {
  width: 100%;
  min-width: 100%;
}
.modal.modal-import h3 {
  margin: 0 0 1px;
  font-size: 13px;
  line-height: 1.2;
}
.modal.modal-import > .sub {
  margin: 0 0 2px;
  font-size: 11px;
  line-height: 1.2;
}
.modal.modal-import .import-head-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin: 0 0 2px;
  min-width: 0;
}
.modal.modal-import .import-head-row > .sub {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  line-height: 1.2;
}
.modal.modal-import .modal-tabs {
  gap: 4px;
  margin-bottom: 0;
  flex: 0 0 auto;
}
.modal.modal-import .modal-tabs button {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.2;
}
.modal.modal-import .modal-scroll {
  flex: 0 1 auto;
  min-height: 0;
}
.modal.modal-import > .actions {
  margin-top: 2px;
  padding-top: 2px;
  gap: 4px;
}
.modal.modal-import .import-box {
  padding: 4px 6px;
  gap: 4px;
  border-radius: 6px;
}
.modal.modal-import .import-csv-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-height: 0;
}
.modal.modal-import .import-csv-top > .sub {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  line-height: 1.2;
}
.modal.modal-import .import-csv-top .toolbar {
  flex: 0 0 auto;
  gap: 4px;
  min-height: 0;
  overflow: visible;
}
.modal.modal-import .hint-inline {
  margin: 0;
  font-size: 11px;
  line-height: 1.25;
}
.modal.modal-import .import-hint {
  flex-shrink: 0;
  margin: 0 0 3px;
  padding: 2px 0;
  color: var(--muted);
}
.modal.modal-import .import-box > .sub {
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
}
.modal.modal-import .csv-paste {
  gap: 2px;
  font-size: 11px;
}
.modal.modal-import .csv-paste textarea {
  min-height: 56px;
  max-height: 100px;
  height: 72px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 11px;
}
.modal.modal-import .dsn-check-list {
  max-height: min(18vh, 100px);
}
.modal.modal-import .form-grid {
  gap: 6px;
}
.modal.modal-import .form-grid label {
  gap: 2px;
  font-size: 11px;
}
.modal.modal-import .form-grid input,
.modal.modal-import .form-grid select,
.modal.modal-import .form-grid textarea {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}
.modal h3 { margin: 0 0 6px; flex-shrink: 0; }
.modal .sub { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.5; flex-shrink: 0; }
.modal-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-shrink: 0; }
.modal-tabs button {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 10px; padding: 8px 12px;
}
.modal-tabs button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.modal-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form-grid input, .form-grid select, .form-grid textarea {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; outline: none; color: inherit;
}
.suggest-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.suggest-box {
  position: relative;
  display: flex;
  align-items: stretch;
}
.suggest-box input {
  flex: 1;
  min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px 0 0 10px;
  padding: 9px 12px;
  outline: none;
  color: inherit;
}
.suggest-box.open input { border-color: var(--accent); }
.suggest-toggle {
  flex: 0 0 36px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: var(--bg-2);
  color: var(--muted);
  padding: 0;
}
.suggest-box.open .suggest-toggle { border-color: var(--accent); color: var(--accent); }
.suggest-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 50;
  max-height: 200px;
  overflow: auto;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 4px;
}
.suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.suggest-item:hover { background: rgba(255,255,255,0.06); }
.suggest-empty { color: var(--muted); font-size: 12px; padding: 8px 10px; }
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.modal > .actions {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.import-box {
  border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px;
  background: var(--bg-2); display: flex; flex-direction: column; gap: 8px;
}
.csv-paste { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.csv-paste textarea {
  width: 100%;
  min-height: 88px;
  max-height: 140px;
  height: 110px;
  resize: vertical;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; outline: none; color: var(--text);
  font-family: Consolas, "Courier New", monospace; font-size: 12px; line-height: 1.4;
}
.csv-paste textarea.short { min-height: 72px; max-height: 110px; height: 88px; }
.csv-paste textarea:focus { border-color: var(--accent); }
.dsn-check-wrap { margin-top: 8px; min-height: 0; }
.dsn-check-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.dsn-check-list {
  max-height: min(28vh, 160px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  scrollbar-width: thin;
}
.dsn-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  flex-wrap: wrap;
}
.dsn-check-item:last-child { border-bottom: 0; }
.dsn-check-item.ok { background: rgba(61, 214, 140, 0.06); }
.dsn-check-item.bad {
  background: rgba(255, 107, 122, 0.16);
  box-shadow: inset 3px 0 0 var(--danger);
}
.dsn-check-flag {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 999px;
  line-height: 1.5;
}
.dsn-check-item.ok .dsn-check-flag {
  background: rgba(61, 214, 140, 0.18);
  color: #3dd68c;
}
.dsn-check-item.bad .dsn-check-flag {
  background: rgba(255, 107, 122, 0.22);
  color: var(--danger);
}
.dsn-check-label { color: var(--muted); flex: 0 0 auto; }
.dsn-check-dsn {
  font-family: Consolas, "Courier New", monospace;
  color: var(--text);
  background: transparent;
  padding: 0;
}
.dsn-check-item.bad .dsn-check-dsn {
  color: var(--danger);
  font-weight: 700;
  background: rgba(255, 107, 122, 0.12);
  padding: 1px 4px;
  border-radius: 4px;
}
.dsn-check-tip { color: var(--danger); font-size: 11px; }

/* 批量选择：压缩提示/统计，放大 DSN 区域 */
.batch-modal {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  max-height: min(82vh, 600px);
}
.batch-modal > h3 {
  margin: 0 0 2px;
  font-size: 14px;
  flex-shrink: 0;
}
.batch-modal .batch-hint {
  margin: 0 0 2px;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.batch-modal .batch-meta {
  margin: 0 0 4px;
  font-size: 10px;
  line-height: 1.2;
}
.batch-modal .batch-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.batch-modal .batch-paste {
  flex: 1 1 55%;
  min-height: 0;
  gap: 2px;
  font-size: 11px;
}
.batch-modal .batch-paste textarea {
  flex: 1 1 auto;
  min-height: 140px;
  max-height: none;
  height: auto;
  resize: vertical;
  font-size: 12px;
  padding: 6px 8px;
}
.batch-modal .dsn-check-wrap {
  flex: 1 1 40%;
  min-height: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
}
.batch-modal .dsn-check-list {
  flex: 1 1 auto;
  max-height: none;
  min-height: 80px;
}
.batch-modal .dsn-check-empty {
  font-size: 10px;
  padding: 4px 6px;
}
.batch-modal .dsn-check-item {
  padding: 2px 6px;
  font-size: 11px;
  gap: 4px;
}
.batch-modal .batch-actions {
  margin-top: 6px;
  padding-top: 6px;
  gap: 6px;
}
.batch-modal .batch-actions .btn {
  padding: 3px 10px;
  font-size: 11px;
}
.online-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(16, 26, 46, 0.9);
  color: var(--muted);
  font-size: 11px;
  min-height: 22px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: #6b7c99;
}
.online-dot.on { background: #3dd68c; box-shadow: 0 0 0 2px rgba(61, 214, 140, 0.18); }
.online-dot.off { background: #6b7c99; }
.online-user {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(61, 214, 140, 0.12);
  color: #3dd68c;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; max-height: none; }
  .hint { display: none; }
  .topbar { height: 34px; padding: 0 10px; flex-wrap: nowrap; }
  .form-grid { grid-template-columns: 1fr; }
}
