/* iTech Workspace — the shell around pages the gateway serves.
 *
 * shared-header.js builds the markup; every rule for it is here. The file is a
 * real same-origin stylesheet because the CSP is style-src 'self' with
 * style-src-attr 'none': a script-built <style> or a style="" attribute would
 * be dropped and leave the frame unstyled.
 *
 * It is self-contained — its own tokens (--itp-*), its own font faces, every
 * rule scoped to #itp-* or html.itp-shell — because nginx injects the script
 * into pages that load none of the portal's other sheets, and it must not leak
 * into theirs.
 *
 * The frame: navigation 216px wide (64px as an icon rail, an off-canvas drawer
 * below 900px), a 60px title bar, the page, a footer. Same measurements and
 * colours as the React portal's shell (portal-ui/src/ui/PortalShell.tsx).
 */
@font-face{font-family:'iTech Sora';font-style:normal;font-weight:100 800;font-display:swap;
  src:url('/auth/assets/fonts/sora-latin.woff2') format('woff2');}
@font-face{font-family:'iTech Inter';font-style:normal;font-weight:100 900;font-display:swap;
  src:url('/auth/assets/fonts/inter-variable.woff2') format('woff2');}

:root{
  --itp-w:216px;
  --itp-nav:#15233d;--itp-nav-ink:#f0f4fb;--itp-nav-muted:#b5c2d9;--itp-nav-active:#86a2e02e;--itp-nav-line:#ffffff17;--itp-nav-mark:#8fb0ff;
  --itp-paper:#fff;--itp-ink:#1a2438;--itp-muted:#56637d;--itp-line:#e3e8f1;--itp-soft:#f5f7fb;--itp-ring:#4654c859;--itp-scrim:#12233a66;
  --itp-sans:'iTech Inter',Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  --itp-display:'iTech Sora',Sora,'iTech Inter',Inter,-apple-system,'Segoe UI',sans-serif;
}
:root.dark{
  --itp-nav:#101b2d;--itp-nav-ink:#e8eff9;--itp-nav-muted:#a1b4ce;--itp-nav-active:#a5bbdc28;
  --itp-paper:#1b2330;--itp-ink:#edf2fa;--itp-muted:#a8b6cc;--itp-line:#303e53;--itp-soft:#242f40;--itp-ring:#a8b3ff73;--itp-scrim:#00000080;
}
:root[data-nav="rail"]{--itp-w:64px;}

/* ── the page makes room ────────────────────────────────────────────────── */
html.itp-shell body{padding-left:var(--itp-w);box-sizing:border-box;}
/* Until the script has built the navigation, hold its place in navy so a page
   that reserved the space does not flash an empty column. */
html.itp-shell:not(.itp-ready) body::before{content:"";position:fixed;left:0;top:0;bottom:0;width:var(--itp-w);background:var(--itp-nav);}

/* ── navigation ─────────────────────────────────────────────────────────── */
#itp-nav{position:fixed;left:0;top:0;bottom:0;z-index:9999;width:var(--itp-w);display:flex;flex-direction:column;gap:16px;
  padding:18px 12px 14px;box-sizing:border-box;background:var(--itp-nav);color:var(--itp-nav-ink);
  font:500 13px/1.4 var(--itp-sans);-webkit-font-smoothing:antialiased;text-align:left;overflow:hidden;}
#itp-nav *,#itp-bar *,#itp-foot *{box-sizing:border-box;}
#itp-nav a,#itp-bar a,#itp-foot a{text-decoration:none;}
#itp-nav ul{list-style:none;margin:0;padding:0;display:grid;gap:2px;}
#itp-nav p{margin:0;}
#itp-nav button,#itp-bar button{margin:0;border:0;background:transparent;font:inherit;color:inherit;cursor:pointer;}
#itp-nav .itp-i,#itp-bar .itp-i{display:block;width:18px;height:18px;flex-shrink:0;}
#itp-nav :is(a,button):focus-visible,#itp-bar :is(a,button):focus-visible,#itp-foot a:focus-visible,.itp-skip:focus-visible{
  outline:3px solid var(--itp-nav-mark);outline-offset:2px;}

