﻿:root {
  --ink: #14211c;
  --ink-2: #30453c;
  --muted: #6e7f77;
  --dim: #93a49c;
  --line: #e3ebe6;
  --bg: #f3f7f4;
  --card: #ffffff;
  --mint: #1fc9a5;
  --mint-soft: #e4f8f1;
  --amber: #f3c45c;
  --amber-soft: #fff5dd;
  --rose: #e85d7e;
  --rose-soft: #ffe9ef;
  --sidebar: #0d1a15;
  --sidebar-2: #14261e;
  --shadow: 0 8px 26px rgba(20, 47, 35, .06);
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px; position: relative; overflow: hidden;
  background: radial-gradient(circle at 15% 15%, #e1f8ef 0, transparent 42%),
              radial-gradient(circle at 88% 82%, #fff3d8 0, transparent 40%),
              #f5f9f6;
}
.login-orb { position: absolute; border-radius: 50%; filter: blur(4px); opacity: .75; }
.login-orb--a { width: 420px; height: 420px; left: -140px; top: -160px; background: radial-gradient(circle, rgba(31,201,165,.28), transparent 68%); }
.login-orb--b { width: 520px; height: 520px; right: -180px; bottom: -220px; background: radial-gradient(circle, rgba(243,196,92,.23), transparent 68%); }
.login-card {
  position: relative; z-index: 2; width: 100%; max-width: 390px;
  background: rgba(255,255,255,.88); backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.9); border-radius: 24px;
  box-shadow: 0 24px 70px rgba(20,47,35,.12); padding: 30px 30px 24px;
}
.login-brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: inline-flex;
  align-items: center; justify-content: center; flex: none;
  background: var(--ink); color: #dffcf2; font-weight: 800; font-size: 18px;
}
.login-brand strong { display: block; font-size: 16px; letter-spacing: 1px; }
.login-brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.login-card h1 { font-size: 26px; margin: 26px 0 4px; letter-spacing: -.5px; }
.login-sub { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.field {
  width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; padding: 0 14px; color: var(--ink); outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(31,201,165,.12); }
.field-sm { height: 38px; width: auto; min-width: 170px; border-radius: 10px; }
.btn {
  border: 0; border-radius: 11px; height: 40px; padding: 0 16px;
  font-size: 13px; font-weight: 600; transition: transform .12s, background .18s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { width: 100%; margin-top: 14px; height: 46px; background: var(--ink); color: #ecfff8; border-radius: 13px; }
.btn-primary:hover { background: #203a30; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: #c9d9d1; }
.login-error { color: #c9465f; font-size: 12px; min-height: 16px; margin: 10px 0 0; }
.login-foot { color: var(--dim); font-size: 11px; text-align: center; margin: 16px 0 0; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex: none; background: var(--sidebar); color: #dfeee7;
  display: flex; flex-direction: column; padding: 22px 14px 16px;
  position: fixed; inset: 0 auto 0 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; }
.brand .brand-mark { background: #dffcf2; color: #0d1a15; }
.brand-txt strong { display: block; font-size: 16px; color: #f1fbf6; letter-spacing: 1px; }
.brand-txt small { display: block; font-size: 10px; color: rgba(223,238,231,.5); letter-spacing: 2px; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: transparent; border: 0; color: rgba(223,238,231,.64);
  padding: 11px 12px; border-radius: 11px; text-align: left; font-size: 13px;
}
.nav-item svg { width: 18px; height: 18px; fill: currentColor; opacity: .8; }
.nav-item:hover { background: rgba(255,255,255,.055); color: #eaf8f1; }
.nav-item.is-active { background: var(--mint); color: #06241c; font-weight: 700; }
.nav-item.is-active svg { opacity: 1; }
.sidebar-foot {
  margin-top: auto; padding: 14px 10px 2px; color: rgba(223,238,231,.45);
  font-size: 11px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-foot small { flex-basis: 100%; color: rgba(223,238,231,.28); font-size: 10px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.main { margin-left: 224px; width: calc(100% - 224px); padding: 0 28px 34px; }
.topbar {
  height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  position: sticky; top: 0; z-index: 10; background: rgba(243,247,244,.9);
  backdrop-filter: blur(12px); border-bottom: 1px solid rgba(227,235,230,.75);
}
.crumb { font-size: 12px; color: var(--muted); }
.crumb span { color: var(--dim); margin: 0 4px; }
.crumb strong { color: var(--ink); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.range-group { display: flex; background: #eaf1ed; border-radius: 10px; padding: 3px; }
.range-btn { border: 0; background: transparent; color: var(--muted); border-radius: 8px; height: 30px; padding: 0 11px; font-size: 12px; }
.range-btn.is-active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(20,47,35,.08); font-weight: 600; }
.date-field { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--dim); }
.date-field input { border: 1px solid var(--line); border-radius: 9px; height: 32px; padding: 0 8px; background: #fff; color: var(--ink); font-size: 11px; }
.icon-btn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 16px; }
.icon-btn:hover { color: var(--ink); }
.loading { padding: 26px 0; color: var(--muted); font-size: 13px; }
.loading::before { content: ""; display: inline-block; width: 12px; height: 12px; border: 2px solid #cfe3da; border-top-color: var(--mint); border-radius: 50%; margin-right: 8px; vertical-align: -2px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 26px 0 18px; }
.page-head h1 { font-size: 25px; margin: 0; letter-spacing: -.5px; }
.page-sub { color: var(--muted); font-size: 12px; margin: 6px 0 0; line-height: 1.6; }
.head-pill { background: var(--mint-soft); color: #127a64; border: 1px solid #c9efe3; padding: 7px 12px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.search-row { display: flex; gap: 8px; align-items: center; }
.search-row .btn { margin-top: 0; width: auto; height: 38px; }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.kpi {
  background: var(--card); border: 1px solid rgba(227,235,230,.85); border-radius: var(--radius);
  padding: 16px 17px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; width: 70px; height: 70px; right: -26px; top: -30px; border-radius: 50%; background: var(--mint-soft); opacity: .75; }
.kpi.kpi-amber::after { background: var(--amber-soft); }
.kpi.kpi-rose::after { background: var(--rose-soft); }
.kpi-label { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 29px; font-weight: 800; letter-spacing: -1px; margin: 8px 0 2px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-hint { color: var(--dim); font-size: 10px; line-height: 1.5; }
.kpi-delta { font-size: 11px; font-weight: 600; }
.kpi-delta.up { color: #12866e; }
.kpi-delta.down { color: #c9465f; }

/* ---------- 卡片 / 图表 ---------- */
.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; margin-top: 14px; }
.card { background: var(--card); border: 1px solid rgba(227,235,230,.85); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 19px; margin-top: 14px; }
.grid-2 .card { margin-top: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 15px; margin: 0; letter-spacing: -.2px; }
.card-head p { margin: 4px 0 0; color: var(--dim); font-size: 10px; }
.legend { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 7px; }
.dot-mint { background: var(--mint); }
.dot-amber { background: var(--amber); }
.chart { width: 100%; min-height: 230px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: #edf3ef; stroke-width: 1; }
.chart .axis-text { fill: #9aaba2; font-size: 9px; }
.chart .series-line { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-area { opacity: .12; }
.chart .point { stroke: #fff; stroke-width: 1.5; }
.chart-empty { color: var(--dim); font-size: 12px; padding: 50px 0; text-align: center; }

/* ---------- 分享漏斗 ---------- */
.funnel { display: flex; flex-direction: column; gap: 11px; padding-top: 4px; }
.funnel-row { display: grid; grid-template-columns: 70px 1fr 62px; align-items: center; gap: 10px; }
.funnel-label { color: var(--muted); font-size: 11px; }
.funnel-track { height: 22px; background: #f1f6f3; border-radius: 7px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 7px; background: linear-gradient(90deg, var(--mint), #7ce8ce); min-width: 2px; transition: width .5s ease; }
.funnel-row:nth-child(2) .funnel-bar { background: linear-gradient(90deg, #58d7bc, #b2f2e3); }
.funnel-row:nth-child(3) .funnel-bar { background: linear-gradient(90deg, var(--amber), #ffe3a0); }
.funnel-row:nth-child(4) .funnel-bar { background: linear-gradient(90deg, #b7a6f3, #ddd5ff); }
.funnel-value { text-align: right; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.funnel-value small { display: block; font-size: 9px; color: var(--dim); font-weight: 400; }
.breakdown { display: flex; flex-direction: column; gap: 12px; }
.breakdown-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.breakdown-row .br-label { width: 80px; color: var(--muted); }
.breakdown-row .br-track { flex: 1; height: 8px; border-radius: 999px; background: #eff4f1; overflow: hidden; }
.breakdown-row .br-fill { height: 100%; background: var(--mint); border-radius: 999px; }
.breakdown-row .br-val { width: 46px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- 留存 ---------- */
.retention { overflow-x: auto; }
.ret-table { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: 11px; }
.ret-table th { color: var(--dim); font-weight: 500; text-align: left; padding: 4px 8px; white-space: nowrap; }
.ret-table td { padding: 8px; border-radius: 7px; background: #f7faf8; white-space: nowrap; }
.ret-table .cohort { color: var(--ink-2); font-weight: 600; }
.ret-cell { text-align: center; font-weight: 700; color: #0d3d30; }
.ret-empty { color: var(--dim); padding: 24px 0; font-size: 12px; }
.metric-note { display: flex; flex-direction: column; gap: 4px; }
.metric-note span { font-size: 11px; color: var(--muted); }
.metric-note strong { font-size: 34px; letter-spacing: -1px; }
.metric-note small { color: var(--dim); font-size: 10px; }

/* ---------- 表格 ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-card .card-head { padding: 17px 19px 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { text-align: left; color: var(--dim); font-weight: 500; padding: 11px 12px; border-bottom: 1px solid var(--line); background: #fafcfb; white-space: nowrap; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid #f0f5f2; color: var(--ink-2); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfdfc; }
.data-table .empty { text-align: center; color: var(--dim); padding: 30px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; background: #eef5f1; color: var(--muted); }
.badge-mint { background: var(--mint-soft); color: #127a64; }
.badge-amber { background: var(--amber-soft); color: #9a6a0b; }
.badge-rose { background: var(--rose-soft); color: #b33b59; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--dim); font-size: 11px; }
.pager div { display: flex; gap: 7px; }
.pager .btn { height: 32px; }
.link-btn { border: 0; background: transparent; color: #12866e; font-size: 11px; padding: 2px; }
.foot { color: var(--dim); font-size: 10px; text-align: center; margin: 28px 0 0; line-height: 1.7; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px); background: var(--ink); color: #eafff6; border-radius: 999px; padding: 9px 18px; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s; z-index: 90; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar { width: 196px; }
  .main { margin-left: 196px; width: calc(100% - 196px); padding: 0 20px 30px; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; flex-direction: row; align-items: center; padding: 10px 12px; }
  .brand { padding: 0 10px 0 0; }
  .brand-txt small { display: none; }
  .nav { flex-direction: row; overflow-x: auto; }
  .nav-item { white-space: nowrap; padding: 8px 10px; }
  .sidebar-foot { display: none; }
  .app { display: block; }
  .main { margin-left: 0; width: 100%; padding: 0 14px 24px; }
  .topbar { height: auto; padding: 10px 0; align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .date-field { display: none; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 24px; }
  .table-card { overflow-x: auto; }
  .data-table { min-width: 720px; }
}
