/* ==========================================================================
   材料价格与汇率追踪 —— 设计系统
   风格：现代数据看板 + 轻玻璃拟态 + 金属质感主题色
   ========================================================================== */

:root {
  /* 色板 */
  --navy-900: #0B1220;
  --navy-800: #0B2A5B;
  --blue-600: #1D4ED8;
  --sky-400: #38BDF8;
  --copper-500: #C2703D;
  --slate-500: #6B7C93;
  --silver-400: #94A3B8;

  --bg: #F4F7FB;
  --surface: #FFFFFF;
  --text: #0F172A;
  --text-soft: #475569;
  --text-muted: #94A3B8;
  --line: #E2E8F0;

  --ok: #16A34A;
  --bad: #DC2626;
  --warn: #F59E0B;

  /* 形状与阴影 */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 30px -12px rgba(11, 42, 91, .22), 0 2px 8px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 60px -24px rgba(11, 42, 91, .35);

  --font: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(1200px 600px at 12% -10%, rgba(56, 189, 248, .12), transparent 60%),
    radial-gradient(900px 500px at 92% 0%, rgba(194, 112, 61, .10), transparent 55%);
  background-attachment: fixed;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

/* ============================ 顶部导航 ============================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(120deg, rgba(11, 18, 32, .97) 0%, rgba(11, 42, 91, .96) 55%, rgba(29, 78, 216, .92) 100%);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid rgba(148, 163, 184, .22);
  box-shadow: 0 12px 40px -24px rgba(11, 18, 32, .9);
  color: #fff;
}

.topbar__inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 14px 26px;
  display: grid;
  grid-template-columns: minmax(230px, auto) 1fr auto;
  align-items: center;
  gap: 22px;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand__text { min-width: 0; max-width: 235px; }

.brand__text h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.brand__mark {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: #dff2ff;
  background: linear-gradient(145deg, rgba(56, 189, 248, .30), rgba(194, 112, 61, .30));
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
  flex: 0 0 auto;
}

.brand__text h1 { font-size: 18px; line-height: 1.2; }
.brand__text p {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: rgba(226, 236, 250, .68);
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tabs { display: flex; gap: 6px; justify-content: center; flex-wrap: nowrap; }

.tab {
  appearance: none;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .06);
  color: rgba(233, 241, 255, .82);
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .22s cubic-bezier(.4, 0, .2, 1);
}

.tab { white-space: nowrap; }

.tab:hover { background: rgba(255, 255, 255, .14); color: #fff; transform: translateY(-1px); }

.tab.is-active {
  background: linear-gradient(135deg, #38BDF8, #1D4ED8);
  color: #fff;
  border-color: rgba(255, 255, 255, .35);
  box-shadow: 0 8px 22px -10px rgba(56, 189, 248, .9);
}

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.segmented {
  display: inline-flex;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  padding: 3px;
}

.segmented button {
  appearance: none; border: 0; background: transparent;
  color: rgba(233, 241, 255, .8);
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
  transition: all .2s ease;
}

.segmented button:hover { color: #fff; }
.segmented button.is-active { background: rgba(255, 255, 255, .95); color: var(--navy-800); box-shadow: var(--shadow-sm); }

.daterange {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 10px;
  padding: 3px 8px;
}

.daterange__sep { color: rgba(233, 241, 255, .55); font-size: 12px; }

/* 自定义日期控件：始终以 YYYY-MM-DD 显示（原生 date 输入框在中文环境显示成 2026/08/01） */
.date-field { display: inline-flex; align-items: center; gap: 2px; }

.date-field__text {
  width: 92px;
  background: transparent; border: 0; color: #fff;
  font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums;
  padding: 4px 2px; outline: none; text-align: center;
}

.date-field__text::placeholder { color: rgba(233, 241, 255, .42); }

.date-field__pick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; padding: 0;
  border: 0; border-radius: 7px; background: transparent;
  color: rgba(233, 241, 255, .72); cursor: pointer;
  transition: all .18s cubic-bezier(.4, 0, .2, 1);
}

.date-field__pick:hover { background: rgba(255, 255, 255, .18); color: #fff; }

/* 原生 date 输入框仅用于调起选择器，不参与布局 */
.date-field__native {
  position: fixed; top: -100px; left: 0;
  width: 1px; height: 1px; padding: 0; border: 0;
  opacity: 0; pointer-events: none;
}

/* ============================ 按钮 ============================ */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 15px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 7px;
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
  white-space: nowrap;
}

