/* ==========================================================================
   深圳航空 · 全员起落操纵质量大表专用样式规范 (Matrix Data Grid CSS)
   ========================================================================== */

:root {
  --bg-dark: #080c16;
  --bg-card: rgba(16, 24, 40, 0.75);
  --bg-card-hover: rgba(22, 34, 56, 0.85);
  --bg-header: rgba(12, 18, 30, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --accent-blue: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-gold: #fbbf24;
  --accent-red: #f87171;
  --accent-green: #34d399;
  --accent-purple: #c084fc;
  
  --score-5: rgba(52, 211, 153, 0.2);
  --score-4: rgba(56, 189, 248, 0.2);
  --score-3: rgba(251, 191, 36, 0.2);
  --score-2: rgba(251, 146, 60, 0.2);
  --score-1: rgba(248, 113, 113, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  user-select: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* ================= 现代化极简深色悬浮滚动条 (WebView2 / Chromium 原生接管) ================= */
*::-webkit-scrollbar,
::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
}

*::-webkit-scrollbar-track,
::-webkit-scrollbar-track {
  background: rgba(8, 12, 22, 0.45) !important;
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22) !important;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box !important;
  transition: all 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.75) !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  background-clip: padding-box !important;
}

*::-webkit-scrollbar-thumb:active,
::-webkit-scrollbar-thumb:active {
  background: rgba(56, 189, 248, 0.95) !important;
  background-clip: padding-box !important;
}

*::-webkit-scrollbar-corner,
::-webkit-scrollbar-corner {
  background: rgba(8, 12, 22, 0.6) !important;
}



/* ================= 品牌标识与标题微标 (红区1) ================= */
.brand-badge,
.brand-badge * {
  cursor: move;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 28px;
}

.logo-dot {
  width: 8px;
  height: 8px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
  flex-shrink: 0;
}

.brand-name {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.brand-divider {
  color: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* ================= 顶部控制工具栏 ================= */
.toolbar-container {
  padding: 12px 20px;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
  cursor: move;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 14px 18px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
  cursor: move;
}

/* 机构/周期/搜索三个控件打包为一个不可拆分的整体 */
.toolbar-filters-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  flex-shrink: 0;
  white-space: nowrap;
  cursor: default;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.control-group label {
  white-space: nowrap;
  flex-shrink: 0;
}

.select-box {
  background: rgba(20, 30, 50, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.select-box:hover {
  border-color: var(--accent-blue);
}

.select-box:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.select-box optgroup {
  background: #0f172a;
  color: #38bdf8;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 0;
}

.select-box option {
  background: #1e293b;
  color: #f8fafc;
  font-weight: normal;
  padding: 4px 8px;
}

.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
  -webkit-app-region: no-drag;
  flex-shrink: 0;
}

.search-box {
  background: rgba(20, 30, 50, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 6px 12px 6px 30px;
  border-radius: 6px;
  font-size: 13px;
  width: 170px;
  outline: none;
  transition: all 0.2s ease;
}

.search-box:focus {
  width: 220px;
  border-color: var(--accent-blue);
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-dim);
  pointer-events: none;
  font-size: 12px;
}

.btn-clear-filters {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #f87171;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  -webkit-app-region: no-drag;
  flex-shrink: 0;
  white-space: nowrap;
}

.btn-clear-filters:hover {
  background: rgba(248, 113, 113, 0.3);
  color: #fff;
  border-color: #f87171;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  cursor: default;
  margin-top: 2px;
}

.kpi-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  padding: 3px 8px 3px 10px;
  border-radius: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.kpi-group-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 2px;
}

.kpi-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-app-region: no-drag;
}

.kpi-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green {
  background: var(--accent-green);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.6);
}

.dot-yellow {
  background: #fbbf24;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
}

.dot-red {
  background: var(--accent-red);
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.6);
}

.kpi-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight: 700;
  font-size: 13px;
}

/* ================= 现代无边框窗体控制按钮 ================= */
.win-controls-group {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
}

.win-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-app-region: no-drag;
}