#itp-nav .itp-brand-row{display:flex;align-items:center;justify-content:space-between;gap:4px;}
#itp-nav .itp-brand{display:flex;align-items:center;gap:11px;min-width:0;padding:0 6px;border-radius:9px;color:var(--itp-nav-ink);}
#itp-nav .itp-mark{display:grid;place-items:center;width:34px;height:34px;border-radius:9px;background:#ffffff14;box-shadow:inset 0 0 0 1px #ffffff26;color:#fff;flex-shrink:0;}
#itp-nav .itp-mark svg{display:block;width:22px;height:22px;}
#itp-nav .itp-word{font-family:var(--itp-display);font-size:21px;font-weight:600;letter-spacing:-.02em;line-height:1.1;}
#itp-nav .itp-word>span{display:block;margin-top:3px;font-family:var(--itp-sans);font-size:9px;font-weight:500;letter-spacing:.19em;text-transform:uppercase;color:var(--itp-nav-muted);white-space:nowrap;}
#itp-nav .itp-icon-btn{display:grid;place-items:center;width:32px;height:32px;border-radius:8px;color:var(--itp-nav-muted);flex-shrink:0;}
#itp-nav .itp-icon-btn:hover{background:var(--itp-nav-active);color:var(--itp-nav-ink);}
#itp-nav .itp-when-rail,#itp-nav #itp-drawer-close{display:none;}

#itp-nav .itp-workspace{display:flex;align-items:center;gap:10px;padding:10px 6px;border-top:1px solid var(--itp-nav-line);border-bottom:1px solid var(--itp-nav-line);font-size:13px;color:var(--itp-nav-ink);}
#itp-nav .itp-workspace>span:first-child{display:grid;place-items:center;width:26px;height:26px;border-radius:6px;background:var(--itp-nav-active);flex-shrink:0;}
#itp-nav .itp-workspace .itp-i{width:15px;height:15px;}
#itp-nav .itp-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}

#itp-nav .itp-groups{display:grid;gap:18px;align-content:start;flex:1;min-height:0;margin:0 -4px;padding:0 4px;overflow-y:auto;}
#itp-nav .itp-label{padding:0 12px;margin-bottom:6px;font-size:11px;font-weight:600;letter-spacing:.09em;text-transform:uppercase;color:var(--itp-nav-muted);}
#itp-nav .itp-item{position:relative;display:flex;align-items:center;gap:12px;width:100%;min-height:38px;padding:8px 12px;border-radius:8px;
  color:var(--itp-nav-muted);font-size:14px;font-weight:400;transition:background .12s,color .12s;}
#itp-nav .itp-item:hover{background:var(--itp-nav-active);color:var(--itp-nav-ink);}
#itp-nav .itp-item[aria-current="page"]{background:var(--itp-nav-active);color:var(--itp-nav-ink);font-weight:600;}
/* The selected row: a soft fill and a 3px bar on its leading edge. */
#itp-nav .itp-item[aria-current="page"]::before{content:"";position:absolute;left:0;top:7px;bottom:7px;width:3px;border-radius:0 3px 3px 0;background:var(--itp-nav-mark);}

#itp-nav .itp-bottom{display:grid;gap:8px;}
#itp-nav .itp-quiet{color:var(--itp-nav-ink);font-weight:600;gap:10px;}
#itp-nav .itp-quiet .itp-i{width:17px;height:17px;}
#itp-nav .itp-account{display:flex;align-items:center;gap:10px;padding:14px 6px 0;border-top:1px solid var(--itp-nav-line);min-width:0;}
#itp-nav .itp-avatar{display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:#9ebce433;color:var(--itp-nav-ink);font-size:12px;font-weight:600;flex-shrink:0;}
#itp-nav .itp-who{min-width:0;}
#itp-nav .itp-who strong{display:block;font-size:13px;font-weight:600;color:var(--itp-nav-ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
#itp-nav .itp-who small{display:block;margin-top:2px;font-size:12px;color:var(--itp-nav-muted);}

/* ── collapsed to an icon rail (desktop only) ───────────────────────────── */
@media(min-width:901px){
  :root[data-nav="rail"] #itp-nav{padding-left:8px;padding-right:8px;}
  :root[data-nav="rail"] #itp-nav .itp-brand-row{flex-direction:column;gap:12px;}
  :root[data-nav="rail"] #itp-nav .itp-brand{padding:0;}
  :root[data-nav="rail"] #itp-nav :is(.itp-word,.itp-workspace,.itp-label,.itp-text,.itp-who,.itp-when-wide){display:none;}
  :root[data-nav="rail"] #itp-nav .itp-when-rail{display:block;}
  :root[data-nav="rail"] #itp-nav .itp-group+.itp-group{padding-top:14px;border-top:1px solid var(--itp-nav-line);}
  :root[data-nav="rail"] #itp-nav .itp-item{justify-content:center;padding:8px 0;}
  :root[data-nav="rail"] #itp-nav .itp-account{justify-content:center;padding:12px 0 0;}
}