.btn--primary {
  background: linear-gradient(135deg, #1D4ED8, #38BDF8);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(29, 78, 216, .95);
}

.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -14px rgba(29, 78, 216, 1); }
.btn--primary:active { transform: translateY(0); }
.btn--primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn--ghost {
  background: #fff; color: var(--text-soft);
  border-color: var(--line); box-shadow: var(--shadow-sm);
}

.btn--ghost:hover { color: var(--blue-600); border-color: #bfdbfe; transform: translateY(-1px); }

.status {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px; padding: 6px 12px;
  font-size: 12px; color: rgba(233, 241, 255, .9);
}

.status__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, .6);
  animation: pulse 2.4s infinite;
}

.status--running .status__dot { background: var(--warn); animation-duration: 1s; }
.status--error .status__dot { background: var(--bad); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .55); }
  70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* ============================ 布局 ============================ */
.page { max-width: 1560px; margin: 0 auto; padding: 22px 26px 40px; }

.panel { display: none; }
.panel.is-active { display: block; animation: fadeUp .38s cubic-bezier(.22, 1, .36, 1); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-md);
  margin-bottom: 18px;
  transition: box-shadow .3s ease, transform .3s ease;
}

.card:hover { box-shadow: var(--shadow-lg); }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.card__title { font-size: 16px; }
.card__title--sm { font-size: 14px; }
.card__sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-muted); }

.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ============================ KPI ============================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.kpi {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: var(--r-md);
  padding: 16px 18px 15px;
  box-shadow: var(--shadow-sm);
  transition: transform .28s cubic-bezier(.22, 1, .36, 1), box-shadow .28s ease;
  animation: fadeUp .5s backwards;
}

.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.kpi::before {
  content: "";
  position: absolute; inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), transparent 130%);
}

.kpi::after {
  content: "";
  position: absolute; right: -30px; top: -40px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
}

.kpi__label { font-size: 12.5px; color: var(--text-soft); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi__value { font-size: 25px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi__unit { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-left: 4px; }
.kpi__meta { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.trend { font-weight: 700; font-size: 12px; }
.trend--up { color: var(--ok); }
.trend--down { color: var(--bad); }
.trend--flat { color: var(--slate-500); }

/* ============================ 覆盖度提示条 ============================ */
.coverage-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  background: linear-gradient(120deg, rgba(255, 255, 255, .92), rgba(244, 247, 251, .92));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 16px;
  /* 位于数据表格下方：与分页条留出间距 */
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
}

.coverage-bar b { color: var(--navy-800); font-variant-numeric: tabular-nums; }
.coverage-bar .chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
}

.chip__dot { width: 8px; height: 8px; border-radius: 50%; }
.chip--warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }

/* ============================ 图表 ============================ */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 16px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: var(--r-lg);
  padding: 16px 18px 8px;
  box-shadow: var(--shadow-md);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1), box-shadow .3s ease;
  animation: fadeUp .5s backwards;
}