.win-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.win-btn.btn-theme svg {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: rotate(0deg);
}

.win-btn.btn-theme:hover svg {
  transform: rotate(25deg);
}

[data-theme="light"] .win-btn.btn-theme svg {
  transform: rotate(180deg);
}

[data-theme="light"] .win-btn.btn-theme:hover svg {
  transform: rotate(205deg);
}

.win-btn.btn-close:hover {
  background: #e11d48;
  color: #fff;
}

/* ================= 核心大表视口与网格 ================= */
.table-viewport {
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--bg-dark);
}

.matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 12px;
  text-align: center;
}

/* 多层表头 */
.matrix-table thead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
}

.matrix-table th {
  padding: 6px 4px;
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  background: rgba(14, 21, 37, 0.98);
}

.matrix-table tr.header-group th {
  color: var(--text-main);
  font-size: 12px;
  letter-spacing: 0.5px;
  background: rgba(18, 28, 48, 0.98);
  border-bottom: 1px solid var(--border-color);
  padding: 7px 6px;
}

.matrix-table th[data-col] {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.matrix-table th[data-col]:hover {
  background: rgba(30, 58, 138, 0.4) !important;
  color: #38bdf8 !important;
}

.matrix-table th.th-sorted {
  color: #38bdf8 !important;
  background: rgba(14, 165, 233, 0.12) !important;
  border-bottom: 2px solid #38bdf8 !important;
}

[data-theme="light"] .matrix-table th[data-col]:hover {
  background: #e0f2fe !important;
  color: #0284c7 !important;
}

[data-theme="light"] .matrix-table th.th-sorted {
  color: #0284c7 !important;
  background: #f0f9ff !important;
  border-bottom: 2px solid #0284c7 !important;
}

.th-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  width: 100%;
}

.th-label {
  white-space: nowrap;
}

.sort-indicator {
  font-size: 8px;
  line-height: 1;
  color: #38bdf8;
  font-weight: 900;
  display: none;
  margin: 0 1px;
}

[data-theme="light"] .sort-indicator {
  color: #0284c7;
}

/* 现代漏斗筛选按钮 */
.btn-filter {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 1px 3px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.45;
  margin-left: 2px;
}

.btn-filter svg {
  pointer-events: none;
  transition: all 0.15s ease;
}

.matrix-table th:hover .btn-filter,
.btn-filter:hover {
  opacity: 1;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.18);
}

[data-theme="light"] .matrix-table th:hover .btn-filter,
[data-theme="light"] .btn-filter:hover {
  color: #0284c7;
  background: rgba(2, 132, 199, 0.15);
}

/* 处于激活筛选状态的漏斗按钮高亮 */
.btn-filter.active-filter {
  opacity: 1 !important;
  background: #38bdf8 !important;
  color: #080c16 !important;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
}

.btn-filter.active-filter svg {
  stroke: #080c16 !important;
  fill: #080c16 !important;
}

[data-theme="light"] .btn-filter.active-filter {
  background: #0284c7 !important;
  color: #ffffff !important;
  box-shadow: 0 0 8px rgba(2, 132, 199, 0.5);
}

[data-theme="light"] .btn-filter.active-filter svg {
  stroke: #ffffff !important;
  fill: #ffffff !important;
}

/* 冻结固定前几列 */
.matrix-table .col-freeze-1 {
  position: sticky;
  left: 0;
  z-index: 20;
  background: rgba(12, 18, 30, 0.98);
  width: 48px;
  min-width: 48px;
}

.matrix-table .col-freeze-2 {
  position: sticky;
  left: 48px;
  z-index: 20;
  background: rgba(12, 18, 30, 0.98);
  min-width: 86px;
}

.matrix-table .col-freeze-3 {
  position: sticky;
  left: 134px;
  z-index: 20;
  background: rgba(12, 18, 30, 0.98);
  min-width: 72px;
  border-right: 2px solid var(--border-light);
}

.matrix-table thead .col-freeze-1,
.matrix-table thead .col-freeze-2,
.matrix-table thead .col-freeze-3 {
  z-index: 120;
}

