/* Scoped presentation repairs. Existing status colors and business data are retained. */
html.os-studio{--os-canvas:#f6f5f7;--os-ink:#20232d;--os-line:#dadce2;--os-turquoise:#087879}
html.os-studio[data-theme=dark]{--os-canvas:#12161e;--os-paper:#1c222d;--os-soft:#242c38;--os-ink:#f3f5f9;--os-muted:#b0b9c8;--os-line:#394555;--os-purple:#c185fc;--os-purple-soft:#342443;--os-turquoise:#67d2ce;--os-turquoise-soft:#183b3e;--os-action:#c185fc;--os-action-text:#20132c}

/* MY: rows must size to their content, not divide the viewport by the task count. */
html.os-studio.os-enhanced[data-os-portal=my] #view-cards.active{display:block!important;min-height:0;overflow:hidden}
html.os-studio.os-enhanced[data-os-portal=my] #cards{display:grid!important;height:100%;min-height:0;overflow:auto;grid-template-rows:none!important;grid-auto-rows:max-content!important;align-content:start!important;align-items:start!important;gap:14px;padding:16px;overscroll-behavior:contain}
html.os-studio.os-enhanced[data-os-portal=my] #cards>.ticket-card{height:auto!important;min-height:238px!important;max-height:none!important;align-self:start;display:flex;flex-direction:column;overflow:hidden;flex:none;border-radius:12px;text-align:start}
html.os-studio.os-enhanced[data-os-portal=my] #cards>.ticket-card>header{height:auto!important;min-height:36px;flex:0 0 auto;padding:9px 13px}
html.os-studio.os-enhanced[data-os-portal=my] #cards .card-body{height:auto!important;min-height:0;flex:1 0 auto;overflow:visible;padding:13px}
html.os-studio.os-enhanced[data-os-portal=my] #cards .card-body h3{font-size:15px;line-height:1.45;margin:0 0 7px;overflow-wrap:anywhere}
html.os-studio.os-enhanced[data-os-portal=my] #cards .card-body p{font-size:12px;line-height:1.55;margin:0 0 12px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
html.os-studio.os-enhanced[data-os-portal=my] #cards .facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
html.os-studio.os-enhanced[data-os-portal=my] #cards .fact{min-width:0;padding:7px 8px;border-radius:7px;background:var(--os-soft)}
html.os-studio.os-enhanced[data-os-portal=my] #cards .fact b{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;font-weight:500}
html.os-studio.os-enhanced[data-os-portal=my] #cards>.ticket-card>footer{flex:0 0 auto;height:auto;min-height:40px;margin-top:auto;padding:10px 13px;border-top:1px solid var(--os-line)}
html.os-studio[data-theme=dark][data-os-portal=my] #cards>.ticket-card>header>span{color:var(--os-ink)}
html.os-studio.os-enhanced[data-os-portal=my] #section-tasks>.toolbar,html.os-studio.os-enhanced[data-os-portal=my] #summary-strip{flex-shrink:0}

/* ADMIN: stacked controls cannot live inside the inherited fixed-height header. */
html.os-studio.os-enhanced[data-os-portal=admin] #status-tree-panel>header{height:auto!important;min-height:70px!important;max-height:none!important;flex:0 0 auto!important;display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:8px;padding:12px!important;overflow:visible}
html.os-studio.os-enhanced[data-os-portal=admin] #status-tree-panel>header>*{flex-shrink:0;min-width:0}
html.os-studio.os-enhanced[data-os-portal=admin] #status-tree-panel>header :is(button,select){min-height:32px}
html.os-studio.os-enhanced[data-os-portal=admin] #status-tree-panel>header+*{min-height:0;overflow:auto}

/* PILOT: source-backed 400px panel, flexible map, real existing task controls. */
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-app{height:100dvh;display:flex;flex-direction:column;overflow:hidden}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-header{height:auto!important;min-height:64px;flex:0 0 auto;padding:10px 18px!important;gap:16px;background:var(--os-paper);border-bottom:1px solid var(--os-line)}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-brand{gap:12px}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-brand .os-brand-mark{width:88px;height:42px}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-header-title{font-size:15px;font-weight:600;letter-spacing:.04em;color:var(--os-ink)}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-header-actions{gap:8px}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-header-actions>.header-button{min-height:38px;padding:8px 12px;font-size:12px}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-header-actions>.header-button small{font-size:12px}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-materials-button{background:var(--os-action)!important;color:var(--os-action-text)!important;border-color:var(--os-action)!important}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-workspace{display:grid!important;direction:ltr;flex:1 1 0%;height:auto!important;min-height:0;min-width:0;overflow:hidden;gap:0;grid-template-columns:minmax(0,1fr) 8px clamp(352px,var(--os-pilot-panel-width,400px),560px)!important;grid-template-rows:minmax(0,1fr)!important}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-map-column{grid-column:1!important;grid-row:1!important;min-height:0;min-width:0;direction:rtl;display:flex;flex-direction:column}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-map{flex:1;min-height:0;width:100%;height:auto!important}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-panel{grid-column:3!important;grid-row:1!important;min-width:0;min-height:0;width:auto!important;max-height:none!important;direction:rtl;overflow:hidden;background:var(--os-paper)}
html.os-studio.os-enhanced[data-os-portal=pilot] .os-pilot-splitter{grid-column:2!important;grid-row:1!important;position:relative;width:8px!important;height:auto!important;min-height:0;margin:0;cursor:col-resize;touch-action:none;background:var(--os-canvas);z-index:2}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-list-view{height:100%;display:flex;flex-direction:column;min-height:0;overflow:hidden}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-list-view[hidden]{display:none!important}
html.os-studio .os-pilot-list-heading{flex:none;padding:20px 20px 8px}
html.os-studio .os-pilot-list-heading h1{margin:0;font-size:22px;line-height:1.3;font-weight:650}
html.os-studio .os-pilot-list-heading p{margin:6px 0 0;color:var(--os-muted);font-size:12px}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-list-toolbar{flex:0 0 auto;display:grid!important;grid-template-columns:minmax(0,1fr);gap:10px;padding:10px 18px 14px!important;border-bottom:1px solid var(--os-line)}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-search-label{width:100%;min-height:40px;height:auto;min-width:0}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-search-input{min-height:38px;font-size:13px}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-sort-actions{display:flex;justify-content:flex-start;gap:7px}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-sort-actions button{min-width:36px;min-height:36px;padding:7px}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-ticket-list{flex:1 1 0%;min-height:0;height:auto;overflow:auto;display:flex;flex-direction:column;gap:12px;padding:16px 18px;overscroll-behavior:contain}
html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-ticket-list>.ticket-card{flex:none;display:grid;grid-template-columns:22px minmax(0,1fr);gap:8px 10px;min-height:116px;height:auto;padding:14px;border-radius:12px;align-items:start;overflow:visible}
html.os-studio.os-enhanced[data-os-portal=pilot] .ticket-check{grid-row:1;grid-column:1;margin:2px 0 0}
html.os-studio.os-enhanced[data-os-portal=pilot] .ticket-copy{grid-column:2;min-width:0;overflow:visible}
html.os-studio.os-enhanced[data-os-portal=pilot] .ticket-title{font-size:14px;line-height:1.5;white-space:normal;overflow-wrap:anywhere;max-height:none;overflow:visible}
html.os-studio.os-enhanced[data-os-portal=pilot] .ticket-number{font-size:11px;font-weight:450;color:var(--os-muted);font-variant-numeric:tabular-nums}
html.os-studio.os-enhanced[data-os-portal=pilot] .ticket-meta{font-size:12px;margin-top:6px;line-height:1.5}
html.os-studio.os-enhanced[data-os-portal=pilot] .ticket-downloads{grid-column:2;grid-row:2;display:flex;justify-content:flex-start;gap:8px}
html.os-studio.os-enhanced[data-os-portal=pilot] .ticket-downloads .icon-link{min-width:44px;min-height:34px;width:auto;padding:6px 10px;font-size:11px}

@media(max-width:999px){
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-header{display:flex;flex-wrap:wrap;min-height:56px;padding:7px 12px!important;gap:6px 12px}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-brand{order:0}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-header .os-account-host{order:1;margin-inline-start:auto}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-header-actions{order:2;display:flex;flex:0 0 100%;width:100%;justify-content:space-between;gap:3px;overflow:auto}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-header-actions>.header-button{min-height:40px;padding:6px 7px;flex-shrink:0}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-header-actions>.header-button small{font-size:11px}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-brand .os-brand-mark{width:68px;height:32px}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-workspace{grid-template-columns:minmax(0,1fr)!important;grid-template-rows:clamp(140px,var(--os-pilot-map-height,42%),calc(100% - 210px)) 18px minmax(0,1fr)!important}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-map-column{grid-column:1!important;grid-row:1!important}
  html.os-studio.os-enhanced[data-os-portal=pilot] .os-pilot-splitter{grid-column:1!important;grid-row:2!important;width:100%!important;height:18px!important;cursor:row-resize}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-panel{grid-column:1!important;grid-row:3!important}
  html.os-studio .os-pilot-list-heading{padding:9px 14px 4px;display:flex;align-items:center;justify-content:space-between;gap:8px}
  html.os-studio .os-pilot-list-heading h1{font-size:17px}
  html.os-studio .os-pilot-list-heading p{margin:0;font-size:11px}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-list-toolbar{display:flex!important;flex-wrap:wrap;align-items:center;gap:6px;padding:6px 12px 9px!important}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-search-label{flex:1 1 160px;width:auto;min-height:38px}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-sort-actions{gap:3px}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-ticket-list{gap:9px;padding:10px 12px}
  html.os-studio.os-enhanced[data-os-portal=pilot] #pilot-ticket-list>.ticket-card{min-height:112px;padding:11px 12px}
  html.os-studio.os-enhanced[data-os-portal=pilot] .ticket-downloads .icon-link{min-height:40px}
}
@media(max-width:760px){
  html.os-studio.os-enhanced[data-os-portal=my] #cards{grid-template-columns:minmax(0,1fr)!important;grid-auto-rows:max-content!important;padding:12px;gap:12px}
  html.os-studio.os-enhanced[data-os-portal=my] #cards>.ticket-card{height:auto!important;min-height:238px!important}
  html.os-studio.os-enhanced[data-os-portal=my] .topbar{position:relative!important;display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;height:56px!important;min-height:56px!important;padding:7px 12px!important;gap:8px!important;width:100%;overflow:visible}
  html.os-studio.os-enhanced[data-os-portal=my] .topbar>.brand{display:flex!important;align-items:center;flex:0 0 auto!important;width:auto!important;margin:0!important;padding:0!important}
  html.os-studio.os-enhanced[data-os-portal=my] .topbar>.brand>strong{display:none!important}
  html.os-studio.os-enhanced[data-os-portal=my] .topbar .os-brand-mark{width:68px;height:34px}
  html.os-studio.os-enhanced[data-os-portal=my] .top-actions{position:static!important;display:flex;align-items:center;gap:3px;margin:0!important;margin-inline-start:auto!important;min-width:0;flex:0 1 auto}
  html.os-studio.os-enhanced[data-os-portal=my] #oa-account-slot{gap:3px;min-width:0}
  html.os-studio.os-enhanced[data-os-portal=my] #admin-context{position:static!important;margin:0!important;width:auto!important;max-width:100%;max-height:190px;overflow:auto;flex:none;font-size:11px}
  html.os-studio.os-enhanced[data-os-portal=my] #admin-context :is(input,select){min-width:0;max-width:100%}
  html.os-studio.os-enhanced[data-os-portal=admin] #status-tree-panel>header{min-height:78px!important;padding:10px 12px!important}
}