.chart-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.chart-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.chart-card__title { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.chart-card__title .dot { width: 10px; height: 10px; border-radius: 3px; }
.chart-card__value { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-card__value small { font-size: 11.5px; color: var(--text-muted); font-weight: 600; margin-left: 4px; }
.chart-card__meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.chart-card__body { height: 258px; width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700;
  padding: 2.5px 8px; border-radius: 999px;
  border: 1px solid transparent;
}

.badge--lbma { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge--yahoo { background: #fff7ed; color: #b45309; border-color: #fed7aa; }
.badge--neutral { background: #f1f5f9; color: var(--text-soft); border-color: var(--line); }

/* ============================ 表格 ============================ */
.table-wrap {
  overflow: auto;
  max-height: 620px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
}

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.8px; }

.data-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  color: var(--navy-800);
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table thead th.num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; color: var(--text-soft); }
.data-table tbody tr:nth-child(even) { background: #fbfdff; }
.data-table tbody tr:hover { background: #eff6ff; }
.data-table .missing { color: var(--text-muted); font-style: normal; }
.data-table .date-cell { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.data-table .highlight { color: var(--navy-800); font-weight: 600; }

.pager { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pager span { font-size: 12.5px; color: var(--text-soft); }

.select, input[type="text"], input[type="time"], input[type="date"] {
  font: inherit; font-size: 13px;
  padding: 7px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  outline: none; transition: border-color .2s, box-shadow .2s;
}

.select:focus, input:focus { border-color: var(--sky-400); box-shadow: 0 0 0 3px rgba(56, 189, 248, .18); }

/* 浅色版分段控件（用于页面主体，顶栏用的是深色版） */
.segmented--light {
  background: #f1f5f9;
  border-color: var(--line);
}

.segmented--light button { color: var(--text-soft); }
.segmented--light button:hover { color: var(--blue-600); }
.segmented--light button.is-active {
  background: #fff;
  color: var(--navy-800);
  box-shadow: var(--shadow-sm);
}

.raw-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ============================ 列选择（每列一个复选框） ============================ */
.column-picker {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fbfcfe;
  margin-bottom: 14px;
}

.column-picker > summary {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--navy-800);
  list-style: none;
}

.column-picker > summary::-webkit-details-marker { display: none; }

.column-picker > summary::before {
  content: "▸";
  font-size: 10px;
  color: var(--text-muted);
  transition: transform .18s ease;
}

.column-picker[open] > summary::before { content: "▾"; }
.column-picker__count { font-weight: 500; color: var(--text-muted); }
.column-picker__body { padding: 0 14px 14px; }
.column-picker__actions { display: flex; gap: 8px; margin-bottom: 12px; }
.column-picker__groups { display: flex; flex-direction: column; gap: 10px; }

.column-picker__group { display: flex; gap: 12px; align-items: flex-start; }

.column-picker__group-label {
  flex: 0 0 200px;
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  padding-top: 3px;
}

.column-picker__items { display: flex; flex-wrap: wrap; gap: 8px 18px; }

.column-picker__item {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-soft); cursor: pointer;
}

.column-picker__item input { accent-color: var(--blue-600); cursor: pointer; }
.column-picker__item:hover { color: var(--navy-800); }

.btn--sm { padding: 5px 11px; font-size: 12px; }

/* ============================ 看板子板块（国内 / 国际 / 汇率） ============================ */
.metric-groups { display: flex; flex-direction: column; gap: 22px; }

.metric-group { display: flex; flex-direction: column; gap: 12px; }

.metric-group__head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding-left: 11px;
  border-left: 3px solid #cbd5e1;
}

.metric-group__head h3 { font-size: 13.5px; font-weight: 700; color: var(--navy-800); }
.metric-group__head span { font-size: 11.5px; color: var(--text-muted); }

.column-toggles { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-soft); }
.column-toggles label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.footnote { margin: 14px 0 0; font-size: 11.8px; color: var(--text-muted); line-height: 1.7; }

/* ============================ 看板分区标题 ============================ */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin: 24px 4px 12px;
}

.section-head h2 {
  font-size: 15px; color: var(--navy-800);
  display: inline-flex; align-items: center; gap: 9px;
}

.section-head h2::before {
  content: ""; width: 4px; height: 15px; border-radius: 2px;
  background: linear-gradient(180deg, #1D4ED8, #38BDF8);
}

.section-head span { font-size: 12px; color: var(--text-muted); }

.kpi-grid--avg { margin-top: 0; }

/* 平均值卡片：数值略小，突出“有效天数”信息 */
.kpi-grid--avg .kpi__value { font-size: 23px; }
.kpi-grid--avg .kpi__meta { justify-content: space-between; }

.alert {
  margin: 6px 0 14px; padding: 10px 14px; border-radius: var(--r-sm);
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; font-size: 13px; font-weight: 600;
}

/* ============================ 设置页 ============================ */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; }

.form { display: flex; flex-direction: column; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.8px; color: var(--text-soft); font-weight: 600; }

/* `hidden` 属性默认的 display:none 会被组件自身的 display:flex/grid 覆盖，
   这里统一兜底：凡是标了 hidden 的元素一律不渲染（曾导致登录后「需要登录」卡片与设置内容同时显示） */
[hidden] { display: none !important; }

.field--switch { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }

.field--switch input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue-600); cursor: pointer; }

.form__actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

.hint { font-size: 11.8px; color: var(--text-muted); margin: 4px 0 0; }

.schedule-info {
  margin-top: 12px; display: flex; flex-direction: column; gap: 6px;
  font-size: 12.5px; color: var(--text-soft);
  background: #f8fafc; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px;
}

.schedule-info b { color: var(--navy-800); }

.logs { display: flex; flex-direction: column; gap: 10px; max-height: 460px; overflow: auto; padding-right: 4px; }

.log {
  border: 1px solid var(--line); border-left: 4px solid var(--ok);
  border-radius: var(--r-sm); padding: 11px 14px; background: #fff;
  transition: box-shadow .2s ease, transform .2s ease;
}

