/* Portals shell for pages outside index.html (the Open Order Report).
 * Copied from index.html so OOR looks and behaves like the rest of Portals:
 * theme tokens (light + dark), sidebar, header card and buttons. If the shell
 * changes in index.html, change it here too. */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #14202c;
  --ink-2: #4b5868;
  --ink-3: #8390a0;
  --line: #e5e8ed;
  --line-2: #eef0f3;
  --brand: #1f4dd8;
  --brand-soft: #e8eeff;
  --ok: #16a34a;
  --ok-soft: #e6f6ec;
  --warn: #c2810b;
  --warn-soft: #fbf2dd;
  --bad: #b42318;
  --bad-soft: #fbe6e3;
  --mute-soft: #eef0f3;
  /* Recessed panel *inside* a card: table header bands, zebra rows, KPI tiles.
     Identical to the #fafbfc that used to be hardcoded, so light is unchanged. */
  --surface-2: #fafbfc;
  /* Fill for "nothing here yet" segments and legend dots. Light value is the
     #cbd5e1 that used to be hardcoded, so light renders byte-identically. */
  --fill-neutral: #cbd5e1;
  /* Pale wash behind the pace-tracking overdue banner. Light value is the
     #fef2f2 that used to be hardcoded, so light renders byte-identically. */
  --bad-wash: #fef2f2;
  /* End stop of the project hero gradient. Light value is the #eef2fb that used
     to be hardcoded, so light renders byte-identically. */
  --hero-wash: #eef2fb;
  /* Unit-map chip family. Every chip is a filled tile carrying a unit number, so
     each fill ships its own ink: whichever of near-black or white clears 4.5:1
     against that fill in that theme. Values that hold in both themes live here;
     the dark block below overrides only the ones that must move. */
  --umap-done-ink:     #032010;
  --umap-approved-bg:  #15803d;
  --umap-approved-ink: #ffffff;
  --umap-await-bg:     #bbf7d0;
  --umap-await-ink:    #14532d;
  --umap-await-line:   #86efac;
  --umap-prog-ink:     #2a1a03;
  --umap-today-ink:    #ffffff;
  --shadow: 0 1px 2px rgba(20,32,44,.06), 0 1px 0 rgba(20,32,44,.04);
  --radius: 10px;
  --radius-sm: 6px;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
/* ===== Dark theme tokens (Portals - F7): overrides the light :root vars ===== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f141a;
  --card: #161d26;
  --ink: #e7edf4;
  --ink-2: #aab6c4;
  --ink-3: #7c8a9a;
  --line: #273140;
  --line-2: #1e2630;
  --brand: #5b86ff;
  --brand-soft: #1b2746;
  --ok: #34d27b;
  --ok-soft: #11301f;
  --warn: #e0a93c;
  --warn-soft: #2e2410;
  --bad: #f0675a;
  --bad-soft: #331613;
  --mute-soft: #1e2630;
  /* One step DOWN the dark ramp from --card, mirroring how the light value
     recedes from white: --bg #0f141a < --surface-2 #121a24 < --card #161d26.
     Held ~12 RGB points below --line-2 #1e2630 so the 1px --line-2 borders
     these surfaces carry stay visible against them. */
  --surface-2: #121a24;
  --fill-neutral: #3a4757;
  --bad-wash: #331613;
  --hero-wash: #182234;
  /* --ok / --warn / --brand stay bright in dark because they are FOREGROUND
     accents. Used as a unit-map FILL they need dark ink, not white: white
     measured 1.97:1 on --ok and 2.12:1 on --warn. Awaiting flips from a pale
     fill to a deep one so it stops being the brightest surface in the report. */
  --umap-await-bg:     #133a26;
  --umap-await-ink:    #86efac;
  --umap-await-line:   #2f7d52;
  --umap-today-ink:    #0a1a4d;
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 1px 0 rgba(0,0,0,.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px; line-height: 1.5; }
/* Redesign: numerals read in IBM Plex Mono across every portal's KPI/value surfaces */
.kpi .value, .sq-kpi .value, .flash-kpi .fk-value,
.dash-kpi .v { font-family: var(--font-mono); font-weight: 600; letter-spacing: -.01em; }
h1 { letter-spacing: -.01em; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--ink); }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .5px; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 20px; }
/* ===== App shell + sidebar portal launcher (Portals - F6) ===== */
.app-shell { display: flex; align-items: flex-start; min-height: 100vh; }
.sidebar { position: sticky; top: 0; align-self: flex-start; flex: 0 0 232px; width: 232px;
  height: 100vh; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px; padding: 14px 12px; box-sizing: border-box; z-index: 50; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 2px 4px 12px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.08; }
.brand-text .brand-tl { font-size: 10px; letter-spacing: .14em; color: var(--ink-3); text-transform: uppercase; font-weight: 700; }
.brand-text .brand-portals { font-size: 17px; font-weight: 700; color: var(--ink); }
.sidebar-toggle { margin-left: auto; width: 26px; height: 26px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); border-radius: 6px; cursor: pointer; font-size: 15px; line-height: 1; }
.sidebar-toggle:hover { border-color: var(--ink-3); color: var(--ink); }
.portal-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
/* Redesign: quiet sidebar — soft active bg + left edge accent instead of a solid brand block */
.portal-nav-label { font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--ink-3);
  text-transform: uppercase; padding: 2px 10px 6px; }
.sidebar-search { display: flex; align-items: center; gap: 8px; width: 100%; background: var(--mute-soft);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; margin: 0 0 12px; color: var(--ink-3);
  font-size: 12.5px; font-family: inherit; cursor: pointer; text-align: left; }
