:root {
  --bg: #eef3fb;
  --card: rgba(255,255,255,.94);
  --ink: #111a2e;
  --muted: #758096;
  --line: #dce3ee;
  --blue: #3f6df6;
  --blue-2: #556bff;
  --green: #17845f;
  --red: #bd5263;
  --orange: #f5a623;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 10% 0%, #f8faff 0, var(--bg) 38%, #edf2f9 100%); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1480px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 14px; }
.mark { display: grid; place-items: center; width: 44px; height: 44px; color: #fff; font-weight: 800; border-radius: 13px; background: linear-gradient(145deg, #355ff0, #6681ff); box-shadow: 0 10px 25px #3e63f13d; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 27px; letter-spacing: -.03em; }
h2 { margin-bottom: 0; font-size: 22px; letter-spacing: -.025em; }
h3 { margin-bottom: 0; font-size: 20px; }
.eyebrow { margin-bottom: 7px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); font-size: 13px; }
.button { border: 0; border-radius: 11px; padding: 10px 16px; color: #fff; background: var(--blue); font-weight: 700; box-shadow: 0 5px 14px #4167e72b; }
.button:hover { filter: brightness(.98); transform: translateY(-1px); }
.button.secondary { color: #384258; background: #fff; border: 1px solid var(--line); box-shadow: 0 4px 12px #1e2e5520; }
.button.compact { padding: 8px 12px; font-size: 13px; }
.status { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid #cce8dc; border-radius: 12px; color: var(--green); background: #edf9f4; font-size: 13px; font-weight: 700; }
.status.loading { color: #4865b3; border-color: #cfdaff; background: #f1f5ff; }
.status.error { color: var(--red); border-color: #f3ced5; background: #fff4f6; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 12%, transparent); }
.health { display: grid; grid-template-columns: repeat(4,1fr); margin: 14px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--card); box-shadow: 0 9px 28px #23406b0b; }
.health div { display: flex; flex-direction: column; gap: 5px; padding: 14px; border-right: 1px solid var(--line); }
.health div:last-child { border-right: 0; }
.health span { color: var(--muted); font-size: 11px; }
.health strong { font-size: 13px; }
.overview { display: grid; grid-template-columns: 1.15fr repeat(4,1fr); gap: 12px; margin-bottom: 14px; }
.metric { display: flex; min-height: 162px; flex-direction: column; justify-content: space-between; padding: 23px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); box-shadow: 0 12px 30px #2b446312; }
.metric p { color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { font-size: 25px; letter-spacing: -.04em; }
.metric > span { color: var(--muted); font-size: 12px; }
.metric.primary { color: #fff; border: 0; background: linear-gradient(135deg, #315ae7, #5078ff); box-shadow: 0 18px 35px #335ae64a; }
.metric.primary p, .metric.primary span { color: #eaf0ff; }
.metric.primary h2 { font-size: clamp(30px,3vw,43px); font-weight: 500; letter-spacing: -.055em; }
.metric-note { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; }
.card { margin-top: 14px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 12px 34px #253e660e; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.segmented { display: flex; gap: 3px; align-items: center; padding: 4px; border-radius: 11px; background: #f3f5fa; }
.segmented button { padding: 7px 10px; border: 0; border-radius: 8px; color: #758096; background: transparent; font-size: 12px; font-weight: 700; }
.segmented button.active { color: var(--ink); background: #fff; box-shadow: 0 3px 9px #18274318; }
.segmented .divider { width: 1px; height: 22px; margin: 0 3px; background: var(--line); }
.chart { width: 100%; height: 330px; margin-top: 20px; overflow: visible; }
.chart-grid { stroke: #dfe5ee; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--blue); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: url(#areaGradient); }
.chart-label { fill: var(--muted); font-size: 11px; }
.chart-point { fill: var(--orange); stroke: #fff; stroke-width: 2; }
.chart-foot { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 11px; }
.flow-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--orange); }
.empty { display: grid; place-items: center; gap: 6px; min-height: 130px; margin-top: 20px; color: var(--muted); text-align: center; border: 1px dashed #ccd5e5; border-radius: 14px; background: #f8faff; }
.empty strong { color: #47536b; }
.chart-empty { min-height: 260px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.head-actions { display: flex; gap: 12px; align-items: center; }
.accounts-card .head-actions .button { display: none; }
.account-allocation { display: flex; width: 100%; height: 11px; margin-top: 28px; overflow: hidden; border-radius: 99px; background: #e7ecf4; box-shadow: inset 0 1px 2px #15254a12; }
.allocation-segment { min-width: 3px; height: 100%; padding: 0; border: 0; border-radius: 0; background: var(--accent); transition: filter .16s ease, opacity .16s ease; }
.allocation-segment:hover, .allocation-segment:focus-visible { z-index: 1; filter: brightness(.92); outline: 2px solid #fff; outline-offset: -2px; }
.allocation-segment.active { box-shadow: inset 0 0 0 2px #ffffffc7; }
.account-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; margin-top: 17px; }
.account-button { position: relative; min-height: 114px; padding: 15px 14px 13px 29px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: #fff; text-align: left; }
.account-button::before { position: absolute; inset: 10px auto 10px 10px; width: 4px; content: ""; border-radius: 3px; background: var(--accent, var(--blue)); }
.account-button:hover { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); transform: translateY(-1px); }
.account-button.active { border-color: color-mix(in srgb, var(--accent) 58%, #b9c7e7); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 15%, transparent), 0 10px 25px #325add12; }
.account-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 7px; }
.account-identity { min-width: 0; }
.account-identity b { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.account-button em { display: block; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 10px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.account-return { flex: 0 0 auto; color: var(--muted); font-size: 9px; font-weight: 700; white-space: nowrap; }
.account-return .return-value { font-size: 10px; }
.account-day { position: absolute; top: 49px; right: 14px; color: var(--muted); font-size: 9px; font-weight: 700; }
.account-value { display: block; margin-top: 15px; font-size: 18px; font-weight: 800; letter-spacing: -.025em; }
.account-share { position: absolute; right: 14px; bottom: 13px; color: var(--muted); font-size: 10px; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.position-section { padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--line); }
.position-title { margin-bottom: 16px; }
.align-right { display: grid; justify-items: end; gap: 3px; }
.align-right strong { font-size: 22px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: right; font-size: 13px; }
th { color: #6d778b; background: #f5f7fb; font-size: 11px; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
.source-pill { padding: 4px 8px; border-radius: 99px; color: var(--green); background: #eaf8f2; font-size: 10px; font-weight: 800; }
.table-empty { height: 95px; color: var(--muted); text-align: center !important; }
.editor { margin-top: 15px; border: 1px solid var(--line); border-radius: 13px; }
.editor summary, .backend-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; cursor: pointer; list-style: none; }
.editor summary::-webkit-details-marker, .backend-card > summary::-webkit-details-marker { display: none; }
.editor summary > span:first-child { display: grid; gap: 5px; }
.editor summary small, .editor summary > span:last-child, .backend-card > summary > span:last-child { color: var(--muted); font-size: 11px; }
.editor-body, .backend-body { padding: 18px; border-top: 1px solid var(--line); }
.manual-form { display: grid; gap: 14px; }
.manual-head, .manual-metrics, .backend-section { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.manual-metrics { display: grid; grid-template-columns: 1.25fr repeat(3,1fr); padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f9fbff; }
.manual-metrics > div { display: grid; gap: 6px; }
.manual-metrics span { color: var(--muted); font-size: 11px; }
.manual-metrics strong { font-size: 17px; }
.position-source { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 700; }
.manual-price, .position-note { width: 130px; }
.advanced-entry { border-top: 1px solid var(--line); }
.advanced-entry > summary { padding: 12px 2px; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.advanced-entry .form-grid { margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.mini-form { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #f9fbff; }
.mini-form h3, .mini-form .button { grid-column: 1 / -1; }
.mini-form h3 { margin-bottom: 4px; font-size: 15px; }
label { display: grid; gap: 6px; color: #596478; font-size: 12px; font-weight: 650; }
input, select { min-width: 0; padding: 10px 11px; border: 1px solid #d7dfeb; border-radius: 9px; color: var(--ink); background: #fff; outline: none; }
input:focus, select:focus { border-color: #879fff; box-shadow: 0 0 0 3px #4b6ef017; }
.wide { grid-column: 1 / -1; }
.backend-card { padding: 0; }
.backend-card > summary { padding: 22px 24px; }
.backend-card p { margin-bottom: 5px; }
.backend-body { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; }
.backend-stack { display: grid; padding: 0; }
.backend-section { padding: 22px 24px; border-bottom: 1px solid var(--line); }
.backend-section:last-child { border-bottom: 0; }
.backend-body h2 { margin-bottom: 6px; font-size: 18px; }
.backend-body p { color: var(--muted); font-size: 13px; }
.backend-actions { display: flex; gap: 9px; }
.connection-badge { padding: 7px 10px; border: 1px solid #cce8dc; border-radius: 99px; color: var(--green); background: #edf9f4; font-size: 11px; font-weight: 800; white-space: nowrap; }
.connection-badge.offline { color: var(--red); border-color: #f3ced5; background: #fff4f6; }
.sync-preview { display: grid; gap: 10px; max-height: 420px; overflow: auto; }
.sync-account { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #f8faff; }
.sync-account strong { display: block; margin-bottom: 6px; }
.sync-account p { margin: 3px 0; color: var(--muted); font-size: 12px; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: .55; transform: none !important; }
.date-search { width: 180px; }
.history-table { max-height: 590px; margin-top: 18px; }
.history-table thead { position: sticky; top: 0; z-index: 1; }
.history-card > .muted { margin: 14px 2px 0; }
footer { display: flex; justify-content: space-between; padding: 24px 4px 0; color: var(--muted); font-size: 11px; }
dialog { width: min(480px, calc(100% - 30px)); padding: 0; border: 0; border-radius: 17px; box-shadow: 0 30px 90px #15234952; }
dialog::backdrop { background: #17203380; backdrop-filter: blur(4px); }
.dialog-form { display: grid; gap: 14px; padding: 22px; }
.dialog-head, .dialog-actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-actions { justify-content: flex-end; margin-top: 5px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: #5b6578; background: #f0f3f8; font-size: 22px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 380px; padding: 13px 16px; opacity: 0; pointer-events: none; border-radius: 11px; color: #fff; background: #1b2840; box-shadow: 0 15px 40px #14203a55; transform: translateY(12px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 1100px) {
  .overview { grid-template-columns: repeat(2,1fr); }
  .metric.primary { grid-column: span 2; }
  .account-grid { grid-template-columns: repeat(2,1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .manual-metrics { grid-template-columns: 1fr 1fr; }
  .backend-section { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 720px) {
  .shell { width: min(100% - 20px, 1480px); padding-top: 18px; }
  .topbar { align-items: flex-start; }
  .health { grid-template-columns: 1fr 1fr; }
  .health div:nth-child(2) { border-right: 0; }
  .health div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .overview { grid-template-columns: 1fr; }
  .metric.primary { grid-column: auto; }
  .metric { min-height: 145px; }
  .section-head, .backend-body { flex-direction: column; }
  .segmented { width: 100%; overflow-x: auto; }
  .account-grid { grid-template-columns: 1fr; }
  .head-actions, .backend-actions { flex-wrap: wrap; }
  .mini-form { grid-template-columns: 1fr; }
  .mini-form h3, .mini-form .button, .wide { grid-column: auto; }
  .manual-head { align-items: flex-start; }
  .manual-metrics { grid-template-columns: 1fr; }
  footer { gap: 8px; flex-direction: column; }
}