.log:hover { box-shadow: var(--shadow-sm); transform: translateX(2px); }
.log--partial { border-left-color: var(--warn); }
.log--failed { border-left-color: var(--bad); }
.log__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.log__time { font-weight: 700; color: var(--navy-800); font-variant-numeric: tabular-nums; }
.log__msg { color: var(--text-soft); margin-top: 5px; font-size: 12.5px; }
.log__sources { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 6px; }

.src-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: var(--text-soft); border: 1px solid var(--line); }
.src-chip--bad { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* ============================ 页脚与提示 ============================ */
.footer {
  max-width: 1560px; margin: 0 auto; padding: 8px 26px 30px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 11.8px; color: var(--text-muted);
}

.toast {
  position: fixed; right: 26px; bottom: 26px; z-index: 90;
  background: var(--navy-900); color: #fff;
  padding: 12px 18px; border-radius: 12px;
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 600;
  animation: toastIn .3s cubic-bezier(.22, 1, .36, 1);
  max-width: 380px;
}

.toast--error { background: linear-gradient(135deg, #991b1b, #dc2626); }
.toast--ok { background: linear-gradient(135deg, #065f46, #16a34a); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.empty {
  padding: 34px 16px; text-align: center; color: var(--text-muted); font-size: 13px;
}

.skeleton { position: relative; overflow: hidden; background: #eef2f7; border-radius: var(--r-sm); }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ============================ 登录鉴权 ============================ */
/* 受保护的入口默认隐藏，登录成功（body.is-authenticated）后才出现，
   避免未登录用户看到点不动的按钮，也避免首屏闪现 */
#export-btn,
.tab[data-tab="settings"] { display: none; }

body.is-authenticated #export-btn { display: inline-flex; }
body.is-authenticated .tab[data-tab="settings"] { display: inline-block; }

.auth-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .16);
  color: rgba(233, 241, 255, .92);
  border-radius: 999px; padding: 6px 13px;
  font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .2s cubic-bezier(.4, 0, .2, 1);
}

.auth-chip:hover { background: rgba(255, 255, 255, .18); color: #fff; transform: translateY(-1px); }
.auth-chip__hint { opacity: .6; font-weight: 500; }

/* 未登录时把登录按钮做成主按钮，作为唯一入口更醒目 */
body:not(.is-authenticated) .auth-chip {
  background: linear-gradient(135deg, #1D4ED8, #38BDF8);
  border-color: rgba(255, 255, 255, .42);
  box-shadow: 0 8px 20px -10px rgba(56, 189, 248, .95);
}

body:not(.is-authenticated) .auth-chip:hover { filter: brightness(1.08); transform: translateY(-1px); }

body.is-authenticated .auth-chip {
  border-color: rgba(56, 189, 248, .55);
  background: rgba(56, 189, 248, .16);
}

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
}

.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 15, 30, .55);
  backdrop-filter: blur(6px);
  animation: fadeIn .22s ease;
}

.modal__box {
  position: relative;
  width: min(400px, calc(100vw - 32px));
  background: #fff;
  border-radius: var(--r-lg);
  padding: 26px 26px 22px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 13px;
  animation: modalIn .32s cubic-bezier(.22, 1, .36, 1);
}

.modal__icon {
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, #1D4ED8, #38BDF8);
  box-shadow: 0 12px 26px -14px rgba(29, 78, 216, .95);
}

.modal__box h2 { font-size: 18px; }

/* 打开弹窗时的说明（信息色，与红色错误提示区分） */
.modal__notice {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  font-size: 12.5px;
  font-weight: 600;
}
.modal__hint { margin: -6px 0 0; font-size: 12.5px; color: var(--text-muted); }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.locked-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; padding: 48px 24px;
}

.locked-card__icon {
  width: 64px; height: 64px; border-radius: 20px;
  display: grid; place-items: center; color: var(--blue-600);
  background: linear-gradient(140deg, rgba(29, 78, 216, .12), rgba(56, 189, 248, .18));
}

.locked-card .card__sub { max-width: 560px; }

/* ============================ 响应式 ============================ */
@media (max-width: 1200px) {
  .topbar__inner { grid-template-columns: 1fr; gap: 14px; }
  .tabs { justify-content: flex-start; }
  .toolbar { justify-content: flex-start; }
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .page { padding: 16px 14px 30px; }
  .topbar__inner { padding: 12px 14px; }
  .brand__text p { display: none; }
  .chart-card__body { height: 220px; }
  .kpi__value { font-size: 21px; }
  .daterange { width: 100%; justify-content: space-between; }
  .footer { padding: 8px 14px 24px; }
  .toast { right: 14px; left: 14px; bottom: 14px; max-width: none; }
}
