/* ==========================================================================
   账号业绩看板 —— 设计系统
   浅色卡片化 / 玻璃质感顶栏 / 数值热力着色 / 微动效
   全部离线，不引用任何外部 CDN 资源。
   ========================================================================== */

:root {
  /* 主色 */
  --primary: #4F46E5;
  --primary-2: #6366F1;
  --primary-3: #8B5CF6;
  --primary-soft: #EEF2FF;
  --primary-ring: rgba(79, 70, 229, .22);

  /* 表格选中行：当前正在操作的那行用蓝色，其余已选中的行用浅蓝色 */
  --selected-bg: #93C5FD;
  --selected-bg-soft: #C7DDFE;
  --selected-line: #2563EB;

  /* 背景与表面 */
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #EEF2FF;
  --surface-3: #F9FAFF;

  /* 文本 */
  --text: #111827;
  --text-2: #4B5563;
  --text-3: #9CA3AF;

  /* 功能色 */
  --ok: #059669;
  --ok-soft: #ECFDF5;
  --warn: #D97706;
  --warn-soft: #FFFBEB;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --info: #2563EB;
  --info-soft: #EFF6FF;

  --line: #E7E9F3;
  --line-strong: #D6DAEA;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow-xs: 0 1px 2px rgba(17, 24, 39, .05);
  --shadow-sm: 0 2px 8px rgba(17, 24, 39, .06);
  --shadow: 0 10px 30px -12px rgba(31, 41, 55, .18), 0 2px 6px rgba(17, 24, 39, .04);
  --shadow-lg: 0 26px 60px -22px rgba(49, 46, 129, .38), 0 6px 18px rgba(17, 24, 39, .06);

  --font: "Noto Sans SC", "Noto Sans", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Mono", Consolas, monospace;

  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

/* 必须放在所有布局样式之前：否则 .modal-host / .btn 等设置了 display 的类
   会盖掉 hidden 属性，导致隐藏元素仍然拦截点击。 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 12% -8%, #E8EAFF 0%, rgba(238, 242, 255, 0) 60%),
    radial-gradient(900px 520px at 96% 0%, #F3E9FF 0%, rgba(243, 233, 255, 0) 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 16px; }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: var(--primary); }

.muted { color: var(--text-3); }
.hint { color: var(--text-3); font-size: 12px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D5D9EA; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #BFC5DE; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ 顶栏 ============================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .74);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  border-bottom: 1px solid rgba(231, 233, 243, .9);
}

.topbar__inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 12px 24px 8px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand__mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  color: #fff;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-3));
  box-shadow: 0 8px 18px -8px var(--primary-ring), inset 0 1px 0 rgba(255, 255, 255, .4);
}

.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__text strong { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }

.topbar__meta { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: 999px;
  font-size: 12.5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .8);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.pill--ghost { color: var(--text-3); }

/* ============================ 标签页 ============================ */
.tabs {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
}

.tab {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 10px 16px 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 10px 10px 0 0;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.tab:hover { color: var(--text-2); background: rgba(238, 242, 255, .6); }
.tab.is-active { color: var(--primary); font-weight: 600; }
.tab.is-locked { color: var(--text-3); }
.tab.is-locked::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  background: currentColor;
  opacity: .75;
  vertical-align: -1px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V8a5 5 0 0 1 10 0v2h1a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1h1Zm2 0h6V8a3 3 0 1 0-6 0v2Z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V8a5 5 0 0 1 10 0v2h1a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1h1Zm2 0h6V8a3 3 0 1 0-6 0v2Z'/%3E%3C/svg%3E") center/contain no-repeat;
}
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 2.5px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--primary), var(--primary-3));
  animation: slideIn .26s var(--ease);
}
@keyframes slideIn { from { transform: scaleX(.3); opacity: .2; } to { transform: scaleX(1); opacity: 1; } }

/* ============================ 页面容器 ============================ */
.page {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px 140px;
}

.view { display: none; }
.view.is-active { display: flex; flex-direction: column; gap: 16px; animation: fadeUp .28s var(--ease); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ============================ 卡片 ============================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.card--date { padding: 14px 18px 16px; }
.card--table { padding: 0; overflow: hidden; }

.card__head { margin-bottom: 14px; }
.card__head h2 { display: flex; align-items: center; gap: 8px; }
.card__head p { margin-top: 4px; font-size: 12.5px; }

/* ============================ 日期条 ============================ */
.datebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.datebar__label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2);
}
.datebar__label strong { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.datebar__label .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(5, 150, 105, .14);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(5, 150, 105, .14); }
  50% { box-shadow: 0 0 0 7px rgba(5, 150, 105, .06); }
}