/* 基准对比行样式 (集成于 thead 内部，统一粘性固顶，0缝隙0漏字) */
.row-benchmark-fleet {
  font-weight: 600;
}

.row-benchmark-squad {
  font-weight: 600;
}

.row-benchmark-fleet td {
  background: #0c1629 !important;
  color: #7dd3fc;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
  padding: 7px 6px;
}

.row-benchmark-squad td {
  background: #141c26 !important;
  color: #fde047;
  border-right: 1px solid var(--border-color);
  border-bottom: 2px solid var(--border-light) !important;
  padding: 7px 6px;
}

.row-benchmark-fleet td.col-freeze-1,
.row-benchmark-fleet td.col-freeze-2,
.row-benchmark-fleet td.col-freeze-3 {
  background: #0c1629 !important;
  z-index: 125 !important;
}

.row-benchmark-squad td.col-freeze-1,
.row-benchmark-squad td.col-freeze-2,
.row-benchmark-squad td.col-freeze-3 {
  background: #141c26 !important;
  z-index: 125 !important;
}

/* 飞行员数据行 (默认光标，双击行可打开画像) */
.matrix-table tbody tr.row-pilot {
  transition: background 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
  cursor: default;
}

.matrix-table tbody tr.row-pilot:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

/* 低可靠性/样本不足数据行 (柔和浅灰淡化，一眼识别数据可信度偏低) */
.matrix-table tbody tr.row-unreliable {
  opacity: 0.4;
  filter: grayscale(0.7);
}

.matrix-table tbody tr.row-unreliable td {
  color: var(--text-dim) !important;
}

.matrix-table tbody tr.row-unreliable .pilot-name-cell {
  color: #94a3b8 !important;
}

.matrix-table tbody tr.row-unreliable .score-cell {
  filter: saturate(0.2);
}

.matrix-table tbody tr.row-unreliable .rank-badge {
  opacity: 0.5;
}

/* 悬停低可靠性行时临时提亮供仔细查阅 */
.matrix-table tbody tr.row-unreliable:hover {
  opacity: 0.95 !important;
  filter: grayscale(0) !important;
}

.matrix-table tbody tr.row-pilot:hover {
  background: var(--bg-card-hover) !important;
}

.matrix-table tbody tr.row-pilot:hover .col-freeze-1,
.matrix-table tbody tr.row-pilot:hover .col-freeze-2,
.matrix-table tbody tr.row-pilot:hover .col-freeze-3 {
  background: #192742 !important;
}

.matrix-table td {
  padding: 6px 6px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

/* 姓名与技术职级微标 */
.pilot-name-cell {
  font-weight: 600;
  color: #fff;
  cursor: pointer !important;
}

.pilot-name-link {
  cursor: pointer !important;
  color: inherit;
  display: inline-block;
  border-bottom: 1px dashed rgba(56, 189, 248, 0.4);
  transition: all 0.15s ease;
}

.pilot-name-cell:hover .pilot-name-link,
.pilot-name-link:hover {
  color: #38bdf8 !important;
  border-bottom-color: #38bdf8;
  transform: translateX(1px);
}

[data-theme="light"] .pilot-name-cell:hover .pilot-name-link,
[data-theme="light"] .pilot-name-link:hover {
  color: #0284c7 !important;
  border-bottom-color: #0284c7;
}

.pilot-rank-cell {
  cursor: pointer !important;
}

.rank-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer !important;
  user-select: none;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease, filter 0.15s ease;
}

.pilot-rank-cell:hover .rank-badge,
.rank-badge:hover {
  transform: scale(1.12);
  box-shadow: 0 0 10px currentColor;
  filter: brightness(1.15);
}

