/* Persistent header: all controls stay within the main column. */
.main-content>.topbar{position:sticky;top:0;z-index:15;height:auto;min-height:70px;max-width:1240px;margin:0 auto;display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:12px;padding:12px 0;background:var(--bg);border-bottom:1px solid var(--line);isolation:isolate}
.topbar>.breadcrumb{grid-column:1;grid-row:1;min-width:0;margin:0;display:flex;align-items:center;white-space:nowrap;overflow-x:auto!important;overflow-y:hidden!important;scrollbar-width:none}
.topbar>.breadcrumb::-webkit-scrollbar{display:none}
.topbar>.beta-sync-status{grid-column:2;grid-row:1;margin:0;justify-self:end}
.topbar>.top-actions{grid-column:3;grid-row:1;display:flex;align-items:center;gap:10px;min-width:0;justify-self:end}
.topbar .help-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:36px;white-space:nowrap}
.topbar .help-button>span{margin:0}.topbar .header-help-label{font-size:12px}
html{scroll-padding-top:calc(var(--tradefold-header-height,70px) + 16px)}
.page [id],.overview-layout-toolbar{scroll-margin-top:calc(var(--tradefold-header-height,70px) + 16px)}
.topbar .profile-popover{max-height:calc(100dvh - var(--tradefold-header-height,70px) - 18px)}
.topbar .tf-notification-panel{max-height:min(70dvh,calc(100dvh - var(--tradefold-header-height,70px) - 24px))}
/* A shared grid allows every Overview card to occupy its own position. */
.overview-card-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));column-gap:14px;row-gap:0;grid-auto-rows:4px;align-items:start;margin:12px 0 0}
.overview-card-grid>[data-overview-widget]{grid-column:span 12;min-width:0;margin:0!important;position:relative}

.overview-card-grid>[hidden]{display:none!important}
.overview-layout-toolbar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;padding:10px 0 16px;color:var(--ink)}
.overview-layout-caption{display:flex;align-items:center;gap:9px;font-size:13px;color:var(--muted)}
.overview-layout-caption>span[data-icon]{display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:var(--soft);color:var(--accent-ink,var(--ink))}
.overview-layout-caption strong{margin-left:8px;color:var(--ink);font-weight:600}
.overview-layout-toolbar>.button{display:flex;align-items:center;gap:7px;font-size:12px;padding:10px 13px}
.overview-layout-toolbar.is-arranging{position:sticky;top:var(--tradefold-header-height,70px);z-index:9;padding:15px 18px;border:1px solid var(--line);border-radius:12px;background:var(--surface);box-shadow:0 6px 16px #00000008}
.overview-layout-editor{display:grid;grid-template-columns:minmax(150px,1fr) auto;gap:12px 18px;flex-basis:100%;align-items:end}
.overview-layout-editor[hidden]{display:none!important}
.overview-layout-editor>label{display:grid;gap:6px;font-size:12px;color:var(--muted);max-width:260px}
.overview-layout-editor select{width:100%;padding:9px 11px;border:1px solid var(--line);border-radius:8px;color:var(--ink);background:var(--soft);font:600 13px 'DM Sans',sans-serif}
.overview-layout-actions{display:flex;flex-wrap:wrap;gap:8px;min-width:0}.overview-layout-actions .button{padding:10px 12px;font-size:12px}
.overview-layout-editor>p{grid-column:1/-1;font-size:12px;line-height:1.6;color:var(--muted);margin:0}
#overview-layout-description{font-size:12px;color:var(--accent-ink,var(--ink))}
.overview-card-grid.is-arranging>[data-overview-widget]{outline:1px dashed var(--accent,var(--green));outline-offset:2px}
.overview-arrange-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;grid-column:1/-1;margin-bottom:16px;padding-bottom:12px;border-bottom:1px solid var(--line);color:var(--ink)}
.overview-arrange-controls[hidden]{display:none!important}
.overview-arrange-controls>strong{font:600 12px/1.5 'DM Sans',sans-serif;flex:1;min-width:85px;color:var(--ink)}
.overview-card-grip,.overview-card-actions>button{display:grid;place-items:center;min-width:32px;min-height:32px;padding:4px;border:1px solid var(--line);border-radius:7px;background:var(--soft);color:var(--ink);font-size:17px;cursor:pointer}
.overview-card-grip{font-size:23px;cursor:grab;touch-action:none}
.overview-card-grip:active{cursor:grabbing}.overview-card-actions{display:flex;align-items:center;gap:6px}
.overview-card-actions>button:disabled{opacity:.35;cursor:default}
.overview-card-actions>label{display:flex;align-items:center;gap:5px;min-height:32px;font-size:12px;color:var(--muted);cursor:pointer}
.overview-card-actions input{accent-color:var(--accent,var(--green));width:16px;height:16px;margin:0}
.overview-card-grid .overview-card-hidden{border-style:dashed;background:var(--soft)}
.overview-card-grid .overview-card-hidden>:not(.overview-arrange-controls){display:none!important}
.overview-card-grid .overview-card-hidden .overview-arrange-controls{margin:0;padding:0;border:0}
.overview-card-grid .overview-card-dragging{opacity:.48}
.overview-drag-preview{position:fixed;z-index:18;width:210px;max-height:64px;padding:15px;border:1px solid var(--accent,var(--green));border-radius:12px;background:var(--surface);color:var(--ink);box-shadow:var(--shadow);pointer-events:none;font:600 13px/1.5 'DM Sans',sans-serif;overflow:hidden}
body.overview-drag-active{cursor:grabbing;user-select:none;-webkit-user-select:none}
#settings-arrange-overview{margin-top:14px}
@media(max-width:980px){.overview-layout-editor{grid-template-columns:1fr}.overview-layout-actions .button{flex:1 1 130px}}

