/* STPO is a tool, not a fourth sidebar section. Shared Portal tokens. */
.stpo-stage{height:100%;overflow:auto;min-height:0;padding:16px 22px 36px;box-sizing:border-box}
.stpo-header{display:flex;align-items:center;justify-content:space-between;gap:16px;
 padding:18px 20px;border:1px solid var(--line,#344a40);border-radius:16px;
 background:var(--panel,#16241d)}
.stpo-header h2{font-size:26px;margin:2px 0 5px}
.stpo-header p{color:var(--muted,#aab6ae);margin:0;font-size:13px}
.stpo-header-actions{display:flex;align-items:center;gap:12px}
.stpo-subtle{color:var(--muted,#aab6ae);font-size:12px}
.stpo-toolbar{display:flex;align-items:center;gap:14px;padding:16px 0}
#stpo-search{width:min(500px,100%);padding:12px 14px;border-radius:10px;
 background:var(--panel,#16241d);color:var(--ink,#eaf3ed);
 border:1px solid var(--line,#344a40);font:inherit}
.stpo-gallery{display:flex;flex-direction:column;gap:25px}
.stpo-group-heading{display:flex;align-items:baseline;gap:12px;margin:0 0 11px}
.stpo-group-heading h3{font-size:17px;margin:0}
.stpo-card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:14px}
.stpo-card{display:flex;flex-direction:column;min-width:0;padding:10px;gap:9px;
 background:var(--panel,#16241d);border:1px solid var(--line,#344a40);
 border-radius:13px}
.stpo-art{min-height:125px;border-radius:9px;display:grid;place-items:center;
 background:var(--soft,#24372e)}
.stpo-file-type{font-weight:800;letter-spacing:.12em;font-size:15px;color:var(--muted,#aab6ae)}
.stpo-file-name{line-height:1.3;overflow-wrap:anywhere;font-size:14px}
.stpo-file-details{color:var(--muted,#aab6ae);font-size:11px}
.stpo-card-actions{display:flex;gap:8px;margin-top:auto}
.stpo-card-actions button{flex:1}
.stpo-waiting{font-size:12px;color:var(--muted,#aab6ae)}
.stpo-empty{padding:30px;border:1px dashed var(--line,#344a40);border-radius:12px}
.stpo-manager-form{display:flex;flex-direction:column;align-items:flex-start;gap:8px}
.stpo-manager-form textarea{width:100%;min-width:0;box-sizing:border-box;resize:vertical;
 background:var(--panel,#16241d);color:var(--ink,#eaf3ed);border:1px solid var(--line,#344a40);
 border-radius:10px;padding:10px;font:inherit}
.stpo-connected{display:flex;flex-direction:column;gap:8px;margin-top:12px}
.stpo-source-entry{display:flex;align-items:center;justify-content:space-between;gap:12px;
 border:1px solid var(--line,#344a40);border-radius:10px;padding:10px}
.stpo-manager-actions{display:flex;flex-wrap:wrap;gap:6px;align-items:center;justify-content:flex-end;flex:0 0 auto}
.stpo-source-text{min-width:0;display:flex;flex-direction:column;gap:3px;overflow-wrap:anywhere}
.stpo-source-text a{font-size:11px;color:var(--muted,#aab6ae)}
.stpo-source-text small{font-size:11px;color:var(--muted,#aab6ae)}
.stpo-preview-dialog{width:min(1100px,93vw);height:min(90vh,850px);padding:12px;border-radius:12px;
 background:var(--panel,#16241d);color:var(--ink,#eaf3ed)}
.stpo-preview-dialog::backdrop{background:#000a}
.stpo-preview-header{display:flex;justify-content:space-between;align-items:center;padding:2px 6px 10px}
#stpo-preview-frame{border:0;background:white;width:100%;height:calc(100% - 44px)}
@media(max-width:680px){.stpo-stage{padding:9px}.stpo-header{display:block}
.stpo-header-actions{margin-top:10px}.stpo-card-grid{grid-template-columns:repeat(auto-fill,minmax(145px,1fr))}}

@media(max-width:560px){.stpo-source-entry{align-items:stretch;flex-direction:column}.stpo-manager-actions{justify-content:flex-start}}

/* Two-level STPO discovery: origin → folder/individual files. */
.stpo-origin{display:flex;flex-direction:column;gap:11px}
.stpo-origin+.stpo-origin{padding-top:23px;border-top:1px solid var(--line,#344a40)}
.stpo-origin-title{margin:0 0 5px;font-size:22px;font-weight:800;color:var(--ink,#eaf3ed)}
.stpo-origin .stpo-group{padding-left:12px;border-left:2px solid var(--line,#344a40)}
.stpo-source-edit{display:flex;align-items:flex-end;gap:8px;flex-wrap:wrap;min-width:280px}
.stpo-source-field{display:flex;flex-direction:column;gap:5px;font-size:11px;color:var(--muted,#aab6ae)}
.stpo-source-edit input,.stpo-source-edit select,.stpo-manager-form select{
 background:var(--panel,#16241d);color:var(--ink,#eaf3ed);
 border:1px solid var(--line,#344a40);border-radius:8px;
 padding:8px;font:inherit;max-width:100%;box-sizing:border-box
}
.stpo-source-edit input{width:220px}
.stpo-source-edit select{min-width:118px}
.stpo-manager-form select{width:min(270px,100%)}
@media(max-width:1050px){.stpo-source-entry{flex-wrap:wrap}.stpo-source-edit{order:3;width:100%}}

/* STPO 2026-10-21: shared-tool-height functional header and bookmark density. */
.stpo-stage{padding:10px 14px 20px}
.stpo-stage .stpo-header{min-height:72px;height:auto;display:grid;
 grid-template-columns:minmax(105px,150px) auto minmax(180px,1fr) auto auto;
 align-items:center;column-gap:12px;row-gap:5px;padding:9px 15px;
 border-radius:11px;box-sizing:border-box}
.stpo-head-identity{min-width:0;display:flex;flex-direction:column;gap:1px}
.stpo-head-identity .eyebrow{font-size:9px;letter-spacing:.12em;margin:0}
.stpo-head-identity h2{font-size:20px;line-height:1.15;margin:0}
.stpo-head-navigation{display:flex;align-items:center;gap:3px;white-space:nowrap}
.stpo-origin-tab{border:1px solid transparent;border-radius:7px;
 background:transparent;color:var(--muted,#aab6ae);padding:7px 10px;
 font:inherit;font-size:12px;cursor:pointer}
.stpo-origin-tab[aria-pressed="true"]{color:var(--ink,#eaf3ed);
 background:var(--soft,#24372e);border-color:var(--line,#344a40);font-weight:700}
.stpo-head-search{display:flex;align-items:center;gap:7px;min-width:0;
 background:var(--soft,#24372e);border:1px solid var(--line,#344a40);
 padding:4px 10px;border-radius:8px}
.stpo-head-search span{color:var(--muted,#aab6ae);font-size:19px}
#stpo-search{border:0;background:transparent;width:100%;min-width:0;
 box-shadow:none;padding:5px 0;font-size:13px;color:var(--ink,#eaf3ed)}
.stpo-head-status{display:flex;flex-direction:column;align-items:flex-end;
 justify-content:center;gap:3px;min-width:115px;white-space:nowrap}
.stpo-head-status .stpo-subtle{font-size:10px}
.stpo-stage .stpo-header #stpo-refresh{padding:7px 9px;font-size:12px}
.stpo-stage #stpo-message:empty{display:none}
.stpo-stage #stpo-message{margin:7px 0;font-size:12px}
.stpo-gallery{gap:12px;margin-top:12px}
.stpo-origin{gap:9px}
.stpo-origin+.stpo-origin{padding-top:12px}
.stpo-origin-title{font-size:18px;line-height:1.2;margin:0}
.stpo-origin .stpo-group{padding-left:9px;gap:5px}
.stpo-group-heading{margin-bottom:7px;gap:8px}
.stpo-group-heading h3{font-size:13px}
.stpo-card-grid{grid-template-columns:repeat(auto-fill,minmax(168px,1fr));gap:9px}
.stpo-card{padding:9px;gap:6px;border-radius:9px}
.stpo-art{min-height:0;height:26px;background:transparent;display:flex;align-items:center;justify-content:flex-start}
.stpo-file-type{font-size:10px;letter-spacing:.04em;font-weight:800;
 background:var(--soft,#24372e);border-radius:4px;padding:4px 6px}
.stpo-file-name{font-size:13px;line-height:1.25;max-height:2.5em;overflow:hidden}
.stpo-file-details{font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.stpo-card-actions{gap:5px}
.stpo-card-actions button{padding:5px 7px;font-size:11px}
.stpo-empty{padding:14px;font-size:12px}
/* Bounded grid: NEVER squeeze titles to one character per line when a
   controls/editor column grows. Other STDB sources keep their own layouts. */
.stpo-source-entry{display:grid;grid-template-columns:minmax(180px,1.1fr)
 minmax(320px,1.7fr) auto;align-items:center;gap:12px;min-width:0}
.stpo-source-text{min-width:180px;max-width:100%;overflow-wrap:normal;word-break:normal}
.stpo-source-text strong{font-size:13px;overflow-wrap:break-word;word-break:normal}
.stpo-source-text a{max-width:100%;white-space:normal;overflow-wrap:break-word;word-break:normal}
.stpo-source-error{color:var(--warning,#eca86d)}
.stpo-source-edit{min-width:0;width:100%;flex-wrap:wrap;align-items:flex-end}
.stpo-source-field{min-width:105px}
.stpo-source-edit input{width:min(225px,100%)}
.stpo-source-edit select{min-width:110px}
.stpo-manager-actions{white-space:nowrap;align-self:center}
@media(max-width:1150px){
 .stpo-source-entry{grid-template-columns:minmax(190px,1fr) minmax(320px,2fr)}
 .stpo-manager-actions{grid-column:2;justify-content:flex-end}
}
@media(max-width:770px){
 .stpo-stage .stpo-header{grid-template-columns:auto 1fr auto;min-height:0;row-gap:7px}
 .stpo-head-navigation{grid-column:2}
 .stpo-head-search{grid-column:1/3;grid-row:2}
 .stpo-head-status{grid-column:3;grid-row:1/3}
 .stpo-stage .stpo-header #stpo-refresh{grid-column:3;grid-row:3;justify-self:end}
 .stpo-source-entry{grid-template-columns:minmax(0,1fr);align-items:stretch}
 .stpo-source-text{min-width:0}
 .stpo-manager-actions{grid-column:auto;justify-content:flex-start}
 .stpo-source-edit{order:0;width:100%}
}
@media(max-width:520px){
 .stpo-stage .stpo-header{grid-template-columns:1fr auto}
 .stpo-head-navigation{grid-column:1/3;grid-row:2;justify-content:flex-start}
 .stpo-head-search{grid-column:1/3;grid-row:3}
 .stpo-head-status{grid-column:2;grid-row:1}
 .stpo-stage .stpo-header #stpo-refresh{grid-column:2;grid-row:4}
 .stpo-card-grid{grid-template-columns:repeat(auto-fill,minmax(145px,1fr))}
}

/* v1.1.0: one accessible card, one modal. No duplicate PDF print controls. */
.stpo-card{width:100%;min-height:134px;text-align:left;color:var(--ink,#eaf3ed);
 cursor:pointer;align-items:stretch;appearance:none;font:inherit}
.stpo-card:hover:not(:disabled){border-color:var(--accent,#ff714f);
 background:color-mix(in srgb,var(--soft,#24372e) 42%,var(--panel,#16241d))}
.stpo-card:focus-visible{outline:2px solid var(--accent,#ff714f);outline-offset:2px}
.stpo-card:disabled{opacity:.65;cursor:default}
.stpo-file-name{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
 overflow:hidden;min-height:2.45em;max-height:2.5em}
.stpo-art{height:75px;min-height:75px;display:flex;align-items:center;justify-content:center;
 overflow:hidden;border-radius:7px;background:var(--soft,#24372e)}
.stpo-image-thumb{width:100%;height:100%;object-fit:contain}
.stpo-fallback-icon{font-size:14px;font-weight:800;letter-spacing:.07em;
 border:1px solid var(--line,#344a40);padding:8px;border-radius:7px}
.stpo-art-pdf .stpo-fallback-icon{border-color:#ac8c82;color:#f6b6a5}
.stpo-sheet-tile{height:61px;width:94px;display:flex;flex-direction:column;
 border-radius:4px;background:#eaf7e8;overflow:hidden;box-shadow:0 2px 8px #0003;
 border:1px solid #80ad81}
.stpo-sheet-mark{font-weight:900;background:#31784a;color:#fff;font-size:14px;
 text-align:left;padding-left:7px;line-height:19px}
.stpo-sheet-cells{flex:1;background:
 repeating-linear-gradient(90deg,transparent 0 18px,#a9cca8 19px 20px),
 repeating-linear-gradient(0deg,#f3f9f1 0 10px,#b7d1b3 11px 12px)}
.stpo-preview-dialog{display:flex;flex-direction:column;gap:9px;max-height:94dvh;
 border:1px solid var(--line,#344a40);box-sizing:border-box}
.stpo-preview-dialog:not([open]){display:none}
.stpo-preview-header{display:flex;align-items:flex-start;justify-content:space-between;
 flex-wrap:wrap;gap:10px;padding:6px}
.stpo-preview-identity{flex:1 1 290px;min-width:0}
.stpo-preview-breadcrumb{font-size:12px;color:var(--muted,#aab6ae);
 margin:0 0 5px;overflow-wrap:anywhere}
#stpo-preview-title{display:block;font-size:17px;line-height:1.25;
 white-space:normal;overflow-wrap:anywhere}
.stpo-preview-controls{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.stpo-preview-controls button{min-height:36px;padding:6px 11px}
#stpo-preview-count{white-space:nowrap;font-variant-numeric:tabular-nums;
 color:var(--muted,#aab6ae);font-size:12px}
.stpo-preview-content{flex:1;min-height:0;overflow:hidden;display:flex;
 align-items:stretch;justify-content:center;border-radius:8px;background:#121c17}
#stpo-preview-frame{flex:1;min-width:0;height:100%;min-height:0}
#stpo-preview-image{width:100%;height:100%;min-height:0;object-fit:contain}
#stpo-preview-image[hidden],#stpo-preview-frame[hidden],
#stpo-preview-print[hidden]{display:none!important}
@media(max-width:680px){
 .stpo-preview-dialog{width:96vw;height:94dvh;padding:8px}
 .stpo-preview-controls{width:100%;justify-content:space-between;gap:4px}
 .stpo-preview-controls button{padding:6px 9px}
 .stpo-preview-identity{flex-basis:100%}
}

/* Shared StenTeam tool-header contract; same density as Sheet/Check-in. */
.stpo-stage{padding:9px 14px 20px}
.stpo-stage .stpo-header{min-height:54px;height:auto;
 grid-template-columns:minmax(155px,auto) auto minmax(160px,1fr) auto auto;
 column-gap:10px;row-gap:7px;padding:8px 12px;border-radius:11px}
.stpo-head-identity.workspace-heading{display:flex;flex-direction:row;
 flex-wrap:wrap;align-items:baseline;gap:6px}
.stpo-head-identity h2{font-size:20px}
.stpo-head-identity .eyebrow{font-size:10px;color:var(--muted);white-space:nowrap}
.stpo-stage .stpo-header #stpo-refresh{padding:7px 9px}
.stpo-head-search{min-width:160px}
.stpo-slide-tile{width:110px;height:64px;box-sizing:border-box;
 position:relative;display:flex;flex-direction:column;justify-content:center;
 align-items:flex-start;gap:7px;padding:10px 11px;background:#fff9ed;
 color:#513e20;border:1px solid #efc474;border-left:8px solid #f4a631;
 border-radius:4px;box-shadow:0 2px 8px #0003;overflow:hidden}
.stpo-slide-ribbon{font-size:13px;line-height:1;color:#ca7715}
.stpo-slide-title{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
 overflow:hidden;text-align:left;font-size:8px;font-weight:760;line-height:1.16}
.stpo-slide-accent{position:absolute;bottom:0;right:0;width:50%;height:5px;
 background:#f4a631}
.stpo-pdf-page{position:relative;width:57px;height:64px;display:flex;
 justify-content:flex-start;align-items:center;padding:9px 5px;
 box-sizing:border-box;border:1px solid #d8b4a9;background:#fff6f4;
 border-radius:2px;box-shadow:0 2px 8px #0003}
.stpo-pdf-page:after{content:'';position:absolute;top:-1px;right:-1px;
 border-top:14px solid var(--soft,#24372e);
 border-left:14px solid #ecd1c8}
.stpo-pdf-ribbon{background:#ba3f36;color:white;border-radius:2px;
 padding:4px 6px;font-size:12px;font-weight:900;letter-spacing:.03em}
.stpo-pdf-lines{position:absolute;bottom:9px;left:7px;width:37px;height:2px;
 background:#d8b4a9;box-shadow:0 -6px #d8b4a9}
@media(max-width:1000px){
 .stpo-stage .stpo-header{grid-template-columns:auto 1fr auto}
 .stpo-head-navigation{grid-column:2}
 .stpo-head-search{grid-column:1/3;grid-row:2}
 .stpo-head-status{grid-column:3;grid-row:1/3}
 .stpo-stage .stpo-header #stpo-refresh{grid-column:3;grid-row:3}
}
@media(max-width:560px){
 .stpo-stage .stpo-header{grid-template-columns:1fr auto}
 .stpo-head-navigation{grid-column:1/3;grid-row:2}
 .stpo-head-search{grid-column:1/3;grid-row:3}
 .stpo-head-status{grid-column:2;grid-row:1}
 .stpo-stage .stpo-header #stpo-refresh{grid-column:2;grid-row:4}
}

/* STAC-inspired shared Hub tool identity: same rail-aligned title hierarchy
 * while STPO keeps its unique origin, search, freshness and refresh controls. */
.stpo-stage{padding:0 12px 20px}
.stpo-stage .stpo-header{min-height:88px;grid-template-columns:
 minmax(210px,auto) auto minmax(140px,1fr) auto auto;
 border:0;border-bottom:1px solid var(--line);border-radius:0;
 background:var(--card);padding:12px 12px 11px}
.stpo-head-identity.workspace-heading{display:flex;flex-direction:column;
 align-items:flex-start;gap:4px}
.stpo-head-identity .eyebrow{font-size:10px;font-weight:830;letter-spacing:.11em;
 color:var(--orange,#ff5733)}
.stpo-head-identity h2{font-size:22px;line-height:1.05;font-weight:880;margin:0}
.stpo-head-identity h2 span{color:var(--muted);font-size:14px;font-weight:650}
@media(max-width:1000px){.stpo-stage .stpo-header{
 grid-template-columns:auto minmax(0,1fr) auto}}
@media(max-width:560px){.stpo-stage{padding:0 6px 14px}
 .stpo-stage .stpo-header{grid-template-columns:1fr auto;padding:10px 7px}}

/* StenTeam fixed tool header: edge-to-edge rail boundary, 22px consistent
 * text gutter, 76px desktop height. Identical identity hierarchy to STDB,
 * STTD, Check-in and embedded STAC; unique controls stay within the bar. */
.stpo-stage{padding:0 0 20px!important}
.stpo-stage .stpo-header{min-height:76px;height:76px;
 border:0;border-bottom:1px solid var(--line);border-radius:0;
 margin:0;background:var(--card);box-sizing:border-box;
 padding:9px 22px;gap:9px;align-items:center}
.stpo-head-identity.workspace-heading{gap:3px}
.stpo-head-identity .eyebrow{font-size:10px;letter-spacing:.09em}
.stpo-head-identity h2{font-size:20px;line-height:1.15}
.stpo-head-identity h2 span{font-size:13px}
@media(max-width:1000px){
 .stpo-stage .stpo-header{height:auto;min-height:76px}
}
@media(max-width:560px){
 .stpo-stage .stpo-header{padding:9px 12px}
}


/* Shared StenTeam body gutter: header stays rail-flush, page content breathes.
 * This is the same natural 22px inset used inside original operational tools.
 * Private viewer/dialog positioning and the card grid are unchanged. */
.stpo-stage > :not(.stpo-header):not(dialog){
 margin-left:clamp(16px,1.5vw,26px);
 margin-right:clamp(16px,1.5vw,26px);
}
@media(max-width:560px){
 .stpo-stage > :not(.stpo-header):not(dialog){
  margin-left:12px;margin-right:12px;
 }
}

/* v1.2: page-orientation toggle belongs to our own modal header.
 * Google only receives the optional export when someone requests it. */
.stpo-preview-controls #stpo-preview-orientation{
 border-color:color-mix(in srgb,var(--blue,#84b9d4) 55%,var(--line,#35463e));
 font-weight:800;white-space:nowrap
}
.stpo-preview-controls #stpo-preview-orientation[hidden],
.stpo-preview-controls #stpo-preview-orientation-status[hidden]{display:none!important}
.stpo-preview-controls .stpo-orientation-status{
 max-width:220px;color:var(--muted,#aab6ae);font-size:10px;line-height:1.3
}
@media(max-width:650px){
 .stpo-preview-controls .stpo-orientation-status{max-width:150px}
}