.rank-TA, .rank-TB, .rank-TC { background: rgba(192, 132, 252, 0.2); color: #d8b4fe; border: 1px solid rgba(192, 132, 252, 0.4); }
.rank-F4, .rank-F5, .rank-FL, .rank-FZ { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.4); }
.rank-F1, .rank-F2, .rank-F3, .rank-FR { background: rgba(52, 211, 153, 0.2); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.4); }
.rank-PP, .rank-P1 { background: rgba(251, 191, 36, 0.2); color: #fde047; border: 1px solid rgba(251, 191, 36, 0.4); }

/* 评分单元格热力色阶 */
.score-cell {
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}

/* 偏离值正负着色 */
.dev-positive { color: #34d399; }
.dev-negative { color: #f87171; }
.dev-neutral { color: var(--text-dim); }

/* 事件预警微标 */
.event-warn-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
  font-weight: 700;
}

/* 事件发生率预警着色 (P90 红 / P75 黄 / 正常 绿) */
.event-rate-high {
  color: #f87171 !important;
  background: rgba(248, 113, 113, 0.15);
  font-weight: 700;
}
.event-rate-mid {
  color: #fbbf24 !important;
  background: rgba(251, 191, 36, 0.1);
  font-weight: 600;
}
.event-rate-low {
  color: #34d399 !important;
}
.event-rate-zero {
  color: var(--text-dim) !important;
}

[data-theme="light"] .event-rate-high {
  color: #dc2626 !important;
  background: rgba(239, 68, 68, 0.12);
}
[data-theme="light"] .event-rate-mid {
  color: #d97706 !important;
  background: rgba(245, 158, 11, 0.1);
}
[data-theme="light"] .event-rate-low {
  color: #059669 !important;
}
[data-theme="light"] .event-rate-zero {
  color: #94a3b8 !important;
}

/* ================= Excel 风格浮动弹窗 (Popover) ================= */
.excel-filter-popover {
  position: fixed;
  z-index: 999999;
  width: 250px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 255, 255, 0.3);
  padding: 8px;
  font-size: 12px;
  color: #f1f5f9;
  backdrop-filter: blur(20px);
  animation: popoverFadeIn 0.12s ease-out;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.popover-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.popover-btn {
  padding: 6px 10px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  color: var(--text-main);
  font-size: 12px;
}

.popover-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-blue);
}

.popover-clear:hover {
  background: rgba(248, 113, 113, 0.15);
  color: var(--accent-red);
}

.popover-icon {
  font-size: 13px;
  width: 16px;
  text-align: center;
  color: var(--accent-blue);
}

.popover-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 6px 0;
}

.popover-search-wrap {
  margin: 4px 0 6px 0;
}

.popover-search-box {
  width: 100%;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f8fafc;
  padding: 6px 9px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
  transition: all 0.15s ease;
}

.popover-search-box:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.popover-select-all-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
  margin-bottom: 4px;
}

.popover-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}

.popover-count-tag {
  font-size: 11px;
  color: var(--text-dim);
}

.popover-items-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0;
  margin-bottom: 6px;
}

.popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.popover-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.popover-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover-item-count {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 6px;
}

.popover-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.popover-action-btn {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-confirm {
  background: var(--accent-blue);
  color: #080c16;
  border: none;
}

.btn-confirm:hover {
  background: #7dd3fc;
}

.btn-cancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-muted);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ================= 底部状态栏 ================= */
.matrix-statusbar {
  height: 28px;
  min-height: 28px;
  background: rgba(10, 15, 26, 0.95);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11px;
  color: var(--text-dim);
  z-index: 50;
}

.status-left, .status-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-tip {
  color: var(--accent-blue);
}

/* ================= ☀️ 日间亮色主题 (Light Theme) ================= */
[data-theme="light"] {
  --bg-dark: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-header: #e2e8f0;
  --border-color: #e2e8f0;
  --border-light: #cbd5e1;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  
  --accent-blue: #0284c7;
  --accent-cyan: #0891b2;
  --accent-gold: #d97706;
  --accent-red: #dc2626;
  --accent-green: #16a34a;
  --accent-purple: #9333ea;
}

[data-theme="light"] body {
  background-color: #ffffff;
  color: #0f172a;
}