@media(max-width:760px){
 .main-content>.topbar{grid-template-columns:auto minmax(0,1fr) auto;gap:9px 10px;padding:10px 0;min-height:84px}
 .topbar>.mobile-menu{grid-column:1;grid-row:1;display:grid;place-items:center;margin:0;width:34px;height:34px;padding:0;color:var(--ink)}
 .topbar>.top-actions{grid-column:2/-1;grid-row:1;gap:10px}
 .topbar>.breadcrumb{grid-column:1/3;grid-row:2;font-size:12px;min-height:22px}
 .topbar>.beta-sync-status{grid-column:3;grid-row:2;padding:3px 6px;font-size:9px}
 .topbar .tf-notification-panel{position:fixed;top:calc(var(--tradefold-header-height,84px) + 8px);right:14px}
 .sidebar.mobile-open{z-index:80}

 .overview-layout-toolbar.is-arranging{padding:12px 14px}
 .overview-layout-editor{gap:10px;grid-template-columns:minmax(0,1fr) auto}
 .overview-layout-actions{gap:6px}.overview-layout-actions .button{padding:10px;font-size:11px;white-space:nowrap}
 .overview-layout-caption{font-size:12px}
}
@media(max-width:560px){
 .topbar .header-help-label{display:none}
 .topbar .help-button{width:32px;height:32px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--ink)}
 .topbar .help-button>span{margin:0}
 .overview-layout-editor{grid-template-columns:1fr}.overview-layout-editor>label{max-width:none}
 .overview-layout-actions .button{flex:1;font-size:12px}
 .overview-arrange-controls>strong{font-size:11px}
 .overview-card-grid>.metric-card .overview-card-actions{flex-basis:100%;justify-content:space-between}
 .overview-layout-editor select{font-size:16px}
}
@media(prefers-reduced-motion:reduce){.overview-card-grid *{animation:none!important;transition:none!important}}

