:root{--p-paper:#f3f5f8;--p-card:#ffffff;--p-ink:#15253f;--p-muted:#52647b;--p-line:#d9e1ec;--p-green:#2563eb;--p-blue:#2457a8;--p-red:#923b36}
.portal-shell{margin:0;background:radial-gradient(ellipse at 90% 0%,#e2eafb,transparent 42%),var(--p-paper);color:var(--p-ink);font:16px/1.55 "Segoe UI",sans-serif;min-height:100vh}
.portal-shell *{box-sizing:border-box}.portal-shell a{color:var(--p-blue);text-underline-offset:4px}.portal-shell button,.portal-shell input,.portal-shell select,.portal-shell textarea{font:inherit}
.p-header{padding:20px max(24px,5vw);border-bottom:1px solid var(--p-line);display:flex;justify-content:space-between;align-items:center;gap:20px;background:#ffffffe8}
.p-brand{text-decoration:none;font:700 24px Georgia,serif;white-space:nowrap}.p-brand span{color:var(--p-green)}.p-brand strong{margin-left:12px}
.p-header nav{display:flex;flex-wrap:wrap;gap:20px;align-items:center}.p-header nav form{margin:0}.p-header nav a{text-decoration:none;font-size:14px;font-weight:650}
.p-main{max-width:1320px;margin:auto;padding:40px 24px 70px}.p-title{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:24px}
.portal-shell h1{font:normal clamp(30px,4vw,48px)/1.15 Georgia,serif;letter-spacing:-1px;margin:6px 0 18px}.portal-shell h2{font-size:21px;margin:0 0 20px}.portal-shell h3{margin:12px 0 8px}
.p-eyebrow{font-size:11px;font-weight:750;letter-spacing:2px;color:var(--p-green)}.p-muted{font-size:14px;color:var(--p-muted)}
.p-card{padding:26px;background:var(--p-card);border:1px solid var(--p-line);border-radius:16px;margin-bottom:22px;box-shadow:0 8px 22px #102e2305}
.p-login{display:grid;grid-template-columns:1.1fr 1fr;gap:clamp(30px,7vw,90px);align-items:center;max-width:1050px;margin:7vh auto}.p-intro p:not(.p-eyebrow){max-width:440px;color:var(--p-muted)}
.p-primary,.p-link-button,.p-quiet,.p-danger{border-radius:9px;padding:11px 17px;border:1px solid var(--p-line);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;text-decoration:none;font-size:14px;font-weight:650;background:var(--p-card);color:var(--p-ink)}
a.p-primary,button.p-primary{background:var(--p-green);border-color:var(--p-green);color:white}.p-danger{background:var(--p-red);color:white;border-color:var(--p-red)}
.p-form input:not([type=checkbox]):not([type=hidden]),.p-form textarea,.p-form select{display:block;width:100%;max-width:650px;background:white;border:1px solid #afbed3;border-radius:8px;padding:10px 12px;margin:7px 0}
.p-form input[type=checkbox]{width:18px;height:18px;accent-color:var(--p-green);flex-shrink:0;margin:0 9px 0 0}
.p-form label{font-size:14px;font-weight:650}.p-form .helptext{display:block;color:var(--p-muted);font-size:13px;max-width:680px}
.p-form ul:not(.errorlist){font-size:13px;color:var(--p-muted);padding-left:22px}
.p-form [id=id_engine_ids]{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:7px;max-height:480px;overflow:auto;border:1px solid var(--p-line);padding:12px;border-radius:10px;margin:12px 0}
.p-form [id=id_engine_ids] label{display:flex;align-items:flex-start;padding:9px;font-size:13px;font-weight:500}
.p-form-actions,.p-admin-actions{display:flex;flex-wrap:wrap;gap:12px;align-items:center}.p-admin-actions{margin-bottom:24px}
.errorlist{color:var(--p-red);font-size:14px;padding-left:20px}.p-alert,.p-warning{background:#e8f0ff;border:1px solid #bbcff3;padding:16px;border-radius:10px;margin-bottom:24px}.p-warning{background:#fff0cb;border-color:#e0c575}
.p-metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:15px}.p-metrics>div{background:var(--p-card);border:1px solid var(--p-line);padding:22px;border-radius:12px}.p-metrics strong{display:block;font:700 26px Georgia,serif;color:var(--p-green)}.p-metrics span{display:block;font-size:13px;color:var(--p-muted);margin-top:8px}
.p-two-columns{display:grid;grid-template-columns:1.2fr 1fr;gap:24px;margin-top:24px;align-items:start}.p-message{padding:20px 0;border-top:1px solid var(--p-line)}.p-message:first-of-type{border-top:0}
.p-message-meta{font-size:12px;color:var(--p-muted);display:flex;justify-content:space-between}.p-unread .p-message-meta b{color:var(--p-green)}.p-message-body{white-space:pre-wrap;overflow-wrap:anywhere;margin-bottom:16px}
.p-engine-tags{display:flex;flex-wrap:wrap;gap:9px}.p-engine-tags span{font-size:13px;border:1px solid var(--p-line);border-radius:6px;padding:7px 11px}
.p-table-wrap{overflow:auto}.p-table-wrap table{border-collapse:collapse;width:100%;font-size:14px;white-space:nowrap}.p-table-wrap th{text-align:left;color:var(--p-muted);font-size:12px;border-bottom:2px solid var(--p-line);padding:12px}.p-table-wrap td{padding:14px 12px;border-bottom:1px solid var(--p-line)}.p-table-wrap small{display:block;color:var(--p-muted)}.p-table-wrap td a{display:inline-block;margin-right:14px}
.p-status{color:var(--p-green);background:#e8f0ff;padding:4px 9px;border-radius:6px;font-size:12px;font-weight:700}.p-blocked{color:var(--p-red);background:#f7e4df}
.p-footer{max-width:1320px;margin:auto;padding:24px;color:var(--p-muted);font-size:11px;letter-spacing:1px;display:flex;justify-content:space-between;gap:20px;border-top:1px solid var(--p-line)}
.portal-studio #closeStudio,.portal-member #download,.portal-member #prepare,.portal-member #batchPrepare{display:none!important}
.portal-account-link{font-size:13px;color:var(--p-blue);text-decoration:none;font-weight:650;padding:8px}
.portal-quota{font-size:12px;white-space:nowrap;color:var(--p-green)}.portal-studio .topbar{flex-wrap:wrap;height:auto;min-height:76px}.portal-studio .top-actions{flex-wrap:wrap;justify-content:flex-end}.portal-studio .connection{display:none}
.portal-shell :focus-visible,.portal-studio .portal-account-link:focus-visible{outline:3px solid #518aad;outline-offset:3px}
@media(max-width:800px){.p-login,.p-two-columns{grid-template-columns:1fr}.p-login{margin:15px auto;gap:25px}.p-header{padding:16px 20px;align-items:flex-start;flex-wrap:wrap}.p-header nav{gap:14px}.p-main{padding:25px 16px}.p-metrics{grid-template-columns:repeat(2,1fr)}.p-title{align-items:flex-start;flex-wrap:wrap}.p-card{padding:21px}.p-footer{flex-direction:column}.portal-studio .top-actions{justify-content:flex-start}.portal-quota{display:block;width:100%}}


/* Website-only controls: no changes to the standalone Studio or prediction logic. */
.portal-theme-toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;height:44px;padding:10px;border:1px solid var(--p-line);border-radius:12px;background:var(--p-card);color:var(--p-ink);cursor:pointer}
.portal-theme-toggle svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.p-header .p-brand{margin-right:auto}.portal-theme-toggle:focus-visible,.portal-monitor button:focus-visible{outline:3px solid #518aad;outline-offset:3px}
.portal-studio .topbar{gap:14px;padding-top:12px;padding-bottom:12px}
.portal-studio #sidebar{top:var(--studio-header-height,82px);height:calc(100dvh - var(--studio-header-height,82px) - 44px)}
.portal-studio main,.p-card,.p-two-columns>*{min-width:0}
.portal-studio .top-actions{gap:6px}
.portal-studio .portal-account-link{display:inline-flex;align-items:center;min-height:40px}
.portal-studio .dialog-header{flex-shrink:0}
.portal-studio dialog[open]{display:flex;flex-direction:column;overflow:hidden}
.portal-studio .dialog-body,.portal-studio .stats-body{flex:1;min-height:0;height:auto;overflow:auto;overscroll-behavior:contain}
.portal-studio #logText{overflow:auto;min-height:0}
.portal-studio .table-scroll,.portal-shell .p-table-wrap{max-width:100%;overscroll-behavior-x:contain}
.portal-studio .model-choice{overflow-wrap:anywhere}
.portal-nav-close,#portalNavBackdrop{display:none}
.portal-monitor{position:fixed;right:18px;bottom:62px;width:min(410px,calc(100vw - 32px));z-index:35;background:var(--p-card);color:var(--p-ink);border:1px solid var(--p-line);border-radius:15px;box-shadow:0 12px 42px #082b2630;font:13px/1.5 "Bahnschrift","Trebuchet MS",sans-serif;overflow:hidden}
.portal-monitor *{box-sizing:border-box}
.portal-monitor #monitorToggle{display:flex;align-items:center;gap:10px;width:100%;min-height:48px;padding:12px 15px;border:0;border-radius:0;background:var(--p-card);color:var(--p-ink);font:inherit;cursor:pointer;text-align:left}
#monitorBrief{margin-left:auto;font-size:11px;color:var(--p-muted)}
#monitorChevron{font-size:19px;line-height:1}
.monitor-light{flex:0 0 8px;width:8px;height:8px;border-radius:50%;background:#8b9f95}
.monitor-light[data-state=running],.monitor-light[data-state=queued]{background:#cb932d}
.monitor-light[data-state=done]{background:#278561}.monitor-light[data-state=error]{background:#ce534e}
#monitorBody{max-height:min(540px,65dvh);overflow:auto;overscroll-behavior:contain;border-top:1px solid var(--p-line);padding:12px 15px 15px}
#monitorBody[hidden]{display:none}
.portal-monitor p{margin:0 0 10px;overflow-wrap:anywhere}
.monitor-operation{font-weight:700}
#monitorMessage{line-height:1.55;font-size:12px}
#monitorProgress{display:block;width:100%;height:8px;accent-color:var(--p-green);margin:12px 0 7px}
#monitorProgress[hidden]{display:none}
#monitorProgressText,#monitorQueue,#monitorBudget{font-size:11px;color:var(--p-muted)}
.monitor-metrics{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:14px 0}
.monitor-metrics>div{border:1px solid var(--p-line);border-radius:9px;padding:10px}
.monitor-metrics strong{display:block;font-size:24px;font-weight:600;color:var(--p-green)}
.monitor-metrics span{font-size:10px;color:var(--p-muted);display:block}
.portal-monitor summary{cursor:pointer;min-height:36px;font-weight:600}
.monitor-note{color:var(--p-muted);font-size:10px;line-height:1.55}
#monitorEvents{list-style:none;margin:6px 0 12px;padding:0;max-height:210px;overflow:auto}
#monitorEvents li{padding:8px 0;border-top:1px solid var(--p-line);font-size:11px;overflow-wrap:anywhere}
#monitorEvents time{display:block;font-size:10px;color:var(--p-muted);margin-bottom:3px}
.portal-monitor.is-collapsed{width:min(320px,calc(100vw - 32px))}

:root[data-theme=dark]{color-scheme:dark;--p-paper:#0d1728;--p-card:#16233a;--p-ink:#e8effb;--p-muted:#aabbd3;--p-line:#30445f;--p-green:#93baff;--p-blue:#b2cdff;--p-red:#ffaaa0;--ink:#e8effb;--muted:#aabbd3;--paper:#0d1728;--line:#30445f;--teal:#93baff;--gold:#e6bd63;--navy:#0a1323;--red:#ffaaa0}
:root[data-theme=light]{color-scheme:light}
[data-theme=dark] .portal-shell{background:radial-gradient(ellipse at 90% 0%,#1d3255,transparent 45%),var(--p-paper)}
[data-theme=dark] .p-header,[data-theme=dark] .portal-studio .topbar,[data-theme=dark] .portal-studio .matches-panel,[data-theme=dark] .portal-studio dialog,[data-theme=dark] .portal-studio #statsDialog{background:var(--p-card)}
[data-theme=dark] .portal-studio #sidebar{background:#111e32}
[data-theme=dark] .p-form input:not([type=checkbox]):not([type=hidden]),[data-theme=dark] .p-form textarea,[data-theme=dark] .p-form select,[data-theme=dark] .portal-studio input,[data-theme=dark] .portal-studio select,[data-theme=dark] .portal-studio .search-field{background:#0f1b30;border-color:var(--p-line);color:var(--p-ink)}
[data-theme=dark] .portal-studio .search-field input{background:transparent}
[data-theme=dark] .p-primary,[data-theme=dark] a.p-primary,[data-theme=dark] .portal-studio .primary{background:#2563eb;border-color:#2563eb;color:#ffffff}
[data-theme=dark] .portal-studio .primary:hover:not(:disabled){background:#1d4ed8}
[data-theme=dark] .p-danger{background:#71372f;color:#fff0e9;border-color:#a7685d}
[data-theme=dark] .portal-studio .secondary{background:#1b3155;border-color:#46679a;color:#b6d0ff}
[data-theme=dark] .portal-studio .quiet:hover{background:#243b5d}
[data-theme=dark] .portal-studio .hero{background:linear-gradient(115deg,#1a3257,#152840 65%,#223d62);border-color:var(--line)}
[data-theme=dark] .portal-studio .hero-copy,[data-theme=dark] .portal-studio .hero-stats span{color:#b6c8e2}
[data-theme=dark] .portal-studio .all-competitions,[data-theme=dark] .portal-studio .league-button:hover,[data-theme=dark] .portal-studio .league-button.active,[data-theme=dark] .portal-studio .open-match,[data-theme=dark] .portal-studio .count-pill,[data-theme=dark] .portal-studio .aside-heading b,[data-theme=dark] .portal-studio .step-title>span:first-child{background:#20395e}
[data-theme=dark] .portal-studio .country,[data-theme=dark] .portal-studio td{border-color:var(--line)}
[data-theme=dark] .portal-studio th,[data-theme=dark] .portal-studio .dialog-header,[data-theme=dark] .portal-studio .explanation{background:#1a2d49}
[data-theme=dark] .portal-studio .match-table tbody tr:hover{background:#1d3352}
[data-theme=dark] .portal-studio .match-table tbody tr.is-selected,[data-theme=dark] .portal-studio .model-choice:has(input:checked){background:#203c68;border-color:#648bcd}
[data-theme=dark] .portal-studio .model-choice.studio-variant{background:#332f22}
[data-theme=dark] .portal-studio .model-choice.studio-variant:has(input:checked){background:#203c68}
[data-theme=dark] .portal-studio .notice,[data-theme=dark] .p-warning{background:#3b3422;color:#f3ddb3;border-color:#8b7542}
[data-theme=dark] .portal-studio .comparison-panel{background:linear-gradient(125deg,#1a3050,#14263f);border-color:var(--line)}
[data-theme=dark] .portal-studio .beta-tag{background:#394a32;color:#d3dabb}
[data-theme=dark] .portal-studio .close-button,[data-theme=dark] .p-blocked,[data-theme=dark] .portal-studio .stats-table .lost,[data-theme=dark] .portal-studio .batch-state-error{background:#4d2e2b;color:#ffb8ad}
[data-theme=dark] .p-alert,[data-theme=dark] .p-status,[data-theme=dark] .portal-studio .stats-table .won,[data-theme=dark] .portal-studio .batch-state-running{background:#214535;border-color:#44795c;color:#b0e7bf}
[data-theme=dark] .portal-studio .batch-state-partial,[data-theme=dark] .portal-studio .batch-state-unavailable,[data-theme=dark] .portal-studio .batch-state-skipped{background:#3b3422}
[data-theme=dark] .portal-studio .data-limited{color:#f0c88a!important}
[data-theme=dark] .portal-studio .unsaved{color:#aabbd3}

@media(max-width:800px){
 .portal-studio .topbar{position:relative;gap:10px;padding:12px}
 .portal-studio .brand{font-size:19px;min-width:0}
 .portal-studio .top-actions{width:100%;margin-left:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
 .portal-studio .top-actions>*,.portal-studio .batch-selection-bar>*{min-width:0}
 .portal-studio .top-actions #reload{display:inline-flex}
 .portal-studio .portal-quota{grid-column:1/-1;white-space:normal}
 .portal-studio button,.portal-studio .portal-account-link,.portal-shell button,.portal-shell nav a{min-height:44px}
 .portal-studio .top-actions button{font-size:12px;padding:9px;white-space:normal}
 .portal-studio .portal-account-link{font-size:12px;padding:8px;justify-content:center;border:1px solid var(--p-line);border-radius:8px}
 .portal-studio input:not([type=checkbox]),.portal-studio select,.portal-shell input:not([type=checkbox]),.portal-shell select,.portal-shell textarea{font-size:16px}
 .portal-studio #sidebar{top:0;bottom:0;height:100dvh;width:min(350px,90vw);z-index:42;padding:16px 16px max(28px,env(safe-area-inset-bottom));overscroll-behavior:contain}
 .portal-nav-close{display:block;margin:0 0 16px auto;border:1px solid var(--p-line);background:var(--p-card);color:var(--p-ink);font-size:13px}
 #portalNavBackdrop:not([hidden]){display:block;position:fixed;inset:0;border:0;border-radius:0;background:#091b2480;z-index:41;padding:0}
 .portal-nav-open{overflow:hidden}
 .portal-studio .hero{padding:22px;min-height:0}
 .portal-studio .hero h1{font-size:clamp(29px,6vw,36px)}
 .portal-studio .filters{flex-wrap:wrap;align-items:stretch}
 .portal-studio .filters label{flex:1 1 160px;max-width:none}
 .portal-studio .filters select,.portal-studio .filters input{width:100%}
 .portal-studio .view-tabs{overflow:auto}
 .portal-studio .view-tabs button{white-space:nowrap}
 .portal-studio .batch-selection-bar{display:grid;grid-template-columns:1fr 1fr;gap:8px}
 .portal-studio #selectedMatchesCount,.portal-studio #openBatch{grid-column:1/-1}
 .portal-studio .match-table{min-width:0}
 .portal-studio .match-table thead{display:none}
 .portal-studio .match-table tbody{display:grid;gap:10px;padding:0 12px 12px}
 .portal-studio .match-table tbody tr{display:grid;grid-template-columns:36px minmax(0,1fr) auto;gap:8px 10px;padding:14px 10px;border:1px solid var(--line);border-radius:12px}
 .portal-studio .match-table tbody td{border:0;padding:0;min-width:0}
 .portal-studio .match-table tbody .selection-cell{grid-column:1;grid-row:1/5;width:auto;min-width:0;padding-top:2px;text-align:left}
 .portal-studio .match-table .selection-cell input{width:26px;height:26px}
 .portal-studio .match-table tbody td:nth-child(2){grid-column:2/-1;grid-row:1}
 .portal-studio .match-table tbody td:nth-child(3){grid-column:2/-1;grid-row:2}
 .portal-studio .match-table tbody td:nth-child(4){grid-column:2/-1;grid-row:3}
 .portal-studio .match-table tbody td:nth-child(5){display:block;grid-column:2;grid-row:4;align-self:center}
 .portal-studio .match-table tbody td:nth-child(6){grid-column:3;grid-row:4}
 .portal-studio .time-cell strong{display:inline-block;margin:0 0 0 8px;font-size:16px}
 .portal-studio .team{white-space:normal;overflow-wrap:anywhere;font-size:15px}
 .portal-studio .team img{flex-shrink:0}
 .portal-studio .competition-cell{font-size:12px;overflow-wrap:anywhere}
 .portal-studio .saved-pill{white-space:normal}
 .portal-studio .dialog-header{align-items:flex-start;gap:10px;padding:15px;flex-wrap:wrap}
 .portal-studio .dialog-header>div:first-child{min-width:0;flex:1 1 160px}
 .portal-studio .dialog-header>div:last-child{display:flex;gap:6px}
 .portal-studio .dialog-header h2{overflow-wrap:anywhere;font-size:22px}
 .portal-studio .dialog-header .quiet{font-size:12px;padding:8px}
 .portal-studio .dialog-body,.portal-studio .stats-body{padding:16px}
 .portal-studio .model-grid{max-height:38dvh}
 .portal-studio .model-choice{font-size:13px}
 .portal-studio .model-choice small{font-size:11px}
 .portal-studio .model-choice input{width:22px;height:22px}
 .portal-studio .generation-actions{display:grid;grid-template-columns:1fr}
 .portal-studio .generation-actions button{font-size:13px}
 .portal-studio .job-bar{min-height:48px;padding:7px 12px max(7px,env(safe-area-inset-bottom))}
 .portal-studio #jobMessage{font-size:11px}
 .portal-studio #showLog{flex-shrink:0}
 .portal-studio footer span{float:none;display:block}
 .portal-monitor{right:10px;bottom:calc(62px + env(safe-area-inset-bottom));width:min(410px,calc(100vw - 20px))}
 .portal-monitor.is-collapsed{width:min(320px,calc(100vw - 20px))}
 #monitorBody{max-height:55dvh}
 .p-header{gap:12px}
 .p-header .p-brand{font-size:21px}
 .p-header nav{width:100%;gap:12px}
 .p-header nav a{display:inline-flex;align-items:center}
 .p-card{padding:18px}
 .p-form [id=id_engine_ids]{grid-template-columns:minmax(0,1fr)}
 .p-main{padding-bottom:110px}
}
@media(max-width:600px){
 .portal-studio dialog,.portal-studio dialog.expanded,.portal-studio #statsDialog,.portal-studio #logDialog{width:100vw;height:100dvh;max-height:100dvh;margin:0;border:0;border-radius:0;padding-bottom:env(safe-area-inset-bottom)}
 .portal-studio .hero{display:block}
 .portal-studio .hero-stats{display:flex;flex-wrap:wrap;align-items:center;gap:16px;margin-top:18px}
 .portal-studio .hero-stats .week-range{border:0;padding:0;margin-left:auto}
 .portal-studio .model-grid{grid-template-columns:minmax(0,1fr)}
 .portal-studio .step-title{flex-wrap:wrap}
 .portal-studio .comparison-main{align-items:flex-start;flex-wrap:wrap}
 .portal-studio .beta-tag{display:none}
 .p-metrics{gap:9px}
 .p-metrics>div{padding:15px}
}


/* Compact brand and calendar, without expanding the existing header. */
.portal-brand-logo{width:43px;height:43px;object-fit:contain;flex:0 0 43px;display:block}
.p-brand{display:inline-flex;align-items:center;gap:12px}.p-brand strong{margin-left:0}
.portal-calendar-filter{display:flex;flex-direction:column;gap:7px;font-size:11px;color:var(--muted);padding:0 2px;margin:0 0 16px}
.portal-calendar-filter select{width:100%;min-height:42px;font-size:14px}
.pdf-controls{display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.pdf-controls label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:var(--muted)}
#pdfLoadState{flex:1 1 230px;font-size:12px;color:var(--muted);line-height:1.5}
.pdf-note{font-size:12px;color:var(--muted);line-height:1.6}
.pdf-layout{display:grid;grid-template-columns:minmax(230px,.8fr) minmax(0,1.4fr);gap:22px;margin-top:18px}
.pdf-layout>section{min-width:0}
.pdf-section-title{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.pdf-section-title h3{margin:0;font-size:16px;font-weight:500}
#pdfMatchCount{font-size:12px;color:var(--muted)}
.pdf-models,.pdf-matches{display:grid;gap:8px;max-height:46vh;overflow:auto;overscroll-behavior:contain;padding:3px}
.pdf-models>label,.pdf-matches>label{display:flex;align-items:flex-start;gap:10px;border:1px solid var(--line);border-radius:10px;padding:12px;cursor:pointer;min-width:0}
.pdf-models>label:has(input:checked),.pdf-matches>label:has(input:checked){border-color:var(--teal);background:color-mix(in srgb,var(--teal) 8%,transparent)}
.pdf-models>label:has(input:disabled){opacity:.55}
.pdf-layout input[type=checkbox]{width:20px;height:20px;flex-shrink:0;accent-color:var(--teal);margin:1px 0 0}
.pdf-layout label>span{min-width:0;overflow-wrap:anywhere}
.pdf-layout label strong{display:block;font-size:12px;font-weight:600;line-height:1.5}
.pdf-layout label small{display:block;margin-top:5px;font-size:11px;line-height:1.5;color:var(--muted)}
.pdf-layout label .pdf-picks{color:var(--teal)}
#pdfSearch{width:100%;font-size:14px}
.pdf-select-actions{display:flex;gap:8px;flex-wrap:wrap;margin:7px 0}
.pdf-download-bar{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:16px 24px;border-top:1px solid var(--line);background:var(--p-card);flex-shrink:0}
.pdf-download-bar #pdfSelection{margin-right:auto;font-size:12px;color:var(--muted);float:none;letter-spacing:0}
.pdf-ready{display:inline-flex;align-items:center;justify-content:center;text-decoration:none;border-radius:8px;padding:11px 15px;font-size:12px;min-height:44px}
.pdf-ready[hidden]{display:none}
@media(max-width:800px){.portal-studio .portal-brand-logo{width:35px;height:35px;flex-basis:35px}.pdf-layout{grid-template-columns:minmax(0,1fr)}.pdf-models{max-height:28dvh}.pdf-matches{max-height:45dvh}.pdf-download-bar{padding:12px 15px}.portal-studio .portal-calendar-filter select{font-size:16px}.pdf-download-bar #pdfSelection{width:100%}.pdf-download-bar button{flex:1}.pdf-layout label strong{font-size:14px}.pdf-layout label small{font-size:12px}}

/* Existing CSRF-protected logout action, also reachable from the main header. */
.portal-studio .top-actions .portal-logout{display:flex;justify-content:flex-end;margin:0 0 0 auto}
.portal-studio .portal-logout .quiet{color:var(--p-red);border:1px solid var(--p-line);min-height:40px;font-size:13px;padding:9px 15px}
@media(max-width:800px){.portal-studio .top-actions .portal-logout{margin:0}.portal-studio .portal-logout button{width:100%;min-height:44px}}


/* Blue website palette. The standalone desktop and all prediction logic are unchanged. */
:root{--ink:#15253f;--muted:#52647b;--paper:#f3f5f8;--line:#d9e1ec;--teal:#2563eb;--navy:#10213b;--ui-tint:#edf3ff;--ui-soft:#f7f9fd;--ui-edge:#bfd0ef;--ui-action:#2563eb;--ui-hover:#1d4ed8}
:root[data-theme=dark]{--ui-tint:#20395e;--ui-soft:#1a2d49;--ui-edge:#46679a;--ui-action:#2563eb;--ui-hover:#1d4ed8}
.portal-studio{background:var(--paper);line-height:1.45}
.portal-studio .topbar{background:var(--p-card)}
.portal-studio #sidebar{background:var(--p-card)}
.portal-studio .primary,.portal-shell .p-primary{background:var(--ui-action);color:#fff;border-color:var(--ui-action)}
.portal-studio .primary:hover:not(:disabled),.portal-shell .p-primary:hover:not(:disabled){background:var(--ui-hover)}
.portal-studio .secondary{background:var(--p-card);border-color:var(--ui-edge);color:var(--teal)}
.portal-studio .quiet:hover{background:var(--ui-tint)}
.portal-studio .hero{background:linear-gradient(115deg,#e6eeff 0%,#f1f5fc 55%,#dce7f9 100%);border-color:var(--line)}
[data-theme=dark] .portal-studio .hero{background:linear-gradient(115deg,#1a3257,#152840 65%,#223d62)}
.portal-studio .hero-copy,.portal-studio .hero-stats span{color:var(--muted)}
.portal-studio .hero-stats .week-range{border-color:var(--line)}
.portal-studio .pitch,.portal-studio .pitch:before,.portal-studio .pitch:after,.portal-studio .pitch span{border-color:#5082cc26}
.portal-studio .all-competitions,.portal-studio .league-button:hover,.portal-studio .league-button.active,.portal-studio .open-match,.portal-studio .count-pill,.portal-studio .aside-heading b,.portal-studio .step-title>span:first-child{background:var(--ui-tint);color:var(--teal)}
.portal-studio .country,.portal-studio td{border-color:var(--line)}
.portal-studio th,.portal-studio .dialog-header,.portal-studio .explanation{background:var(--ui-soft)}
.portal-studio .match-table tbody tr:hover{background:var(--ui-soft)}
.portal-studio .match-table tbody tr.is-selected,.portal-studio .model-choice:has(input:checked){background:var(--ui-tint);border-color:var(--ui-edge)}
.portal-studio .model-choice.studio-variant{background:var(--ui-soft)}
.portal-studio .model-choice.studio-variant:has(input:checked){background:var(--ui-tint)}
.portal-studio .comparison-panel{background:linear-gradient(125deg,var(--ui-tint),var(--ui-soft));border-color:var(--line)}
.portal-studio .beta-tag{background:var(--ui-tint);color:var(--muted)}
.portal-studio .unsaved,.portal-studio .empty-symbol{color:var(--muted)}
.portal-studio .connection i,.portal-studio .job-dot{background:#75a7fa}
.portal-studio .job-dot.busy{background:#e6bd63}.portal-studio .job-dot.error{background:#fa9380}
.portal-shell .p-alert,.portal-shell .p-status{background:var(--ui-tint);border-color:var(--ui-edge);color:var(--p-ink)}
.portal-shell .p-blocked{background:#f7e4df;color:var(--p-red)}
[data-theme=dark] .portal-shell .p-blocked{background:#4d2e2b}
.portal-studio .batch-state-running{background:var(--ui-tint);color:var(--ink)}
.portal-monitor .monitor-light[data-state=done]{background:#75a7fa}
.portal-studio .stats-table .won{background:#e6f4e9;color:#146035}
.portal-studio .stats-table .lost{background:#fceaea;color:#a32825}
[data-theme=dark] .portal-studio .stats-table .won{background:#214535;color:#b0e7bf}
[data-theme=dark] .portal-studio .stats-table .lost{background:#4d2e2b;color:#ffb8ad}
.portal-studio input[type=checkbox],.portal-shell input[type=checkbox]{accent-color:var(--ui-action)}
.portal-studio :focus-visible,.portal-shell :focus-visible{outline:3px solid #719eee;outline-offset:3px}
.portal-tools,.portal-mobile-calendar{display:none}
.portal-studio dialog .dialog-header>div:first-child{white-space:normal}
.portal-studio .stats-body,.portal-studio .dialog-body{scrollbar-gutter:stable}
.portal-studio .table-scroll{min-width:0}
.portal-studio .model-choice>span,.portal-studio .team>span,.portal-studio .competition-cell>div{min-width:0;overflow-wrap:anywhere}
.portal-studio.portal-dialog-open{overflow:hidden}
.portal-studio .pdf-download-bar{padding-bottom:max(14px,env(safe-area-inset-bottom))}
.portal-shell .p-form input,.portal-shell .p-form select,.portal-shell .p-form textarea{color:var(--p-ink)}
.portal-shell .p-main,.portal-shell .p-metrics>div{min-width:0;overflow-wrap:anywhere}

@media(max-width:960px){
 /* One compact identity row, then account/tools. No controls are removed. */
 .portal-studio .topbar{position:relative;display:grid;grid-template-columns:44px minmax(0,1fr) 44px auto;gap:8px;padding:10px 12px;height:auto;min-height:0;align-items:center}
 .portal-studio #navToggle{display:flex;align-items:center;justify-content:center;grid-column:1;grid-row:1;min-width:44px;min-height:44px;background:var(--ui-tint);color:var(--teal);padding:8px}
 .portal-studio .topbar>.brand{grid-column:2;grid-row:1;font-size:18px;gap:8px;min-width:0;white-space:normal;line-height:1.15}
 .portal-studio .brand small{font-size:7px;letter-spacing:1px}
 .portal-studio .portal-brand-logo{width:32px;height:32px;flex-basis:32px}
 .portal-studio .topbar>.portal-theme-toggle{grid-column:3;grid-row:1;width:44px;min-width:0}
 .portal-studio .topbar>.portal-logout{grid-column:4;grid-row:1;margin:0}
 .portal-studio .portal-logout .quiet{font-size:12px;padding:8px 10px;min-height:44px}
 .portal-studio .top-actions{display:grid;grid-column:1/-1;grid-row:2;grid-template-columns:minmax(0,1fr) auto;gap:6px;width:100%;margin:0;align-items:start;justify-content:stretch}
 .portal-studio #portalAccount{grid-column:1;grid-row:1;display:block;min-height:44px;line-height:24px;text-align:left;padding:9px 10px;font-size:13px;border:1px solid var(--line);border-radius:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
 .portal-studio #portalQuota{grid-column:1/-1;grid-row:2;font-size:11px;line-height:1.4;white-space:normal;padding:1px 2px;width:auto;overflow-wrap:anywhere}
 .portal-studio .portal-tools{display:block;grid-column:2;grid-row:1;position:relative}
 .portal-tools>summary{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:9px 12px;cursor:pointer;list-style:none;border:1px solid var(--ui-edge);border-radius:8px;background:var(--ui-tint);color:var(--teal);font-size:13px;font-weight:600}
 .portal-tools>summary::-webkit-details-marker{display:none}
 .portal-tools>summary:after{content:"+";font-size:19px}.portal-tools[open]>summary:after{content:"-"}
 .portal-tools-content{position:absolute;right:0;top:calc(100% + 8px);width:min(330px,calc(100vw - 24px));max-height:65dvh;overflow:auto;overscroll-behavior:contain;background:var(--p-card);border:1px solid var(--line);box-shadow:0 16px 45px #07162f30;border-radius:12px;padding:8px;z-index:38;display:grid;gap:6px}
 .portal-tools-content>*{width:100%;margin:0!important;min-width:0}
 .portal-studio .portal-tools-content button,.portal-studio .portal-tools-content a{display:flex;align-items:center;justify-content:flex-start;min-height:46px;padding:11px 12px;text-align:left;font-size:14px;white-space:normal;line-height:1.4}
 .portal-studio .portal-tools-content #statistics{font-size:18px}
 .portal-studio .portal-tools-content .primary b{display:inline;font-size:11px}
 .portal-studio .workspace{display:block}
 .portal-studio #sidebar{display:none;position:fixed;top:0;left:0;bottom:0;height:100dvh;width:min(350px,92vw);z-index:42;padding:16px 16px max(28px,env(safe-area-inset-bottom));overflow:auto;overscroll-behavior:contain}
 .portal-studio #sidebar.open{display:block}
 .portal-nav-close{display:block;margin:0 0 16px auto;padding:10px 14px;border:1px solid var(--line);background:var(--p-card);color:var(--p-ink);font-size:14px;min-height:44px}
 #portalNavBackdrop:not([hidden]){display:block;position:fixed;inset:0;border:0;border-radius:0;background:#091b2480;z-index:41;padding:0}
 .portal-nav-open{overflow:hidden}
 .portal-studio .country summary,.portal-studio .league-button,.portal-studio .all-competitions{min-height:46px;font-size:14px}
 .portal-studio .league-button span{overflow-wrap:anywhere}
 .portal-studio main{padding:12px 12px calc(125px + env(safe-area-inset-bottom))}
 .portal-mobile-calendar{display:flex;align-items:end;gap:10px;margin-bottom:12px;padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--p-card)}
 .portal-mobile-calendar .portal-calendar-filter{flex:1;min-width:0;margin:0;padding:0;font-size:12px}
 .portal-mobile-calendar .portal-calendar-filter select{width:100%;min-height:46px}
 .portal-mobile-calendar>button{font-size:13px;min-height:46px;padding:8px 11px}
 .portal-studio .hero{padding:16px 18px;min-height:0;gap:14px;display:flex}
 .portal-studio .hero h1{font-size:26px;line-height:1.12}
 .portal-studio .hero .eyebrow,.portal-studio .hero-copy{display:none}
 .portal-studio .hero-stats{display:flex;flex-wrap:wrap;min-width:0;margin:0;gap:10px 18px;flex:0 1 200px}
 .portal-studio .hero-stats>div:nth-child(2){display:block}
 .portal-studio .hero-stats strong{font-size:25px}
 .portal-studio .hero-stats span{font-size:11px}
 .portal-studio .hero-stats .week-range{width:100%;margin:0;padding:0;border:0;font-size:10px}
 .portal-studio .view-tabs{margin:14px 0 10px;gap:0;overflow:auto}
 .portal-studio .view-tabs button{flex:1;min-height:46px;white-space:nowrap;padding:10px;font-size:13px}
 .portal-studio .view-tabs #readTime{display:none}
 .portal-studio .panel-heading{padding:16px 14px 10px;align-items:flex-start;gap:8px}
 .portal-studio .panel-heading h2{font-size:18px;overflow-wrap:anywhere;line-height:1.35}
 .portal-studio .panel-heading>div{min-width:0}
 .portal-studio .filters{padding:8px 14px 14px;flex-wrap:wrap}
 .portal-studio .filters label{min-width:0;flex:1 1 140px;max-width:none;font-size:12px}
 .portal-studio .filters input,.portal-studio .filters select{width:100%;min-height:46px}
 .portal-studio .table-hint{display:none}
 .portal-studio .batch-selection-bar{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:0 14px 14px}
 .portal-studio #selectedMatchesCount,.portal-studio #openBatch{grid-column:1/-1;margin:0;width:auto}
 .portal-studio .batch-selection-bar button{font-size:12px;min-height:44px;white-space:normal}
 .portal-studio button,.portal-studio .portal-account-link,.portal-shell button,.portal-shell nav a{min-height:44px}
 .portal-studio input:not([type=checkbox]),.portal-studio select,.portal-shell input:not([type=checkbox]),.portal-shell select,.portal-shell textarea{font-size:16px}
 .portal-studio .match-table{min-width:0;table-layout:fixed}
 .portal-studio .match-table thead{display:none}
 .portal-studio .match-table tbody{display:grid;gap:10px;padding:0 12px 12px}
 .portal-studio .match-table tbody tr{display:grid;grid-template-columns:34px minmax(0,1fr) auto;gap:10px;padding:14px 12px;border:1px solid var(--line);border-radius:12px}
 .portal-studio .match-table tbody td{border:0;padding:0;min-width:0}
 .portal-studio .match-table tbody .selection-cell{grid-column:1;grid-row:1/5;width:auto;min-width:0;padding:0;text-align:left}
 .portal-studio .match-table .selection-cell input{width:26px;height:26px;margin:4px 0}
 .portal-studio .match-table tbody td:nth-child(2){grid-column:2/-1;grid-row:1}
 .portal-studio .match-table tbody td:nth-child(3){grid-column:2/-1;grid-row:2}
 .portal-studio .match-table tbody td:nth-child(4){grid-column:2/-1;grid-row:3}
 .portal-studio .match-table tbody td:nth-child(5){display:block;grid-column:2;grid-row:4;align-self:center}
 .portal-studio .match-table tbody td:nth-child(6){grid-column:3;grid-row:4}
 .portal-studio .time-cell strong{display:inline-block;margin:0 0 0 8px;font-size:16px}
 .portal-studio .team{font-size:15px;white-space:normal;overflow-wrap:anywhere;align-items:center;line-height:1.4}
 .portal-studio .team img{flex-shrink:0}
 .portal-studio .competition-cell{font-size:13px;overflow-wrap:anywhere}
 .portal-studio .saved-pill{white-space:normal;font-size:12px}
 .portal-studio .open-match{font-size:13px;padding:10px 12px}
 /* One scroll area inside each full-screen popup, not several tiny nested lists. */
 .portal-studio dialog,.portal-studio dialog.expanded,.portal-studio #statsDialog,.portal-studio #logDialog{width:100%;height:100dvh;max-height:100dvh;max-width:100%;margin:0;border:0;border-radius:0;padding:0}
 .portal-studio .dialog-header{display:flex;align-items:flex-start;flex-wrap:nowrap;gap:10px;padding:12px 14px;position:relative}
 .portal-studio .dialog-header>div:first-child{min-width:0;flex:1 1 0}
 .portal-studio .dialog-header>div:last-child{flex:0 0 auto;display:flex;gap:4px}
 .portal-studio .dialog-header h2{font-size:20px;line-height:1.25;overflow-wrap:anywhere;white-space:normal;margin-top:3px}
 .portal-studio .dialog-header .eyebrow{font-size:10px;line-height:1.5;letter-spacing:.5px}
 .portal-studio .dialog-header .quiet{font-size:12px;padding:8px}
 .portal-studio .close-button{width:44px;min-width:44px;height:44px;margin:0;padding:8px}
 .portal-studio #maximize,.portal-studio #batchMaximize,.portal-studio #pdfMaximize{display:none}
 .portal-studio .dialog-body,.portal-studio .stats-body{padding:14px 14px max(24px,env(safe-area-inset-bottom));height:auto;min-height:0;overflow:auto;scrollbar-gutter:auto}
 .portal-studio .step-title{flex-wrap:wrap;gap:10px}
 .portal-studio .collapsible-heading{flex-wrap:nowrap;align-items:flex-start}
 .portal-studio .step-title h3{font-size:16px}.portal-studio .step-title p{font-size:12px}
 .portal-studio .collapsible-heading>span:first-child{flex-shrink:0}
 .portal-studio .collapsible-heading .section-toggle{margin-left:auto;min-width:34px}
 .portal-studio .model-grid{grid-template-columns:minmax(0,1fr);max-height:none;overflow:visible;padding:2px}
 .portal-studio .model-choice{font-size:14px;min-height:56px;padding:12px;line-height:1.4}
 .portal-studio .model-choice small{font-size:12px}
 .portal-studio .model-choice input{width:24px;height:24px}
 .portal-studio .model-shortcuts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
 .portal-studio .model-shortcuts button{font-size:12px;white-space:normal;padding:8px 5px}
 .portal-studio .generation-actions{display:grid;grid-template-columns:minmax(0,1fr);gap:8px}
 .portal-studio .generation-actions button{font-size:14px;min-height:48px}
 .portal-studio .notice,.portal-studio .model-selection-note,.portal-studio .model-availability{font-size:13px}
 .portal-studio .comparison-panel{padding:14px;margin-top:20px}
 .portal-studio .comparison-main{align-items:flex-start;flex-wrap:wrap}
 .portal-studio .comparison-panel p{font-size:13px;overflow-wrap:anywhere}
 .portal-studio .explanation{padding:14px;font-size:14px}
 .portal-studio .pdf-layout{grid-template-columns:minmax(0,1fr);gap:20px}
 .portal-studio .pdf-models,.portal-studio .pdf-matches{max-height:none;overflow:visible}
 .portal-studio .pdf-layout label strong{font-size:14px}
 .portal-studio .pdf-layout label small{font-size:12px}
 .portal-studio .pdf-layout input[type=checkbox]{width:24px;height:24px}
 .portal-studio .pdf-controls{align-items:stretch}
 .portal-studio .pdf-controls label{flex:1;min-width:0}
 .portal-studio #pdfLoadState{flex-basis:100%}
 .portal-studio .pdf-download-bar{padding:10px 14px max(12px,env(safe-area-inset-bottom));gap:7px}
 .portal-studio .pdf-download-bar #pdfSelection{width:auto;flex:1;min-width:0;float:none;font-size:12px}
 .portal-studio .pdf-download-bar button{flex:0 0 auto;min-height:46px}
 .portal-studio .pdf-ready{flex:1 1 100%}
 .portal-studio .stats-body .filters{display:grid;grid-template-columns:1fr 1fr;gap:10px}
 .portal-studio .stats-model-filter{grid-column:1/-1;min-width:0}
 /* Mobile cards preserve every cell, including match results and explanatory actions. */
 .portal-card-table{display:block;min-width:0!important;width:100%;max-width:100%;white-space:normal!important}
 .portal-card-table thead{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 .portal-card-table tbody{display:grid;gap:12px;min-width:0}
 .portal-card-table tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;min-width:0;padding:14px;border:1px solid var(--p-line);border-radius:12px;background:var(--p-card)}
 .portal-card-table tbody td{display:block;min-width:0!important;max-width:none!important;border:0!important;padding:0!important;font-size:14px!important;white-space:normal;overflow-wrap:anywhere;vertical-align:top}
 .portal-card-table tbody td:before{content:attr(data-mobile-label);display:block;margin-bottom:5px;color:var(--p-muted);font-size:11px;font-weight:400;line-height:1.4}
 .portal-card-table tbody td:first-child{grid-column:1/-1;font-size:15px!important;font-weight:600}
 .portal-card-table tbody td:first-child:before{display:none}
 .portal-card-table tbody td small{font-size:12px;line-height:1.5;max-width:none}
 .portal-card-table tbody td[colspan]{grid-column:1/-1;font-weight:400}
 .portal-card-table tbody td[colspan]:before{display:none}
 .portal-card-table tbody td button{width:100%;font-size:13px;border:1px solid var(--p-line)}
 .portal-card-table tbody td:has(button){align-self:end}
 .portal-card-table .probability{font-size:22px;font-weight:650}
 .portal-studio #statsSummary tr{grid-template-columns:repeat(5,minmax(0,1fr));gap:12px 5px}
 .portal-studio #statsSummary td:nth-child(-n+2){grid-column:1/-1}
 .portal-studio #statsSummary td:nth-child(n+3){font-size:13px!important;font-variant-numeric:tabular-nums}
 .portal-studio #statsSummary td:nth-child(n+3):before{font-size:10px;min-height:28px}
 .portal-studio #statsSummary td:nth-child(n+8){border-top:1px solid var(--line)!important;padding-top:10px!important}
 .portal-studio #statsRows td:nth-child(2),.portal-studio #statsRows td:nth-child(3){grid-column:1/-1}
 .portal-studio #batchMatches td:nth-child(2),.portal-studio #batchMatches td:last-child{grid-column:1/-1}
 .portal-shell .p-table-wrap td a{min-height:44px;padding:8px 0;display:block;margin:0}
 .portal-studio .job-bar{min-height:48px;padding:6px 10px max(6px,env(safe-area-inset-bottom));gap:8px}
 .portal-studio #jobMessage{font-size:11px}
 .portal-studio #showLog{flex-shrink:0}
 .portal-studio footer span{float:none;display:block}
 .portal-monitor{right:8px;bottom:calc(58px + env(safe-area-inset-bottom));width:calc(100vw - 16px)}
 .portal-monitor.is-collapsed{width:178px;max-width:calc(100vw - 16px)}
 .portal-monitor.is-collapsed #monitorBrief{display:none}
 .portal-monitor #monitorToggle{padding:9px 12px;min-height:44px;font-size:12px}
 .portal-monitor #monitorBody{max-height:45dvh}
 .portal-monitor #monitorBrief{white-space:normal;overflow-wrap:anywhere}
 .portal-studio #toast{right:12px;bottom:calc(112px + env(safe-area-inset-bottom));max-width:calc(100vw - 24px)}
 .portal-shell .p-header{padding:12px;display:flex;flex-wrap:wrap;gap:10px}
 .portal-shell .p-header .p-brand{font-size:20px;min-width:0;white-space:normal}
 .portal-shell .p-header nav{width:100%;display:flex;flex-wrap:wrap;gap:8px}
 .portal-shell .p-header nav>a{display:inline-flex;align-items:center;padding:8px 10px;min-height:44px;border:1px solid var(--p-line);border-radius:8px}
 .portal-shell .p-header nav form{margin-left:auto}
 .portal-shell .p-main{padding:22px 12px 130px}
 .portal-shell .p-card{padding:16px}
 .portal-shell .p-two-columns,.portal-shell .p-login{grid-template-columns:minmax(0,1fr);gap:18px}
 .portal-shell .p-login{margin:12px auto}
 .portal-shell .p-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 .portal-shell .p-metrics>div{padding:16px}
 .portal-shell .p-metrics strong{font-size:24px}
 .portal-shell .p-title{flex-wrap:wrap;gap:10px}
 .portal-shell .p-form [id=id_engine_ids]{grid-template-columns:minmax(0,1fr);max-height:none;overflow:visible;padding:6px}
 .portal-shell .p-form [id=id_engine_ids] label{font-size:14px;line-height:1.45;min-height:46px}
 .portal-shell .p-form input[type=checkbox]{width:24px;height:24px}
 .portal-shell .p-admin-actions{display:grid;grid-template-columns:1fr}
 .portal-shell .p-form-actions>*{flex:1}
 .portal-shell .p-footer{flex-direction:column;padding:18px 12px;gap:10px}
}
@media(max-width:380px){
 .portal-studio .topbar{gap:6px;padding:8px;grid-template-columns:40px minmax(0,1fr) 40px auto}
 .portal-studio .topbar>.brand{font-size:16px;gap:5px}
 .portal-studio .portal-brand-logo{width:26px;height:26px;flex-basis:26px}
 .portal-studio .brand small{font-size:6px}
 .portal-studio #navToggle,.portal-studio .topbar>.portal-theme-toggle{width:40px;min-width:40px;padding:8px}
 .portal-studio .portal-logout .quiet{padding:8px;font-size:12px}
 .portal-studio .hero{display:block}.portal-studio .hero-stats{margin-top:12px;gap:10px;flex-wrap:wrap}
 .portal-studio .hero-stats .week-range{width:auto;margin-left:auto;max-width:115px}
 .portal-studio .dialog-header h2{font-size:18px}
 .portal-studio .match-table tbody tr{grid-template-columns:30px minmax(0,1fr);padding:12px 10px}
 .portal-studio .match-table tbody td:nth-child(5){grid-column:2;grid-row:4}
 .portal-studio .match-table tbody td:nth-child(6){grid-column:2;grid-row:5}
 .portal-studio .open-match{width:100%}
}


/* Today's ticket: existing estimates only, separate from AI generation and statistics. */
#todayTicketDialog{width:min(980px,95vw)}
.ticket-controls{display:flex;align-items:flex-end;gap:12px;margin:0;padding:16px 24px;border-bottom:1px solid var(--line);background:var(--p-card);flex-shrink:0}
.ticket-controls label{display:flex;flex-direction:column;gap:7px;min-width:160px;font-size:12px;color:var(--muted)}
.ticket-controls select{min-height:44px}
.ticket-controls button{min-height:44px}
.ticket-intro,.ticket-method p{font-size:13px;line-height:1.65;color:var(--muted);margin:0 0 14px}
.ticket-state{padding:12px 14px;background:var(--ui-tint);border:1px solid var(--ui-edge);border-radius:9px;color:var(--ink);font-size:14px;line-height:1.6}
.ticket-state.ticket-warning{border-color:#cc9a44;background:#fff5dc;color:#674815}
[data-theme=dark] .ticket-state.ticket-warning{background:#3b3422;color:#f3ddb3;border-color:#8b7542}
.ticket-stamp{font-size:12px;color:var(--muted);line-height:1.6}
.ticket-items{list-style:none;margin:18px 0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.ticket-match{min-width:0;padding:18px;border:1px solid var(--line);border-radius:13px;background:var(--p-card);overflow-wrap:anywhere}
.ticket-match-top{display:flex;align-items:center;gap:10px;margin-bottom:14px}
.ticket-position{display:grid;place-items:center;flex:0 0 28px;height:28px;border-radius:8px;background:var(--ui-tint);color:var(--teal);font-size:13px;font-weight:700}
.ticket-time{font-size:12px;color:var(--muted)}
.ticket-match h3{font-size:18px;margin:0 0 7px;font-weight:600;line-height:1.45}
.ticket-competition{font-size:12px;color:var(--muted);margin:0 0 15px;line-height:1.5}
.ticket-pick{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px;background:var(--ui-tint);border-radius:9px}
.ticket-pick strong{font-size:17px}
.ticket-probability{color:var(--teal);font-size:23px;font-weight:700;white-space:nowrap}
.ticket-model{font-size:13px;margin:13px 0 6px;line-height:1.5}
.ticket-quality{font-size:11px;color:var(--muted);margin:0;line-height:1.5}
.ticket-quality.ticket-limited{color:#936112;font-weight:700}
[data-theme=dark] .ticket-quality.ticket-limited{color:#f0c88a}
.ticket-method{border-top:1px solid var(--line);padding-top:14px;font-size:13px}
.ticket-method summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-weight:600;color:var(--teal)}
.ticket-method summary:before{content:"+";margin-right:10px}
.ticket-method[open] summary:before{content:"-"}
.ticket-footer{flex-shrink:0;border-top:1px solid var(--line);padding:14px 24px;background:var(--p-card);font-size:12px;color:var(--muted);line-height:1.5}
.ticket-match.ticket-expired{border-color:var(--p-red)}
.ticket-live-state{margin:12px 0 0;color:var(--p-red);font-size:12px;font-weight:600}
#todayTicketDialog [hidden]{display:none!important}
@media(max-width:960px){
 .portal-studio #todayTicketDialog{width:100%;height:100dvh;max-height:100dvh}
 .ticket-controls{padding:12px 14px;gap:10px;flex-wrap:wrap}
 .ticket-controls label{flex:1;min-width:130px;font-size:12px}
 .ticket-controls select{width:100%;font-size:16px}
 .ticket-controls button{font-size:13px;min-height:46px}
 .ticket-items{grid-template-columns:minmax(0,1fr);gap:12px}
 .ticket-match{padding:15px}
 .ticket-match h3{font-size:18px}
 .ticket-footer{padding:12px 14px max(14px,env(safe-area-inset-bottom));font-size:11px}
 .ticket-intro{font-size:13px}
}


/* Public requests reuse the existing login layout and administration controls. */
.p-auth-forms{display:grid;gap:20px;min-width:0}
.p-auth-forms .p-card{min-width:0}
.p-auth-forms input:not([type=checkbox]){max-width:100%}
#registrazione{scroll-margin-top:24px}
.p-registration-alert{display:flex;flex-wrap:wrap;gap:10px 18px;align-items:center}
.p-registration-alert a{font-weight:600}
.p-registration-alert [hidden]{display:none!important}
.p-registration-history{margin-top:18px}
.p-registration-history summary{cursor:pointer;min-height:44px;display:flex;align-items:center;color:var(--p-ink)}
#registrazioni td{overflow-wrap:anywhere}
@media(max-width:960px){.p-auth-forms{gap:16px}.p-registration-alert{align-items:flex-start;flex-direction:column}}
