*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f7f6fb;
  --card: #ffffff;
  --ink: #1a1730;
  --ink-2: #3a3656;
  --muted: #8a8799;
  --line: #eceaf3;
  --hair: #f4f2f8;
  --purple: #5a4fe0;
  --purple-d: #3a3196;
  --purple-l: #efedfc;
  --lav: #f3f1fc;
  --green: #1f9d63;
  --red: #d2495f;
  --gold: #b8923f;
  --slate: #6b7a99;
  --shadow: 0 1px 2px rgba(26,23,48,.04), 0 12px 32px rgba(26,23,48,.06);
  --serif: "Playfair Display", "Noto Serif SC", Georgia, serif;
  --sans: "Inter", -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
  min-height: 100vh;
  min-height: 100dvh;
}
.hidden { display: none !important; }

/* ── Topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 36px; background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--purple-d), var(--purple));
  color: #fff; display: grid; place-items: center; font-weight: 700;
  font-family: var(--serif); font-size: 20px;
  box-shadow: 0 4px 14px rgba(90,79,224,.35);
}
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: .01em; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: .22em; text-transform: uppercase; }

.nav { display: flex; gap: 4px; flex-shrink: 0; }
.nav button {
  border: 0; background: transparent; padding: 8px 16px; border-radius: 9px;
  font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.nav button:hover { color: var(--ink); }
.nav button.active { color: var(--purple-d); background: var(--purple-l); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; row-gap: 10px; }
.lang-toggle { display: flex; background: var(--lav); border-radius: 10px; padding: 3px; }
.lang-toggle button { border: 0; background: transparent; padding: 7px 11px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.lang-toggle button.active { background: #fff; color: var(--purple-d); box-shadow: 0 1px 4px rgba(26,23,48,.1); }
.ccy-toggle { display: flex; background: var(--lav); border-radius: 10px; padding: 3px; }
.ccy-toggle button {
  border: 0; background: transparent; padding: 7px 15px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; letter-spacing: .03em;
}
.ccy-toggle button.active { background: #fff; color: var(--purple-d); box-shadow: 0 1px 4px rgba(26,23,48,.1); }
.btn-upload {
  border: 0; background: var(--purple-d); color: #fff; font-weight: 600;
  padding: 10px 18px; border-radius: 10px; cursor: pointer; font-size: 13px;
  letter-spacing: .02em; box-shadow: 0 6px 18px rgba(58,49,150,.28); white-space: nowrap;
}
.btn-upload:hover { background: var(--purple); }
.btn-pdf { border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-weight: 600; padding: 9px 14px; border-radius: 10px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn-pdf:hover { background: var(--lav); border-color: var(--purple-l); color: var(--purple-d); }
.btn-app {
  border-color: transparent;
  background: var(--purple-d);
  color: #fff;
  box-shadow: 0 6px 18px rgba(58,49,150,.20);
}
.btn-app:hover { background: var(--purple); color: #fff; }

/* 打印专用页眉,平时隐藏 */
.print-only { display: none; }