/* Preferred widths and measured content heights form an aligned, responsive grid. */
.overview-card-width{display:flex;gap:7px;align-items:center;flex-basis:100%;font-size:11px;color:var(--muted)}
.overview-card-width select{max-width:150px;min-width:90px;padding:6px 8px;border:1px solid var(--line);border-radius:7px;background:var(--soft);color:var(--ink);font-size:12px}
.overview-card-grid>.rhythm-panel{display:block}.overview-card-grid>.rhythm-panel .rhythm-copy{max-width:none}
.overview-card-grid>.metric-card .metric-value{font-size:clamp(21px,2.4vw,30px);overflow-wrap:anywhere}
.overview-card-grid>.metric-card .metric-foot{flex-wrap:wrap;gap:7px}.overview-card-grid .panel-heading{flex-wrap:wrap;gap:12px}
.overview-card-grid .strategy-score-list>div{grid-template-columns:minmax(70px,1fr) 30px 30px 55px minmax(70px,auto);font-size:10px;gap:5px}
.overview-card-grid .calendar-grid{min-width:0}.overview-card-grid .plan-list-item{flex-wrap:wrap}.overview-layout-actions{flex-wrap:wrap}
@media(max-width:560px){.overview-card-width select{font-size:16px}.overview-layout-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}.overview-card-grid .strategy-score-list>div{grid-template-columns:minmax(70px,1fr) 25px 25px 48px 65px;font-size:9px}.overview-card-grid .strategy-leaders{grid-template-columns:1fr}}
/* Compact packing and stable pointer gestures. Cards keep their content minimum. */
.overview-card-grid.is-arranging>[data-overview-widget]{padding-top:64px;overflow:visible}
.overview-arrange-controls{position:absolute;top:12px;left:14px;right:14px;display:flex;flex-wrap:nowrap;gap:6px;margin:0;padding:0;border:0;z-index:3}
.overview-arrange-controls>strong{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:11px}
.overview-card-actions{margin-left:auto;gap:4px;flex-shrink:0}
.overview-card-actions>button,.overview-card-grip{min-width:28px;min-height:28px}
.overview-card-actions>label{font-size:11px;gap:4px;min-height:28px}
.overview-size-menu{position:relative;font-size:11px;color:var(--ink)}
.overview-size-menu summary{cursor:pointer;list-style:none;padding:6px 8px;background:var(--soft);border:1px solid var(--line);border-radius:7px}
.overview-size-menu summary::-webkit-details-marker{display:none}
.overview-size-popover{position:absolute;top:calc(100% + 8px);right:0;width:230px;max-width:calc(100vw - 32px);max-height:var(--overview-popover-height,calc(100dvh - 150px));overflow:auto;overscroll-behavior:contain;transform:translate(var(--overview-popover-shift,0px),var(--overview-popover-top-shift,0px));background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);padding:14px;display:grid;gap:12px;z-index:20}
.overview-size-menu[open]{z-index:20}.overview-size-popover label{display:grid;gap:6px;font-size:12px}.overview-size-popover input,.overview-size-popover select{min-width:0;width:100%;padding:8px;border:1px solid var(--line);border-radius:7px;background:var(--soft);color:var(--ink);font-size:14px}
.overview-card-resize{position:absolute;right:4px;bottom:4px;width:30px;height:30px;border:0;border-radius:8px;background:var(--soft);color:var(--accent-ink,var(--ink));display:grid;place-items:center;touch-action:none;cursor:nwse-resize;z-index:2;opacity:.8}
.overview-card-resize[hidden]{display:none!important}.overview-card-resize:focus-visible{outline:2px solid var(--green-dark);outline-offset:2px}.overview-card-resize:hover{opacity:1}
body.overview-resize-active{cursor:nwse-resize;user-select:none;-webkit-user-select:none}
.overview-hidden-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin:24px 0}.overview-hidden-cards[hidden]{display:none!important}
.overview-hidden-cards>[data-overview-widget]{position:relative;min-height:58px!important;height:auto!important;margin:0!important;padding:14px!important;border:1px dashed var(--line);border-radius:12px;background:var(--soft)}
.overview-hidden-cards>[data-overview-widget]>:not(.overview-arrange-controls){display:none!important}
.overview-hidden-cards .overview-arrange-controls{position:static}.overview-hidden-cards .overview-card-actions>button,.overview-hidden-cards .overview-card-grip,.overview-hidden-cards .overview-size-menu{display:none}
.overview-card-grid>.metric-card .overview-arrange-controls>strong{display:none}
.overview-card-grid>.rhythm-panel .rhythm-copy{width:100%}
@media(max-width:560px){.overview-card-grid>.metric-card .overview-card-actions{flex-basis:auto;justify-content:flex-end}.overview-card-actions>label{font-size:10px}.overview-arrange-controls{left:9px;right:9px;gap:4px}.overview-card-grid>.metric-card .overview-card-actions>button{display:none}.overview-size-popover input,.overview-size-popover select{font-size:16px}.overview-hidden-cards{grid-template-columns:1fr}}
.overview-card-grid>[data-overview-widget]:has(.overview-size-menu[open]){z-index:8}
.overview-card-grid>[data-overview-widget]{container-name:overview-card;container-type:inline-size}
@container overview-card (max-width:245px){
 .overview-card-actions>button{display:none}
 .overview-arrange-controls>strong{display:none}
 .overview-arrange-controls{left:9px;right:9px;gap:4px}
 .overview-card-actions{gap:4px}
 .overview-card-actions>label{font-size:10px}
}
.overview-size-popover fieldset{min-width:0;margin:0;padding:0;border:0}.overview-size-popover legend{font-size:13px;font-weight:700;margin-bottom:9px}
.overview-colour-options{display:grid;grid-template-columns:1fr 1fr;gap:7px}.overview-colour-options button{display:flex;align-items:center;gap:7px;min-width:0;padding:8px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--ink);font:inherit;font-size:12px;text-align:left;cursor:pointer}
.overview-colour-options button:first-child{grid-column:1/-1}.overview-colour-options button[aria-pressed="true"]{border-color:var(--accent-ink);box-shadow:0 0 0 1px var(--accent-ink);font-weight:700}.overview-colour-swatch{flex:none;width:17px;height:17px;border-radius:50%;border:1px solid var(--line)}
.overview-colour-hint{font-size:11px;line-height:1.5;color:var(--muted)}
