/* Shared presentation for the overview, studies and tools. */
html { --card-hover:#4c6d7f; }
html[data-theme=light] { --bg:#f3f6f8; --panel:#fff; --panel2:#edf3f5; --text:#132e40; --muted:#526d7e; --line:#d8e3e9; --teal:#007e73; --gold:#966420; --blue:#3b68aa; --red:#b24859; --card-hover:#9cb8c5; }
body { font-family:Arial,Helvetica,sans-serif; }
button,select,input { border-radius:5px; }
button:disabled { cursor:default; }
html[data-theme=light] .primary,html[data-theme=light] .primary:hover { color:#fff; }
.topbar { height:66px; padding:0 30px; border-bottom:1px solid var(--line); box-shadow:0 2px 12px #10293806; }
.topbar .appword { letter-spacing:1.4px; font-size:10px; border-left:1px solid var(--line); padding-left:25px; color:var(--muted); }
.toptools { gap:9px; }
.toptools button { min-height:38px; }
.shell { max-width:1780px; padding:26px 34px; }
.intro { padding:0 0 22px; margin:0; border:0; gap:24px; }
.intro h1 { font-size:33px; line-height:1.15; letter-spacing:-.7px; }
.intro > div:first-child > p:last-child { font-size:12px; max-width:740px; margin:10px 0 0; }
.intro .eyebrow { font-size:9px; letter-spacing:1.3px; }
.intro-index { border-left:1px solid var(--line); padding-left:25px; min-width:225px; font-size:11px; }
.intro-index span,.intro-index strong,.intro-index a { display:block; }
.intro-index span { color:var(--muted); }
.intro-index strong { font:18px Georgia,serif; margin:7px 0; }
.intro-index a { color:var(--teal); font-weight:600; text-decoration:none; }
.workspace-tabs { display:flex; gap:2px; align-items:center; padding:5px; background:var(--panel); border:1px solid var(--line); border-radius:7px; margin-bottom:26px; }
.workspace-tabs > button { background:transparent; border:1px solid transparent; border-radius:4px; padding:10px 16px; font-size:12px; font-weight:600; color:var(--muted); }
.workspace-tabs > button[aria-pressed=true] { color:var(--teal); background:var(--panel2); border-color:var(--line); }
.workspace-tabs span { font-size:11px; font-weight:400; padding-left:12px; color:var(--muted); }
.workspace-tabs > button:last-child { margin-left:auto; color:var(--teal); }
.text-button { border:0; background:transparent; color:var(--teal); font-size:11px; padding:7px 0; font-weight:600; text-align:left; }
.workspace { grid-template-columns:255px minmax(0,1fr); gap:26px; align-items:start; }
.library { background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:21px 15px; }
.library-head { padding:0 6px; margin-bottom:20px; }
.library-head h2 { font-size:22px; }
.study-list { max-height:760px; overflow:auto; scrollbar-width:thin; margin-top:16px; }
.study-button { border-radius:4px; }
.study-button:hover { background:var(--panel2); }
.library-note { font:11px/1.7 Arial,sans-serif; margin:18px 4px 0; padding-top:16px; }
.library > select { height:39px; font-size:12px; }
.study-heading { padding:4px 0 0; margin-bottom:23px; }
.study-heading h2 { font:34px/1.2 Georgia,serif; letter-spacing:-.6px; }
.study-heading .eyebrow { font-size:10px; letter-spacing:1px; }
.study-actions button { background:var(--panel); }
.analysis-toolbar { background:var(--panel); border:1px solid var(--line); border-radius:7px; padding:12px 16px; margin-bottom:18px; }
.analysis-toolbar select { min-height:36px; }
.metrics { border:1px solid var(--line); border-radius:8px; overflow:hidden; margin-bottom:22px; }
.metrics > div { padding:20px; }
.metrics strong { font-family:Georgia,serif; font-size:29px; }
.metrics span { letter-spacing:.5px; line-height:1.5; }
.metrics small { line-height:1.6; }
.chart-card { border:1px solid var(--line); border-radius:9px; padding:24px; margin-bottom:22px; box-shadow:0 3px 12px #102e4103; }
.chart-card .card-heading { margin-bottom:20px; }
.chart-card .card-heading h3 { font-size:25px; letter-spacing:-.3px; }
.chart-card .card-heading .eyebrow { font-size:9px; letter-spacing:1.1px; }
.chart-card .card-heading p:not(.eyebrow) { line-height:1.7; }
.chart { overflow:hidden; }
.relationship-card .chart.large { height:350px; }
.oscillator-card .chart { height:270px; }
.chart.small { height:232px; }
.two-up { gap:22px; }
.two-up .chart-card { padding:23px; }
.two-up .card-heading { min-height:108px; }
.two-up .card-heading h3 { font-size:23px; }
.source-legend { gap:10px 22px; padding:15px 3px; font-size:11px; }
.hover-readout { line-height:1.6; font-size:11px; }
.chart-foot { line-height:1.75; }
.insight-strip { background:var(--panel2); border:1px solid var(--line); border-left:3px solid var(--teal); border-radius:7px; padding:20px 23px; margin-bottom:22px; }
.insight-icon { display:none; }
.insight-strip .eyebrow { color:var(--teal); font-size:9px; letter-spacing:1px; margin-bottom:7px; }
.methodology { border-radius:7px; padding:19px 22px; margin-bottom:12px; }
.methodology summary { line-height:1.6; }
.study-guide { margin-top:30px; padding-top:28px; }
.study-guide > p { max-width:1180px; line-height:1.8; }
.guide-columns { gap:40px; line-height:1.8; }
.footer { line-height:1.7; margin-top:24px; padding-bottom:10px; }
/* Builder and source picker share the same form rhythm. */
body:has(dialog[open]) { overflow:hidden; }
dialog { border-radius:12px; }
.dialog-header { background:var(--panel); padding:23px 28px; position:sticky; top:0; z-index:3; }
.dialog-header .eyebrow { font-size:9px; margin-bottom:6px; }
.dialog-header h2 { font-size:29px; letter-spacing:-.4px; }
.dialog-header .icon { background:var(--panel2); min-width:38px; }
.builder-content { background:var(--bg); padding:25px 28px; }
.name-label { margin-bottom:27px; }
.name-label input { padding:12px 14px; font-size:17px; }
.builder-step { margin:22px 0 16px; align-items:center; }
.builder-step > span { display:grid; place-items:center; width:34px; height:34px; flex-shrink:0; padding:0; background:var(--panel); border:1px solid var(--line); border-radius:50%; color:var(--teal); font-weight:700; }
.builder-step h3 { font-size:23px; }
.builder-step p { font-size:12px; line-height:1.65; margin:5px 0 0; }
.builder-legs { grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:15px; }
.leg { background:var(--panel); border-radius:7px; padding:15px; }
.leg:nth-child(2) { border-top-color:var(--gold); }
.leg:nth-child(n+3) { border-top-color:var(--blue); }
.leg-head { margin-bottom:12px; }
.leg-name { min-height:62px; background:var(--panel2); font:17px/1.4 Georgia,serif; padding:11px; }
.leg-controls { margin-top:13px; grid-template-columns:minmax(0,1fr) 65px; }
.leg-controls select,.leg-controls input { height:40px; font-size:12px; padding:8px; }
.flow-connector { padding:20px 0 0; font-size:16px; }
.flow-connector span { letter-spacing:1px; font-size:9px; }
.config-grid { background:var(--panel); border-radius:7px; padding:20px; gap:16px; }
.config-grid label { font-size:11px; line-height:1.6; }
.config-grid select,.config-grid input { height:44px; padding:9px; line-height:normal; }
.builder-help { font-size:11px; line-height:1.6; margin:10px 0; }
.builder-note { align-self:center; font:16px/1.5 Georgia,serif; }
.dialog-footer { background:var(--panel); padding:17px 28px; }
.dialog-footer .primary { padding:12px 20px; }
.picker-body { padding:23px 28px; }
.picker-body > select { height:44px; }
.input-result { border-radius:5px; padding:14px 12px; }
.input-result:hover { background:var(--panel2); }
.input-result small { font-size:11px; }
.input-result span { line-height:1.5; }
/* Full-screen map: fixed header, generous controls, scrollable results. */
.map-dialog-header { display:flex; justify-content:space-between; align-items:center; padding:15px 26px; border-bottom:1px solid var(--line); background:var(--panel); z-index:3; }
.map-dialog-header .eyebrow { font-size:9px; margin-bottom:5px; }
.map-dialog-header h2 { font:25px Georgia,serif; margin:0; }
.map-dialog-body { padding:20px 26px; }
.map-dialog-body .matrix-heading h2,.map-dialog-body .matrix-heading .eyebrow { display:none; }
.map-dialog-body .matrix-bottom { display:none; }
.matrix-heading{display:flex;justify-content:space-between;align-items:flex-end;gap:20px}
.matrix-heading h2{font-size:30px;line-height:1.2}
.matrix-heading p:not(.eyebrow){font-size:13px;color:var(--muted);margin:8px 0 0}
.matrix-heading .eyebrow{letter-spacing:1px;font-size:9px}
.matrix-scope{font-size:11px;color:var(--muted);text-align:right;max-width:240px;line-height:1.65}
.matrix-shortcuts{display:flex;gap:0;flex-wrap:wrap;margin:22px 0 0;border-bottom:1px solid var(--line)}
.matrix-shortcuts button{font-size:11px;padding:11px 13px;border:0;border-radius:0;border-bottom:2px solid transparent;background:none;color:var(--muted)}
.matrix-shortcuts button.active{color:var(--teal);border-bottom-color:var(--teal);font-weight:700}
.matrix-controls{display:flex;gap:12px;align-items:flex-end;background:var(--panel2);padding:17px 18px;margin:0 0 19px;border-bottom:1px solid var(--line)}
.matrix-controls label{font-size:10px;color:var(--muted);display:block}
.matrix-controls select,.matrix-controls input{font-size:12px;height:35px;margin-top:6px;max-width:100%}
.matrix-axis{flex:1;min-width:150px;display:grid;grid-template-columns:1fr 1fr;gap:0 7px}
.matrix-axis label{grid-column:1/-1}
.matrix-axis select,.matrix-axis input{min-width:0;width:100%}
.matrix-controls>label select{display:block;min-width:95px}
.matrix-controls>button{height:35px}
.matrix-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px}
.matrix-toolbar .segmented{width:auto;margin:0;gap:0}
.matrix-toolbar .segmented button{font-size:11px;padding:9px 14px}
.matrix-display{display:flex;gap:16px;font-size:11px;color:var(--muted)}
.matrix-display label{display:flex;align-items:center;gap:7px}
.matrix-display select{font-size:11px;padding:7px}
.matrix-explanation{font-size:12px;line-height:1.7;margin:14px 0;color:var(--muted)}
.matrix-message{padding:25px 0;border-block:1px solid var(--line);font-size:13px;color:var(--muted)}
.matrix-legend{display:flex;gap:16px;flex-wrap:wrap;font-size:10px;color:var(--muted);padding:12px 0;border-top:1px solid var(--line)}
.matrix-legend span{display:flex;align-items:center;gap:5px}
.matrix-legend i{width:12px;height:10px;display:inline-block}
.matrix-legend .negative{background:#ad7433aa}
.matrix-legend .neutral{background:var(--panel2);border:1px solid var(--line)}
.matrix-legend .positive{background:#168b80aa}
.matrix-table{width:100%;min-width:0}
.matrix-grid{table-layout:fixed;width:100%;border-collapse:separate;border-spacing:2px;margin:0;font-variant-numeric:tabular-nums}
.matrix-grid thead th{height:115px;padding:0;border:0;text-align:center;vertical-align:bottom;font-weight:500;font-size:10px;color:var(--muted)}
.matrix-grid thead th:first-child{width:145px;text-align:left;padding-bottom:12px;font-size:11px;vertical-align:bottom}
.matrix-grid thead th span{writing-mode:vertical-rl;transform:rotate(180deg);max-height:115px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-block;padding:5px 0}
.matrix-grid tbody th{border:0;padding:5px 8px 5px 0;font-size:11px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:500}
.matrix-grid td{padding:0;height:31px;border:0;text-align:center;font-size:10px}
.matrix-grid td a,.matrix-grid td span{display:flex;justify-content:center;align-items:center;gap:1px;width:100%;min-height:30px;text-decoration:none;color:var(--text);border:1px solid transparent}
.matrix-grid td a:hover,.matrix-grid td a:focus-visible{border:1px solid var(--text);outline:1px solid var(--text);position:relative;z-index:1}
.matrix-grid td .unavailable{color:var(--muted);background:var(--panel2);opacity:.65}
.matrix-grid td .diagonal{background:transparent;color:var(--line)}
.matrix-grid td a.stale{border:1px dotted var(--muted)}
.matrix-detail{min-height:54px;margin-top:13px;padding:13px 15px;border-block:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:20px;background:var(--panel2);font-size:11px;color:var(--muted);line-height:1.6}
.matrix-detail strong{font-family:Georgia,serif;font-size:16px;color:var(--text)}
.matrix-detail span{display:block}
.matrix-detail .detail-numbers{display:flex;gap:22px;flex-shrink:0}
.detail-numbers b{font-size:16px;color:var(--text);display:block;font-variant-numeric:tabular-nums}
.matrix-pagination{display:flex;justify-content:space-between;gap:20px;padding:12px 0}
.matrix-pagination>div{display:flex;align-items:center;gap:6px;font-size:11px;color:var(--muted)}
.matrix-pagination span{margin-right:7px}
.matrix-pagination button{font-size:12px;padding:4px 10px;background:var(--panel);border:1px solid var(--line)}
.matrix-footnote{font-size:11px;color:var(--muted);line-height:1.7;max-width:1100px}
.matrix-bottom{display:grid;grid-template-columns:1fr 1fr;gap:40px;padding:24px 0 0;margin-top:24px;border-top:2px solid var(--text)}
.matrix-bottom h3{font-size:21px}
.matrix-bottom p{font-size:12px;color:var(--muted);line-height:1.75;max-width:640px}
.matrix-list{font-size:12px;font-variant-numeric:tabular-nums;margin:0}
.matrix-list th{font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px}
.matrix-list th,.matrix-list td{padding:12px 8px}
.matrix-list td:not(:first-child),.matrix-list th:not(:first-child){text-align:right}
.matrix-list td:first-child{width:55%;padding-left:0}
.matrix-list a{color:var(--text);font-weight:600;text-decoration:none}
.matrix-list a:hover{text-decoration:underline;color:var(--teal)}
.matrix-list small{display:block;font-size:10px;color:var(--muted);font-weight:400;margin-top:3px}
.matrix-list .matrix-positive{color:var(--teal)}
.matrix-list .matrix-negative{color:var(--gold)}
.matrix-list-more{margin-top:12px;font-size:12px}
.matrix-display select:disabled{opacity:.6}
/* Keep labels and native field text legible at every map size. */
.map-dialog-body .matrix-heading { align-items:center; }
.map-dialog-body .matrix-heading p { margin:0; font-size:12px; }
.matrix-scope { max-width:none; }
.matrix-shortcuts { margin:18px 0 0; }
.matrix-shortcuts button { font-size:11px; padding:12px; }
.matrix-controls { display:grid; grid-template-columns:minmax(0,1fr) 40px minmax(0,1fr) 110px 112px 90px; gap:15px; padding:18px; margin-bottom:18px; border:1px solid var(--line); border-radius:0 0 7px 7px; }
.matrix-coverage { grid-column:1/-1; display:grid; grid-template-columns:auto 230px minmax(0,1fr); gap:14px; align-items:center; padding-bottom:14px; border-bottom:1px solid var(--line); }
.matrix-controls .matrix-coverage label { font-size:12px; color:var(--text); }
.matrix-coverage p { font-size:11px; line-height:1.65; color:var(--muted); margin:0; }
.matrix-controls select,.matrix-controls input { height:44px; min-height:44px; padding:8px 10px; line-height:normal; font-size:12px; margin-top:6px; }
.matrix-controls .matrix-coverage select { margin:0; }
.matrix-controls label { font-size:11px; line-height:1.5; }
.matrix-controls > button { height:44px; padding:8px; font-size:12px; }
.matrix-axis { min-width:0; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:0 10px; }
.matrix-controls > label select { width:100%; min-width:0; }
.matrix-toolbar .segmented button { width:auto; min-width:125px; padding:10px 14px; }
.matrix-toolbar .segmented { max-width:none; }
.matrix-display select { min-height:36px; }
.matrix-grid tbody th { white-space:normal; }
.matrix-grid td { height:25px; }
.matrix-grid td a,.matrix-grid td span { min-height:25px; }
.matrix-detail { border:1px solid var(--line); border-radius:6px; }
.matrix-pagination button { min-height:32px; min-width:35px; }
.matrix-table { overflow-x:auto; }
@media(max-width:1300px) {
 .workspace-tabs span { display:none; }
 .workspace { grid-template-columns:225px minmax(0,1fr); gap:20px; }
 .study-heading { display:block; }
 .study-actions { margin-top:15px; }
 .two-up { gap:18px; }
 .two-up .chart-card { padding:20px; }
 .two-up .card-heading h3 { font-size:21px; }
}
@media(max-width:1200px) {
 .matrix-controls { display:flex; flex-wrap:wrap; }
 .matrix-coverage { flex-basis:100%; }
 .matrix-axis { flex:1 1 40%; }
 .matrix-controls > label { flex:0 1 150px; }
 .matrix-controls > button[type=submit] { margin-left:auto; flex:0 0 100px; }
 .matrix-grid td { font-size:9px; }
 .shell { padding:24px; }
 .metrics { grid-template-columns:1fr 1fr; }
 .metrics > div:nth-child(-n+2) { border-bottom:1px solid var(--line); }
 .metrics > div:nth-child(2) { border-right:0; }
 .config-grid { grid-template-columns:1fr 1fr; }
}
@media(max-width:900px) {
 .topbar { padding:0 20px; }
 .workspace { display:block; }
 .library { padding:16px; margin-bottom:25px; }
 .library-head,.library-note { display:none; }
 .library .segmented { max-width:270px; margin-bottom:12px; }
 .library .searchbox { display:inline-block; width:57%; }
 .library > select { width:40%; margin:0 0 0 2%; }
 .study-list { display:flex; max-height:180px; gap:6px; margin-top:12px; }
 .study-button { min-width:190px; width:190px; padding:12px; }
 .study-button small { font-size:9px; }
 .library #more-studies { display:none!important; }
 .two-up .card-heading { min-height:105px; }
 .intro-index { display:none; }
 .workspace-tabs > button { font-size:11px; padding:10px 12px; }
 .workspace-tabs > button:last-child { display:none; }
 .map-dialog-header { padding:15px 20px; }
 .map-dialog-body { padding:18px 20px; }
 .matrix-grid thead th:first-child { width:160px; }
 .matrix-toolbar { gap:12px; align-items:flex-start; flex-wrap:wrap; }
 .matrix-coverage { grid-template-columns:auto 230px 1fr; }
 .matrix-display { gap:12px; }
}
@media(max-width:640px) {
 .topbar { height:auto; min-height:62px; padding:12px 15px; flex-wrap:wrap; gap:12px; }
 .brand { font-size:17px; }
 .toptools { gap:6px; flex-wrap:wrap; }
 .toptools button { padding:8px 10px; min-height:36px; font-size:11px; }
 .toptools #import { font-size:11px; }
 .shell { padding:20px 15px; }
 .intro h1 { font-size:28px; }
 .intro > div:first-child > p:last-child { font-size:12px; }
 .workspace-tabs { gap:0; padding:4px; }
 .workspace-tabs > button { font-size:10px; padding:10px 9px; }
 .study-heading h2 { font-size:29px; }
 .analysis-toolbar { padding:12px; }
 .analysis-toolbar > div { flex-wrap:wrap; gap:10px; }
 .metrics > div { padding:16px 13px; }
 .metrics span { font-size:8px; }
 .metrics strong { font-size:26px; }
 .metrics > div:first-child strong { font-size:20px; }
 .two-up { grid-template-columns:1fr; gap:0; }
 .chart-card,.two-up .chart-card { padding:20px 15px; }
 .chart-card .card-heading h3 { font-size:22px; }
 .two-up .card-heading { min-height:0; }
 .relationship-card .chart.large { height:280px; }
 .oscillator-card .chart { height:245px; }
 .card-heading { flex-wrap:wrap; }
 .card-heading .quiet { font-size:11px; }
 .insight-strip { padding:17px; }
 .source-legend { font-size:10px; }
 .hover-readout { font-size:10px; }
 .methodology { padding:17px; }
 .lag-chart { overflow-x:auto; grid-template-columns:62px repeat(17,34px); padding:4px 2px 12px; }
 .lag-cell { font-size:10px; }
 .lag-cell.label { font-size:9px; }
 .guide-columns,.preset-directory { grid-template-columns:1fr; }
 .dialog-header,.builder-content,.picker-body { padding:20px 17px; }
 .dialog-header h2 { font-size:25px; }
 .dialog-footer { padding:14px 17px; }
 .builder-step { flex-wrap:wrap; gap:10px; }
 .builder-step > div { flex:1; min-width:190px; }
 .builder-step > button { margin-left:44px; }
 .builder-step > span { display:grid; }
 .builder-step h3 { font-size:21px; }
 .builder-step p { font-size:11px; }
 .builder-legs { grid-template-columns:1fr; }
 .config-grid { padding:15px; gap:14px 12px; }
 .config-grid label:first-child { grid-column:1/-1; }
 .config-grid label { font-size:11px; }
 .builder-note { font-size:14px; }
 .flow-connector { font-size:14px; }
 .flow-connector span { font-size:8px; margin:0 6px; }
 .map-dialog-header { padding:13px 16px; }
 .map-dialog-header h2 { font-size:23px; }
 .map-dialog-body { padding:15px 14px; }
 .matrix-heading { display:block; }
 .matrix-scope { text-align:left; display:block; margin-top:8px; }
 .matrix-shortcuts { margin-top:12px; }
 .matrix-shortcuts button { font-size:10px; padding:10px 8px; }
 .matrix-controls { padding:13px; gap:12px; }
 .matrix-coverage { display:block; width:100%; }
 .matrix-controls .matrix-coverage select { width:100%; margin:6px 0 9px; }
 .matrix-coverage p { font-size:10px; }
 .matrix-axis { flex-basis:100%; }
 .matrix-controls #matrix-swap { margin-left:auto; min-width:44px; }
 .matrix-controls > label { flex:1 1 30%; }
 .matrix-controls > button[type=submit] { flex:0 0 80px; }
 .matrix-controls select,.matrix-controls input { font-size:11px; }
 .matrix-toolbar { display:block; }
 .matrix-toolbar .segmented { margin-bottom:12px; }
 .matrix-toolbar .segmented button { flex:1; min-width:0; font-size:10px; padding:10px; }
 .matrix-display { flex-wrap:wrap; gap:10px; justify-content:space-between; }
 .matrix-display label { font-size:10px; }
 .matrix-display select { max-width:135px; }
 .matrix-explanation { font-size:11px; }
 .matrix-legend { font-size:9px; gap:10px; }
 .matrix-grid thead th:first-child { width:120px; }
 .matrix-grid td { font-size:9px; }
 .matrix-detail { display:block; }
 .matrix-detail .detail-numbers { margin-top:10px; }
 .matrix-pagination { flex-wrap:wrap; gap:10px; }
 .matrix-list { font-size:11px; }
 .matrix-list th { font-size:8px; }
 .matrix-list th,.matrix-list td { padding:10px 4px; }
 .matrix-list td { overflow-wrap:anywhere; }
}
