:root{--ink:#172e3a;--muted:#5e706f;--green:#176b59;--green-dark:#105544;--line:#dde4de;--cream:#f6f7f2;--surface:#fff;--soft:#edf4ef;--error:#8b302d;--error-bg:#fff2ef;--warning:#735521;--warning-bg:#fff8e9;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans JP","Yu Gothic",Meiryo,sans-serif;color:var(--ink);background:var(--cream);font-synthesis:none}
*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}button,select,input[type=file]{cursor:pointer}button{border:0}a{color:var(--green)}h1,h2,h3,p{margin:0}h2{font-size:21px;line-height:1.5;letter-spacing:.01em}h3{font-size:16px}p{line-height:1.8}button:focus-visible,select:focus-visible,input:focus-visible,a:focus-visible,summary:focus-visible,[tabindex]:focus-visible{outline:3px solid #db963b;outline-offset:4px}[hidden]{display:none!important}.site-header{height:90px;background:rgba(255,255,255,.8);border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 max(28px,calc((100vw - 1216px)/2))}.brand{display:flex;align-items:center;gap:13px;font-size:18px;font-weight:750;letter-spacing:.05em}.brand small{display:block;font-size:10px;letter-spacing:.08em;font-weight:500;margin-top:3px;color:var(--muted)}.brand-mark{display:flex;gap:4px;align-items:flex-end;height:32px;width:33px}.brand-mark span{display:block;width:8px;background:var(--green);border-radius:2px 2px 0 0}.brand-mark span:nth-child(1){height:15px;opacity:.4}.brand-mark span:nth-child(2){height:23px;opacity:.7}.brand-mark span:nth-child(3){height:32px}.version-label{font-size:12px;color:var(--muted)}.page-shell{max-width:1272px;margin:auto;padding:51px 28px 0}.page-heading{margin-bottom:34px}.eyebrow,.section-kicker{font-size:10px;letter-spacing:.18em;font-weight:750;color:var(--green)}h1{font-size:38px;line-height:1.35;font-weight:750;letter-spacing:.035em;margin:12px 0 17px}.lead{font-size:14px;color:var(--muted);line-height:1.9}.workspace{display:grid;grid-template-columns:minmax(0,1fr) 282px;gap:28px;align-items:start}.panel{background:var(--surface);border:1px solid var(--line);border-radius:15px;padding:28px;box-shadow:0 5px 18px rgba(27,58,48,.025)}.panel-heading{display:flex;gap:16px;align-items:center;justify-content:space-between;margin-bottom:24px}.section-kicker{font-size:9px;margin-bottom:7px}.tag{font-size:11px;font-weight:650;color:var(--green);background:var(--soft);padding:6px 10px;border-radius:6px;white-space:nowrap}.tag.needs-attention{background:var(--warning-bg);color:var(--warning)}.drop-zone{border:1.5px dashed #b5c9bc;background:#f7faf6;border-radius:10px;padding:28px 20px 24px;text-align:center;transition:background .15s,border-color .15s}.drop-zone.drag-over{background:#e5f2e8;border-color:var(--green)}.upload-icon{color:var(--green);margin-bottom:8px}.drop-title{font-size:16px;font-weight:700}.drop-description{font-size:12px;color:var(--muted);margin-top:4px}.button{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;border-radius:7px;padding:11px 19px;line-height:1.5;font-size:13px;font-weight:650;text-align:center;transition:background .15s,color .15s;cursor:pointer;white-space:nowrap}.primary{background:var(--green);color:white}.primary:hover:not(:disabled){background:var(--green-dark)}.button:disabled{opacity:.45;cursor:not-allowed}.secondary{background:white;border:1px solid #c8d7cd;color:var(--green)}.secondary:hover{background:var(--soft)}.text-button{background:transparent;color:var(--muted);padding:6px 8px;font-size:12px}.text-button:hover{background:var(--soft);color:var(--green)}.file-picker{position:relative;margin-top:18px;overflow:hidden}.file-picker:focus-within{outline:3px solid #db963b;outline-offset:4px}.file-picker input{position:absolute;inset:0;opacity:0;width:100%;height:100%;font-size:0}.fine-print{font-size:10px;color:var(--muted);margin-top:11px}.file-options{display:flex;align-items:start;justify-content:space-between;gap:24px;margin-top:20px}.field-label,label:not(.button){display:block;font-size:11px;color:var(--muted);margin-bottom:7px}.file-info{min-width:0;padding-top:2px}.file-info strong{font-size:12px;display:block;overflow-wrap:anywhere;font-weight:550}.encoding-control{flex:0 0 140px}select,input[type=search]{width:100%;border:1px solid #ced9d1;border-radius:6px;color:var(--ink);background:white;min-height:42px;padding:8px 32px 8px 12px;font-size:12px}input[type=search]{padding-right:12px}#encoding-status{margin-top:5px;min-height:0}.small{font-size:11px}.subtle{color:var(--muted)}.demo-section{margin-top:23px;padding-top:22px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:13px}.demo-section strong{font-size:12px}.demo-section p{font-size:11px;color:var(--muted);margin-top:3px}.demo-actions{display:flex;gap:10px}.demo-actions select{max-width:220px}.status:empty{display:none}.status{font-size:12px;color:var(--green);margin-top:17px;line-height:1.8}.sidebar{padding-top:5px}.guide-card{padding:17px 6px 0 6px}.guide-card h2{font-size:17px;margin-top:4px}.steps{padding:0;list-style:none;display:flex;flex-direction:column;gap:24px;margin:23px 0 0}.steps li{display:flex;gap:13px}.step-number{display:flex;align-items:center;justify-content:center;flex:0 0 27px;height:27px;color:var(--green);background:#e5eee6;border-radius:50%;font-size:11px;font-weight:700}.steps strong{font-size:12px;display:block;margin-top:3px}.steps p{font-size:11px;margin-top:6px;color:var(--muted);line-height:1.85}.storage-note{border-top:1px solid #d8e0d5;margin:27px 6px 0;padding-top:23px}.storage-note h2{font-size:12px;margin-bottom:10px}.storage-note p{font-size:11px;color:var(--muted);line-height:1.9;margin-top:8px}.analysis-panel,.holdings-panel{margin-top:28px}.notice{padding:13px 15px;border-radius:7px;font-size:12px;line-height:1.8;margin:15px 0}.notice ul{margin:0;padding-left:18px}.notice li+li{margin-top:4px}.notice.error{background:var(--error-bg);color:var(--error);border:1px solid #f2d5cf}.notice.warning{background:var(--warning-bg);color:var(--warning);border:1px solid #eddfb9}.demo-notice{background:#eef3fb;color:#40567c;border:1px solid #d9e2f0}.mapping-box{border:1px solid var(--line);border-radius:8px;margin:12px 0;background:#fbfcfa}.mapping-box>summary{padding:15px 17px;cursor:pointer;font-size:12px;font-weight:650;line-height:1.8}.mapping-description{padding:0 17px 14px;font-size:11px;color:var(--muted)}.mapping-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 20px;padding:0 17px 20px}.mapping-field{min-width:0}.mapping-field label{font-size:12px;font-weight:600;color:var(--ink)}.required-label{font-size:10px;color:var(--muted);font-weight:400;margin-left:7px}.mapping-field select{font-size:11px;max-width:100%}.mapping-field.unresolved select{border-color:#b88737;background:#fffdf7}.mapping-note{font-size:10px;color:var(--warning);margin-top:6px}.preview-heading{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-top:25px;margin-bottom:12px}.preview-heading h3{font-size:13px}.table-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:7px;scrollbar-width:thin}.table-wrap:empty{display:none}table{border-collapse:collapse;width:100%;min-width:715px;font-size:12px;text-align:left}th{color:var(--muted);font-weight:550;font-size:10px;background:#f7f9f5;padding:12px 15px;white-space:nowrap;border-bottom:1px solid var(--line)}td{padding:14px 15px;border-bottom:1px solid #ebefe8;vertical-align:middle;line-height:1.6}tbody tr:last-child td{border-bottom:none}tbody tr:hover{background:#fbfcfa}th.numeric,td.numeric{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}.stock-name{font-weight:650;font-size:12px;display:block}.stock-code{display:block;color:var(--muted);font-size:10px;margin-top:2px}.account-label{display:inline-block;max-width:140px;padding:4px 7px;font-size:10px;background:#f0f4ef;border-radius:4px;color:#526853;white-space:nowrap}.calculated-label{display:block;color:var(--muted);font-size:9px;font-weight:400}.table-message{padding:23px;font-size:12px;color:var(--muted);text-align:center}.import-footer{margin-top:20px;display:flex;gap:25px;align-items:center;justify-content:space-between}.import-footer p{max-width:570px}.holdings-panel{margin-bottom:34px}.empty-state{padding:25px 20px 35px;text-align:center}.empty-state h3{font-size:14px;margin-top:15px;font-weight:600}.empty-state p{font-size:12px;color:var(--muted);margin-top:9px}.empty-chart{display:inline-flex;align-items:flex-end;gap:5px;height:35px}.empty-chart span{width:10px;background:#dbe7d9;border-radius:2px 2px 0 0}.empty-chart span:nth-child(1){height:12px}.empty-chart span:nth-child(2){height:22px}.empty-chart span:nth-child(3){height:17px}.empty-chart span:nth-child(4){height:34px;background:#a4c5b3}.holdings-summary{display:grid;grid-template-columns:1fr 1.8fr;gap:25px;padding:4px 0 25px;border-bottom:1px solid var(--line);margin-bottom:22px}.holdings-summary>div+div{border-left:1px solid var(--line);padding-left:30px}.holdings-summary strong{display:block;font-size:28px;font-weight:650;letter-spacing:-.025em;line-height:1.5;font-variant-numeric:tabular-nums}.holdings-summary strong span{font-size:13px;margin-left:7px;font-weight:500}.holdings-summary p{margin-top:4px}.filter-row{display:flex;gap:16px;margin-bottom:18px}.search-field{flex:1}.account-field{width:230px;max-width:45%}.source-note{margin-top:14px;overflow-wrap:anywhere}.page-footer{display:flex;justify-content:space-between;color:#7d8980;font-size:10px;border-top:1px solid var(--line);padding:20px 0 30px}.mobile-only{display:none}.skip-link{position:absolute;left:18px;top:-80px;background:white;padding:10px;z-index:5}.skip-link:focus{top:12px}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(min-width:1400px){.page-shell{padding-top:59px}.page-heading{margin-bottom:39px}}
@media(max-width:1000px){.workspace{grid-template-columns:minmax(0,1fr) 235px;gap:22px}.panel{padding:23px}.site-header{padding:0 26px}.page-shell{padding-left:26px;padding-right:26px}.mapping-grid{gap:14px}}
@media(max-width:760px){.site-header{height:76px;padding:0 20px}.brand{font-size:16px;gap:10px}.brand small{font-size:9px}.brand-mark{transform:scale(.9);transform-origin:left center;width:30px}.version-label{font-size:10px}.page-shell{padding:33px 18px 0}.page-heading{margin-bottom:25px}h1{font-size:31px;margin-top:11px;margin-bottom:14px}.lead{font-size:12px;line-height:1.9}.workspace{display:flex;flex-direction:column;gap:22px}.import-panel{width:100%}.panel{padding:20px;border-radius:11px}.panel-heading{margin-bottom:19px}h2{font-size:18px}.drop-zone{padding:24px 14px 21px}.sidebar{width:100%;display:grid;grid-template-columns:1.2fr 1fr;gap:20px;padding:0 4px}.guide-card{padding:0}.guide-card .section-kicker{display:none}.guide-card h2{font-size:13px}.steps{gap:15px;margin-top:16px}.steps li{gap:9px}.step-number{flex-basis:22px;height:22px;font-size:10px}.steps strong{font-size:11px;margin-top:1px}.steps p{font-size:10px;margin-top:3px}.storage-note{border-top:0;border-left:1px solid var(--line);margin:0;padding:0 0 0 17px}.storage-note h2{font-size:11px}.storage-note p{font-size:10px;margin-top:5px}.analysis-panel,.holdings-panel{margin-top:24px}.desktop-only{display:none}.analysis-panel .panel-heading{gap:9px}.analysis-panel .tag{white-space:normal;text-align:center;font-size:10px}.mapping-grid{grid-template-columns:1fr}.preview-heading{align-items:start;flex-direction:column;gap:5px}.import-footer{flex-direction:column;gap:13px;align-items:stretch}.import-footer .button{width:100%}.holdings-summary{grid-template-columns:.8fr 1.2fr;gap:16px}.holdings-summary>div+div{padding-left:18px}.holdings-summary strong{font-size:23px}.holdings-summary .small{font-size:10px}.filter-row{gap:10px}.account-field{width:145px}.holdings-panel .panel-heading{gap:7px}.holdings-panel .text-button{font-size:10px;min-height:40px}.empty-state{padding:20px 4px 26px}.empty-state h3{font-size:12px}.empty-state p{font-size:11px}.page-footer{font-size:9px;padding-bottom:24px}.fine-print{font-size:9px}}
@media(max-width:420px){.mobile-only{display:block}h1{line-height:1.45}.version-label{display:none}.page-shell{padding-left:14px;padding-right:14px}.panel{padding:17px}.file-options{gap:13px;flex-wrap:wrap}.file-info{flex:1;min-width:140px}.encoding-control{flex-basis:122px}.demo-actions{flex-direction:column}.demo-actions select{max-width:none}.demo-actions .button{width:100%}.sidebar{grid-template-columns:1fr;gap:18px;padding:0 4px}.steps{display:flex;flex-direction:column;gap:12px}.steps p{font-size:11px}.storage-note{border-left:none;border-top:1px solid var(--line);padding:16px 0 0}.storage-note p{font-size:11px}.holdings-summary{grid-template-columns:1fr;gap:16px}.holdings-summary>div+div{border-left:0;border-top:1px solid var(--line);padding:14px 0 0}.holdings-summary strong{font-size:27px}.filter-row{flex-direction:column}.account-field{width:100%;max-width:none}.mapping-box>summary{padding:12px}.mapping-grid{padding:0 12px 15px}.mapping-description{padding-left:12px;padding-right:12px}.notice{padding:11px;font-size:11px}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}

/* Portfolio overview shares the import screen's colors and spacing. */
.portfolio-filters{display:grid;grid-template-columns:minmax(160px,1.5fr) minmax(120px,.85fr) minmax(150px,1.1fr) minmax(120px,.8fr) minmax(85px,.6fr) auto;gap:12px;align-items:end;padding-bottom:22px;border-bottom:1px solid var(--line);margin-bottom:24px}
.portfolio-filters>div{min-width:0}.portfolio-filters .account-field{width:auto;max-width:none}.portfolio-filters .text-button{min-height:42px;margin-bottom:0}
.dashboard-heading{display:flex;justify-content:space-between;gap:16px;align-items:baseline;margin-bottom:16px}.dashboard-heading h3{font-size:15px}.dashboard-heading p{max-width:500px}
.portfolio-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));border:1px solid var(--line);border-radius:10px;margin-bottom:24px;overflow:hidden;background:#fafbf8}
.metric-card{min-width:0;padding:19px 20px}.metric-card+.metric-card{border-left:1px solid var(--line)}.metric-card .field-label{font-size:11px;margin-bottom:10px}.metric-value{display:block;font-size:clamp(20px,1.9vw,27px);font-weight:700;line-height:1.4;letter-spacing:-.025em;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.metric-note{font-size:10px;line-height:1.8;color:var(--muted);margin-top:8px;overflow-wrap:anywhere}.metric-rate{font-size:12px;font-variant-numeric:tabular-nums;margin-top:4px;line-height:1.7}.metric-count-detail{font-size:11px;color:var(--muted);margin-top:5px}.metric-count-detail span{font-weight:650;margin-right:5px;color:var(--ink)}
.positive-value,.profit-positive{color:#176b59}.negative-value,.profit-negative{color:#a04737}
.allocation-grid{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:20px;align-items:start;margin-bottom:28px}.allocation-card{min-width:0;border:1px solid var(--line);border-radius:10px;padding:20px}.allocation-heading{margin-bottom:20px}.allocation-heading h3{font-size:14px}.allocation-heading p{margin-top:5px;font-size:10px}.allocation-empty{padding:35px 6px;min-height:130px;font-size:12px;text-align:center;color:var(--muted);line-height:1.9}
.stock-bars{display:flex;flex-direction:column;gap:7px}.stock-bar-item{display:block;width:100%;background:transparent;text-align:left;border-radius:7px;padding:10px 8px;min-width:0;color:var(--ink)}button.stock-bar-item:hover{background:var(--soft)}.stock-bar-remainder{background:#f7f9f5}.stock-bar-label{display:flex;justify-content:space-between;gap:12px;align-items:start;margin-bottom:9px}.stock-bar-company{font-size:12px;line-height:1.7;font-weight:650;overflow-wrap:anywhere;min-width:0}.stock-bar-code{font-size:10px;color:var(--muted);font-weight:400;display:block;line-height:1.5}.stock-bar-value{font-size:12px;line-height:1.7;font-weight:600;text-align:right;font-variant-numeric:tabular-nums;flex-shrink:0}.stock-bar-percent{font-size:10px;color:var(--muted);display:block;font-weight:400;line-height:1.5}.stock-bar-graphic{display:block;width:100%;height:6px;overflow:hidden;border-radius:3px}
.account-chart-body{display:flex;flex-direction:column;align-items:center;gap:13px}.account-donut{width:200px;max-width:80%;height:auto;display:block}.donut-caption{fill:var(--muted);font-size:11px}.donut-count{fill:var(--ink);font-size:17px;font-weight:700}.account-legend{width:100%;display:flex;flex-direction:column;gap:4px}.account-legend-button{display:grid;grid-template-columns:12px minmax(0,1fr) auto;align-items:center;gap:10px;width:100%;background:transparent;text-align:left;padding:10px 8px;border-radius:6px;color:var(--ink)}.account-legend-button:hover{background:var(--soft)}.legend-swatch{width:12px;height:12px}.account-legend-name{font-size:11px;line-height:1.7;overflow-wrap:anywhere;font-weight:550}.account-legend-value{font-size:12px;font-weight:600;text-align:right;font-variant-numeric:tabular-nums;line-height:1.7;white-space:nowrap}.account-legend-percent{display:block;font-size:10px;font-weight:400;color:var(--muted);line-height:1.5}
.chart-coverage{font-size:10px;line-height:1.8;color:var(--muted);border-top:1px solid var(--line);padding-top:12px;margin-top:16px}.table-section-heading{display:flex;justify-content:space-between;align-items:baseline;gap:15px;margin:8px 0 12px}.table-section-heading h3{font-size:14px}
@media(max-width:1100px){.portfolio-filters{grid-template-columns:repeat(4,minmax(0,1fr))}.portfolio-filters .search-field{grid-column:span 2}.portfolio-filters .text-button{grid-column:span 2;justify-self:end}.metric-card{padding:17px 15px}.portfolio-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.metric-card:nth-child(3){border-left:0}.metric-card:nth-child(n+3){border-top:1px solid var(--line)}.metric-value{font-size:26px}}
@media(max-width:760px){.dashboard-heading{flex-direction:column;gap:5px}.portfolio-filters{grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}.portfolio-filters .text-button{justify-self:start;grid-column:span 2}.allocation-grid{grid-template-columns:1fr;gap:17px}.allocation-card{padding:18px}.portfolio-metrics{margin-bottom:19px}.metric-card{padding:15px}.metric-value{font-size:23px}.metric-note{font-size:10px}.table-section-heading{align-items:start;flex-direction:column;gap:5px}.account-chart-body{display:grid;grid-template-columns:minmax(120px,180px) minmax(0,1fr);align-items:center;gap:13px}.account-donut{width:100%;max-width:100%}.account-legend-button{padding:9px 4px;gap:7px}.account-legend-name{font-size:10px}.account-legend-value{font-size:11px}.account-legend-percent{font-size:10px}}
@media(max-width:480px){.portfolio-metrics{grid-template-columns:1fr}.metric-card+.metric-card{border-left:0;border-top:1px solid var(--line)}.metric-card{padding:15px 17px}.metric-value{font-size:27px}.metric-card .field-label{margin-bottom:6px}.metric-note{margin-top:6px}.account-chart-body{display:flex;flex-direction:column;gap:13px}.account-donut{width:190px;max-width:80%}.account-legend-name{font-size:11px}.account-legend-value{font-size:12px}.stock-bar-item{padding:9px 3px}.stock-bar-label{gap:8px}.stock-bar-company{font-size:11px}.stock-bar-value{font-size:11px}.allocation-heading{margin-bottom:14px}.allocation-card{padding:16px}.portfolio-filters{padding-bottom:18px;margin-bottom:20px}}
/* Shared navigation between holdings and the imported candidate list. */
.view-tabs { display: flex; gap: 8px; margin: 0 0 28px; border-bottom: 1px solid #d4dfd9; }
.view-tabs [role="tab"] { padding: 13px 24px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #526a77; font: inherit; font-weight: 700; cursor: pointer; }
.view-tabs [role="tab"][aria-selected="true"] { color: #176b59; border-bottom-color: #176b59; }
.view-tabs [role="tab"]:focus-visible { outline: 3px solid #176b59; outline-offset: -3px; }
@media (max-width: 600px) { .view-tabs [role="tab"] { flex: 1; padding: 12px 8px; } }

/* Dividend summary and holding details. */
.holdings-dividend-section{border-bottom:1px solid var(--line);padding-bottom:20px;margin-bottom:24px}
.holdings-dividend-section>p{margin-top:8px}
#holdings-market-controls{margin:16px 0;min-width:0}
#holdings-market-progress{display:block;width:100%;height:9px;accent-color:var(--green);margin-top:12px}
#holdings-market-status,#holdings-market-errors{overflow-wrap:anywhere}
.dividend-totals{margin:0 0 20px}.dividend-totals h4{margin:0 0 9px;font-size:13px;font-weight:650}
.dividend-total-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border:1px solid var(--line);border-radius:9px;background:#fafbf8;overflow:hidden}
.dividend-total-grid .metric-card:nth-child(odd){border-left:0}
.dividend-total-grid .metric-card:nth-child(even){border-left:1px solid var(--line)}
.dividend-total-grid .metric-card:nth-child(n+3){border-top:1px solid var(--line)}
#holdings-table .dividend-note{display:block;white-space:normal;font-size:10px;line-height:1.7;color:var(--muted);margin-top:5px;overflow-wrap:anywhere}
#holdings-table [data-field="dividend-reason"]{font-weight:500}
@media(max-width:760px){
  #holdings-table:has(.holdings-detail-table){border:0;overflow:visible}
  #holdings-table .holdings-detail-table{display:block;min-width:0;width:100%}
  #holdings-table .holdings-detail-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  #holdings-table .holdings-detail-table tbody{display:grid;gap:16px}
  #holdings-table .holdings-detail-table tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border:1px solid var(--line);border-radius:9px;overflow:hidden}
  #holdings-table .holdings-detail-table td{display:block;min-width:0;max-width:none;text-align:left;white-space:normal;padding:11px 12px;overflow-wrap:anywhere;border-bottom:1px solid var(--line)}
  #holdings-table .holdings-detail-table td:before{content:attr(data-label);display:block;font-size:10px;color:var(--muted);margin-bottom:5px}
  #holdings-table .holdings-detail-table td:first-child{grid-column:1/-1;background:#f7f9f5}
  #holdings-table .holdings-detail-table td:first-child:before{display:none}
  #holdings-table .holdings-detail-table td:nth-child(10){grid-column:1/-1}
  #holdings-table .holdings-detail-table .account-label{max-width:100%;white-space:normal}
  #holdings-market-controls .button{white-space:normal}
}
@media(max-width:480px){
  .dividend-total-grid .metric-card{padding:11px 9px}
  .dividend-total-grid .metric-card:nth-child(2){border-top:0}
  .dividend-total-grid .metric-value{font-size:18px}
}

.broker-imports{list-style:none;margin:8px 0 20px;padding:0}
.broker-imports li{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:6px 0;border-bottom:1px solid var(--line)}
.broker-imports li>div{min-width:0;overflow-wrap:anywhere;font-size:13px}

.manual-dividend-form {
  margin: 12px 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}
.manual-dividend-form h4 { margin: 0; overflow-wrap: anywhere; }
#manual-dividend-reference { white-space: pre-line; overflow-wrap: anywhere; }
.manual-dividend-fields { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 16px; margin: 12px 0; }
.manual-dividend-fields input, .manual-dividend-fields textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font: inherit;
}
.manual-dividend-fields textarea { resize: vertical; }
.manual-dividend-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.manual-dividend-edit { display: block; margin-left: auto; color: var(--green); text-decoration: underline; }
.manual-dividend-label { margin-left: 6px; color: var(--green); font-size: 11px; font-weight: 650; }
.dividend-newer { display: block; white-space: normal; margin-top: 5px; color: var(--warning); font-size: 11px; }
#holdings-table .manual-dividend-memo { white-space: pre-wrap; }
@media (max-width: 760px) {
  .manual-dividend-fields { grid-template-columns: 1fr; }
  .manual-dividend-edit { margin-left: 0; }
  .manual-dividend-fields input, .manual-dividend-fields textarea { font-size: 16px; }
}

@media (min-width: 761px) {
  .holdings-card-edit-name { display: none; }
  .page-shell:has(#view-portfolio:not([hidden])) { max-width: 1500px; padding-inline: 16px; }
  #view-portfolio .holdings-panel { padding-inline: 16px; }
}

#holdings-table .holdings-compact-table { table-layout: fixed; min-width: 0; }
#holdings-table .holdings-compact-table th,
#holdings-table .holdings-compact-table td {
  min-width: 0;
  max-width: none;
  padding: 3px 8px;
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}
#holdings-table .holdings-compact-table th { padding-block: 6px; font-size: 12px; }
.holdings-compact-table th:nth-child(1) { width: 17%; }
.holdings-compact-table th:nth-child(2) { width: 7%; }
.holdings-compact-table th:nth-child(3) { width: 10%; }
.holdings-compact-table th:nth-child(4) { width: 15%; }
.holdings-compact-table th:nth-child(5) { width: 20%; }
.holdings-compact-table th:nth-child(6) { width: 16%; }
.holdings-compact-table th:nth-child(7) { width: 15%; }
.holdings-compact-table .holding-primary { display: block; font-weight: 600; }
.holdings-compact-table .holding-secondary { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.holdings-compact-table td.dividend-cell > .holding-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.holdings-compact-table .stock-name { font-size: inherit; }
.holdings-compact-table .stock-code { display: inline; margin: 0; font-size: inherit; }
.holdings-compact-table .calculated-label { font-size: 11px; }
#holdings-table .holdings-compact-table .dividend-note,
.holdings-compact-table .manual-dividend-label,
.holdings-compact-table .dividend-newer {
  display: inline;
  margin: 0;
  font-size: 12px;
  line-height: inherit;
}
.holdings-compact-table .manual-dividend-edit {
  display: inline-flex;
  min-width: 44px;
  min-height: 24px;
  max-width: 100%;
  padding: 2px 4px;
  margin: 0;
  font-size: 12px;
  line-height: 1.25;
  white-space: normal;
  vertical-align: middle;
}

#concentration-dashboard, #holdings-overview {
  --defensive-color: #176b59;
  --cyclical-color: #946029;
}
#concentration-dashboard {
  display: grid;
  gap: 18px;
  min-width: 0;
}
#concentration-dashboard h4, .concentration-map-grid h4 { margin: 0 0 9px; font-size: 14px; }
.stock-cycle-settings { margin: 16px 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.stock-cycle-settings h4 { margin: 0 0 4px; font-size: 14px; }
.stock-cycle-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.stock-cycle-actions .file-picker { margin-top: 0; }
.stock-cycle-mark { margin-inline-start: .5em; font-size: 11px; color: var(--green); }
.concentration-band + .concentration-band { border-top: 1px solid var(--line); padding-top: 17px; margin-top: 17px; }
.concentration-legend, .concentration-map-grid, .concentration-stock-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.concentration-legend { margin: 10px 0 8px; }
.concentration-legend-item { font-size: 13px; }
.concentration-legend-item.cyclical { text-align: right; }
.concentration-legend-item > span { font-weight: 600; }
.concentration-legend-item.defensive, .concentration-map-grid .defensive { color: var(--defensive-color); }
.concentration-legend-item.cyclical, .concentration-map-grid .cyclical { color: var(--cyclical-color); text-align: right; }
.concentration-map-grid:has(.excluded) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.concentration-map-grid .cyclical:not(:last-child) { text-align: center; }
.concentration-map-grid .excluded { color: #545454; text-align: right; }
.concentration-legend-item strong { display: inline-block; margin-inline-start: 8px; font-size: 20px; line-height: 1.3; }
.concentration-legend-item small { display: block; color: var(--muted); font-size: 12px; }
.concentration-strip { width: 100%; height: 17px; display: block; border-radius: 4px; }
.concentration-strip .defensive { fill: var(--defensive-color); }
.concentration-strip .cyclical { fill: var(--cyclical-color); }
.concentration-midpoint { stroke: white; stroke-width: 3; vector-effect: non-scaling-stroke; }
.concentration-reference { text-align: center; font-size: 11px; color: var(--muted); }
#concentration-map { margin-top: 14px; padding: 14px; background: var(--surface); }
#concentration-map .allocation-heading { margin-bottom: 12px; }
.concentration-treemap { display: block; width: 100%; background: #f4f6f2; }
.concentration-tile rect { stroke: white; stroke-width: 1; vector-effect: non-scaling-stroke; }
.concentration-tile text { font-size: 12px; pointer-events: none; }
.concentration-tile:hover rect { stroke: var(--ink); stroke-width: 2; }
.concentration-stock-lists { margin-top: 12px; }
.concentration-stock-list summary { cursor: pointer; font-size: 14px; color: var(--ink); padding: 10px 0; }
.concentration-stock-list ol, .concentration-sector-bars { list-style: none; padding: 0; margin: 0; }
.concentration-stock-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  border-top: 1px solid var(--line);
  padding: 9px 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.concentration-stock-list li strong { grid-column: 1 / -1; }
.concentration-stock-list li span:last-child { text-align: right; }
.concentration-comparisons { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 18px; align-items: start; }
#concentration-metric { max-width: 240px; }
#concentration-sectors .chart-coverage { padding-top: 8px; margin-top: 10px; }
.concentration-sector-bars { margin-top: 12px; }
.concentration-sector-bars li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 4px 12px;
  padding: 8px 0;
  align-items: baseline;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.concentration-sector-percent, .concentration-sector-amount { text-align: right; font-variant-numeric: tabular-nums; }
.concentration-sector-count { display: inline-block; margin-left: 4px; font-size: 10px; color: var(--muted); }
.concentration-sector-bar { grid-column: 1 / -1; display: block; width: 100%; height: 6px; border-radius: 3px; }
.concentration-ranking-table { min-width: 0; width: 100%; }
.concentration-ranking-table th, .concentration-ranking-table td {
  white-space: normal;
  padding: 8px 6px;
  overflow-wrap: anywhere;
}
.concentration-ranking-table th:last-child, .concentration-ranking-table td:last-child { text-align: right; }
@media (max-width: 950px) {
  .concentration-comparisons { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  #concentration-map { display: none; }
  .concentration-stock-lists { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .concentration-legend-item strong { display: block; margin-inline-start: 0; }
  .concentration-sector-bars li { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; }
  .concentration-sector-amount { grid-row: 2; grid-column: 1 / -1; }
  .concentration-ranking-table, .concentration-ranking-table tbody { display: block; }
  .concentration-ranking-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .concentration-ranking-table tr { display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: baseline; gap: 4px 7px; padding: 9px 0; border-top: 1px solid var(--line); }
  .concentration-ranking-table td { padding: 0; border: 0; }
  .concentration-ranking-table td:nth-child(3) { font-weight: 650; }
  .concentration-ranking-table td:nth-child(4) { grid-column: 1 / 3; color: var(--muted); }
  .concentration-ranking-table td:nth-child(5) { grid-column: 3; }
}

/* The imported portfolio opens with all five overview panels above the detail views. */
body:has(#view-portfolio:not([hidden]) #holdings-overview:not([hidden])) .site-header { height: 58px; }
.page-shell:has(#view-portfolio:not([hidden]) #holdings-overview:not([hidden])) { padding-top: 10px; }
.page-shell:has(#view-portfolio:not([hidden]) #holdings-overview:not([hidden])) .view-tabs { margin-bottom: 12px; }
#owner-switch { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
#owner-status { color: var(--muted); font-size: 13px; }
#owner-switch button:disabled { opacity: .65; cursor: default; }
#owner-switch #edit-owner-names { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
#owner-names-form { max-width: 36rem; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.owner-name-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 8px 12px; margin: 10px 0; }
.owner-name-fields label { display: block; font-size: 13px; overflow-wrap: anywhere; }
.owner-name-fields input { width: 100%; padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; }
#owner-names-status:not(:empty) { margin-bottom: 10px; }
#owner-switch button, #import-heading, #file-help, #status, #import-button, #clear-button, #clear-receipts, .broker-imports button {
  max-width: 100%; white-space: normal; overflow-wrap: anywhere;
}
#holdings-overview { min-width: 0; }
.overview-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
#market-scope { display: inline-flex; order: 2; flex-wrap: wrap; gap: 2px; margin-left: auto; }
#owner-switch button, #market-scope button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 5px; padding: 4px 10px; font: inherit; font-size: 13px; cursor: pointer; }
#owner-switch button[aria-pressed="true"], #market-scope button[aria-pressed="true"] { background: var(--green-dark); color: white; }
#receipt-import { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
#overview-heading { font-size: 23px; line-height: 1.4; margin: 0; }
#overview-scope { font-size: 12px; font-weight: 500; color: var(--muted); }
#overview-metrics {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1fr 1fr 1.15fr 1.15fr 1.15fr .65fr;
  border: 1px solid var(--line);
  border-top: 3px solid var(--green);
  background: var(--surface);
  border-radius: 9px;
  font-variant-numeric: tabular-nums;
}
.overview-metric { min-width: 0; padding: 10px 11px; }
.overview-metric + .overview-metric { border-left: 1px solid var(--line); }
.overview-label, .overview-value, .overview-note { display: block; }
.overview-label { color: var(--muted); font-size: 12px; font-weight: 550; line-height: 1.4; }
.overview-value { margin-top: 5px; font-size: clamp(15px, 1.45vw, 22px); line-height: 1.35; overflow-wrap: anywhere; }
.overview-metric:nth-child(-n+2) .overview-value { color: var(--green-dark); }
.overview-note { margin: 5px 0 0; font-size: 11px; color: var(--muted); line-height: 1.4; }
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "sectors ranking bands" "sectors ranking yields";
  gap: 9px;
  align-items: start;
  margin-top: 10px;
}
.overview-card { min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 12px; background: var(--surface); }
#overview-bands { grid-area: bands; }
#overview-sectors { grid-area: sectors; }
#overview-ranking { grid-area: ranking; }
#overview-yields { grid-area: yields; }
.overview-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.overview-card h3 { font-size: 15px; line-height: 1.4; }
.overview-band + .overview-band { margin-top: 8px; }
.overview-band-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 3px 5px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.overview-band-labels strong { font-size: 12px; }
.overview-band-labels .defensive { color: var(--defensive-color); font-weight: 650; }
.overview-band-labels .cyclical { color: var(--cyclical-color); font-weight: 650; }
.overview-band .concentration-strip { height: 8px; margin: 4px 0; border-radius: 2px; background: #e9eee8; }
#overview-sector-metric { width: auto; max-width: 60%; min-height: 29px; padding: 3px 4px; font-size: 12px; }
.overview-sector-list { margin: 0; padding: 0; list-style: none; }
.overview-sector-list.many-sectors { column-count: 2; column-gap: 12px; column-rule: 1px solid var(--line); }
.overview-sector-row {
  display: grid;
  grid-template-columns: minmax(0, 11em) minmax(12px, 1fr) 4em;
  gap: 4px;
  align-items: center;
  height: 17px;
  line-height: 17px;
  break-inside: avoid;
  font-size: 11px;
}
.overview-sector-row > span { white-space: nowrap; }
.overview-sector-row > svg { grid-column: auto; display: block; width: 100%; height: 6px; }
.overview-sector-row > strong { text-align: right; font-variant-numeric: tabular-nums; }
.overview-ranking-table { min-width: 0; width: 100%; table-layout: fixed; }
.overview-ranking-table th, .overview-ranking-table td { font-size: 12px; padding: 4px; line-height: 1.45; overflow-wrap: anywhere; }
.overview-ranking-table th:first-child, .overview-ranking-table td:first-child { width: 3em; text-align: center; }
.overview-ranking-table th:last-child, .overview-ranking-table td:last-child { width: 36%; text-align: right; font-variant-numeric: tabular-nums; }
.overview-ranking-table td:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-ranking-table th { white-space: normal; }
.overview-histogram {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
  padding: 0;
  margin: 0;
  list-style: none;
  text-align: center;
}
.overview-bin { min-width: 0; }
.overview-bin svg { display: block; width: 100%; height: 79px; }
.overview-bin span { display: block; font-size: 10px; line-height: 1.4; }
#import-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin: 12px 0; }
#import-counts { font-size: 13px; }
@media (min-width: 761px) and (max-width: 1099px) {
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "sectors ranking" "bands yields"; }
  #overview-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .overview-metric:nth-child(n+5) { border-top: 1px solid var(--line); }
  .overview-metric:nth-child(5) { border-left: 0; }
}
@media (max-width: 760px) {
  #overview-heading { font-size: 20px; }
  .overview-heading { flex-wrap: wrap; }
  #market-scope { flex-basis: 100%; margin-left: 0; }
  #overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-metric { padding: 9px 10px; }
  .overview-metric:nth-child(odd) { border-left: 0; }
  .overview-metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .overview-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bands" "sectors" "ranking" "yields"; }
  .overview-sector-list.many-sectors { column-count: 1; }
  .overview-sector-row { grid-template-columns: minmax(0, 10em) minmax(20px, 1fr) 4em; }
}

#candidate-list .candidate-forecast-warning {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: normal;
  overflow-wrap: anywhere;
}

#storage-error-banner {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
#storage-error-message { flex: 1 1 18em; }

#mobile-view-controls {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  background: var(--soft);
  color: var(--green-dark);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 650;
}
#mobile-view-controls:not([hidden]) + #storage-error-banner { top: 68px; }
@media (max-width: 768px) {
  html[data-public-view]:not([data-public-view="mobile"]) #main { visibility: hidden; }
}
