/* BIG[int] CI 0.4.2 - admin portal (app shell). Opt-in add-on to bigint.css; include AFTER bigint.css, unchanged.
   Tokens only, no hex. Websites and artifacts that do not use these classes are unaffected.
   Classes:  <body class="bi-portal">        every page of a portal (sign-in too): grey chrome, bordered cards, error boxes, table rules
             <body class="bi-portal shell">  signed-in pages: sticky top bar + left sidebar + fluid work area
   Rules and markup skeleton: SKILL.md "Admin portals (app shell)". First consumer: MCP Management (mgmt). */

.bi-portal{--side:232px;--side-mini:64px;--head:56px}

/* --- surfaces (approved exception 2026-10-10): grey chrome, white work area, white cards with a hairline --- */
.bi-portal .bi-top{background:var(--surface);border-bottom:1px solid var(--line)}
.bi-portal .card,.bi-portal .kpi,.bi-portal .card.line{background:var(--bg);border:1px solid var(--line)}
.bi-portal th{background:var(--surface)}
.bi-portal .kpi.warn .val{color:var(--warn)}
.bi-portal .kpi.bad .val{color:var(--bad)}

/* --- page helpers --- */
.bi-portal .page-head{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:12px}
.bi-portal .page-head p{margin:4px 0 0;max-width:96ch}
.bi-portal .page-head h1+p,.bi-portal .card>p{margin-top:6px}
.bi-portal .section-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px}
.bi-portal .row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.bi-portal .toolbar{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.bi-portal .toolbar select{width:auto;min-width:9rem;border-radius:var(--r-pill);padding:6px 12px}
.bi-portal .mono{font-family:var(--mono);font-size:.8125rem;overflow-wrap:anywhere}
.bi-portal .helptext,.bi-portal .help{font-size:.82rem;color:var(--muted)}
.bi-portal .empty{color:var(--muted);text-align:center}
.bi-portal :not(td).empty{padding:20px} /* a td.empty keeps the table cell padding */
.bi-portal .avatar{width:30px;height:30px;border-radius:50%;background:var(--surface2);color:var(--fg);display:grid;place-items:center;font-size:.75rem;font-weight:700;flex:none}
.bi-portal .sticky-bar{position:sticky;top:calc(var(--head) + 8px);z-index:10}

/* --- messages and errors: text --fg / --bad on soft grounds, >= 4.5:1 in both themes --- */
.bi-portal .msg{border:1px solid transparent;color:var(--fg)}
.bi-portal .msg.success{border-color:var(--ok)}
.bi-portal .msg.error{border-color:var(--bad)}
.bi-portal .msg.warning{border-color:var(--warn)}
.bi-portal .errorlist{list-style:none;margin:6px 0 0;padding:0;color:var(--bad);font-size:.875rem;font-weight:500}
.bi-portal .errorlist li+li{margin-top:2px}
.bi-portal .errorlist.nonfield{background:var(--bad-soft);border:1px solid var(--bad);border-radius:var(--r-ctl);padding:10px 14px;margin:12px 0 4px;color:var(--fg);font-weight:500}
.bi-portal input[aria-invalid="true"],.bi-portal select[aria-invalid="true"],.bi-portal textarea[aria-invalid="true"]{border-color:var(--bad)}
.bi-portal input[aria-invalid="true"]:focus{box-shadow:0 0 0 3px var(--bad-soft)}

/* --- tables: values never break (IPs, times, ids, URLs); free text wraps; wide tables scroll in their card --- */
.bi-portal td.num,.bi-portal td.mono,.bi-portal td .num,.bi-portal .nowrap{white-space:nowrap}
.bi-portal td.wrap{white-space:normal;overflow-wrap:anywhere;min-width:10rem}
.bi-portal td.mono .help,.bi-portal td.nowrap .help{white-space:normal}
.bi-portal td .mono{white-space:nowrap;overflow-wrap:normal}
.bi-portal td.wrap .mono{white-space:normal;overflow-wrap:anywhere}
.bi-portal td.act{width:1%;white-space:nowrap;text-align:right}
.bi-portal td.act .row{flex-wrap:nowrap;justify-content:flex-end}
.bi-portal td select,.bi-portal td input{width:auto;padding:5px 10px;font-size:.875rem;border-radius:var(--r-pill)}
.bi-portal td.num,.bi-portal td.mono{font-size:.8125rem}

/* --- app shell (signed in): full-width top bar, left sidebar, fluid work area --- */
.shell{--max:none;min-height:100vh}
.shell .bi-top{position:sticky;top:0;z-index:30}
.shell .bi-top .bi-in{max-width:none;height:var(--head);padding:0 20px;flex-wrap:nowrap}
.shell .bi-top .logo{height:22px}
.shell .bi-app{font-size:.9375rem}
.shell .top-right{display:flex;align-items:center;gap:10px}
.shell .me{display:flex;align-items:center;gap:10px;font-size:.875rem;color:var(--muted);white-space:nowrap}

/* avatar menu: <details class="menu">, works without JavaScript */
.shell .menu{position:relative}
.shell .menu>summary{list-style:none;cursor:pointer;padding:4px 12px 4px 4px;border-radius:var(--r-pill)}
.shell .menu>summary::-webkit-details-marker{display:none}
.shell .menu>summary:hover,.shell .menu[open]>summary{background:var(--surface)}
.shell .menu>summary::after{content:"\25BE";font-size:.75rem;color:var(--muted)}
.shell .menu-pop{position:absolute;right:0;top:calc(100% + 8px);z-index:40;width:300px;max-width:calc(100vw - 24px);background:var(--bg);border:1px solid var(--line);border-radius:var(--r-card);box-shadow:var(--shadow-nav);padding:8px;display:grid;gap:2px;white-space:normal}
.shell .menu-pop a,.shell .menu-pop .item{display:flex;align-items:center;gap:10px;width:100%;text-align:left;padding:8px 12px;border-radius:var(--r-ctl);color:var(--fg);background:none;border:0;font-size:.9375rem;font-weight:400;cursor:pointer}
.shell .menu-pop a:hover,.shell .menu-pop .item:hover{background:var(--surface);text-decoration:none}
.shell .menu-pop form{margin:0}
.shell .menu-head,.shell .menu-row{padding:8px 12px;display:grid;gap:2px;font-size:.9375rem;color:var(--fg)}
.shell .menu-sep{height:1px;background:var(--line);margin:6px 4px}
.shell .menu-theme{padding:6px 12px 8px;display:grid;gap:6px}
.shell .menu-theme .tabs button{padding:5px 12px;font-size:.875rem}

/* layout + sidebar */
.shell .layout{display:grid;grid-template-columns:var(--side) minmax(0,1fr);min-height:calc(100vh - var(--head))}
.shell .side{position:sticky;top:var(--head);height:calc(100vh - var(--head));overflow-y:auto;border-right:1px solid var(--line);padding:12px;display:flex;flex-direction:column;gap:2px;background:var(--surface)}
.shell .side .lbl{padding:14px 12px 4px}
.shell .side .lbl:first-child{padding-top:4px}
.shell .side a{display:flex;align-items:center;gap:10px;padding:8px 12px;border-radius:var(--r-pill);color:var(--fg);font-size:.9375rem;font-weight:500;white-space:nowrap}
.shell .side a:hover{background:var(--surface2);text-decoration:none}
.shell .side a[aria-current="page"]{background:var(--bg);box-shadow:inset 0 0 0 2px var(--accent);font-weight:600}
.shell .side svg{width:18px;height:18px;flex:none;color:var(--muted);fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.shell .side a[aria-current="page"] svg{color:var(--accent)}
.shell .side-foot{margin-top:auto;padding-top:12px}
.shell .side-foot .item{display:flex;align-items:center;gap:10px;width:100%;padding:8px 12px;border:0;border-radius:var(--r-pill);background:transparent;box-shadow:inset 0 0 0 1px var(--line);color:var(--muted);font-weight:500;cursor:pointer;justify-content:flex-start;white-space:nowrap;text-align:left}
.shell .side-foot .item:hover{background:var(--surface2);color:var(--fg)}

/* work area: fluid, denser type */
.shell .bi-main{max-width:none;margin:0;padding:20px 24px 48px;gap:16px;align-content:start}
.shell .bi-main>*{min-width:0}
.shell [id]{scroll-margin-top:calc(var(--head) + 12px)}
.shell h1{font-size:1.5rem;line-height:1.25}
.shell h2,.shell .card h2{font-size:1.125rem;font-weight:600;letter-spacing:-.01em}
.shell h3{font-size:1rem;font-weight:600}
.shell .page-head p{font-size:.9375rem}
.shell .card{padding:16px 20px}
.shell .kpis{grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}
.shell .kpi{padding:12px 16px}
.shell .kpi .val{font-size:1.375rem}
.shell table{font-size:.875rem}
.shell th{padding:8px 12px}
.shell td{padding:8px 12px;vertical-align:middle}
.shell tbody tr:hover td{background:var(--surface)}

/* < 1600 px: icon-only sidebar (labels hidden, keep title= tooltips) so wide tables keep their action columns */
@media (max-width:1599px){
  .shell .layout{grid-template-columns:var(--side-mini) minmax(0,1fr)}
  .shell .side{padding:12px 10px}
  .shell .side .lbl{display:none}
  .shell .side a{justify-content:center;padding:10px}
  .shell .side .t{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .shell .side .lbl+a{margin-top:8px}
  .shell .side-foot .item{justify-content:center;padding:10px}
  .shell .bi-main{padding:20px}
}
/* < 900 px: sidebar becomes a horizontal icon strip under the top bar */
@media (max-width:900px){
  .shell .layout{grid-template-columns:1fr}
  .shell .side a{flex:none}
  .shell .side .lbl+a{margin-top:0}
  .shell .side{z-index:20;height:auto;flex-direction:row;align-items:center;overflow-x:auto;border-right:0;border-bottom:1px solid var(--line);padding:8px 12px}
  .shell .bi-main{padding:16px}
  .shell .me .who-name{display:none}
  .shell .side-foot{margin-top:0;padding-top:0}
}
