/* One compact screen toolbar, then content. Never pin tabs over a document. */
body:not(.lite) main:has(.dossier-view:not([hidden])){padding-top:8px}
.dossier-view:has(>.section-tabs){grid-template-columns:minmax(0,1fr) minmax(0,1.6fr);column-gap:12px;row-gap:12px;align-items:start}
.dossier-view:has(>.section-tabs)>.scene-heading{grid-column:1;grid-row:1;align-self:center;min-width:0;min-height:0;padding:0;overflow:visible}
.dossier-view:has(>.section-tabs)>.scene-heading h1{font-size:20px;line-height:1.4;letter-spacing:.02em;margin:0;overflow-wrap:anywhere}
.dossier-view:has(>.section-tabs)>.section-tabs{grid-column:2;grid-row:1;min-width:0;position:static;top:auto;padding:0;gap:4px;align-self:start}
.dossier-view:has(>.section-tabs)>.section-pane{grid-column:1/-1;min-width:0}
.dossier-view .section-tabs button{min-width:44px;min-height:44px;padding:8px 2px;line-height:1.5;white-space:normal;overflow-wrap:anywhere}
.agent-home>.home-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:0;position:static}
.agent-home>.home-tabs::before{display:none}
.agent-home>.home-tabs button{min-width:44px;min-height:44px;padding:8px 4px;font-size:14px;line-height:1.5;white-space:normal}
.gacha-scene .seg{padding:0;margin-block:0;gap:8px}
.gacha-scene .seg button{min-width:44px;min-height:44px;padding:8px 4px;font-size:16px;line-height:1.5;white-space:normal}
.menu-scene{gap:12px}
.menu-page-heading{grid-template-columns:minmax(44px,max-content) minmax(0,1fr);align-items:center;gap:12px;padding-bottom:8px;min-width:0}
.menu-page-heading .menu-back{min-width:44px;max-width:140px;padding:8px 4px;line-height:1.5;white-space:normal;text-align:left}
.menu-page-heading h1{min-width:0;font-size:20px;line-height:1.5;overflow-wrap:anywhere}
.report-scene .agent-record-link{margin:0;min-height:44px;font-size:15px;line-height:1.6}
.catalog{display:grid;gap:12px;min-width:0}
.catalog>.catalog-tabs,.catalog>.catalog-intro,.catalog>.catalog-summary,.catalog-summary p{margin:0}
.catalog-tabs button{min-height:44px;min-width:44px;white-space:normal;overflow-wrap:anywhere}
.menu-scene .account-card:first-child{margin-top:0}
/* Reading can grow; the toolbar must reflow, not clip enlarged text. */
.section-tabs button:focus-visible,.home-tabs button:focus-visible,.seg button:focus-visible{outline-offset:1px}
@media(max-height:500px){.dossier-view:has(>.section-tabs){row-gap:8px}.menu-scene{gap:8px}}