/* ── Layout ── */
main { max-width: 1320px; margin: 0 auto; padding: 28px 36px 80px; }
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid-2 { grid-template-columns: 1.45fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px 24px; box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .14em; text-transform: uppercase;
}

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, #f4f1fd 0%, #ffffff 55%, #f6f3fe 100%);
  border: 1px solid var(--line);
  border-radius: 20px; padding: 30px 34px; margin-bottom: 18px;
  position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.hero::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--purple), var(--purple-d));
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -80px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(90,79,224,.10), transparent 70%);
}
.hero-label { font-size: 11px; color: var(--muted); letter-spacing: .16em; text-transform: uppercase; }
.hero-total {
  font-family: var(--serif); font-size: 50px; font-weight: 700;
  color: var(--ink); margin: 8px 0 4px; letter-spacing: -.01em;
}
.hero-total .sym { color: var(--purple-d); font-size: 34px; margin-right: 4px; vertical-align: 6px; }
.hero-pnl { margin: 2px 0 6px; }
.hero-pnl .hp-label { font-size: 13px; color: var(--muted); }
.hero-pnl .hp-val { font-size: 18px; font-weight: 700; }
.hero-pnl .hp-cov { font-size: 12px; color: var(--muted); }
.hero-meta { font-size: 13px; color: var(--ink-2); }
.hero-kpis { display: flex; gap: 0; margin-top: 22px; flex-wrap: wrap; }
.hero-kpis > div { padding-right: 38px; margin-right: 38px; border-right: 1px solid var(--line); }
.hero-kpis > div:last-child { border-right: 0; }
.kpi-label { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.kpi-val { font-family: var(--serif); font-size: 23px; font-weight: 600; margin-top: 4px; color: var(--ink); }
.kpi-val.sm { font-size: 17px; }

/* ── Charts ── */
.chart { height: 248px; }
.chart.sm { height: 182px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ── Concentration ── */
.conc-list { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.conc-row { display: grid; grid-template-columns: 150px 1fr 70px; align-items: center; gap: 14px; }
.conc-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conc-bar { height: 8px; border-radius: 5px; background: var(--hair); overflow: hidden; }
.conc-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--purple), var(--purple-d)); }
.conc-bar i.warn { background: linear-gradient(90deg, #e8896a, var(--red)); }
.conc-pct { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.conc-pct.warn { color: var(--red); }
.alert {
  margin-top: 16px; padding: 11px 14px; border-radius: 10px;
  background: #fdf3f1; border: 1px solid #f6d6cf; color: #a13a2c;
  font-size: 12.5px; display: flex; gap: 8px; align-items: flex-start;
}
.ok-note {
  margin-top: 16px; padding: 11px 14px; border-radius: 10px;
  background: #f0faf4; border: 1px solid #cdeeda; color: #1f7a4d; font-size: 12.5px;
}

/* ── Statements ── */
.stmt-list { margin-top: 12px; }
.stmt { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px; border-top: 1px solid var(--hair); }
.stmt:first-child { border-top: 0; }
.stmt-info { display: flex; align-items: center; gap: 13px; }
.stmt-name { font-weight: 600; font-size: 14px; }
.stmt-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tag { font-size: 10px; padding: 3px 9px; border-radius: 6px; background: #eafaf0; color: var(--green); font-weight: 700; letter-spacing: .04em; }
.tag.hist { background: var(--purple-l); color: var(--purple); }
.stmt-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.recon { font-size: 10px; padding: 2px 8px; border-radius: 6px; font-weight: 700; letter-spacing: .03em; margin-left: 6px; vertical-align: 1px; cursor: help; }
.recon.ok { background: #eafaf0; color: var(--green); }
.recon.warn { background: #fdf1f3; color: var(--red); }
.recon.unknown { background: #f4f2f8; color: var(--muted); }
.btn-del, .btn-clear, .btn-ghost {
  border: 1px solid var(--line); color: var(--ink-2); background: #fff;
  border-radius: 9px; padding: 7px 13px; font-size: 12px; cursor: pointer; font-weight: 500;
}
.btn-del { border-color: #f0d4da; color: var(--red); }
.btn-del:hover { background: #fdf1f3; }
.btn-clear { border-color: #f0d4da; color: var(--red); }
.btn-ghost:hover { background: var(--lav); border-color: var(--purple-l); color: var(--purple-d); }

/* ── Filters / Table ── */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select { border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px; font-size: 12px; color: var(--ink); background: #fff; cursor: pointer; }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table.holdings { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.holdings th {
  text-align: left; color: var(--muted); font-weight: 700; font-size: 10.5px;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; user-select: none;
}
table.holdings th.num { text-align: right; }
table.holdings th:hover { color: var(--purple-d); }
table.holdings td { padding: 13px 12px; border-bottom: 1px solid var(--hair); }
table.holdings th:nth-child(2), table.holdings td:nth-child(2) { min-width: 96px; }
table.holdings td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.holdings tbody tr { cursor: pointer; transition: background .12s; }
table.holdings tbody tr:hover { background: var(--lav); }
.pill {
  display: inline-flex; align-items: center; width: max-content;
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--purple-l); color: var(--purple-d); font-weight: 600;
  white-space: nowrap; line-height: 1.2;
}
.muted { color: var(--muted); }
.pnl-pos { color: var(--green); font-weight: 600; }
.pnl-neg { color: var(--red); font-weight: 600; }
.pnl-pct { font-size: 11px; opacity: .8; }
.bar-cell { position: relative; }
.bar-cell .mini { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 3px; background: var(--hair); border-radius: 2px; }
.bar-cell .mini i { display: block; height: 100%; background: var(--purple); border-radius: 2px; }

/* ── Empty / drop ── */
.empty { padding: 70px 0; }
.drop { border: 2px dashed #d3cfe8; border-radius: 18px; padding: 72px 24px; text-align: center; background: #fff; cursor: pointer; transition: .15s; box-shadow: var(--shadow); }
.drop.drag { border-color: var(--purple); background: var(--lav); }
.drop-icon { width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 50%; background: var(--purple-l); color: var(--purple-d); display: grid; place-items: center; font-size: 26px; }
.drop-title { font-family: var(--serif); font-size: 22px; font-weight: 700; }
.drop-sub { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* ── Drawer ── */
.drawer-mask { position: fixed; inset: 0; background: rgba(26,23,48,.32); z-index: 50; opacity: 0; transition: opacity .2s; }
.drawer-mask.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 90vw;
  background: #fff; z-index: 51; box-shadow: -16px 0 48px rgba(26,23,48,.18);
  transform: translateX(100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
  padding: 28px 30px; overflow-y: auto;
}
.drawer.show { transform: translateX(0); }
.drawer-close { position: absolute; top: 20px; right: 22px; border: 0; background: var(--lav); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: 16px; }
.drawer h3 { font-family: var(--serif); font-size: 26px; font-weight: 700; margin-bottom: 2px; }
.drawer .d-ticker { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.drawer .d-val { font-family: var(--serif); font-size: 38px; font-weight: 700; color: var(--purple-d); margin-bottom: 4px; }
.drawer .d-sub { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.d-rows { border-top: 1px solid var(--line); }
.d-rows .d-r { display: flex; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--hair); font-size: 13.5px; }
.d-rows .d-r .k { color: var(--muted); }
.d-rows .d-r .v { font-weight: 600; }

/* ── Auth / Landing ── */
.lang-fixed { position: fixed; top: 20px; right: 24px; z-index: 5; }
.lang-fixed .lang-toggle { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #f4f1fd 0%, #f7f6fb 55%, #f6f3fe 100%); padding: 24px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 40px 36px; width: 420px; max-width: 92vw; text-align: center; }
.auth-title { font-family: var(--serif); font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.auth-sub { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 22px; }
.auth-btns { display: flex; flex-direction: column; gap: 10px; }
.auth-btn { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; padding: 12px 16px; border-radius: 11px; font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid var(--line); }
.auth-btn.google { background: var(--purple-d); color: #fff; border: 0; }
.auth-btn.google:hover { background: var(--purple); }
.auth-btn.google span { background: #fff; color: var(--purple-d); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.auth-btn.dev { background: #fff; color: var(--ink-2); }
.auth-btn.dev:hover { background: var(--lav); }
.auth-demo-link { display: inline-flex; justify-content: center; margin-top: 14px; color: var(--purple-d); font-size: 13px; font-weight: 700; text-decoration: none; }
.auth-demo-link:hover { color: var(--purple); text-decoration: underline; }
.auth-btn.app {
  width: 100%;
  margin-top: 12px;
  background: #fff;
  color: var(--purple-d);
  border-color: #dedaf5;
  box-shadow: 0 4px 12px rgba(58,49,150,.08);
}
.auth-btn.app:hover { background: var(--lav); border-color: var(--purple-l); }
.auth-input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; font-size: 16px; text-align: center; letter-spacing: .08em; margin-bottom: 12px; font-family: var(--sans); }
.auth-input:focus { outline: none; border-color: var(--purple); }
.auth-err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 10px; }
.auth-foot { font-size: 12px; color: var(--muted); margin-top: 18px; }

/* ── User menu (dashboard) ── */
.user-menu { position: relative; }
.user-chip { display: flex; align-items: center; gap: 9px; background: var(--lav); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 5px; cursor: pointer; }
.user-chip img, .user-chip .avatar-fallback { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.user-chip .avatar-fallback { background: var(--purple); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.user-chip .uname { font-size: 13px; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-quota { font-size: 11px; color: var(--muted); }
.user-dd { position: absolute; right: 0; top: 44px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; min-width: 200px; z-index: 40; }
.user-dd .ddrow { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; text-decoration: none; }
.user-dd .ddrow:hover { background: var(--lav); }
.user-dd .ddrow.danger { color: var(--red); }
.user-dd .ddinfo { padding: 9px 12px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--hair); margin-bottom: 4px; }

/* ── 结构性产品 / FCN ── */
.fcn-toolbar { display: flex; align-items: center; gap: 10px; }
.fcn-refresh-status { font-size: 11px; color: var(--muted); }
.fcn-incl { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; padding: 5px 11px; border: 1px solid var(--line); border-radius: 9px; user-select: none; }
.fcn-incl:hover { border-color: var(--purple-l); background: var(--lav); }
.fcn-incl input { accent-color: var(--purple); width: 14px; height: 14px; cursor: pointer; }
.fcn-explain { padding: 10px 14px; background: var(--lav); border: 1px solid var(--purple-l); border-radius: 10px; font-size: 12px; color: var(--ink-2); line-height: 1.8; margin: 12px 0 8px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; margin-right: 2px; }
.tag-ki-american { background: #fde8e8; color: #d2495f; }
.tag-ki-european { background: #ebeafc; color: #5a4fe0; }
.tag-ko-standard { background: #f7efda; color: #b8923f; }
.tag-ko-memory   { background: #e6f7ee; color: #1f9d63; }

.fcn-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 14px 0 18px; }
@media (max-width: 820px) { .fcn-kpis { grid-template-columns: 1fr 1fr; } }
.fcn-kpi { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.fcn-kpi .fk-l { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.fcn-kpi .fk-v { font-family: var(--serif); font-size: 23px; font-weight: 700; margin-top: 4px; }

/* FCN 卡片(复刻) */
.fcn-card2 { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px 16px 22px; margin-bottom: 16px; box-shadow: var(--shadow); background: #fff; }
.fcn-card2::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.fcn-card2.risk-safe::before { background: var(--green); }
.fcn-card2.risk-warning::before { background: var(--gold); }
.fcn-card2.risk-critical::before, .fcn-card2.risk-knocked_in::before { background: var(--red); }
.fcn-head2 { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.fcn-title2 { font-family: var(--serif); font-size: 18px; font-weight: 700; }
.fcn-sub2 { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.7; }
.fcn-acts2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.risk-badge2 { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 12px; }
.rb-safe { background: #e6f7ee; color: #1f9d63; } .rb-warning { background: #f7efda; color: #b8923f; }
.rb-critical, .rb-knocked_in { background: #fde8e8; color: #d2495f; }
.leg-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.leg-table th { color: var(--muted); font-weight: 600; font-size: 11px; padding: 7px 9px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.leg-table th:first-child { text-align: left; }
.leg-table td { padding: 8px 9px; text-align: right; border-bottom: 1px solid var(--hair); font-variant-numeric: tabular-nums; }
.leg-table td:first-child { text-align: left; font-weight: 600; }
.leg-table tr:last-child td { border-bottom: none; }
.price-refresh { background: #fff; border: 1px solid var(--line); color: var(--muted); border-radius: 7px; padding: 3px 9px; font-size: 11px; cursor: pointer; }
.price-refresh:hover { border-color: var(--gold); color: var(--gold); }
.gauge-wrap { margin: 12px 0 4px; }
.gauge-label { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 5px; }
.gauge-track { background: var(--hair); border-radius: 6px; height: 8px; overflow: hidden; }
.gauge-fill { height: 100%; border-radius: 6px; transition: width .4s; }
.gauge-fill.safe { background: linear-gradient(90deg, #1f9d63, #4ade80); }
.gauge-fill.warning { background: linear-gradient(90deg, #d4a843, #fbbf24); }
.gauge-fill.critical { background: linear-gradient(90deg, #d2495f, #f87171); }
.scenario-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 600px) { .scenario-grid { grid-template-columns: 1fr; } }
.scenario-cell { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; background: #fcfcfe; }
.scenario-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.scenario-val { font-family: var(--serif); font-size: 18px; font-weight: 700; }
.scenario-note { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.fcn-times { margin-top: 12px; font-size: 11px; color: var(--muted); display: flex; gap: 22px; flex-wrap: wrap; }
.fcn-times strong { color: var(--ink); }
/* 录入表单 */
.fcn-sec-h2 { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 16px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--hair); }
.fcn-fr2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.fcn-fr3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.fcn-fr4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
@media (max-width: 600px) { .fcn-fr3, .fcn-fr4 { grid-template-columns: 1fr 1fr; } }
.fcn-full2 { display: block; margin-bottom: 10px; }
.modal label { display: flex; flex-direction: column; gap: 5px; }
.modal label > span { font-size: 11px; color: var(--muted); }
.modal input, .modal select { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: 13px; width: 100%; font-family: var(--sans); box-sizing: border-box; }
.modal input:focus, .modal select:focus { outline: none; border-color: var(--purple); }
.fcn-hint { font-size: 10px; color: var(--muted); margin-top: 3px; }
.fcn-ps { font-weight: 400; color: var(--muted); font-size: 10px; }
.tg-ki { background: #eceafe; color: #5a4fe0; } .tg-ko { background: #eafaf0; color: var(--green); }
.fcn-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.fcn-status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 7px; white-space: nowrap; }
.fs-safe { background: #eafaf0; color: var(--green); } .fs-warn { background: #fff7ed; color: var(--gold); } .fs-crit { background: #fdf1f3; color: var(--red); }
.fcn-worst { color: var(--gold); font-size: 11px; font-weight: 700; }
.fcn-table th, .fcn-table td { font-size: 12.5px; }
.fcn-bar-row { display: flex; justify-content: space-between; font-size: 12px; margin: 14px 0 6px; }
.fcn-bar-lbl { color: var(--muted); } .fcn-bar-right { color: var(--green); font-weight: 600; }
.fcn-bar { height: 8px; border-radius: 5px; background: var(--hair); overflow: hidden; }
.fcn-bar i { display: block; height: 100%; border-radius: 5px; }
.fb-safe { background: linear-gradient(90deg, #34d399, var(--green)); } .fb-warn { background: linear-gradient(90deg, #e8b86a, var(--gold)); } .fb-crit { background: linear-gradient(90deg, #e8896a, var(--red)); }
.fcn-konote { font-size: 12px; color: var(--muted); margin-top: 8px; }
.fcn-sec-h { font-size: 11px; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; margin: 16px 0 8px; }
.fcn-scs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 600px) { .fcn-scs { grid-template-columns: 1fr; } }
.fcn-sc { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.fcn-sc .sc-l { font-size: 12px; color: var(--ink-2); } .fcn-sc .sc-v { font-family: var(--serif); font-size: 20px; font-weight: 700; margin-top: 4px; } .fcn-sc .sc-a { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* FCN 录入弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(26,23,48,.35); z-index: 50; opacity: 0; transition: opacity .2s; }
.modal-mask.show { opacity: 1; }
.modal-mask.hidden, .modal.hidden { display: none; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -46%); width: 700px; max-width: 94vw; max-height: 88vh; overflow-y: auto; background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(26,23,48,.25); z-index: 51; padding: 26px 28px; opacity: 0; transition: transform .22s, opacity .22s; }
.modal.show { transform: translate(-50%, -50%); opacity: 1; }
.fcn-f1 { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.fcn-f1 > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.fcn-fsub { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 14px 0 8px; border-top: 1px solid var(--hair); padding-top: 12px; }
.fcn-opt { color: var(--muted); text-transform: none; letter-spacing: 0; }
.fcn-frow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 600px) { .fcn-frow { grid-template-columns: 1fr 1fr; } }
.fcn-frow label { display: flex; flex-direction: column; gap: 5px; }
.fcn-frow span { font-size: 11px; color: var(--muted); }
.fcn-frow input, .fcn-frow select, .fcn-f1 input { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: 13px; font-family: var(--sans); width: 100%; }
.fcn-frow input:focus, .fcn-frow select:focus, .fcn-f1 input:focus { outline: none; border-color: var(--purple); }
.fcn-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.fcn-namecell { grid-column: span 2; }
@media (max-width: 600px) { .fcn-namecell { grid-column: span 2; } }
.fcn-namewrap { display: flex; gap: 6px; }
.fcn-namewrap input { flex: 1; }
.fcn-lookup { white-space: nowrap; border: 1px solid var(--purple-l); background: var(--lav); color: var(--purple-d); border-radius: 9px; padding: 0 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.fcn-lookup:hover { background: var(--purple-l); }
.fcn-look-status { font-size: 11px; margin-top: 4px; min-height: 14px; color: var(--muted); }
.fcn-look-status.ok { color: var(--green); }
.fcn-look-status.err { color: var(--red); }

/* ── 保障规划 ── */
.ins-subline { color: var(--muted); font-size: 12px; margin-top: 6px; letter-spacing: 0; text-transform: none; }
.insurance-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; margin-top: 14px; }
@media (max-width: 980px) { .insurance-layout { grid-template-columns: 1fr; } }
.ins-country { font-size: 12px; color: var(--muted); font-weight: 700; margin: 16px 0 8px; }
.ins-card {
  border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 14px;
  background: #fff; box-shadow: var(--shadow); border-left: 4px solid var(--purple);
}
.ins-card.type-life { border-left-color: #6d8ee8; }
.ins-card.type-critical_illness { border-left-color: var(--red); }
.ins-card.type-medical { border-left-color: var(--green); }
.ins-card.type-disability { border-left-color: var(--gold); }
.ins-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.ins-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.ins-title span, .ins-title em { color: var(--muted); font-style: normal; font-size: 12px; font-weight: 500; }
.ins-meta-line { margin-top: 6px; color: var(--muted); font-size: 12px; }
.ins-type { background: #edf2ff; color: #496fc8; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; margin-right: 4px; }
.ins-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ins-status { font-size: 12px; font-weight: 700; }
.ins-fields { display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); gap: 12px; margin-top: 14px; }
@media (max-width: 780px) { .ins-card-head { flex-direction: column; } .ins-fields { grid-template-columns: repeat(2, 1fr); } }
.ins-fields span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.ins-fields b { font-size: 13px; color: var(--ink-2); }
.ins-fields small { color: var(--muted); font-weight: 500; }
.ins-notes { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--hair); color: var(--muted); font-size: 12px; line-height: 1.6; }
.insurance-gap-panel { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: #fff; box-shadow: var(--shadow); }
.ins-score { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.score-ring-lite {
  width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: conic-gradient(var(--score-color) var(--score), var(--hair) 0);
  position: relative;
}
.score-ring-lite::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #fff; }
.score-ring-lite strong, .score-ring-lite span { position: relative; z-index: 1; }
.score-ring-lite strong { font-size: 22px; line-height: 1; }
.score-ring-lite span { color: var(--muted); font-size: 11px; margin-top: 24px; position: absolute; }
.ins-score-title { font-size: 13px; font-weight: 700; }
.ins-score-grade { font-family: var(--serif); font-size: 22px; font-weight: 700; margin-top: 2px; }
.ins-score p { color: var(--muted); font-size: 12px; line-height: 1.55; margin-top: 4px; }
.ins-gap-title { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin: 16px 0 8px; }
.gap-card-lite { border-radius: 11px; padding: 12px 13px; margin-bottom: 10px; border-left: 4px solid var(--slate); background: #f7f8fb; }
.gap-card-lite.gap-critical { border-left-color: var(--red); background: #fdf1f3; }
.gap-card-lite.gap-warning { border-left-color: var(--gold); background: #fff8e9; }
.gap-card-lite.gap-info { border-left-color: #6d8ee8; background: #f0f4ff; }
.gap-card-lite b { font-size: 13px; }
.gap-card-lite p { color: var(--ink-2); font-size: 12px; line-height: 1.6; margin-top: 5px; }
.insurance-modal { width: 760px; }
.ins-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin: 0 0 18px; }
.ins-tabs button {
  border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700;
  padding: 0 2px 12px; cursor: pointer; border-bottom: 3px solid transparent;
}
.ins-tabs button.active { color: var(--purple-d); border-bottom-color: var(--purple-d); }
.ins-pdf-panel { margin-bottom: 18px; }
.ins-upload-zone {
  width: 100%; border: 2px dashed #d3cfe8; border-radius: 14px; background: #fff;
  padding: 34px 22px; text-align: center; cursor: pointer; color: var(--ink);
}
.ins-upload-zone:hover { border-color: var(--purple); background: var(--lav); }
.ins-upload-zone strong { display: block; font-size: 17px; margin-bottom: 7px; }
.ins-upload-zone span { display: block; color: var(--muted); font-size: 12px; line-height: 1.6; }
.ins-pdf-status { min-height: 20px; margin-top: 10px; text-align: center; color: var(--muted); font-size: 12px; }

/* 对账单确认弹窗 */
.statement-modal { width: 520px; }
.statement-modal h3 { font-family: var(--serif); font-size: 24px; margin-bottom: 8px; }
.statement-intro { color: var(--ink-2); font-size: 13px; line-height: 1.6; margin-bottom: 18px; }
.statement-field { display: flex; flex-direction: column; gap: 7px; }
.statement-field span { color: var(--muted); font-size: 12px; font-weight: 600; }
.statement-field input { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 15px; font-family: var(--sans); width: 100%; }
.statement-field input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(90,79,224,.10); }
.statement-meta { color: var(--muted); font-size: 12px; margin-top: 10px; }
.statement-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

@media (max-width: 640px) {
  .stmt { align-items: flex-start; gap: 12px; }
  .stmt-info { align-items: flex-start; }
  .stmt-actions { flex-direction: column; align-items: stretch; }
  .stmt-actions button { width: 72px; }
}

/* ── Toast ── */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 11px; font-size: 13px; z-index: 60; box-shadow: 0 12px 36px rgba(0,0,0,.22); max-width: 80vw; }
.toast.err { background: #b3243c; }
.toast.ok { background: #15803d; }

.pwa-install {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 70;
  border: 0;
  border-radius: 999px;
  background: var(--purple-d);
  color: #fff;
  box-shadow: 0 12px 28px rgba(58,49,150,.28);
  cursor: pointer;
  font: 700 13px/1 var(--sans);
  padding: 13px 17px;
}
.pwa-install:disabled { opacity: .65; cursor: default; }

/* ── AI 资产分析 ── */
.analyze-empty { color: var(--muted); font-size: 14px; padding: 24px 4px; }
.az-when { font-size: 12px; color: var(--muted); margin-top: 4px; }
.az-summary { font-size: 15px; line-height: 1.7; color: var(--ink); margin: 12px 0 4px; }
.az-sec { margin-top: 18px; }
.az-h { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.az-obs { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--hair); }
.az-obs:first-of-type { border-top: 0; }
.az-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--slate); }
.az-obs.sev-watch .az-dot { background: var(--gold); }
.az-obs.sev-high .az-dot { background: var(--red); }
.az-t { font-size: 14px; font-weight: 600; }
.az-d { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; margin-top: 2px; }
.az-sevtag { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 6px; vertical-align: 1px; margin-left: 4px; background: #eef1f6; color: var(--slate); }
.az-sevtag.sev-watch { background: #fbf3e2; color: var(--gold); }
.az-sevtag.sev-high { background: #fdf1f3; color: var(--red); }
.az-sug { padding: 9px 0; border-top: 1px solid var(--hair); }
.az-sug:first-of-type { border-top: 0; }
.az-flags { display: flex; flex-wrap: wrap; gap: 8px; }
.az-flag { font-size: 12px; padding: 4px 11px; border-radius: 999px; background: #fdf1f3; color: var(--red); font-weight: 600; }
.az-disclaimer { margin-top: 20px; padding: 11px 14px; border-radius: 10px; background: var(--lav); color: var(--ink-2); font-size: 12px; line-height: 1.6; }

/* 税务输入表单 */
.tax-form { display: flex; gap: 14px; flex-wrap: wrap; margin: 14px 0 6px; align-items: flex-end; }
.tax-form label { display: flex; flex-direction: column; gap: 6px; }
.tax-lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.tax-form select, .tax-form input { border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; font-size: 13px; background: #fff; min-width: 160px; font-family: var(--sans); }
.tax-form select:focus, .tax-form input:focus { outline: none; border-color: var(--purple); }
.tax-form .tax-notes { flex: 1; min-width: 240px; }
.tax-form .tax-notes input { width: 100%; }
.tax-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tax-tag { font-size: 12px; padding: 5px 11px; border-radius: 999px; background: var(--purple-l); color: var(--purple-d); font-weight: 600; }
.tax-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px) { .tax-cards { grid-template-columns: 1fr; } }
.tax-ecard { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; }
.tax-ecard .te-l { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.tax-ecard .te-v { font-family: var(--serif); font-size: 24px; font-weight: 700; margin-top: 4px; }
.tax-ecard .te-s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tax-note { font-size: 11.5px; color: var(--muted); margin-top: 10px; }

/* ── 打印 / 导出 PDF ── */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .topbar, .btn-upload, .btn-pdf, .user-menu, .ccy-toggle, .nav,
  .filters, .toolbar, .btn-ghost, .btn-clear, .btn-del,
  #emptyState, .drawer, .drawer-mask, .toast { display: none !important; }
  main { max-width: 100%; padding: 0; }
  /* 打印时所有板块都展开(忽略 总览/持仓/对账单 视图切换) */
  .view-overview, .view-holdings, .view-statements { display: block !important; }
  .grid-2, .grid-3 { display: grid !important; }
  .card, .hero { box-shadow: none !important; border: 1px solid #e3e0ec !important; break-inside: avoid; }
  .print-only { display: block !important; margin-bottom: 16px; }
  .print-header h1 { font-family: var(--serif); font-size: 26px; font-weight: 700; }
  .print-header .pmeta { color: var(--muted); font-size: 12px; margin-top: 4px; }
  .print-header .ptotal { font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--purple-d); margin-top: 10px; }
  .chart { height: 220px; }
  table.holdings { font-size: 11px; }
}

@media (display-mode: standalone) {
  .topbar { padding-top: max(16px, env(safe-area-inset-top)); }
  .auth-wrap { min-height: 100dvh; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    gap: 12px;
    padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  }
  .brand { min-width: 0; }
  .brand-name { font-size: 17px; }
  .brand-sub { display: none; }
  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { padding: 8px 11px; font-size: 13px; }
  .topbar-right { gap: 8px; }
  .ccy-toggle button, .lang-toggle button { padding: 7px 9px; }
  .btn-pdf, .btn-upload { padding: 9px 11px; }
  main { padding: 18px 14px calc(72px + env(safe-area-inset-bottom)); }
  .hero { border-radius: 16px; padding: 24px 20px; }
  .hero-total { font-size: 38px; overflow-wrap: anywhere; }
  .hero-total .sym { font-size: 26px; vertical-align: 5px; }
  .hero-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .hero-kpis > div { border-right: 0; margin-right: 0; padding-right: 0; }
  .card { border-radius: 12px; padding: 18px 16px; }
  .card-head { align-items: flex-start; flex-direction: column; }
  .chart { height: 220px; }
  .chart.sm { height: 190px; }
  .conc-row { grid-template-columns: 118px 1fr 56px; gap: 10px; }
  .drawer { width: 100%; max-width: none; padding: 26px 20px calc(30px + env(safe-area-inset-bottom)); }
  .modal {
    width: calc(100vw - 28px);
    max-height: calc(100dvh - 28px - env(safe-area-inset-top));
    overflow-y: auto;
  }
  .toast { bottom: calc(78px + env(safe-area-inset-bottom)); max-width: calc(100vw - 28px); }
}