.datebar__picker { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .18s var(--ease);
  white-space: nowrap;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); transform: translateY(-1px); box-shadow: var(--shadow-xs); }
.chip.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 14px -6px var(--primary-ring);
}
.chip--icon { color: var(--primary); border-color: var(--primary-soft); background: var(--primary-soft); }
.chip--count { background: var(--primary-soft); border-color: transparent; color: var(--primary); font-weight: 600; }
.chip--count b { font-variant-numeric: tabular-nums; }

/* ============================ 工具条 ============================ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.toolbar__spacer { flex: 1 1 auto; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 11.5px; color: var(--text-3); padding-left: 2px; }
.field--inline { flex-direction: row; align-items: center; gap: 8px; }
.field--inline > span { padding-left: 0; }
.field--search { min-width: 200px; }

input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="password"], select {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  height: 34px;
  min-width: 120px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
input::placeholder { color: var(--text-3); }
input:focus, select:focus {
  outline: none;
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px var(--primary-ring);
  background: #fff;
}
input[type="date"] { min-width: 148px; font-variant-numeric: tabular-nums; }
select { cursor: pointer; }

.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 999px;
  gap: 2px;
}
.seg__item {
  appearance: none; border: 0; background: transparent;
  font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-2);
  padding: 6px 14px; border-radius: 999px; cursor: pointer;
  transition: all .18s var(--ease);
  white-space: nowrap;
}
.seg__item:hover { color: var(--text); }
.seg__item.is-active { background: #fff; color: var(--primary); box-shadow: var(--shadow-xs); }

.quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ============================ 按钮 ============================ */
.btn {
  appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 550;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .18s var(--ease);
  white-space: nowrap;
}
.btn--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text-2);
}
.btn--ghost:hover { border-color: var(--primary-2); color: var(--primary); background: var(--surface-3); transform: translateY(-1px); }
.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 20px -12px var(--primary-ring), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -12px rgba(79, 70, 229, .55); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #B91C1C; }
.btn--warn { background: var(--warn); color: #fff; }
.btn--lg { height: 40px; padding: 0 20px; font-size: 14px; }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn:active { transform: translateY(0) scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.range-hint { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ============================ 表格 ============================ */
.tablewrap {
  overflow: auto;
  max-height: 62vh;
  border-radius: var(--radius);
  position: relative;
}
.tablewrap--tall { max-height: 68vh; }
.tablewrap--short { max-height: 320px; }

.grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, #FBFBFE, #F4F5FC);
  color: var(--text-2);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .01em;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #F1F2F8;
  vertical-align: middle;
  white-space: nowrap;
}
.grid tbody tr { transition: background .14s var(--ease); }
.grid tbody tr:hover { background: var(--surface-3); }
/* 选中行：已选中的行用浅蓝；当前正在操作的那行加深，鼠标悬停也临时加深 */
.grid tbody tr.is-selected,
.grid tbody tr.is-selected td { background: var(--selected-bg-soft); }
.grid tbody tr.is-selected td { border-bottom-color: rgba(37, 99, 235, .16); }
.grid tbody tr.is-selected.is-current,
.grid tbody tr.is-selected.is-current td,
.grid tbody tr.is-selected:hover,
.grid tbody tr.is-selected:hover td { background: var(--selected-bg); }
.grid tbody tr.is-selected.is-current td { border-bottom-color: rgba(37, 99, 235, .3); }
.grid tbody tr.is-filled td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.grid tbody tr.row--date { background: #FCFCFF; }

.grid td input[type="number"], .grid td input[type="text"], .grid td input[type="date"] {
  height: 30px; padding: 4px 8px; min-width: 90px; font-variant-numeric: tabular-nums;
}
.grid td input.cell-input { width: 108px; }
.grid td input.cell-input--health { width: 84px; }
.grid td input.cell-input.is-dirty { border-color: var(--warn); background: var(--warn-soft); }
.grid td input.cell-input.is-saved { border-color: var(--ok); background: var(--ok-soft); }

/* 录入表：等宽列，表头与单元格统一居中、上下居中 */
.grid--entry { table-layout: fixed; }
.grid--entry thead th,
.grid--entry tbody td {
  text-align: center;
  vertical-align: middle;
  padding-left: 6px;
  padding-right: 6px;
}
.grid--entry thead th { white-space: normal; line-height: 1.25; }
.grid--entry tbody td { white-space: normal; word-break: break-word; line-height: 1.35; }
.grid--entry th.col-check, .grid--entry td.col-check { width: 34px; padding-left: 0; padding-right: 0; }
.grid--entry th.col-action, .grid--entry td.col-action { width: 74px; padding-left: 0; padding-right: 0; }
.grid--entry td input.cell-input,
.grid--entry td input.cell-input--health {
  width: 100%;
  min-width: 0;
  text-align: center;
  box-sizing: border-box;
}

/* 备注：只读展示，超长省略 */
.cell-note {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

/* 停用账号：整行置灰，输入框不可编辑 */
.grid--entry tr.is-disabled td { opacity: .55; }
.grid--entry tr.is-disabled td.col-action { opacity: 1; }
.grid--entry tr.is-disabled input.cell-input { cursor: not-allowed; background: var(--surface-2, #F5F6FA); }

.col-check { width: 38px; }
.col-num { text-align: right; }

.grid td.num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.mono { font-family: var(--mono); font-size: 12.5px; }

/* 录入表：覆盖上面的数值右对齐，所有列（含健康分 / GMV / 表头）一律居中 */
.grid--entry thead th,
.grid--entry tbody td,
.grid--entry thead th.num,
.grid--entry tbody td.num,
.grid--entry .col-num,
.grid--entry .col-num--wide { text-align: center; }

.grid--board td.col-sticky, .grid--board th.col-sticky {
  position: sticky;
  background: #fff;
  z-index: 2;
}
.grid--board tbody tr:hover td.col-sticky { background: var(--surface-3); }
.grid--board thead th.col-sticky { z-index: 4; background: linear-gradient(180deg, #FBFBFE, #F4F5FC); }
.grid--board tbody tr.is-selected td.col-sticky { background: var(--selected-bg-soft); }
.grid--board tbody tr.is-selected.is-current td.col-sticky,
.grid--board tbody tr.is-selected:hover td.col-sticky { background: var(--selected-bg); }
.sticky-1 { left: 0; }
.sticky-2 { left: 82px; }
.grid--board .col-code { width: 82px; min-width: 82px; }
.grid--board .col-account { width: 152px; min-width: 152px; }
.grid--board .datecol { min-width: 88px; text-align: right; font-variant-numeric: tabular-nums; }
.grid--board thead th.datecol { text-align: right; }
.grid--board thead th.is-today { color: var(--primary); }

/* 数值热力着色 */
.heat { border-radius: 6px; padding: 2px 6px; display: inline-block; min-width: 46px; text-align: right; }
.heat-0 { color: var(--text-3); }
.heat-1 { color: #312E81; background: rgba(99, 102, 241, .09); }
.heat-2 { color: #312E81; background: rgba(99, 102, 241, .18); }
.heat-3 { color: #1E1B4B; background: rgba(79, 70, 229, .28); }
.heat-4 { color: #fff; background: rgba(79, 70, 229, .62); }
.heat-5 { color: #fff; background: rgba(67, 56, 202, .9); font-weight: 600; }
.cell-blank { color: #D8DBE8; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #fff;
  background: var(--info);
}
.badge--soft {
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
}
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 21px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 500;
}
.tag--ok { background: var(--ok-soft); color: var(--ok); }
.tag--warn { background: var(--warn-soft); color: var(--warn); }
.tag--danger { background: var(--danger-soft); color: var(--danger); }
.tag--info { background: var(--info-soft); color: var(--info); }
.tag--mute { background: var(--surface-2); color: var(--text-3); }

.empty {
  padding: 44px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

tr.row--trash { opacity: .72; }

/* ============================ 录入底部操作栏 ============================ */
.savebar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 35;
  width: min(1560px, calc(100% - 48px));
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(14px) saturate(1.6);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  border: 1px solid rgba(231, 233, 243, .95);
  box-shadow: var(--shadow-lg);
  animation: fadeUp .3s var(--ease);
}
.savebar__info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.savebar__bulk { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.savebar__toggle { display: none; }

/* ============================ KPI 卡 ============================ */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.kpi {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi::after {
  content: "";
  position: absolute;
  right: -30px; top: -40px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, .16), rgba(99, 102, 241, 0) 68%);
}
.kpi__label { font-size: 12px; color: var(--text-3); }
.kpi__value {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.kpi__value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.kpi__foot { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.kpi--accent .kpi__value { background: linear-gradient(135deg, var(--primary), var(--primary-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ============================ 图表（按国家 / 按持有人） ============================ */
.charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.chart { padding: 16px 18px 14px; }
.chart__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 2px;
}
.chart__title h2 { margin: 0; }
.chart__title .muted { margin: 4px 0 0; font-size: 12px; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--text-2);
  padding-top: 2px;
}
.chart-legend__item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.chart__plot {
  position: relative;
  display: flex;
  height: 248px;
  margin-top: 12px;
}
.chart__axis { position: relative; width: 58px; flex: none; }
.chart__axis span {
  position: absolute;
  right: 10px;
  transform: translateY(50%);
  font-size: 10.5px;
  line-height: 1;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chart__area { position: relative; flex: 1; min-width: 0; }
.chart__grid { position: absolute; inset: 0; pointer-events: none; }
.chart__grid div {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px dashed var(--line);
}
.chart__grid div:first-child { border-top: 1px solid var(--line); }
.chart__bars {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.chart-group {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}
.chart-bar {
  flex: 1 1 0;
  min-width: 3px;
  border-radius: 4px 4px 2px 2px;
  position: relative;
  transition: filter .15s var(--ease);
}
.chart-bar:hover { filter: brightness(1.1); }
.chart-bar b {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chart__xaxis {
  display: flex;
  gap: 10px;
  margin: 10px 0 0 58px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.chart__xaxis .item { flex: 1 1 0; min-width: 0; text-align: center; }
.chart__xaxis .name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart__xaxis .name i {
  font-style: normal;
  margin-right: 3px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.chart__xaxis .sub {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chart__canvas .empty { padding: 40px 0; }

/* ============================ 拖拽上传 ============================ */
.drop {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px;
  border-radius: var(--radius);
  border: 1.6px dashed var(--line-strong);
  background: linear-gradient(180deg, var(--surface-3), #fff);
  transition: all .2s var(--ease);
}
.drop.is-over { border-color: var(--primary-2); background: var(--primary-soft); transform: scale(1.004); }
.drop__icon {
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 14px; color: var(--primary);
  background: var(--primary-soft);
}
.drop__text { display: flex; flex-direction: column; gap: 2px; }
.drop__text strong { font-size: 14px; }
.drop__text span { font-size: 12px; }
.drop__actions { margin-left: auto; display: flex; gap: 8px; }

.progressline {
  margin-top: 12px; height: 4px; border-radius: 999px; overflow: hidden; background: var(--surface-2);
}
.progressline span {
  display: block; height: 100%; width: 30%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-3));
  animation: indeterminate 1.1s infinite var(--ease);
}
@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(380%); }
}

/* ============================ 导入预览 ============================ */
.counters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.counter {
  display: flex; align-items: baseline; gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-3);
  min-width: 132px;
}
.counter b { font-size: 19px; font-variant-numeric: tabular-nums; }
.counter span { font-size: 12px; color: var(--text-3); }
.counter--new b { color: var(--info); }
.counter--value b { color: var(--ok); }
.counter--conflict b { color: var(--warn); }
.counter--warn b { color: var(--danger); }

.warnbox {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid #FDE68A;
  background: var(--warn-soft);
  color: #92400E;
  font-size: 12.5px;
}
.warnbox ul { margin: 6px 0 0; padding-left: 18px; }

.confirmbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 0 2px;
}
.confirmbar__info { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.confirmbar__info strong { font-size: 13.5px; }

.row-conflict { background: rgba(217, 119, 6, .07); }
.row-new { background: rgba(37, 99, 235, .05); }
.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* ============================ 弹窗 ============================ */
.modal-host { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(17, 24, 39, .38);
  backdrop-filter: blur(3px);
  animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  width: min(560px, calc(100% - 32px));
  max-height: min(86vh, 720px);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop .24s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.modal__close {
  appearance: none; border: 0; background: transparent;
  font-size: 22px; line-height: 1; color: var(--text-3); cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
  transition: all .16s var(--ease);
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal__foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px 18px;
  border-top: 1px solid var(--line);
}

.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.formgrid .field--full { grid-column: 1 / -1; }
.formgrid .field > span { font-size: 12px; color: var(--text-2); font-weight: 500; }
.formgrid input, .formgrid select { width: 100%; }
.switch { display: flex; align-items: center; gap: 8px; height: 34px; }
.switch input { width: 16px; height: 16px; accent-color: var(--primary); }
.form-errors {
  padding: 10px 12px; border-radius: var(--radius);
  background: var(--danger-soft); color: #991B1B; font-size: 12.5px;
}

/* ============================ Toast ============================ */
.toast-host {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 80;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 220px;
  max-width: 380px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: toastIn .26s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(.98); } to { opacity: 1; transform: none; } }
.toast.is-out { animation: toastOut .22s var(--ease) forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px) scale(.98); } }
.toast__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--info); }
.toast--ok .toast__dot { background: var(--ok); }
.toast--warn .toast__dot { background: var(--warn); }
.toast--error .toast__dot { background: var(--danger); }
.toast__body { display: flex; flex-direction: column; gap: 2px; }
.toast__body strong { font-size: 13px; }
.toast__body span { font-size: 12px; color: var(--text-3); white-space: pre-wrap; }

/* ============================ 单元格详情浮层 ============================ */
.cellpop {
  position: fixed;
  z-index: 70;
  min-width: 200px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .98);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  animation: pop .18s var(--ease);
}
.cellpop__title { font-weight: 600; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.cellpop__row { display: flex; justify-content: space-between; gap: 16px; color: var(--text-2); }
.cellpop__row b { font-variant-numeric: tabular-nums; color: var(--text); }

/* ============================ 响应式 ============================ */
@media (max-width: 1100px) {
  .savebar { width: calc(100% - 24px); }
  .grid--board .sticky-2 { display: none; }
}

@media (max-width: 900px) {
  .topbar__inner, .tabs, .page { padding-left: 14px; padding-right: 14px; }
  .page { padding-bottom: 170px; }
  .datebar__picker { margin-left: 0; width: 100%; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

  /* 底部操作栏在窄屏折叠，避免挡住表格 */
  .savebar { padding: 10px 14px; gap: 10px; }
  .savebar__info, .savebar__bulk { width: 100%; margin-left: 0; }
  .savebar__toggle { display: inline-flex; }
  .savebar:not(.is-expanded) .field--bulk,
  .savebar:not(.is-expanded) #entry-apply-bulk { display: none; }
  .savebar #entry-save { flex: 1 1 auto; }

  /* 录入表退化为卡片列表 */
  .grid--entry thead { display: none; }
  .grid--entry, .grid--entry tbody, .grid--entry tr, .grid--entry td { display: block; width: 100%; }
  .grid--entry tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 0 0 10px;
    padding: 8px 10px;
    background: #fff;
    box-shadow: var(--shadow-xs);
  }
  .grid--entry tr.is-selected,
  .grid--entry tr.is-selected td {
    background: var(--selected-bg-soft);
    border-color: var(--selected-line);
    box-shadow: none;
  }
  .grid--entry tr.is-selected { box-shadow: 0 0 0 2px var(--selected-line); }
  .grid--entry tr.is-selected.is-current,
  .grid--entry tr.is-selected.is-current td { background: var(--selected-bg); }
  .grid--entry td {
    border: 0;
    padding: 4px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .grid--entry td::before {
    content: attr(data-label);
    color: var(--text-3);
    font-size: 11.5px;
    flex: none;
  }
  .grid--entry td[data-label=""]::before { content: none; }
  .grid--entry td input.cell-input { width: 120px; }
}

/* ============================ 登录页 ============================ */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login__card {
  width: min(384px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px 24px 22px;
}

.login__head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login__title { display: flex; flex-direction: column; line-height: 1.3; }
.login__title strong { font-size: 16px; font-weight: 650; }
.login__title .muted { font-size: 12px; }

.login__form { display: flex; flex-direction: column; gap: 14px; }
.login__form .field > span { font-size: 12px; }
.login__form input { height: 40px; min-width: 0; }
.login__submit { width: 100%; margin-top: 4px; }
.login__hint { margin-top: 16px; line-height: 1.6; text-align: center; }

/* 顶栏当前登录用户 */
.userchip { gap: 8px; }
.userchip__name { font-weight: 600; }
.userchip__name + .tag { margin-left: -2px; }

/* 成员账号页 */
.usercell__account { font-family: var(--mono); font-size: 12.5px; }
.usercell__sub { display: block; font-size: 11.5px; color: var(--text-3); }

/* ============================ 短视频 / 中视频切换 ============================ */
.mediabar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}

.seg--media .seg__item { font-weight: 600; }

/* 合计行：底色放在整行上，单元格保持透明，避免 th/td 混用出现「断层」色差 */
.grid tfoot tr { background: var(--bg); }

.grid tfoot th,
.grid tfoot td {
  background: transparent;
  border-top: 1px solid var(--line-strong);
  font-weight: 650;
  white-space: nowrap;
}