/* Dark screen text uses its own solid surface, never the paper --ink token. */
.watch-lab{margin:0 0 16px;padding:12px;background:#171510;color:#f0e6d0;border:1px solid #65563e;min-width:0}
.watch-lab-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px}
.watch-lab-heading h2{font-size:18px;line-height:1.5;margin:0}
.watch-lab-heading .watch-lab-links{display:flex;flex-wrap:wrap;gap:6px;margin:0;min-width:0}
.watch-lab-heading .watch-lab-links button{flex:0 1 auto;min-width:44px;min-height:44px;padding:8px 6px;font-size:14px;white-space:normal}
.watch-lab .watch-lab-context{display:flex;flex-wrap:wrap;gap:2px 16px;margin:8px 0;color:#e3d7c1;font-size:14px;line-height:1.6;overflow-wrap:anywhere}
.watch-lab :is(.watch-upgrades,.watch-route-details)>summary{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:48px;padding:12px 0;cursor:pointer;color:#f0e6d0;border-top:1px solid #65563e;line-height:1.5}
.watch-lab :is(.watch-upgrades,.watch-route-details)>summary::after{content:'';flex:0 0 8px;width:8px;height:8px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;transform:rotate(45deg);margin:0 4px 4px 0}
.watch-lab :is(.watch-upgrades,.watch-route-details)[open]>summary::after{transform:rotate(225deg);margin-block:4px 0}
.watch-route-details>summary span,.watch-lab .watch-upgrades>summary span{flex-shrink:0;color:#d8ccb5;font-size:14px}
.watch-lab .watch-note{font-size:14px;line-height:1.7;color:#d8ccb5}
.watch-lab .watch-mode>span{color:#e3d7c1;font-size:14px;line-height:1.5;max-width:8em;text-align:right}
.watch-lab .watch-mode small,.watch-lab .watch-upgrades small{color:#d8ccb5}
.watch-upgrades article>.watch-upgrade-action{display:grid;justify-items:end;gap:4px;flex:0 0 auto;min-width:90px;max-width:45%}
.watch-upgrade-action .watch-upgrade-hint{margin:0;text-align:right;font-size:14px;line-height:1.5;overflow-wrap:anywhere}
/* The completed cross-file sits on a dark research card, unlike paper upgrades. */
.lab-scene .research-card .up-eff{color:#ebddc2}
.lab-scene .research-card .note{color:#e8c7a4}
body:not(.lite) .lab-scene .research-card::before{color:#e4ad9b}

/* Archive: keep the first dossier visible sooner without hiding progress or the case link. */
.archive-scene [data-spane="archive:files"]{grid-template-columns:minmax(0,1fr) auto;gap:8px;align-content:start}
.archive-scene .progress{grid-column:1/-1;gap:4px;padding:4px 0 2px;border:0;background:transparent}
.archive-scene .progress .row{align-items:baseline;color:#e2d5bf;font-size:13px;line-height:1.5}
.archive-scene .progress .row:last-child{color:#d4c5aa}
.archive-scene .progress #rate{font-size:17px;color:#ffe7ba}
.archive-scene .progress .bar{height:4px;margin:2px 0;background:#5d5448}
.archive-scene .chips{display:flex;flex-wrap:nowrap;gap:4px;min-width:0}
.archive-scene .chips button{flex:1 1 0;min-width:0;min-height:44px;height:auto;padding:7px 4px;font-size:13px;line-height:1.45;white-space:normal;overflow-wrap:anywhere}
.archive-scene .legend-link{grid-column:2;min-width:44px;min-height:44px;width:auto;margin:0;padding:8px 9px;justify-content:center;line-height:1.45;white-space:normal;overflow-wrap:anywhere}
.archive-scene .files{grid-column:1/-1;gap:16px 10px;padding-top:8px}
.archive-scene .folder.secret{grid-column:1/-1;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:4px 8px;min-height:104px;padding:16px 14px 10px}
.archive-scene .folder.secret .m,.archive-scene .folder.secret .cond{grid-column:1/-1;margin:0;padding:0;border:0;line-height:1.4}
.archive-scene .folder.secret .m{font-size:12px;color:#4b3327}
.archive-scene .folder.secret .n{min-width:0;font-size:17px;line-height:1.35}
.archive-scene .folder.secret .pips{margin:0;align-self:center}
.archive-scene .folder.secret .cond{font-size:12px;color:#4b3327}
.archive-scene .folder .m,.archive-scene .folder .cond{font-size:13px;line-height:1.5}
.archive-scene .folder .m{color:#49331e}
.archive-scene .folder .cond{color:#3f2b19}
@media(max-width:359px){.archive-scene [data-spane="archive:files"]{grid-template-columns:minmax(0,1fr)}.archive-scene .legend-link{grid-column:1;justify-self:start}}
/* On agent phones, the archive serial is secondary to the title and balance. */
@media(max-width:599px){
 body:not(.lite) .top-in{padding-block:6px}
 body:not(.lite) .top-in .logo small{display:none}
 .lab-scene [data-spane="lab:upgrade"]>.labhead{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:4px 10px;padding:0}
 .lab-scene [data-spane="lab:upgrade"]>.labhead #evi{font-size:26px}
 .lab-scene [data-spane="lab:upgrade"]>.labhead .context-help{margin-left:auto;max-width:100%}
 .lab-scene [data-spane="lab:upgrade"]>.labhead .context-help[open]{flex-basis:100%;margin-left:0}
 .lab-scene #observation-lab .watch-lab{margin-bottom:0}
 .lab-scene #incursion-defense .inc-defense{margin:0}
}