/* ── title bar ──────────────────────────────────────────────────────────── */
#itp-bar{position:sticky;top:0;z-index:9990;display:flex;align-items:center;justify-content:space-between;gap:15px;min-height:60px;padding:12px 28px;
  background:var(--itp-paper);color:var(--itp-ink);border-bottom:1px solid var(--itp-line);
  font:500 13px/1.4 var(--itp-sans);-webkit-font-smoothing:antialiased;flex-shrink:0;}
#itp-bar .itp-bar-title{display:flex;align-items:center;gap:9px;min-width:0;}
#itp-title{margin:0;font-family:var(--itp-display);font-size:16px;font-weight:600;letter-spacing:-.2px;line-height:1.4;color:var(--itp-ink);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
#itp-bar .itp-bar-actions{display:flex;align-items:center;gap:6px;flex-shrink:0;}
#itp-bar .itp-icon-btn{display:grid;place-items:center;width:36px;height:36px;border-radius:8px;color:var(--itp-muted);flex-shrink:0;}
#itp-bar .itp-icon-btn:hover,#itp-bar .itp-bar-link:hover{background:var(--itp-soft);color:var(--itp-ink);}
#itp-bar .itp-icon-btn .itp-i{width:18px;height:18px;}
#itp-bar .itp-bar-link{display:inline-flex;align-items:center;gap:8px;min-height:36px;padding:6px 10px;border-radius:8px;color:var(--itp-muted);font-size:13px;font-weight:550;white-space:nowrap;}
#itp-bar :is(a,button):focus-visible{outline-color:var(--itp-ring);}
#itp-bar .itp-when-dark,:root.dark #itp-bar .itp-when-light{display:none;}
:root.dark #itp-bar .itp-when-dark{display:block;}
#itp-bar #itp-menu{display:none;margin-left:-6px;}

/* ── footer ─────────────────────────────────────────────────────────────── */
#itp-foot{display:flex;align-items:center;justify-content:space-between;gap:8px 24px;flex-wrap:wrap;padding:12px 28px;margin-top:auto;
  background:var(--itp-paper);color:var(--itp-muted);border-top:1px solid var(--itp-line);font:400 12px/1.5 var(--itp-sans);flex-shrink:0;}
#itp-foot .itp-foot-links{display:flex;flex-wrap:wrap;gap:4px 22px;}
#itp-foot a{color:var(--itp-muted);font-weight:550;border-radius:4px;}
#itp-foot a:hover{color:var(--itp-ink);}
#itp-foot a:focus-visible{outline-color:var(--itp-ring);}

/* ── skip link, drawer scrim ────────────────────────────────────────────── */
.itp-skip{position:fixed;left:16px;top:-60px;z-index:10001;padding:8px 14px;border-radius:8px;background:#4654c8;color:#fff;
  font:600 13px/1.4 var(--itp-sans);text-decoration:none;}
.itp-skip:focus{top:16px;}
#itp-scrim{display:none;position:fixed;inset:0;z-index:9998;background:var(--itp-scrim);}

/* ── below 900px the navigation is a drawer ─────────────────────────────── */
@media(max-width:900px){
  html.itp-shell body{padding-left:0;}
  html.itp-shell:not(.itp-ready) body::before{content:none;}
  #itp-nav{width:min(264px,86vw);transform:translateX(-102%);visibility:hidden;transition:transform .18s ease,visibility 0s linear .18s;box-shadow:0 18px 50px #0007;}
  html.itp-drawer-open #itp-nav{transform:none;visibility:visible;transition:transform .18s ease;}
  html.itp-drawer-open #itp-scrim{display:block;}
  #itp-nav #itp-collapse{display:none;}
  #itp-nav #itp-drawer-close,#itp-bar #itp-menu{display:grid;}
  #itp-bar{padding:10px 16px;}
  #itp-foot{padding:12px 16px;}
}
@media(max-width:480px){
  #itp-bar .itp-bar-link span{display:none;}
  #itp-bar .itp-bar-link{padding:6px 9px;}
}
@media(pointer:coarse){
  #itp-nav .itp-item{min-height:44px;}
  #itp-bar .itp-icon-btn,#itp-bar .itp-bar-link{min-width:44px;min-height:44px;justify-content:center;}
}
@media(prefers-reduced-motion:reduce){#itp-nav{transition:none!important;}}
@media print{#itp-nav,#itp-bar,#itp-foot,#itp-scrim,.itp-skip{display:none!important;}html.itp-shell body{padding-left:0;}}