.sidebar-search:hover { border-color: var(--ink-3); color: var(--ink-2); }
.sidebar-search .ss-txt { flex: 1; }
.sidebar-search .ss-kbd { font-family: var(--font-mono); font-size: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.app-shell.collapsed .sidebar-search .ss-txt, .app-shell.collapsed .sidebar-search .ss-kbd,
.app-shell.collapsed .portal-nav-label { display: none; }
.app-shell.collapsed .sidebar-search { justify-content: center; }
.portal-link { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: transparent; border: 0; border-left: 3px solid transparent; color: var(--ink-2);
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 600; font-family: inherit; }
.portal-link .pl-ico { width: 18px; text-align: center; font-size: 13px; color: var(--ink-3); flex: 0 0 auto; }
a.portal-link { text-decoration: none; }
.portal-link .pl-lbl { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-link .pl-tag { font-size: 9px; padding: 1px 7px; border-radius: 999px; background: var(--mute-soft);
  color: var(--ink-3); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.portal-link .pl-badge { font-size: 10px; font-weight: 700; font-family: var(--font-mono);
  background: var(--bad-soft); color: var(--bad); border-radius: 999px; padding: 1px 7px;
  font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.portal-link .pl-badge.warn { background: var(--warn-soft); color: var(--warn); }
.portal-link .pl-badge:not([hidden]) ~ .pl-tag { display: none; }
.portal-link:hover:not(.active):not(:disabled) { background: var(--mute-soft); color: var(--ink); }
.portal-link.active { background: var(--brand-soft); color: var(--brand); border-left-color: var(--brand); }
.portal-link.active .pl-ico { color: var(--brand); }
.portal-link.active .pl-tag { background: var(--brand); color: #fff; }
.portal-link.soon { opacity: .5; cursor: default; }
.portal-link.restricted { opacity: .38; cursor: not-allowed; }
.portal-link.restricted:hover { background: transparent; color: inherit; }
.portal-link.restricted .pl-tag { text-decoration: line-through; }
.portal-link[hidden] { display: none; }
.portal-link .pl-soon { font-size: 8px; padding: 1px 6px; border-radius: 999px; border: 1px dashed var(--line);
  color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.portal-divider { height: 1px; background: var(--line); margin: 8px 6px; }
.sidebar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.theme-toggle { display: flex; align-items: center; gap: 10px; width: 100%; background: transparent;
  border: 1px solid var(--line); color: var(--ink-2); padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit; }
.theme-toggle:hover { border-color: var(--ink-3); color: var(--ink); }
.theme-toggle .tt-ico { width: 18px; text-align: center; }

.main { flex: 1 1 auto; min-width: 0; }
.main > .wrap { max-width: 1200px; }

/* Collapsed (icon-rail) */
.app-shell.collapsed .sidebar { flex-basis: 64px; width: 64px; padding: 14px 8px; }
.app-shell.collapsed .sidebar .pl-lbl,
.app-shell.collapsed .sidebar .pl-tag,
.app-shell.collapsed .sidebar .pl-soon,
.app-shell.collapsed .sidebar .brand-text,
.app-shell.collapsed .sidebar .tt-lbl { display: none; }
.app-shell.collapsed .sidebar .sidebar-brand { justify-content: center; }
.app-shell.collapsed .sidebar .sidebar-toggle { margin: 0 auto; transform: rotate(180deg); }
.app-shell.collapsed .sidebar .portal-link,
.app-shell.collapsed .sidebar .theme-toggle { justify-content: center; }

/* Mobile bar + slide-in drawer */
.mobile-bar { display: none; align-items: center; gap: 12px; margin-bottom: 14px; }
.hamburger { width: 40px; height: 38px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); border-radius: 8px; font-size: 16px; cursor: pointer; }
.sidebar-scrim { display: none; }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.28); }
  .app-shell.drawer-open .sidebar { transform: translateX(0); }
  .app-shell.collapsed .sidebar { flex-basis: 232px; width: 232px; padding: 14px 12px; }
  .mobile-bar { display: flex; }
  .sidebar-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 49; }
  .app-shell.drawer-open .sidebar-scrim { display: block; }
  .sidebar-toggle { display: none; }
}

/* ===== Header ===== */
.app-header {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 16px; display: flex; flex-wrap: wrap;
  gap: 16px; align-items: center; justify-content: space-between; box-shadow: var(--shadow);
}
.app-title { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--brand);
  color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.app-title-text .sub { color: var(--ink-3); font-size: 12px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.control { display: flex; align-items: center; gap: 6px; }
.control label { font-size: 12px; color: var(--ink-3); }
.btn { background: var(--card); border: 1px solid var(--line); color: var(--ink);
  padding: 7px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: #163fb0; }
.brand-home { display: contents; color: inherit; text-decoration: none; }
.portal-admin-link { text-decoration: none; margin-bottom: 6px; }
.portal-admin-link .tt-ico { color: #a78bfa; }

/* "Back to MyTLCiQ": the hub every portal opens from. */
.hub-back { display: flex; align-items: center; gap: 9px; width: 100%; margin: 0 0 12px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink-2);
  font-size: 13px; font-weight: 600; font-family: inherit; text-decoration: none; }
.hub-back .hb-ico { width: 18px; text-align: center; color: #a78bfa; flex: 0 0 auto; }
.hub-back:hover { border-color: #a78bfa; color: var(--ink); background: rgba(167, 139, 250, .08); text-decoration: none; }
.app-shell.collapsed .hub-back { justify-content: center; }
.app-shell.collapsed .hub-back .pl-lbl { display: none; }

@media print {
  .sidebar, .sidebar-scrim, .mobile-bar, .no-print { display: none !important; }
  .app-shell { display: block; }
  .main { width: 100%; }
}
