:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --surface-accent: #eef8f4;
  --ink: #17231f;
  --muted: #68766f;
  --subtle: #92a099;
  --line: #dfe7e3;
  --line-strong: #ccd9d3;
  --primary: #14735a;
  --primary-dark: #0d5a45;
  --primary-light: #d9f0e7;
  --blue: #3976a8;
  --gold: #b7812e;
  --red: #c24e52;
  --up: #c24e52;
  --down: #0f8a64;
  --red-soft: #fff0f0;
  --green-soft: #eaf7f1;
  --shadow-sm: 0 1px 2px rgba(22, 48, 39, .05);
  --shadow-md: 0 12px 36px rgba(22, 48, 39, .08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

/* Unified local wealth workspace */
.unified-shell { min-height: 100vh; display: grid; grid-template-columns: 226px minmax(0, 1fr); }
.app-sidebar {
  position: sticky; top: 0; z-index: 70; height: 100vh; display: flex; flex-direction: column;
  padding: 22px 16px 18px; color: #8d99aa;
  background: radial-gradient(circle at 10% 0, rgba(45, 212, 191, .14), transparent 27%), linear-gradient(180deg, #111827, #0b1220);
  border-right: 1px solid rgba(255,255,255,.05);
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 26px; }
.sidebar-brand > span {
  width: 36px; height: 36px; display: grid; place-items: center; color: #073b36;
  background: linear-gradient(145deg, #99f6e4, #5eead4); border-radius: 11px; font-weight: 900;
  box-shadow: 0 10px 26px rgba(45, 212, 191, .2);
}
.sidebar-brand strong { display: block; color: #fff; font-size: 13px; }
.sidebar-brand small { display: block; margin-top: 3px; color: #667085; font-size: 8px; letter-spacing: .14em; }
.sidebar-label { margin: 13px 11px 7px; color: #596579; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.sidebar-item {
  width: 100%; display: flex; align-items: center; gap: 11px; margin: 2px 0; padding: 10px 12px;
  color: #8d99aa; background: transparent; border: 0; border-radius: 10px; font-size: 11px; font-weight: 650;
  text-align: left; transition: .18s ease;
}
.sidebar-item:hover { color: #fff; background: rgba(255,255,255,.045); transform: translateX(2px); }
.sidebar-item.active { color: #fff; background: linear-gradient(90deg, rgba(45,212,191,.16), rgba(45,212,191,.05)); box-shadow: inset 2px 0 #5eead4; }
.sidebar-item i { width: 17px; color: #667085; font-style: normal; text-align: center; }
.sidebar-item.active i { color: #5eead4; }
.sidebar-item b { margin-left: auto; padding: 2px 6px; color: #ccfbf1; background: rgba(45,212,191,.14); border-radius: 8px; font-size: 8px; }
.sidebar-privacy { margin-top: auto; padding: 13px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06); border-radius: 12px; }
.sidebar-privacy b { color: #d6dee9; font-size: 9px; }
.sidebar-privacy b i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; background: #5eead4; border-radius: 50%; }
.sidebar-privacy p { margin: 6px 0 0; color: #758195; font-size: 8px; line-height: 1.55; }
.unified-content {
  min-width: 0; min-height: 100vh;
  background: radial-gradient(circle at 76% -8%, rgba(45,212,191,.16), transparent 29%), radial-gradient(circle at 105% 28%, rgba(96,165,250,.1), transparent 24%), #f3f5f8;
}
.unified-topbar {
  position: sticky; top: 0; z-index: 60; height: 70px; display: flex; align-items: center; justify-content: space-between;
  margin: 0 30px; background: rgba(243,245,248,.74); border-bottom: 1px solid rgba(17,24,39,.07); backdrop-filter: blur(18px);
}
.unified-topbar > div:first-child { display: flex; align-items: center; gap: 8px; color: #8b95a5; font-size: 10px; }
.unified-topbar > div:first-child i { color: #c2c8d0; font-style: normal; }
.unified-topbar > div:first-child strong { color: #111827; }
.unified-actions { display: flex; align-items: center; gap: 9px; }
.sync-status { margin-right: 4px; color: #697586; font-size: 9px; }
.sync-status i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; background: #35a172; border-radius: 50%; }
.compact-primary { min-width: 0 !important; height: 38px !important; padding: 0 15px !important; }
.portfolio-pages { padding: 0 30px 50px; }
.app-page { display: none; }
.app-page.active { display: block; }
.portfolio-hero, .page-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 31px 2px 23px; }
.portfolio-hero h1, .page-heading h1 { margin: 7px 0 7px; color: #111827; font-size: 30px; letter-spacing: -.04em; }
.portfolio-hero p, .page-heading p { margin: 0; color: #687386; font-size: 10px; }
.hero-pills { display: flex; gap: 7px; }
.hero-pills span { padding: 7px 10px; color: #4b5b70; background: rgba(255,255,255,.64); border: 1px solid rgba(255,255,255,.9); border-radius: 999px; font-size: 8px; box-shadow: 0 7px 20px rgba(15,23,42,.04); }
.portfolio-empty {
  min-height: 460px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 50px; text-align: center; background: rgba(255,255,255,.75); border: 1px dashed #cdd6df; border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15,23,42,.04); backdrop-filter: blur(16px);
}
.portfolio-empty > span { width: 54px; height: 54px; display: grid; place-items: center; color: #0f766e; background: #e7f6f3; border-radius: 16px; font-size: 23px; }
.portfolio-empty h2 { margin: 18px 0 7px; font-size: 17px; }
.portfolio-empty p { max-width: 480px; margin: 0 0 20px; color: #7c8797; font-size: 10px; line-height: 1.65; }
.portfolio-warnings { margin-bottom: 14px; padding: 12px 14px; color: #7c5518; background: #fff5df; border: 1px solid rgba(234,179,8,.24); border-radius: 12px; font-size: 9px; }
.portfolio-warnings strong { display: block; margin-bottom: 4px; font-size: 10px; }
.dashboard-grid, .dashboard-lower { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr); gap: 15px; }
.dashboard-lower { margin-top: 15px; }
.dashboard-card {
  background: rgba(255,255,255,.83); border: 1px solid rgba(255,255,255,.92); border-radius: 18px;
  box-shadow: 0 16px 44px rgba(15,23,42,.07), 0 2px 6px rgba(15,23,42,.03); backdrop-filter: blur(18px);
}
.wealth-card { position: relative; padding: 22px 22px 17px; overflow: hidden; }
.wealth-card::after { content: ""; position: absolute; width: 240px; height: 240px; right: -110px; top: -130px; background: radial-gradient(circle, rgba(45,212,191,.16), transparent 68%); pointer-events: none; }
.dashboard-card-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.dashboard-card-head h2 { margin: 0; color: #111827; font-size: 13px; }
.dashboard-card-head p { margin: 4px 0 0; color: #98a2b3; font-size: 8px; }
.dashboard-card-head > span, .verified-badge { padding: 5px 8px; color: #0f766e; background: #e7f6f3; border-radius: 999px; font-size: 8px; font-weight: 800; }
.dashboard-card-head button { color: #0f766e; background: none; border: 0; font-size: 8px; font-weight: 750; }
.wealth-value { display: block; margin-top: 19px; color: #111827; font-size: 34px; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.wealth-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 7px; color: #687386; font-size: 8px; }
.wealth-meta .gain, .portfolio-table .gain { color: var(--up); }
.wealth-meta .loss, .portfolio-table .loss { color: var(--down); }
.distribution-heading { display: flex; justify-content: space-between; margin-top: 21px; padding-top: 14px; border-top: 1px solid rgba(17,24,39,.07); color: #98a2b3; font-size: 8px; }
.distribution-list { margin-top: 2px; }
.distribution-row { display: grid; grid-template-columns: 105px 1fr 56px; align-items: center; gap: 9px; margin-top: 9px; font-size: 8px; }
.distribution-row > span:last-child { color: #687386; text-align: right; }
.distribution-track { height: 6px; overflow: hidden; background: #e9edf1; border-radius: 8px; }
.distribution-track i { display: block; height: 100%; background: linear-gradient(90deg,#0f766e,#2dd4bf); border-radius: inherit; }
.metric-strip { display: grid; grid-template-columns: repeat(4,1fr); margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(17,24,39,.07); }
.metric-strip div { padding: 0 12px; border-right: 1px solid rgba(17,24,39,.07); }
.metric-strip div:first-child { padding-left: 0; }
.metric-strip div:last-child { border: 0; }
.metric-strip span { color: #98a2b3; font-size: 7px; }
.metric-strip strong { display: block; margin-top: 5px; color: #111827; font-size: 12px; font-variant-numeric: tabular-nums; }
.strategy-bridge { position: relative; padding: 20px; overflow: hidden; }
.strategy-bridge::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg,#14b8a6,#60a5fa); }
.bridge-visual { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 20px; padding: 16px 8px; color: #546276; background: linear-gradient(135deg,rgba(231,246,243,.9),rgba(239,246,255,.8)); border-radius: 12px; font-size: 8px; }
.bridge-visual b { color: #9ba6b5; }
.mapping-summary { margin: 14px 0; }
.mapping-summary-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(17,24,39,.07); font-size: 8px; }
.mapping-summary-row span { color: #687386; }
.mapping-summary-row b { color: #0f766e; }
.full-button { width: 100%; }
.table-card { overflow: hidden; }
.table-card .dashboard-card-head { padding: 17px 18px 13px; }
.responsive-table { width: 100%; overflow-x: auto; }
.portfolio-table { width: 100%; border-collapse: collapse; }
.portfolio-table th { padding: 9px 17px; color: #98a2b3; background: rgba(245,247,249,.72); font-size: 7px; font-weight: 650; text-align: left; white-space: nowrap; }
.portfolio-table td { padding: 11px 17px; color: #344054; border-top: 1px solid rgba(17,24,39,.065); font-size: 8px; white-space: nowrap; }
.portfolio-table th:nth-child(n+3), .portfolio-table td:nth-child(n+3) { text-align: right; }
.portfolio-asset { display: flex; align-items: center; gap: 9px; }
.portfolio-asset > span { width: 29px; height: 29px; display: grid; place-items: center; color: #0f766e; background: linear-gradient(145deg,#dff7f1,#eefbf8); border-radius: 9px; font-size: 7px; font-weight: 900; }
.portfolio-asset b { display: block; color: #111827; font-size: 8px; }
.portfolio-asset small { display: block; margin-top: 3px; color: #98a2b3; font-size: 7px; }
.type-tag, .status-tag { padding: 3px 6px; color: #687386; background: #f0f3f5; border-radius: 999px; font-size: 7px; }
.status-tag.review { color: #936515; background: #fff5df; }
.activity-card { padding-bottom: 7px; }
.activity-list { padding: 0 18px; }
.activity-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 9px; padding: 10px 0; border-top: 1px solid rgba(17,24,39,.065); }
.activity-row > span { width: 27px; height: 27px; display: grid; place-items: center; color: #0f766e; background: #e7f6f3; border-radius: 8px; font-size: 10px; }
.activity-row b { display: block; color: #111827; font-size: 8px; }
.activity-row small { display: block; margin-top: 3px; color: #98a2b3; font-size: 7px; }
.activity-row > strong { color: #344054; font-size: 8px; text-align: right; }
.wide-card { min-height: 300px; }
.ios-performance-card { padding: 21px; }
.ios-chart-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.ios-chart-head h2 { margin: 0; font-size: 15px; }
.ios-chart-head p { margin: 5px 0 0; color: #98a2b3; font-size: 8px; }
.ios-chart-head > div:last-child { text-align: right; }
.ios-chart-head span { display: block; color: #98a2b3; font-size: 8px; }
.ios-chart-head strong { display: block; margin-top: 4px; color: #0f766e; font-size: 12px; }
.chart-scope-switch { display: grid; grid-template-columns: 1fr 1fr; margin-top: 18px; padding: 4px; background: #edf0f3; border-radius: 11px; }
.chart-scope-switch button { height: 33px; color: #667085; background: transparent; border: 0; border-radius: 8px; font-size: 9px; }
.chart-scope-switch button.active { color: #111827; background: #fff; box-shadow: 0 2px 8px rgba(15,23,42,.08); font-weight: 750; }
.holding-periods { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 14px; }
.holding-periods button { height: 32px; color: #667085; background: #f0f2f5; border: 0; border-radius: 999px; font-size: 9px; font-weight: 650; }
.holding-periods button.active { color: #fff; background: linear-gradient(135deg,#0f766e,#14b8a6); box-shadow: 0 7px 16px rgba(15,118,110,.2); }
.holding-chart-wrap { position: relative; height: 190px; margin-top: 14px; }
#holdingPerformanceChart { width: 100%; height: 100%; display: block; }
.holding-chart-loading { height: 190px; display: grid; place-items: center; margin-top: 14px; color: #98a2b3; font-size: 9px; background: linear-gradient(180deg,#fafbfc,rgba(250,251,252,.4)); border-radius: 10px; }
.holding-chart-loading.hidden + .holding-chart-wrap { display: block; }
.holding-chart-loading:not(.hidden) + .holding-chart-wrap { display: none; }
.holding-chart-tooltip { position: absolute; min-width: 112px; padding: 8px 9px; color: #fff; background: rgba(17,24,39,.9); border-radius: 8px; font-size: 7px; line-height: 1.55; pointer-events: none; transform: translate(-50%,-110%); white-space: nowrap; }
.holding-chart-tooltip strong { font-size: 9px; }
.holding-chart-dates { display: flex; justify-content: space-between; margin-top: 5px; color: #98a2b3; font-size: 7px; }
.ios-holding-sections { display: grid; gap: 14px; margin-top: 15px; }
.ios-holding-section { padding: 18px 20px 4px; }
.ios-section-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 11px; }
.ios-section-head h2 { margin: 0; font-size: 13px; }
.ios-section-head strong { font-size: 10px; }
.ios-section-head strong.gain { color: var(--up); }
.ios-section-head strong.loss { color: var(--down); }
.ios-holding-columns, .ios-holding-row { display: grid; grid-template-columns: minmax(180px,1fr) 150px 150px; gap: 12px; align-items: center; }
.ios-holding-columns { padding: 7px 0; color: #98a2b3; font-size: 7px; }
.ios-holding-columns span:nth-child(n+2) { text-align: right; }
.ios-holding-row { min-height: 68px; border-top: 1px solid rgba(17,24,39,.065); }
.ios-holding-row, .ios-balance-row { cursor: pointer; transition: background .16s ease, transform .16s ease; }
.ios-holding-row:hover, .ios-balance-row:hover { margin: 0 -10px; padding: 0 10px; background: rgba(231,246,243,.55); border-radius: 10px; transform: translateX(2px); }
.ios-holding-name b { display: block; color: #111827; font-size: 10px; }
.ios-holding-name small { display: inline-block; margin-top: 5px; padding: 2px 5px; color: #667085; background: #f0f2f5; border-radius: 5px; font-size: 7px; }
.ios-holding-name small em { margin-left: 6px; color: #0f766e; font-style: normal; }
.ios-holding-stat { text-align: right; }
.ios-holding-stat b { display: block; color: #111827; font-size: 10px; font-variant-numeric: tabular-nums; }
.ios-holding-stat small { display: block; margin-top: 4px; color: #98a2b3; font-size: 8px; }
.ios-holding-stat small.gain, .ios-holding-stat b.gain { color: var(--up); }
.ios-holding-stat small.loss, .ios-holding-stat b.loss { color: var(--down); }
.ios-balance-row { display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 62px; border-top: 1px solid rgba(17,24,39,.065); }
.ios-balance-row .ios-holding-name { display: flex; align-items: center; gap: 10px; }
.ios-balance-row .ios-holding-name > span { width: 30px; height: 30px; display: grid; place-items: center; color: #475467; background: #f0f2f5; border-radius: 9px; }
.ios-balance-row > strong { font-size: 10px; }
.raw-holdings-details { margin-top: 15px; overflow: hidden; }
.raw-holdings-details > summary { padding: 15px 18px; color: #667085; font-size: 9px; font-weight: 700; cursor: pointer; }
.asset-detail-overlay { position: fixed; inset: 0; z-index: 100; display: flex; justify-content: flex-end; background: rgba(15,23,42,.34); backdrop-filter: blur(5px); }
.asset-detail-panel { width: min(720px, 100%); height: 100%; overflow-y: auto; padding: 0 22px 34px; background: #f3f5f8; box-shadow: -28px 0 70px rgba(15,23,42,.18); }
.asset-detail-nav { position: sticky; top: 0; z-index: 3; height: 66px; display: flex; align-items: center; justify-content: space-between; background: rgba(243,245,248,.86); border-bottom: 1px solid rgba(17,24,39,.07); backdrop-filter: blur(16px); }
.asset-detail-nav button { color: #0f766e; background: none; border: 0; font-size: 9px; font-weight: 750; }
.asset-detail-nav button:last-child { color: #667085; font-size: 20px; font-weight: 400; }
.asset-detail-nav > div { display: flex; align-items: center; gap: 10px; }
.asset-detail-nav .danger-text { color: #b8494d; }
.asset-detail-loading { min-height: 420px; display: grid; place-items: center; color: #98a2b3; font-size: 9px; }
.asset-detail-card { margin-top: 15px; padding: 20px; background: #fff; border: 1px solid rgba(17,24,39,.06); border-radius: 17px; box-shadow: 0 14px 36px rgba(15,23,42,.06); }
.asset-detail-title { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.asset-detail-title h2 { margin: 0; color: #111827; font-size: 20px; letter-spacing: -.025em; }
.asset-detail-title p { margin: 4px 0 0; color: #667085; font-size: 9px; }
.asset-platform-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.asset-platform-filters button { padding: 5px 8px; color: #667085; background: #f0f2f5; border: 0; border-radius: 999px; font-size: 7px; }
.asset-platform-filters button.active { color: #fff; background: #0f766e; }
.asset-detail-pnl { display: flex; gap: 15px; margin-top: 11px; color: #98a2b3; font-size: 8px; }
.asset-detail-pnl b { margin-left: 3px; color: #0f766e; }
.asset-price-row { display: flex; align-items: baseline; justify-content: space-between; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(17,24,39,.07); }
.asset-price-row > strong { color: #111827; font-size: 28px; letter-spacing: -.04em; }
.asset-price-row > span { padding: 5px 8px; color: #0f766e; background: #e7f6f3; border-radius: 8px; font-size: 8px; font-weight: 750; }
.asset-update-line { display: flex; justify-content: space-between; margin-top: 5px; }
.asset-update-line > span { color: #0f766e; font-size: 8px; font-weight: 700; }
.asset-update-line > small { color: #98a2b3; font-size: 7px; }
.asset-detail-chart-wrap { position: relative; height: 150px; margin-top: 14px; }
#assetDetailChart { width: 100%; height: 100%; display: block; }
.asset-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; }
.asset-stat-grid div { min-width: 0; }
.asset-stat-grid span { display: block; color: #98a2b3; font-size: 8px; }
.asset-stat-grid strong { display: block; margin-top: 5px; color: #111827; font-size: 11px; }
.asset-stat-grid strong.gain { color: var(--up); }
.asset-stat-grid strong.loss { color: var(--down); }
.asset-detail-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.asset-detail-section-head h3 { margin: 0; font-size: 13px; }
.asset-detail-section-head p { margin: 4px 0 0; color: #98a2b3; font-size: 8px; }
.asset-transaction-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 9px; align-items: center; padding: 13px 0; border-top: 1px solid rgba(17,24,39,.065); }
.asset-transaction-row:first-child { margin-top: 10px; }
.asset-transaction-row b { display: block; color: #111827; font-size: 9px; }
.asset-transaction-row span { display: block; margin-top: 4px; color: #667085; font-size: 8px; }
.asset-transaction-row small { display: block; margin-top: 3px; color: #98a2b3; font-size: 7px; }
.asset-transaction-row > strong { color: var(--up); font-size: 9px; }
.asset-transaction-row > strong.loss { color: var(--down); }
.delete-transaction { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; color: #b8494d; background: #fff0f0; border: 0; border-radius: 8px; font-size: 12px; opacity: .72; transition: .16s ease; }
.delete-transaction:hover { opacity: 1; transform: scale(1.04); }
.edit-transaction { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; color: #0f766e; background: #e7f6f3; border: 0; border-radius: 8px; font-size: 10px; opacity: .78; }
.edit-transaction:hover { opacity: 1; transform: scale(1.04); }
.portfolio-table .delete-transaction { margin-left: auto; }
.transaction-form-overlay { position: fixed; inset: 0; z-index: 120; display: flex; justify-content: flex-end; background: rgba(15,23,42,.4); backdrop-filter: blur(5px); }
.transaction-form-panel { width: min(560px,100%); height: 100%; overflow-y: auto; background: #f3f5f8; box-shadow: -28px 0 70px rgba(15,23,42,.2); }
.transaction-form-panel .asset-detail-nav { padding: 0 20px; }
.transaction-form-panel .asset-detail-nav h2 { margin: 0; font-size: 13px; }
.transaction-form-content { padding: 0 20px 36px; }
.transaction-form-card { margin-top: 13px; padding: 16px; background: #fff; border: 1px solid rgba(17,24,39,.06); border-radius: 15px; box-shadow: 0 10px 28px rgba(15,23,42,.05); }
.transaction-field { display: flex; flex-direction: column; gap: 7px; color: #667085; font-size: 8px; }
.transaction-field + .transaction-field { margin-top: 13px; }
.transaction-field input, .transaction-field select { width: 100%; height: 42px; padding: 0 11px; color: #111827; background: #f7f9fa; border: 1px solid rgba(17,24,39,.08); border-radius: 9px; outline: 0; font-size: 9px; }
.transaction-field input:focus, .transaction-field select:focus { background: #fff; border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15,118,110,.09); }
.transaction-field small { color: #98a2b3; font-size: 7px; line-height: 1.55; }
.tx-asset-snapshot { display: flex; gap: 15px; margin-top: 11px; color: #98a2b3; font-size: 7px; }
.tx-asset-snapshot b { color: #344054; }
.tx-type-buttons { display: flex; gap: 6px; overflow-x: auto; }
.tx-type-buttons button, .tx-mode-buttons button { min-width: 72px; height: 36px; padding: 0 12px; color: #667085; background: #f0f2f5; border: 0; border-radius: 9px; font-size: 8px; white-space: nowrap; }
.tx-type-buttons button.active { color: #fff; background: #0f766e; }
.tx-mode-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 11px; padding: 4px; background: #f0f2f5; border-radius: 10px; }
.tx-mode-buttons button { width: 100%; background: transparent; }
.tx-mode-buttons button.active { color: #0f766e; background: #fff; box-shadow: 0 2px 7px rgba(15,23,42,.07); font-weight: 750; }
#txManualFields, #txPositionFields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 13px; }
#txManualFields .transaction-field + .transaction-field, #txPositionFields .transaction-field + .transaction-field { margin-top: 0; }
#txManualFields .transaction-field:last-child, #txPositionFields .transaction-field:last-child { grid-column: 1 / -1; }
.tx-position-platform-field { grid-column: 1 / -1; }
.tx-current-position { grid-column: 1 / -1; display: flex; gap: 18px; padding: 10px; color: #667085; background: #f7f9fa; border-radius: 8px; font-size: 7px; }
.tx-current-position b { margin-left: 4px; color: #111827; }
#txAmountFields, #txBalanceFields { margin-top: 13px; }
.tx-total-preview { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding: 12px; color: #667085; background: #eaf7f3; border-radius: 9px; font-size: 8px; }
.tx-total-preview strong { color: #0f766e; font-size: 12px; }
.transaction-save { width: 100%; height: 46px !important; margin-top: 14px; }
.asset-code-input { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.asset-code-input input { min-width: 0; }
.asset-code-input .button { height: 42px; }
.fee-mode-input { display: grid; grid-template-columns: 1fr 82px; gap: 7px; }
.fee-mode-input input, .fee-mode-input select { min-width: 0; }
.tx-implied-preview { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 12px; background: #eef8f5; border-radius: 9px; }
.tx-implied-preview div span { display: block; color: #98a2b3; font-size: 7px; }
.tx-implied-preview div b { display: block; margin-top: 4px; color: #0f766e; font-size: 9px; }
.tx-implied-preview .error { grid-column: 1 / -1; color: #b8494d; font-size: 8px; }
.transaction-filters { display: flex; align-items: center; gap: 9px; padding: 14px 17px; }
.transaction-filters select {
  min-width: 150px; height: 35px; padding: 0 10px; color: #475467; background: #f7f9fa;
  border: 1px solid rgba(17,24,39,.08); border-radius: 8px; font-size: 8px;
}
.transaction-filters span { margin-left: auto; color: #98a2b3; font-size: 8px; }
.import-layout { display: grid; grid-template-columns: minmax(300px,.8fr) minmax(0,1.2fr); gap: 15px; }
.import-card, .import-result-card { padding: 20px; }
.import-step { display: flex; align-items: start; gap: 11px; margin-bottom: 17px; }
.import-step > b { width: 28px; height: 28px; display: grid; place-items: center; color: #0f766e; background: #e7f6f3; border-radius: 8px; font-size: 8px; }
.import-step h2 { margin: 0; font-size: 13px; }
.import-step p { margin: 4px 0 0; color: #98a2b3; font-size: 8px; }
.file-drop { position: relative; display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; padding: 15px; background: #f7f9fa; border: 1px dashed #cbd4dd; border-radius: 11px; cursor: pointer; }
.file-drop:hover { border-color: #0f766e; background: #f2faf8; }
.file-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-drop span { color: #0f766e; font-size: 7px; font-weight: 800; }
.file-drop b { font-size: 9px; }
.file-drop small { color: #98a2b3; font-size: 7px; }
.import-idle { min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.import-idle > span { width: 43px; height: 43px; display: grid; place-items: center; color: #0f766e; background: #e7f6f3; border-radius: 13px; font-size: 17px; }
.import-idle h2 { margin: 15px 0 6px; font-size: 13px; }
.import-idle p { max-width: 360px; margin: 0; color: #98a2b3; font-size: 8px; line-height: 1.6; }
.import-problems { margin-bottom: 16px; }
.import-problem { margin-top: 7px; padding: 10px 11px; border-radius: 9px; font-size: 8px; }
.import-problem.warning { color: #80571b; background: #fff5df; border: 1px solid rgba(234,179,8,.2); }
.import-problem.error { color: #9a3d42; background: #fff0f0; border: 1px solid #f4d4d5; }
.import-result-card h3 { margin: 0 0 7px; font-size: 10px; }
.import-mapping-row { display: grid; grid-template-columns: 1fr 18px 1fr; padding: 8px 0; border-top: 1px solid rgba(17,24,39,.07); font-size: 8px; }
.import-mapping-row span:nth-child(2) { color: #98a2b3; }
.import-mapping-row b { color: #0f766e; }
.replace-warning { margin: 15px 0; padding: 11px; color: #80571b; background: #fff5df; border-radius: 9px; }
.replace-warning strong { font-size: 8px; }
.replace-warning p { margin: 4px 0 0; font-size: 7px; }
.settings-layout { display: grid; grid-template-columns: minmax(340px, 1.05fr) minmax(300px, .95fr); gap: 15px; }
.settings-card, .sources-card { padding: 20px; }
.settings-source-head { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; }
.source-logo { width: 42px; height: 42px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg,#0f766e,#2563eb); border-radius: 12px; font-size: 10px; font-weight: 900; box-shadow: 0 9px 20px rgba(15,118,110,.18); }
.settings-source-head h2 { margin: 0; font-size: 13px; }
.settings-source-head p { margin: 4px 0 0; color: #98a2b3; font-size: 8px; line-height: 1.5; }
.source-state { padding: 5px 8px; color: #80571b; background: #fff5df; border-radius: 999px; font-size: 7px; font-weight: 800; }
.source-state.configured { color: #0f766e; background: #e7f6f3; }
.settings-field { display: flex; flex-direction: column; gap: 7px; margin-top: 22px; color: #667085; font-size: 8px; }
.settings-field input { height: 42px; padding: 0 12px; color: #111827; background: #f7f9fa; border: 1px solid rgba(17,24,39,.09); border-radius: 10px; outline: 0; font-size: 10px; }
.settings-field input:focus { background: #fff; border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15,118,110,.1); }
.settings-field small { color: #98a2b3; font-size: 7px; }
.settings-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 15px; }
.settings-message { margin-top: 12px; padding: 10px; color: #0f766e; background: #e7f6f3; border-radius: 9px; font-size: 8px; }
.settings-message.error { color: #9a3d42; background: #fff0f0; }
.security-note { margin-top: 18px; padding: 12px; color: #667085; background: #f7f9fa; border: 1px solid rgba(17,24,39,.06); border-radius: 10px; }
.security-note b { color: #344054; font-size: 8px; }
.security-note p { margin: 5px 0 0; font-size: 7px; line-height: 1.6; }
.sources-card .dashboard-card-head { margin-bottom: 8px; }
.source-row { display: grid; grid-template-columns: 90px 1fr; gap: 3px 12px; padding: 12px 0; border-bottom: 1px solid rgba(17,24,39,.07); font-size: 8px; }
.source-row > span { grid-row: span 2; color: #667085; }
.source-row b { color: #111827; }
.source-row small { color: #98a2b3; font-size: 7px; }
.legacy-topbar { display: none; }
.page-shell[data-page="strategy"] { min-height: auto; background: transparent; }
.page-shell[data-page="strategy"] .app-main { padding-top: 1px; }

@media (max-width: 1120px) {
  .unified-shell { grid-template-columns: 74px minmax(0,1fr); }
  .sidebar-brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar-brand div, .sidebar-label, .sidebar-item span, .sidebar-item b, .sidebar-privacy { display: none; }
  .sidebar-item { justify-content: center; }
  .dashboard-grid, .dashboard-lower { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .unified-shell { display: block; }
  .app-sidebar { position: fixed; top: auto; bottom: 0; width: 100%; height: 62px; flex-direction: row; justify-content: space-around; padding: 7px; }
  .sidebar-brand, .sidebar-label, .sidebar-privacy, .sidebar-item:nth-of-type(n+5) { display: none; }
  .sidebar-item { width: auto; margin: 0; padding: 10px 14px; }
  .unified-topbar { margin: 0 16px; }
  .sync-status, .unified-topbar > div:first-child span, .unified-topbar > div:first-child i { display: none; }
  .portfolio-pages { padding: 0 16px 82px; }
  .portfolio-hero, .page-heading { align-items: start; flex-direction: column; }
  .metric-strip { grid-template-columns: 1fr 1fr; gap: 12px 0; }
  .import-layout { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .ios-holding-columns, .ios-holding-row { grid-template-columns: minmax(120px,1fr) 100px 100px; }
  .asset-detail-panel { padding: 0 14px 82px; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, summary, select { cursor: pointer; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 max(28px, calc((100vw - 1560px) / 2));
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid rgba(204, 217, 211, .8);
  backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #1c8267, #0e5d48);
  border-radius: 12px;
  font-weight: 800;
  box-shadow: 0 7px 16px rgba(20, 115, 90, .2);
}
.brand-copy { display: flex; flex-direction: column; }
.brand-copy strong { font-size: 15px; line-height: 1.2; }
.brand-copy small { margin-top: 2px; color: var(--subtle); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.top-nav { display: flex; align-items: center; gap: 4px; padding: 4px; background: #f2f6f4; border-radius: 10px; }
.top-nav a { padding: 8px 14px; color: var(--muted); border-radius: 7px; font-size: 12px; font-weight: 600; transition: .2s ease; }
.top-nav a:hover, .top-nav a.active { color: var(--primary-dark); background: #fff; box-shadow: var(--shadow-sm); }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 14px; }
.status-dot { color: var(--muted); font-size: 11px; white-space: nowrap; }
.status-dot i, .form-submit p i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  background: #38a173;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(56, 161, 115, .12);
}

.button { border: 0; border-radius: 9px; font-weight: 700; transition: .18s ease; }
.button.secondary { padding: 9px 14px; color: var(--primary-dark); background: #fff; border: 1px solid var(--line-strong); font-size: 11px; }
.button.secondary:hover { border-color: var(--primary); background: var(--surface-accent); }
.button.primary {
  min-width: 185px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 22px;
  color: #fff;
  background: linear-gradient(135deg, #178064, #0f664e);
  box-shadow: 0 9px 20px rgba(20, 115, 90, .22);
}
.button.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(20, 115, 90, .27); }
.button.primary:disabled { cursor: wait; opacity: .68; transform: none; }

.app-main { max-width: 1560px; margin: 0 auto; padding: 0 28px 72px; }
.welcome {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 48px;
  padding: 42px 6px 30px;
}
.eyebrow { color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.welcome h1 { margin: 8px 0 9px; font-size: clamp(28px, 3vw, 42px); line-height: 1.18; letter-spacing: -.035em; }
.welcome p { max-width: 680px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.rule-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 15px 18px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.rule-strip div { display: flex; flex-direction: column; gap: 4px; }
.rule-strip span { color: var(--subtle); font-size: 9px; }
.rule-strip strong { font-size: 11px; white-space: nowrap; }
.rule-strip i { width: 1px; height: 25px; background: var(--line); }

.workspace { display: grid; grid-template-columns: minmax(430px, 500px) minmax(0, 1fr); gap: 22px; align-items: start; }
.control-panel, .results-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.control-panel { position: relative; overflow: clip; }
.panel-intro { display: flex; justify-content: space-between; align-items: start; gap: 20px; padding: 24px 26px 16px; }
.panel-kicker { color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.panel-intro h2 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.02em; }
.draft-label { margin-top: 3px; color: var(--subtle); font-size: 9px; }
.step-rail { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 26px; padding: 5px; background: var(--surface-soft); border: 1px solid #e8eeeb; border-radius: 10px; }
.step-rail a { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 4px; color: var(--muted); font-size: 10px; }
.step-rail a + a { border-left: 1px solid var(--line); }
.step-rail b { width: 19px; height: 19px; display: grid; place-items: center; color: var(--primary); background: var(--primary-light); border-radius: 50%; font-size: 9px; }

.panel-section { margin: 0 26px; padding: 25px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.section-heading > div { display: flex; align-items: start; gap: 11px; }
.step-number { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; color: var(--primary); background: var(--surface-accent); border-radius: 8px; font-size: 9px; font-weight: 800; }
.section-heading h3 { margin: 0; font-size: 14px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.text-button { padding: 6px 0; color: var(--primary); background: none; border: 0; font-size: 11px; font-weight: 700; white-space: nowrap; }
.text-button span { font-size: 16px; vertical-align: -1px; }
.text-button:hover { color: var(--primary-dark); }

.strategy-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.strategy-switch label { position: relative; }
.strategy-switch input { position: absolute; opacity: 0; pointer-events: none; }
.strategy-switch label > span {
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: start;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: .18s ease;
}
.strategy-switch label > span:hover { border-color: var(--line-strong); background: #fff; }
.strategy-switch span i { margin-bottom: 10px; padding: 3px 6px; color: var(--muted); background: #e9efec; border-radius: 5px; font-size: 8px; font-style: normal; font-weight: 800; }
.strategy-switch span b { font-size: 12px; }
.strategy-switch span small { margin-top: 6px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.strategy-switch input:checked + span { background: var(--surface-accent); border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.strategy-switch input:checked + span i { color: #fff; background: var(--primary); }

.asset-table-wrap { width: 100%; overflow-x: auto; }
.asset-table { width: 100%; border-spacing: 0 7px; table-layout: fixed; }
.asset-table th { padding: 0 5px 2px; color: var(--subtle); font-size: 8px; font-weight: 600; text-align: left; white-space: nowrap; }
.asset-table th:first-child { width: 18%; }
.asset-table th:nth-child(2) { width: 22%; }
.asset-table th:last-child { width: 31px; }
.asset-table td { padding: 0 4px; }
.asset-table td:first-child, .asset-table th:first-child { padding-left: 0; }
.asset-table td:last-child, .asset-table th:last-child { padding-right: 0; text-align: right; }
.asset-table input, .asset-table select, .field-grid input, .field-grid select, .entry-controls input, .entry-controls select, .portfolio-value input {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  font-size: 11px;
  transition: .16s ease;
}
.asset-table select { padding: 0 5px; font-size: 9px; }
.asset-symbol-field { position: relative; padding-bottom: 15px; }
.asset-symbol-field small { position: absolute; left: 2px; bottom: 0; overflow: hidden; width: 100%; color: var(--subtle); font-size: 7px; line-height: 12px; text-overflow: ellipsis; white-space: nowrap; }
.asset-table input:hover, .asset-table select:hover, .field-grid input:hover, .field-grid select:hover, .entry-controls input:hover, .entry-controls select:hover, .portfolio-value input:hover { border-color: var(--line-strong); }
.asset-table input:focus, .asset-table select:focus, .field-grid input:focus, .field-grid select:focus, .entry-controls input:focus, .entry-controls select:focus, .portfolio-value input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(20, 115, 90, .1); }
.number-unit, .input-unit { position: relative; }
.number-unit input, .input-unit input { padding-right: 28px; }
.number-unit span, .input-unit > span { position: absolute; right: 10px; top: 13px; color: var(--subtle); font-size: 9px; pointer-events: none; }
.remove-asset { width: 28px; height: 28px; padding: 0; color: var(--subtle); background: transparent; border: 0; border-radius: 7px; font-size: 18px; line-height: 1; }
.remove-asset:hover { color: var(--red); background: var(--red-soft); }
.weight-summary { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 9px; margin-top: 8px; color: var(--muted); font-size: 9px; }
.weight-summary strong { min-width: 43px; color: var(--primary); text-align: right; font-size: 10px; }
.weight-track { height: 5px; overflow: hidden; background: #e8eeeb; border-radius: 9px; }
.weight-track i { display: block; width: var(--weight-total, 100%); max-width: 100%; height: 100%; background: var(--primary); border-radius: inherit; transition: width .2s ease; }
.weight-summary.invalid strong { color: var(--red); }
.weight-summary.invalid .weight-track i { background: var(--red); }
.inline-tip { margin: 9px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 11px; }
.field-grid label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 9px; }
.advanced { margin-top: 17px; padding: 0 13px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.advanced summary { display: flex; flex-direction: column; gap: 3px; padding: 13px 18px 13px 0; list-style: none; position: relative; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: "＋"; position: absolute; right: 0; top: 15px; color: var(--primary); font-size: 14px; }
.advanced[open] summary::after { content: "−"; }
.advanced summary span { color: var(--ink); font-size: 10px; font-weight: 700; }
.advanced summary small { color: var(--subtle); font-size: 8px; }
.field-grid.compact { padding: 14px 0; border-top: 1px solid var(--line); }
.check-label { flex-direction: row !important; align-items: center; gap: 9px !important; padding: 6px 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.check-label > input { width: 16px; height: 16px; padding: 0; accent-color: var(--primary); }
.check-label > span { display: flex; flex-direction: column; gap: 2px; }
.check-label b { color: var(--ink); font-size: 9px; }
.check-label small { color: var(--subtle); font-size: 8px; }
.cost-note { margin: 0; padding: 0 0 13px; color: var(--subtle); font-size: 8px; line-height: 1.55; }
.discrete-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 16px; }
.discrete-mode .initial-capital-field { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 9px; }
.discrete-mode input[type="number"] { width: 100%; height: 40px; padding: 0 28px 0 10px; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; outline: 0; }
.discrete-mode p { grid-column: 1 / -1; margin: 0; padding: 9px 11px; color: #72591b; background: #fff8dd; border: 1px solid #eee0aa; border-radius: 8px; font-size: 9px; line-height: 1.55; }
.erc-column { display: none !important; }
.risk-column, .cash-strategy-column, .vol-target-column { display: none !important; }
body.erc-mode th.erc-column, body.erc-mode td.erc-column { display: table-cell !important; }
body.erc-mode label.erc-column { display: flex !important; }
body.erc-mode p.erc-column { display: block !important; }
body.risk-mode label.risk-column { display: flex !important; }
body.risk-mode .weight-cap-editor { display: block !important; }
body.cash-strategy-mode label.cash-strategy-column { display: flex !important; }
body.vol-target-mode label.vol-target-column { display: flex !important; }
body.erc-mode .fixed-column { display: none !important; }
body.risk-mode .fixed-column { display: none !important; }

.weight-cap-editor { grid-column: 1 / -1; }
.weight-cap-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.weight-cap-head > span { color: var(--muted); font-size: 11px; }
.weight-cap-head button { padding: 5px 0; color: var(--primary); background: none; border: 0; font-size: 11px; font-weight: 750; }
.weight-cap-rows { display: grid; gap: 8px; margin-top: 8px; }
.weight-cap-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 30px; gap: 9px; align-items: center; }
.weight-cap-row select, .weight-cap-row input { width: 100%; height: 40px; padding: 0 10px; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; outline: 0; font-size: 13px; }
.weight-cap-row select:focus, .weight-cap-row input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(20, 115, 90, .1); }
.remove-weight-cap { width: 30px; height: 30px; padding: 0; color: var(--subtle); background: transparent; border: 0; border-radius: 7px; font-size: 18px; }
.remove-weight-cap:hover { color: var(--red); background: var(--red-soft); }
.weight-cap-editor > small { display: block; margin-top: 7px; color: var(--subtle); font-size: 10px; }

.form-feedback { padding: 0 26px; }
.form-error, .run-status { display: none; margin-top: 16px; padding: 11px 13px; border-radius: 9px; font-size: 10px; line-height: 1.5; }
.form-error.visible { display: block; color: #94393d; background: var(--red-soft); border: 1px solid #f4d4d5; }
.run-status.visible { display: block; color: var(--primary-dark); background: var(--green-soft); border: 1px solid #d7eee3; }
.form-submit {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 16px 26px 20px;
  background: rgba(255, 255, 255, .95);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.form-submit p { margin: 0; color: var(--muted); font-size: 8px; }
.form-submit p i { width: 6px; height: 6px; margin-right: 6px; box-shadow: none; }

.results-panel { min-height: 850px; padding: 28px; overflow: hidden; }
.empty-state, .loading-state { min-height: 790px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state h2, .loading-state h2 { margin: 10px 0 8px; font-size: 24px; letter-spacing: -.025em; }
.empty-state > p, .loading-state p { max-width: 490px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.empty-visual { display: flex; align-items: center; margin-bottom: 24px; }
.empty-visual span { width: 42px; height: 42px; display: grid; place-items: center; color: var(--primary); background: var(--surface-accent); border: 1px solid #cfe6dc; border-radius: 50%; font-size: 11px; font-weight: 800; }
.empty-visual i { width: 38px; height: 1px; background: #cfe0d8; }
.empty-features { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 22px; }
.empty-features span { padding: 6px 9px; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 20px; font-size: 9px; }
.loader { width: 42px; height: 42px; border: 3px solid #e0ebe6; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.loader.small { width: 23px; height: 23px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.result-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 20px; }
.result-header h2 { margin: 6px 0 6px; font-size: 25px; letter-spacing: -.025em; }
.result-header p { margin: 0; color: var(--muted); font-size: 10px; }
.badge { padding: 7px 10px; color: var(--primary-dark); background: var(--surface-accent); border: 1px solid #cfe6dc; border-radius: 20px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.discrete-result { margin-top: 18px; }
.discrete-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.discrete-summary > div { display: flex; flex-direction: column; gap: 5px; padding: 12px; background: var(--surface-soft); border-radius: 9px; }
.discrete-summary span { color: var(--muted); font-size: 9px; }
.discrete-summary strong { font-size: 15px; }
.discrete-table-wrap { overflow-x: auto; }
.discrete-result td:first-child strong, .discrete-result td:first-child small { display: block; }
.discrete-result td:first-child small { margin-top: 3px; color: var(--subtle); font-size: 8px; }
.discrete-result td.positive { color: var(--primary); }
.discrete-result td.negative { color: var(--red); }
.coverage-notice { margin-bottom: 18px; padding: 13px 15px; color: #765a1e; background: #fff9e9; border: 1px solid #f0dfb3; border-radius: 10px; font-size: 9px; line-height: 1.65; }
.coverage-notice details { margin-top: 6px; }
.coverage-notice summary { font-weight: 700; }

.result-tabs {
  position: sticky;
  top: 78px;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin: 0 0 25px;
  padding: 5px;
  background: rgba(241, 246, 244, .95);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(10px);
}
.result-tabs button { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px; color: var(--muted); background: transparent; border: 0; border-radius: 8px; text-align: left; }
.result-tabs button:hover { color: var(--ink); }
.result-tabs button.active { color: var(--primary-dark); background: #fff; box-shadow: 0 2px 9px rgba(24, 58, 47, .08); }
.result-tabs span { font-size: 11px; font-weight: 800; }
.result-tabs small { color: var(--subtle); font-size: 8px; }
.result-view { display: none; animation: view-in .2s ease; }
.result-view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.view-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.view-heading h3 { margin: 0; font-size: 17px; }
.view-heading p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.view-heading > strong { color: var(--primary); font-size: 11px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.metric { min-width: 0; padding: 15px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 11px; }
.metric span { display: block; color: var(--muted); font-size: 9px; }
.metric strong { display: block; margin-top: 8px; font-size: clamp(17px, 1.6vw, 23px); letter-spacing: -.025em; }
.metric strong.positive { color: var(--up); }
.metric strong.negative { color: var(--down); }
.content-card { padding: 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-md); }
.card-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.card-heading h3 { margin: 0; font-size: 13px; }
.card-heading p { margin: 5px 0 0; color: var(--muted); font-size: 8px; line-height: 1.5; }
.headline-value { text-align: right; }
.headline-value span { display: block; color: var(--muted); font-size: 8px; }
.headline-value strong { display: block; margin-top: 3px; color: var(--primary); font-size: 20px; }
.chart-wrap { position: relative; width: 100%; height: 360px; margin-top: 18px; }
.chart-wrap canvas { width: 100%; height: 100%; }
.chart-tooltip { position: absolute; z-index: 5; min-width: 125px; padding: 9px 10px; color: #fff; background: rgba(20, 36, 30, .92); border-radius: 8px; font-size: 9px; line-height: 1.6; transform: translate(-50%, calc(-100% - 9px)); pointer-events: none; box-shadow: var(--shadow-md); }
.explain-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.explain-grid div { padding: 13px 14px; background: var(--surface-soft); border-radius: 10px; }
.explain-grid b { font-size: 10px; }
.explain-grid p { margin: 5px 0 0; color: var(--muted); font-size: 8px; line-height: 1.55; }

.yearly-card { min-height: 580px; }
.yearly-bars { height: 270px; display: flex; align-items: stretch; gap: 8px; padding: 15px 5px 0; overflow-x: auto; }
.year-column { min-width: 46px; flex: 1 0 46px; display: flex; flex-direction: column; }
.year-bar-zone { position: relative; flex: 1; }
.year-zero { position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--line); }
.year-bar { position: absolute; left: 16%; width: 68%; min-height: 3px; border-radius: 4px; }
.year-bar.positive { bottom: 50%; background: linear-gradient(180deg, #dc7377, var(--up)); }
.year-bar.negative { top: 50%; background: linear-gradient(180deg, var(--down), #48af8a); }
.year-value { position: absolute; left: 50%; color: var(--muted); font-size: 8px; white-space: nowrap; transform: translateX(-50%); }
.year-bar.positive .year-value { top: -15px; color: var(--up); }
.year-bar.negative .year-value { bottom: -15px; color: var(--down); }
.year-label { height: 25px; padding-top: 8px; color: var(--muted); text-align: center; font-size: 8px; }
.yearly-table-wrap, .entry-signal-table-wrap { max-height: 300px; overflow: auto; margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; }
.yearly-table { width: 100%; border-collapse: collapse; font-size: 9px; }
.yearly-table th, .yearly-table td { padding: 10px 11px; border-bottom: 1px solid #edf1ef; text-align: right; white-space: nowrap; }
.yearly-table th:first-child, .yearly-table td:first-child { text-align: left; }
.yearly-table tr:last-child td { border-bottom: 0; }
.yearly-table th { position: sticky; top: 0; z-index: 2; color: var(--muted); background: #f8faf9; font-weight: 700; }
.yearly-table .gain { color: var(--up); font-weight: 800; }
.yearly-table .loss { color: var(--down); font-weight: 800; }
.partial-tag { padding: 3px 6px; color: #85651f; background: #fff4d5; border-radius: 12px; }

.result-columns { display: grid; grid-template-columns: 1fr; gap: 14px; min-width: 0; align-items: start; }
.result-columns > * { min-width: 0; }
.weight-bars { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }
.weight-row { display: grid; grid-template-columns: minmax(75px, 1fr) 1.7fr 47px; align-items: center; gap: 9px; font-size: 9px; }
.weight-row label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weight-row strong { text-align: right; font-size: 9px; }
.bar-track { height: 7px; overflow: hidden; background: #e9eeec; border-radius: 8px; }
.bar-track i { display: block; height: 100%; border-radius: inherit; }
.portfolio-value { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; color: var(--muted); font-size: 9px; }
.portfolio-value > div { position: relative; width: 150px; }
.portfolio-value > div span { position: absolute; left: 10px; top: 12px; color: var(--subtle); }
.portfolio-value input { padding-left: 25px; text-align: right; }
.live-control { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.live-control > div { display: flex; flex-direction: column; gap: 3px; }
.live-control strong { font-size: 13px; }
.live-control small { color: var(--muted); font-size: 11px; }
.live-actions { display: flex !important; flex-direction: row !important; gap: 7px !important; }
.live-control button { min-width: 104px; padding: 10px 14px; font-size: 11px; }
.live-control button:disabled { cursor: wait; opacity: .65; }
.live-allocation { margin-top: 12px; padding: 11px; overflow-x: auto; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
.live-message { margin: 0; color: var(--muted); font-size: 9px; }
.live-message.error { color: var(--red); }
.live-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 360px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.live-status span { color: #85651f; font-size: 9px; font-weight: 800; }
.live-status.open span { color: var(--primary); }
.live-status small { color: var(--subtle); text-align: right; font-size: 8px; }
.live-head, .live-row { display: grid; grid-template-columns: minmax(82px, 1fr) 55px 55px 70px 67px; align-items: center; gap: 6px; min-width: 360px; }
.live-head { padding: 9px 0 5px; color: var(--subtle); font-size: 7px; text-align: right; }
.live-head span:first-child { text-align: left; }
.live-row { min-height: 36px; border-bottom: 1px solid #e7ecea; font-size: 8px; text-align: right; }
.live-row:last-of-type { border-bottom: 0; }
.live-row .asset { overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.live-row .asset small { display: block; margin-top: 2px; color: var(--subtle); }
.live-row strong { color: var(--primary); }
.live-row b { font-size: 8px; }
.live-rebalance-head, .live-rebalance-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(100px, .75fr) minmax(100px, .75fr) minmax(105px, .7fr) minmax(180px, 1.25fr); align-items: center; gap: 12px; }
.live-rebalance-head { padding: 12px 8px 7px; color: var(--subtle); font-size: 10px; text-align: right; }
.live-rebalance-head span:first-child { text-align: left; }
.live-rebalance-row { min-height: 66px; padding: 6px 8px; border-bottom: 1px solid #e7ecea; font-size: 12px; text-align: right; }
.live-rebalance-row .asset { text-align: left; }
.live-rebalance-row small { display: block; margin-top: 4px; color: var(--subtle); font-size: 10px; }
.live-rebalance-row .trade-advice { text-align: left; }
.live-rebalance-row .trade-advice b { display: block; font-size: 13px; }
.live-rebalance-row .trade-advice .buy { color: var(--up); }
.live-rebalance-row .trade-advice .sell { color: var(--down); }
.trade-table-wrap { max-height: 235px; overflow: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 9px; }
.trade-table { width: 100%; border-collapse: collapse; font-size: 9px; }
.trade-table th, .trade-table td { padding: 9px 10px; border-bottom: 1px solid #edf1ef; text-align: right; white-space: nowrap; }
.trade-table th:first-child, .trade-table td:first-child { text-align: left; }
.trade-table th { position: sticky; top: 0; color: var(--muted); background: #f8faf9; font-weight: 700; }
.trade-row { cursor: pointer; }
.trade-row:hover td { background: #f4f9f7; }
.trade-row.selected td { color: var(--primary-dark); background: var(--surface-accent); font-weight: 800; }
.trade-detail { margin-top: 16px; padding-top: 15px; border-top: 1px solid var(--line); }
.trade-detail-header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 9px; color: var(--muted); font-size: 8px; }
.trade-detail-header strong { color: var(--ink); }
.trade-action { display: grid; grid-template-columns: minmax(78px, 1fr) 48px 48px 70px 72px; align-items: center; gap: 6px; min-height: 40px; border-bottom: 1px solid #edf1ef; font-size: 8px; }
.trade-action:last-child { border-bottom: 0; }
.trade-action .asset { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-action .asset small { display: block; margin-top: 2px; color: var(--subtle); }
.trade-action .numeric, .trade-action .amount { text-align: right; }
.trade-action .numeric { color: var(--muted); }
.trade-action .amount { font-weight: 800; }
.trade-action .action { padding: 4px; border-radius: 5px; text-align: center; font-weight: 800; white-space: nowrap; }
.trade-action .action.buy { color: #a83d41; background: var(--red-soft); }
.trade-action .action.sell { color: var(--primary); background: var(--green-soft); }
.trade-action .action.hold { color: var(--muted); background: #eff2f1; }
.trade-detail-note { margin: 9px 0 0; color: var(--muted); font-size: 8px; line-height: 1.55; }

.holdings-card { grid-column: 1 / -1; }
.holding-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.holding-presets button { padding: 6px 9px; color: var(--primary-dark); background: var(--surface-accent); border: 1px solid #cfe4dc; border-radius: 7px; font-size: 8px; font-weight: 700; }
.holding-presets button:hover { border-color: var(--primary); }
.holding-cash { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-top: 13px; padding: 12px; background: var(--surface-soft); border-radius: 8px; }
.holding-cash label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 8px; }
.holding-cash label > div { position: relative; width: 160px; }
.holding-cash label > div > span { position: absolute; left: 10px; top: 12px; color: var(--subtle); }
.holding-cash input { padding-left: 25px; text-align: right; }
.holding-cash p { margin: 0; color: var(--muted); font-size: 8px; }
.holding-rows { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.holding-row { display: grid; grid-template-columns: minmax(95px, 1.2fr) minmax(110px, 1.25fr) 65px 75px 90px 85px minmax(90px, 1fr) 45px 26px; align-items: end; gap: 7px; padding: 10px; background: #fbfcfb; border: 1px solid var(--line); border-radius: 8px; }
.holding-row label { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: var(--muted); font-size: 7px; }
.holding-row input, .holding-row select { width: 100%; height: 34px; padding: 7px 8px; color: var(--ink); background: var(--surface-soft); border: 1px solid transparent; border-radius: 7px; outline: 0; font-size: 8px; }
.holding-row input:focus, .holding-row select:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(20, 115, 90, .1); }
.holding-row .disabled-field { opacity: .42; }
.holding-tradable { align-items: center; }
.holding-tradable input { width: 17px; height: 34px; padding: 0; accent-color: var(--primary); }
.remove-holding { width: 26px; height: 34px; padding: 0; color: var(--subtle); background: transparent; border: 0; border-radius: 6px; font-size: 17px; }
.remove-holding:hover { color: var(--red); background: var(--red-soft); }
.holding-empty { margin-top: 12px; padding: 13px; color: var(--muted); background: var(--surface-soft); border: 1px dashed var(--line-strong); border-radius: 8px; font-size: 8px; }
.holding-submit { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 13px; }
.holding-submit p { margin: 0; color: var(--subtle); font-size: 8px; }
.holding-submit button { width: auto; padding: 9px 13px; font-size: 9px; }
.holding-submit button:disabled { cursor: wait; opacity: .65; }
.holding-result { margin-top: 14px; overflow-x: auto; border-top: 1px solid var(--line); padding-top: 14px; }
.holding-result-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; min-width: 620px; }
.holding-result-summary > div { padding: 10px; background: var(--surface-soft); border-radius: 7px; }
.holding-result-summary span, .exposure-row span { display: block; color: var(--muted); font-size: 7px; }
.holding-result-summary strong { display: block; margin-top: 4px; font-size: 10px; }
.exposure-head, .exposure-row { display: grid; grid-template-columns: minmax(110px, 1.2fr) 90px 90px 105px minmax(180px, 1.4fr); align-items: center; gap: 8px; min-width: 620px; }
.exposure-head { padding: 12px 8px 6px; color: var(--subtle); font-size: 7px; text-align: right; }
.exposure-head span:first-child { text-align: left; }
.exposure-row { min-height: 58px; padding: 7px 8px; border-bottom: 1px solid #e8edeb; font-size: 8px; text-align: right; }
.exposure-row .asset { overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.exposure-row .asset small, .exposure-row div small { display: block; margin-top: 3px; color: var(--subtle); font-size: 7px; }
.exposure-row .gap.buy strong { color: #a83d41; }
.exposure-row .gap.sell strong { color: var(--primary); }
.exposure-row .advice { text-align: left; }
.holding-warning { color: var(--red) !important; }
.holding-warning-note { margin: 10px 0 0; color: var(--red); font-size: 8px; }
.holding-values { min-width: 620px; margin-top: 10px; color: var(--muted); font-size: 8px; }
.holding-values summary { cursor: pointer; color: var(--primary); font-weight: 700; }
.holding-values > div { display: grid; grid-template-columns: 1fr 2fr 90px; gap: 8px; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.holding-values > div strong { text-align: right; }

.entry-card { padding: 3px 1px; }
.entry-hero { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 25px; color: #fff; background: linear-gradient(135deg, #143c31, #17634e); border-radius: 15px; }
.entry-hero .eyebrow { color: #88d2b8; }
.entry-hero h3 { margin: 7px 0 7px; font-size: 20px; }
.entry-hero p { max-width: 620px; margin: 0; color: rgba(255, 255, 255, .72); font-size: 9px; line-height: 1.65; }
.entry-hero p strong { color: #fff; }
.analysis-button { flex: 0 0 auto; padding: 11px 16px; color: var(--primary-dark); background: #fff; font-size: 10px; box-shadow: 0 7px 18px rgba(0, 0, 0, .12); }
.analysis-button:hover { transform: translateY(-1px); }
.analysis-button:disabled { cursor: wait; opacity: .65; transform: none; }
.entry-flow { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0; padding: 10px; color: var(--muted); background: var(--surface-soft); border-radius: 9px; font-size: 8px; }
.entry-flow span { padding: 4px 8px; color: var(--primary-dark); background: #fff; border: 1px solid var(--line); border-radius: 20px; }
.entry-flow i { color: var(--subtle); font-style: normal; }
.entry-controls { display: grid; grid-template-columns: 1.2fr 1.2fr .7fr; gap: 11px; margin-top: 15px; }
.entry-controls label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 9px; }
.entry-controls label > div { position: relative; }
.entry-controls label > div input { padding-right: 28px; }
.entry-controls label > div span { position: absolute; right: 10px; top: 13px; color: var(--subtle); font-size: 9px; }
.entry-empty { margin-top: 14px; padding: 16px 18px; color: var(--muted); background: var(--surface-soft); border: 1px dashed var(--line-strong); border-radius: 10px; font-size: 9px; line-height: 1.65; }
.entry-empty strong { display: block; margin-bottom: 4px; color: var(--ink); }
.entry-loading { min-height: 120px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 9px; }
.entry-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 17px; }
.entry-summary > div { padding: 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.entry-summary span { display: block; color: var(--muted); font-size: 8px; }
.entry-summary strong { display: block; margin-top: 6px; font-size: 14px; }
.entry-chart-card { margin-top: 13px; }
.entry-chart-wrap { height: 310px; }
.entry-extremes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 13px; }
.entry-extremes > div { padding: 15px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; }
.entry-extremes h4 { margin: 0 0 9px; font-size: 10px; }
.entry-rank-row { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 8px; }
.entry-rank-row:last-child { border-bottom: 0; }
.entry-rank-row strong.gain { color: var(--up); }
.entry-rank-row strong.loss { color: var(--down); }
.entry-signal-table-wrap { max-height: 330px; }
.entry-note { margin: 11px 2px 0; color: var(--muted); font-size: 8px; line-height: 1.55; }

@media (max-width: 1240px) {
  .topbar { grid-template-columns: 1fr auto; }
  .top-nav { display: none; }
  .workspace { grid-template-columns: minmax(400px, 460px) minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .result-columns { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .welcome { align-items: start; }
  .rule-strip { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .results-panel { min-height: 600px; }
  .empty-state, .loading-state { min-height: 540px; }
  .result-columns { grid-template-columns: minmax(240px, .8fr) minmax(400px, 1.2fr); }
  .holding-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .holding-row .remove-holding { align-self: end; }
}

@media (max-width: 720px) {
  html { scroll-padding-top: 68px; }
  .topbar { height: 60px; padding: 0 15px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-copy small, .status-dot { display: none; }
  .top-actions { gap: 7px; }
  .button.secondary { padding: 8px 10px; }
  .app-main { padding: 0 12px 42px; }
  .welcome { padding: 27px 4px 20px; }
  .welcome h1 { font-size: 28px; }
  .welcome p { font-size: 11px; }
  .control-panel, .results-panel { border-radius: 15px; }
  .panel-intro { padding: 21px 18px 14px; }
  .panel-intro h2 { font-size: 18px; }
  .draft-label { display: none; }
  .step-rail { margin: 0 18px; }
  .panel-section { margin: 0 18px; padding: 22px 0; }
  .strategy-switch { grid-template-columns: 1fr; }
  .strategy-switch label > span { min-height: 78px; display: grid; grid-template-columns: auto 1fr; column-gap: 9px; align-items: center; }
  .strategy-switch span i { grid-row: span 2; margin: 0; }
  .strategy-switch span small { margin-top: 2px; }

  .asset-table { display: block; border-spacing: 0; }
  .asset-table thead { display: none; }
  .asset-table tbody { display: flex; flex-direction: column; gap: 10px; }
  .asset-table tr { position: relative; display: grid; grid-template-columns: 84px 1fr 34px; gap: 8px; padding: 11px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 11px; }
  .asset-table td { display: block; padding: 0; }
  .asset-table td:nth-child(1) { grid-column: 1; }
  .asset-table td:nth-child(2) { grid-column: 2; }
  .asset-table td:nth-child(3) { grid-column: 1 / span 2; }
  .asset-table td:nth-child(4), .asset-table td:nth-child(5) { grid-column: 1 / span 2; }
  .asset-table td:last-child { grid-column: 3; grid-row: 1; align-self: center; }
  .asset-table td:nth-child(3)::before, .asset-table td:nth-child(4)::before, .asset-table td:nth-child(5)::before { display: block; margin: 3px 0 5px; color: var(--subtle); font-size: 8px; }
  .asset-table td:nth-child(3)::before { content: "标的名称"; }
  .asset-table td:nth-child(4)::before { content: "目标权重"; }
  .asset-table td:nth-child(5)::before { content: "风险预算"; }
  .asset-symbol-field small { font-size: 9px; }
  body.erc-mode td.erc-column { display: block !important; }
  .weight-summary { grid-template-columns: 1fr auto; }
  .weight-summary .weight-track { grid-column: 1 / -1; }
  .field-grid { grid-template-columns: 1fr; }
  .form-feedback { padding: 0 18px; }
  .form-submit { padding: 14px 18px 17px; }
  .form-submit p { display: none; }
  .button.primary { width: 100%; }
  .holding-cash, .holding-submit { align-items: stretch; flex-direction: column; }
  .holding-cash label > div { width: 100%; }
  .holding-row { grid-template-columns: 1fr 1fr; }
  .holding-submit button { width: 100%; }

  .results-panel { padding: 18px 14px; }
  .empty-state, .loading-state { min-height: 460px; }
  .empty-state h2, .loading-state h2 { font-size: 21px; }
  .result-header { padding: 4px 3px 16px; }
  .result-header h2 { font-size: 21px; }
  .result-tabs { top: 68px; grid-template-columns: repeat(4, minmax(68px, 1fr)); overflow-x: auto; }
  .result-tabs button { min-width: 68px; padding: 9px 7px; text-align: center; }
  .result-tabs small { display: none; }
  .metric-grid { gap: 7px; }
  .metric { padding: 13px 11px; }
  .metric strong { font-size: 18px; }
  .content-card { padding: 15px 12px; }
  .chart-wrap { height: 290px; }
  .explain-grid { grid-template-columns: 1fr; }
  .yearly-card { min-height: 500px; }
  .yearly-bars { height: 235px; }
  .result-columns { grid-template-columns: 1fr; }
  .trade-action { grid-template-columns: minmax(72px, 1fr) 62px 68px; }
  .trade-action .numeric { display: none; }
  .entry-hero { align-items: start; padding: 20px 17px; }
  .entry-hero h3 { font-size: 18px; }
  .entry-hero p { font-size: 8px; }
  .entry-flow { justify-content: start; overflow-x: auto; }
  .entry-flow span { flex: 0 0 auto; }
  .entry-controls { grid-template-columns: 1fr; }
  .entry-summary { grid-template-columns: 1fr 1fr; gap: 7px; }
  .entry-extremes { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .entry-hero { flex-direction: column; gap: 15px; }
  .analysis-button { width: 100%; }
  .entry-summary { grid-template-columns: 1fr; }
  .card-heading { gap: 10px; }
  .headline-value { min-width: 60px; }
}

/* Readability pass: the original 7–10px desktop type was too small. */
body { font-size: 14px; }
.sidebar-brand strong { font-size: 15px; }
.sidebar-brand small, .sidebar-label, .sidebar-item b, .sidebar-privacy p { font-size: 10px; }
.sidebar-item { font-size: 13px; }
.sidebar-privacy b { font-size: 11px; }
.unified-topbar > div:first-child, .portfolio-hero p, .page-heading p { font-size: 12px; }
.sync-status { font-size: 11px; }
.hero-pills span, .verified-badge, .dashboard-card-head > span { font-size: 10px; }
.portfolio-warnings, .dashboard-card-head p, .wealth-meta,
.distribution-heading, .distribution-row, .bridge-visual,
.mapping-summary-row { font-size: 11px; }
.portfolio-warnings strong { font-size: 12px; }
.dashboard-card-head h2 { font-size: 16px; }
.dashboard-card-head button { font-size: 11px; }
.metric-strip span { font-size: 10px; }
.metric-strip strong { font-size: 15px; }

.portfolio-table th { font-size: 10px; }
.portfolio-table td { font-size: 12px; }
.portfolio-asset > span, .portfolio-asset small, .type-tag, .status-tag { font-size: 10px; }
.portfolio-asset b, .activity-row b, .activity-row > strong { font-size: 12px; }
.activity-row small { font-size: 10px; }

.ios-chart-head h2 { font-size: 18px; }
.ios-chart-head p, .ios-chart-head span { font-size: 11px; }
.ios-chart-head strong { font-size: 15px; }
.chart-scope-switch button, .holding-periods button, .holding-chart-loading { font-size: 12px; }
.holding-chart-tooltip { min-width: 145px; font-size: 10px; }
.holding-chart-tooltip strong { font-size: 12px; }
.holding-chart-dates { font-size: 10px; }
.ios-holding-section { padding: 20px 22px 7px; }
.ios-section-head h2 { font-size: 19px; }
.ios-section-head strong { font-size: 15px; }
.ios-holding-columns { font-size: 11px; }
.ios-holding-row { min-height: 86px; }
.ios-holding-name b { font-size: 15px; }
.ios-holding-name small { font-size: 12px; }
.ios-holding-stat b { font-size: 15px; }
.ios-holding-stat small { font-size: 12px; }
.ios-balance-row { min-height: 78px; }
.ios-balance-row > strong { font-size: 15px; }
.raw-holdings-details > summary { font-size: 12px; }

.asset-detail-nav button, .asset-detail-title p, .asset-detail-pnl,
.asset-update-line > span, .asset-detail-section-head p { font-size: 11px; }
.asset-platform-filters button, .asset-update-line > small { font-size: 10px; }
.asset-price-row > span, .asset-stat-grid span { font-size: 11px; }
.asset-stat-grid strong { font-size: 14px; }
.asset-detail-section-head h3 { font-size: 16px; }
.asset-transaction-row b, .asset-transaction-row > strong { font-size: 12px; }
.asset-transaction-row span { font-size: 11px; }
.asset-transaction-row small { font-size: 10px; }

.transaction-field, .settings-field, .transaction-filters span,
.tx-total-preview, .import-problem, .import-mapping-row,
.settings-message, .source-row { font-size: 11px; }
.transaction-field input, .transaction-field select,
.transaction-filters select, .settings-field input { font-size: 13px; }
.transaction-field small, .tx-asset-snapshot, .tx-current-position,
.tx-implied-preview div span, .file-drop span, .file-drop small,
.replace-warning p, .settings-field small, .security-note p,
.source-row small { font-size: 10px; }
.tx-type-buttons button, .tx-mode-buttons button, .tx-implied-preview .error,
.import-step p, .import-idle p, .replace-warning strong,
.source-state, .security-note b { font-size: 11px; }
.tx-implied-preview div b, .file-drop b, .import-result-card h3 { font-size: 12px; }
.import-step > b { font-size: 11px; }
.import-step h2, .import-idle h2, .settings-source-head h2 { font-size: 16px; }
.settings-source-head p { font-size: 11px; }

.eyebrow, .panel-kicker, .step-rail a, .draft-label { font-size: 12px; }
.rule-strip span, .section-heading p, .inline-tip, .field-grid label,
.weight-summary, .advanced summary small, .cost-note,
.coverage-notice, .result-header p, .view-heading p { font-size: 11px; }
.rule-strip strong, .step-rail b, .step-number, .advanced summary span,
.check-label b, .form-submit p, .badge, .result-tabs small { font-size: 12px; }
.section-heading h3 { font-size: 17px; }
.strategy-switch span i { font-size: 10px; }
.strategy-switch span b { font-size: 14px; }
.strategy-switch span small { font-size: 11px; }
.asset-table th { font-size: 10px; }
.asset-table input, .asset-table select, .field-grid input,
.entry-controls input, .entry-controls select, .portfolio-value input { font-size: 13px; }
.asset-table select, .number-unit span, .input-unit > span { font-size: 11px; }
.weight-summary strong { font-size: 12px; }
.form-error, .run-status { font-size: 12px; }
.result-tabs span { font-size: 13px; }
.view-heading > strong { font-size: 13px; }
.metric span, .card-heading p, .explain-grid p,
.year-label, .live-control small, .live-message,
.live-status small, .live-head, .live-row, .trade-table,
.trade-detail-header, .trade-action, .trade-detail-note,
.holding-cash label, .holding-cash p, .holding-row label,
.holding-empty, .holding-submit p, .holding-result-summary span,
.exposure-row span, .exposure-head, .exposure-row,
.holding-values, .entry-summary span, .entry-rank-row,
.entry-note { font-size: 11px; }
.card-heading h3, .explain-grid b, .live-control strong,
.holding-result-summary strong, .entry-extremes h4 { font-size: 13px; }
.yearly-table { font-size: 12px; }
.live-row b { font-size: 11px; }
.holding-row input, .holding-row select { font-size: 12px; }
.entry-hero p, .entry-flow, .entry-controls label,
.entry-controls label > div span, .entry-empty, .entry-loading { font-size: 12px; }

@media (max-width: 720px) {
  .ios-holding-columns { display: none; }
  .ios-holding-row { grid-template-columns: minmax(135px, 1fr) 92px 92px; gap: 9px; }
  .portfolio-table td { font-size: 11px; }
  .entry-hero p { font-size: 11px; }
}