[data-theme="light"] .toolbar-container {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

[data-theme="light"] .brand-name {
  color: #0f172a;
}

[data-theme="light"] .brand-divider {
  color: #cbd5e1;
}

[data-theme="light"] .select-box,
[data-theme="light"] .search-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .search-box:focus,
[data-theme="light"] .select-box:focus {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

[data-theme="light"] .select-box optgroup {
  background: #f1f5f9;
  color: #0369a1;
  font-weight: 700;
}

[data-theme="light"] .select-box option {
  background: #ffffff;
  color: #0f172a;
}

[data-theme="light"] .search-icon {
  color: #94a3b8;
}

[data-theme="light"] .kpi-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

[data-theme="light"] .kpi-group-label {
  color: #475569;
}

[data-theme="light"] .kpi-badge {
  color: #1e293b;
}

[data-theme="light"] .win-btn {
  color: #475569;
}

[data-theme="light"] .win-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .win-btn.btn-close:hover {
  background: #e11d48;
  color: #ffffff;
}

[data-theme="light"] .table-viewport {
  background: #ffffff;
}

[data-theme="light"] .matrix-table th {
  background: #f1f5f9;
  color: #334155;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
}

[data-theme="light"] .matrix-table tr.header-group th {
  background: #e2e8f0;
  color: #0f172a;
  border-bottom: 1px solid #cbd5e1;
}

[data-theme="light"] .matrix-table .col-freeze-1,
[data-theme="light"] .matrix-table .col-freeze-2,
[data-theme="light"] .matrix-table .col-freeze-3 {
  background: #f8fafc;
  color: #0f172a;
  border-right: 1px solid #e2e8f0;
}

[data-theme="light"] .matrix-table thead .col-freeze-1,
[data-theme="light"] .matrix-table thead .col-freeze-2,
[data-theme="light"] .matrix-table thead .col-freeze-3 {
  background: #e2e8f0;
}

[data-theme="light"] .matrix-table td {
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}

[data-theme="light"] .pilot-name-cell {
  color: #0f172a;
}

[data-theme="light"] .matrix-table tbody tr.row-pilot:nth-child(even) {
  background: #fbfcfe;
}

[data-theme="light"] .matrix-table tbody tr.row-pilot:hover {
  background: #e0f2fe !important;
}

[data-theme="light"] .matrix-table tbody tr.row-pilot:hover .col-freeze-1,
[data-theme="light"] .matrix-table tbody tr.row-pilot:hover .col-freeze-2,
[data-theme="light"] .matrix-table tbody tr.row-pilot:hover .col-freeze-3 {
  background: #bae6fd !important;
}

/* 基准对比行在日间模式下的高清晰不透明配色 */
[data-theme="light"] .row-benchmark-fleet td {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border-bottom: 1px solid #bae6fd;
}

[data-theme="light"] .row-benchmark-squad td {
  background: #fef3c7 !important;
  color: #92400e !important;
  border-bottom: 2px solid #fde68a !important;
}

[data-theme="light"] .row-benchmark-fleet td.col-freeze-1,
[data-theme="light"] .row-benchmark-fleet td.col-freeze-2,
[data-theme="light"] .row-benchmark-fleet td.col-freeze-3 {
  background: #e0f2fe !important;
}

[data-theme="light"] .row-benchmark-squad td.col-freeze-1,
[data-theme="light"] .row-benchmark-squad td.col-freeze-2,
[data-theme="light"] .row-benchmark-squad td.col-freeze-3 {
  background: #fef3c7 !important;
}

/* 评分高亮色阶 (日间柔和高清晰对比度) */
[data-theme="light"] .score-high { color: #15803d; background: #dcfce7; }
[data-theme="light"] .score-mid { color: #0369a1; background: #e0f2fe; }
[data-theme="light"] .score-low { color: #b45309; background: #fef3c7; }
[data-theme="light"] .score-warn { color: #b91c1c; background: #fee2e2; }

/* 亮色模式职级徽章：深色文字+浅色背景，保证对比度 */
[data-theme="light"] .rank-TA,
[data-theme="light"] .rank-TB,
[data-theme="light"] .rank-TC { background: #f3e8ff; color: #7c3aed; border: 1px solid #c4b5fd; }
[data-theme="light"] .rank-F4,
[data-theme="light"] .rank-F5,
[data-theme="light"] .rank-FL,
[data-theme="light"] .rank-FZ { background: #e0f2fe; color: #0284c7; border: 1px solid #7dd3fc; }
[data-theme="light"] .rank-F1,
[data-theme="light"] .rank-F2,
[data-theme="light"] .rank-F3,
[data-theme="light"] .rank-FR { background: #ecfdf5; color: #059669; border: 1px solid #6ee7b7; }
[data-theme="light"] .rank-PP,
[data-theme="light"] .rank-P1 { background: #fffbeb; color: #d97706; border: 1px solid #fde047; }

/* 偏离值 */
[data-theme="light"] .dev-positive { color: #16a34a; }
[data-theme="light"] .dev-negative { color: #dc2626; }
[data-theme="light"] .dev-neutral { color: #94a3b8; }

/* 低可靠性浅灰淡化行 */
[data-theme="light"] .matrix-table tbody tr.row-unreliable {
  opacity: 0.45;
  filter: grayscale(0.85);
}

[data-theme="light"] .matrix-table tbody tr.row-unreliable td {
  color: #94a3b8 !important;
  background: #f8fafc;
}

[data-theme="light"] .matrix-table tbody tr.row-unreliable:hover td {
  background: #e0f2fe !important;
}

/* 弹出框与状态栏 */
[data-theme="light"] .excel-filter-popover {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  color: #0f172a;
}

[data-theme="light"] .popover-btn {
  color: #1e293b !important;
}

[data-theme="light"] .popover-btn:hover {
  background: #f1f5f9 !important;
  color: #0284c7 !important;
}

[data-theme="light"] .popover-clear:hover {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

[data-theme="light"] .popover-search-box {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

[data-theme="light"] .popover-search-box::placeholder {
  color: #94a3b8 !important;
}

[data-theme="light"] .popover-search-box:focus {
  background: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15) !important;
}

[data-theme="light"] .popover-select-all-row {
  background: #f8fafc !important;
  color: #334155 !important;
}

[data-theme="light"] .popover-item {
  color: #1e293b !important;
}

[data-theme="light"] .popover-item:hover {
  background: #f1f5f9 !important;
}

[data-theme="light"] .popover-divider {
  background: #e2e8f0 !important;
}

[data-theme="light"] .popover-action-btn.btn-confirm {
  background: #0284c7 !important;
  color: #ffffff !important;
}

[data-theme="light"] .popover-action-btn.btn-confirm:hover {
  background: #0369a1 !important;
}

[data-theme="light"] .popover-action-btn.btn-cancel {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
}

[data-theme="light"] .popover-action-btn.btn-cancel:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

[data-theme="light"] .matrix-statusbar {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
}

[data-theme="light"] ::-webkit-scrollbar-track {
  background: #f1f5f9;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ================= Web 浏览器模式适配 (无 pywebview 时自动生效) ================= */
body.web-mode #btnWinMin,
body.web-mode #btnWinMax,
body.web-mode #btnWinClose {
  display: none !important;
}

body.web-mode .pywebview-drag-region {
  -webkit-app-region: unset !important;
  app-region: unset !important;
  cursor: default;
}

body.web-mode {
  user-select: auto;
}

/* ========== 分享按钮与分级转授权模态框样式 ========== */
.win-btn.btn-share {
  color: var(--accent-blue);
}

.win-btn.btn-share:hover {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}

.share-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.share-modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  width: 90%;
  max-width: 520px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

[data-theme="light"] .share-modal-box {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

.share-modal-header h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text-main);
  font-weight: 600;
}

.share-modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.share-modal-close:hover {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
}

.share-modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-field-group label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

.modal-shares-list-wrap {
  margin-top: 6px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.modal-shares-list-wrap h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.modal-shares-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-share-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-size: 12px;
}

[data-theme="light"] .modal-share-item {
  background: #f8fafc;
}

