/* ============================================================
   APQP Manager Enterprise — premium application theme
   Inter typography · deep automotive gradients · gradient icon
   tiles · per-module brand colours · soft depth.
   ============================================================ */

/* ---- Inter (vendored, offline) ---- */
@font-face { font-family:'Inter'; font-style:normal; font-weight:400; font-display:swap;
  src:url("../vendor/css/fonts/inter-latin.da03732a27e1.woff2") format('woff2'); }
@font-face { font-family:'Inter'; font-style:normal; font-weight:500; font-display:swap;
  src:url("../vendor/css/fonts/inter-latin-500.51205681a1ba.woff2") format('woff2'); }
@font-face { font-family:'Inter'; font-style:normal; font-weight:600; font-display:swap;
  src:url("../vendor/css/fonts/inter-latin-600.2ede57db1a3a.woff2") format('woff2'); }
@font-face { font-family:'Inter'; font-style:normal; font-weight:700; font-display:swap;
  src:url("../vendor/css/fonts/inter-latin-700.8ca0a5155296.woff2") format('woff2'); }
@font-face { font-family:'Inter'; font-style:normal; font-weight:800; font-display:swap;
  src:url("../vendor/css/fonts/inter-latin-800.900ae45e40b8.woff2") format('woff2'); }

:root {
  --brand-900: #0a1020;
  --brand-800: #101c38;
  --brand-700: #16264c;
  --accent: #2563eb;
  --accent-600: #1d4ed8;
  --accent-soft: #eaf1fe;
  --sky: #0ea5e9;
  --indigo: #6366f1;
  --violet: #8b5cf6;
  --amber: #f59e0b;
  --emerald: #10b981;
  --teal: #14b8a6;
  --rose: #f43f5e;
  --ok: #10b981;
  --ok-soft: #e7f7ef;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --danger: #e11d48;
  --danger-soft: #fdeaef;
  --ink: #0f172a;
  --ink-soft: #64748b;
  --line: #e6eaf1;
  --bg: #f4f6fb;
  --card: #ffffff;
  --radius: 16px;
  --radius-sm: 12px;
  --sidebar-w: 256px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 4px 18px rgba(16, 24, 40, 0.07);
  --shadow: 0 12px 30px rgba(16, 24, 40, 0.13);
  --shadow-lg: 0 18px 46px rgba(8, 17, 45, 0.30);
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6, .fw-bold, .fw-semibold, .page-title, .kpi-value { letter-spacing: -0.02em; }
a { text-decoration: none; }

/* ============================================================
   ProQ top navbar — glassmorphism bar + animated mega-menu
   ============================================================ */
.proq-body { background: var(--bg); }

.proq-nav {
  background: linear-gradient(120deg, #0e225a 0%, #16308f 38%, #1d4ed8 74%, #2f6bf6 100%) !important;
  box-shadow: 0 6px 22px rgba(8, 17, 45, .35), inset 0 1px 0 rgba(255, 255, 255, .14);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  padding: .5rem 0; position: sticky; top: 0; z-index: 1030;
}
/* glossy sheen across the top half + soft accent line at the bottom */
.proq-nav::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 52%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.proq-nav::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0), rgba(96, 165, 250, .65), rgba(56, 189, 248, 0));
  pointer-events: none;
}
.proq-nav .container-fluid { position: relative; z-index: 1; padding-left: 22px; padding-right: 22px; }
/* A light beam that sweeps left→right once every 10s for a subtle live feel.
   (Disabled automatically under prefers-reduced-motion via the global reset.) */
.proq-nav-beam {
  position: absolute; top: 0; bottom: 0; left: 0; width: 150px; z-index: 2;
  pointer-events: none; mix-blend-mode: screen; filter: blur(2px); opacity: 0;
  background: linear-gradient(90deg,
    rgba(255,255,255,0) 0%, rgba(255,255,255,.16) 42%,
    rgba(173,216,255,.42) 50%, rgba(255,255,255,.16) 58%, rgba(255,255,255,0) 100%);
  transform: translateX(-180px);
  animation: proqNavBeam 10s ease-in-out infinite;
  will-change: transform, opacity;
}
@keyframes proqNavBeam {
  0%   { transform: translateX(-180px); opacity: 0; }
  3%   { opacity: 1; }
  22%  { transform: translateX(calc(100vw + 40px)); opacity: 1; }
  26%  { opacity: 0; }
  100% { transform: translateX(calc(100vw + 40px)); opacity: 0; }
}

/* ---- Brand ---- */
.proq-nav .navbar-brand { font-weight: 800; color: #fff; padding-top: 0; padding-bottom: 0; }
.brand-badge {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #38bdf8 0%, #2563eb 55%, #14b8a6 100%);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 0.9rem; letter-spacing: .5px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .5), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.brand-word {
  display: inline-flex; flex-direction: column; line-height: 1;
  font-size: 1.22rem; font-weight: 800; letter-spacing: .3px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.brand-tag { font-size: .5rem; font-weight: 700; letter-spacing: .22em; color: rgba(255, 255, 255, .62); margin-top: 3px; }

/* ---- Text nav links: pill hover with glow ---- */
.proq-nav .navbar-nav > .nav-item > .nav-link {
  color: rgba(255, 255, 255, .84) !important; font-weight: 600; font-size: .86rem;
  letter-spacing: .1px; padding: .46rem .8rem; margin: 0 .06rem; border-radius: 10px;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .12s ease;
}
.proq-nav .navbar-nav > .nav-item > .nav-link:hover,
.proq-nav .navbar-nav > .nav-item.show > .nav-link,
.proq-nav .navbar-nav > .nav-item > .nav-link.active {
  color: #fff !important; background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 3px 10px rgba(0, 0, 0, .16);
}
.proq-nav .nav-link i { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .22)); }
.proq-nav .dropdown-toggle::after { opacity: .65; margin-left: .4rem; }

/* ---- Quick-access icons: 3D glass buttons ---- */
.nav-quick-icon {
  width: 40px; height: 40px; border-radius: 11px; padding: 0 !important;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem;
  color: rgba(255, 255, 255, .92) !important;
  background: linear-gradient(160deg, rgba(255, 255, 255, .18), rgba(255, 255, 255, .045));
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), inset 0 -1px 0 rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .2);
  transition: transform .14s ease, box-shadow .18s ease, background .18s ease;
}
.nav-quick-icon:hover {
  color: #fff !important; transform: translateY(-2px);
  background: linear-gradient(160deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 7px 16px rgba(0, 0, 0, .3);
}
.nav-quick-icon:active { transform: translateY(0); }
.nav-quick-icon.active {
  color: #fff !important;
  background: linear-gradient(160deg, rgba(56, 189, 248, .55), rgba(37, 99, 235, .35));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 5px 16px rgba(37, 99, 235, .55);
}
.nav-quick-icon i { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }

/* ---- User chip + avatar ---- */
.user-chip {
  border-radius: 12px; padding: .28rem .5rem !important; color: #fff !important;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.user-chip:hover { background: rgba(255, 255, 255, .2); }
.user-chip-name { font-weight: 600; font-size: .82rem; }
.avatar-badge {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #6366f1); color: #fff;
  font-weight: 700; font-size: 0.74rem; display: inline-flex; align-items: center;
  justify-content: center; box-shadow: 0 4px 12px rgba(37, 99, 235, .45), inset 0 1px 0 rgba(255, 255, 255, .35);
}

/* ---- Notification bell + badge ---- */
.notif-bell { border-radius: 10px; padding: .4rem .55rem !important; transition: background .18s ease; }
.notif-bell:hover { background: rgba(255, 255, 255, .14); }
.notif-badge {
  position: absolute; top: 1px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, .55), 0 0 0 1.5px rgba(255, 255, 255, .9);
}

/* ---- Premium dropdown menus ---- */
.proq-nav .dropdown-menu {
  border: 1px solid rgba(15, 23, 42, .06); border-radius: 14px; padding: .4rem;
  margin-top: .55rem !important;
  box-shadow: 0 16px 40px rgba(8, 17, 45, .22), 0 2px 8px rgba(8, 17, 45, .1);
  animation: navDrop .16s ease;
}
@keyframes navDrop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.proq-nav .dropdown-menu .dropdown-item {
  border-radius: 9px; font-weight: 500; font-size: .85rem; padding: .5rem .7rem;
  transition: background .14s ease, color .14s ease;
}
.proq-nav .dropdown-menu .dropdown-item:hover { background: linear-gradient(135deg, #eff4ff, #e6edff); color: #1d4ed8; }
.proq-nav .dropdown-menu .dropdown-item i { color: #2563eb; }

/* ---- Notification menu rows ---- */
.notif-menu .notif-item { border-radius: 9px; }
.notif-title { font-weight: 600; font-size: .82rem; display: flex; align-items: center; gap: 6px; color: var(--ink); }
.notif-udot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.notif-msg { font-size: .74rem; color: var(--ink-soft); margin-top: 2px; }
.notif-menu .dropdown-item:hover .notif-msg { color: #475569; }

/* ============================================================
   Quality Tools mega-menu (per-module colored tiles + motion)
   ============================================================ */
.proq-nav .dropdown-menu.qt-menu {
  --qt-spring: cubic-bezier(.34, 1.56, .64, 1);
  --qt-ease: cubic-bezier(.22, .61, .36, 1);
  width: 328px; padding: .4rem .42rem .5rem;
  border: 1px solid rgba(15, 23, 42, .07); border-radius: 18px;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(37, 99, 235, .06), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(248, 250, 255, .95));
  box-shadow: 0 24px 60px rgba(8, 17, 45, .26), 0 4px 14px rgba(8, 17, 45, .12), inset 0 1px 0 rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(1.5) blur(14px); backdrop-filter: saturate(1.5) blur(14px);
}
.proq-nav .dropdown-menu.qt-menu .dropdown-item.qt-item:hover,
.proq-nav .dropdown-menu.qt-menu .dropdown-item.qt-item:focus { background: transparent; color: inherit; }
.proq-nav .dropdown-menu.qt-menu .dropdown-item.qt-item i { color: inherit; }

.qt-menu .qt-head {
  display: flex; align-items: center; gap: .45rem; font-size: .64rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; color: #94a3b8;
  padding: .4rem .6rem .45rem; margin: 0 0 .25rem; border-bottom: 1px solid rgba(15, 23, 42, .07);
}
.qt-menu .qt-head-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: linear-gradient(135deg, #2f6bf6, #10b981); box-shadow: 0 0 0 3px rgba(47, 107, 246, .14);
}

.proq-nav .dropdown-menu.qt-menu .qt-item {
  position: relative; display: flex; align-items: center; gap: .68rem;
  padding: .5rem .55rem; border-radius: 12px; color: #0f172a; overflow: hidden; isolation: isolate;
  transition: transform .26s var(--qt-spring), background-color .2s ease, box-shadow .2s ease;
  opacity: 0; transform: translateX(-8px); animation: qtRowIn .42s var(--qt-spring) both;
}
.qt-menu li + li .qt-item::after {
  content: ""; position: absolute; left: 3rem; right: .55rem; top: -1px; height: 1px;
  background: rgba(15, 23, 42, .055); z-index: -1;
}
.qt-menu .qt-item::before {
  content: ""; position: absolute; left: 0; top: 50%; height: 0; width: 3px;
  border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--qt-a), var(--qt-b));
  transform: translateY(-50%); transition: height .28s var(--qt-spring); z-index: 1;
}
.qt-menu .qt-tile {
  position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; color: #fff; font-size: .98rem; overflow: hidden;
  background: linear-gradient(140deg, var(--qt-a), var(--qt-b));
  box-shadow: 0 3px 9px rgba(var(--qt-glow), .35), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: transform .3s var(--qt-spring), box-shadow .24s ease;
}
.qt-menu .qt-tile .bi { color: #fff; line-height: 1; transition: transform .3s var(--qt-spring); }
.qt-menu .qt-tile::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, .45) 50%, transparent 62%);
  transform: translateX(-130%); opacity: 0;
}
.qt-menu .qt-body { flex: 1 1 auto; min-width: 0; line-height: 1.18; }
.qt-menu .qt-title {
  display: block; font-weight: 650; font-size: .84rem; color: #0f172a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qt-menu .qt-sub {
  display: block; font-size: .695rem; font-weight: 500; color: #64748b;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .2s ease;
}
.qt-menu .qt-pill {
  display: inline-block; margin-left: .3rem; padding: .03rem .34rem; font-size: .58rem; font-weight: 700;
  letter-spacing: .03em; color: #475569; background: #f1f5f9; border-radius: 999px; vertical-align: middle;
}
.qt-menu .qt-go {
  flex: 0 0 auto; font-size: .72rem; color: #cbd5e1; opacity: 0; transform: translateX(-4px);
  transition: opacity .2s ease, transform .26s var(--qt-spring), color .2s ease;
}
.proq-nav .dropdown-menu.qt-menu .qt-item:hover,
.proq-nav .dropdown-menu.qt-menu .qt-item:focus-visible {
  transform: translateX(5px); background-color: rgba(var(--qt-glow), .07);
}
.qt-menu .qt-item:hover::before,
.qt-menu .qt-item:focus-visible::before,
.qt-menu .qt-item.is-active::before { height: 64%; }
.qt-menu .qt-item:hover .qt-tile,
.qt-menu .qt-item:focus-visible .qt-tile {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 6px 16px rgba(var(--qt-glow), .5), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.qt-menu .qt-item:hover .qt-tile .bi,
.qt-menu .qt-item:focus-visible .qt-tile .bi { transform: scale(1.04) rotate(-3deg); }
.qt-menu .qt-item:hover .qt-tile::before { animation: qtSheen .6s ease forwards; }
.qt-menu .qt-item:hover .qt-go,
.qt-menu .qt-item:focus-visible .qt-go,
.qt-menu .qt-item.is-active .qt-go { opacity: 1; transform: translateX(0); color: var(--qt-a); }
.qt-menu .qt-item.is-active { background-color: rgba(var(--qt-glow), .09); }
.qt-menu .qt-item:active { transform: translateX(5px) scale(.99); }
.proq-nav .dropdown-menu.qt-menu .qt-item:focus-visible { outline: 2px solid var(--qt-a); outline-offset: -2px; }
@keyframes qtRowIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes qtSheen { from { transform: translateX(-130%); opacity: .9; } to { transform: translateX(130%); opacity: 0; } }
.qt-menu li:nth-child(2) .qt-item { animation-delay: .03s; }
.qt-menu li:nth-child(3) .qt-item { animation-delay: .06s; }
.qt-menu li:nth-child(4) .qt-item { animation-delay: .09s; }
.qt-menu li:nth-child(5) .qt-item { animation-delay: .12s; }
.qt-menu li:nth-child(6) .qt-item { animation-delay: .15s; }
.qt-menu li:nth-child(7) .qt-item { animation-delay: .18s; }
.qt-menu li:nth-child(8) .qt-item { animation-delay: .21s; }

/* ============================================================
   Context sub-bar (page title + page actions)
   ============================================================ */
.subbar { background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); }
.subbar-inner {
  max-width: var(--app-max, none); margin: 0 auto; padding: 9px 24px; min-height: 46px;
  display: flex; align-items: center; gap: 14px;
}
.subbar .page-context { font-weight: 700; color: var(--ink); font-size: .95rem; }
.btn-icon {
  border: 1px solid var(--line); background: #fff; border-radius: 11px;
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-soft); position: relative; transition: all .15s ease;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--shadow-xs); }

/* App width follows the monitor: fluid to the full display by default.
   Set --app-max (e.g. 1600px) on :root to re-cap the working area if desired. */
.content { padding: 24px; max-width: var(--app-max, none); width: 100%; margin: 0 auto; }
.content-plain { padding: 0; max-width: none; }
/* A touch more side breathing room on very wide displays */
@media (min-width: 1900px) { .content { padding: 26px 40px; } .subbar-inner { padding: 9px 40px; } }

/* ---------- Hero band ---------- */
.hero-band {
  border-radius: 22px; color: #fff; overflow: hidden; position: relative;
  margin-bottom: 22px;
  background:
    url("../img/hero-automotive.3133761112b9.svg") right -6px bottom -10px / auto 168% no-repeat,
    radial-gradient(120% 160% at 92% -20%, rgba(56,189,248,0.30) 0%, rgba(56,189,248,0) 55%),
    linear-gradient(118deg, #0a1020 0%, #122a52 44%, #1b46b0 78%, #2563eb 100%);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.hero-band::before {
  content:""; position:absolute; inset:0;
  background-image: repeating-linear-gradient(116deg, rgba(255,255,255,.035) 0 1px, transparent 1px 11px);
  pointer-events:none;
}
.hero-band::after {
  content:""; position:absolute; inset:0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,0) 42%),
    linear-gradient(90deg, rgba(56,189,248,0) 0%, rgba(96,165,250,.55) 50%, rgba(56,189,248,0) 100%) bottom / 100% 2px no-repeat;
  pointer-events:none;
}
.hero-inner { display:flex; justify-content:space-between; align-items:center; gap:20px;
  padding: 26px 32px; position:relative; z-index:1; flex-wrap: wrap; }
.hero-eyebrow { font-size:.7rem; font-weight:700; text-transform:uppercase; letter-spacing:2px;
  color:#93c5fd; margin-bottom:6px; text-shadow:0 1px 6px rgba(37,99,235,.45); }
.hero-title { font-size:1.9rem; font-weight:800; margin:0 0 6px; text-shadow:0 2px 10px rgba(0,0,0,.35); }
.hero-sub { font-size:.92rem; color:#d4def0; margin:0; }
.btn-hero {
  border-radius:13px; font-weight:700; padding:11px 20px;
  background:linear-gradient(180deg,#fff,#eef2fb); border:1px solid rgba(255,255,255,.8); color:#15294f;
  box-shadow:0 8px 20px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.9);
  transition:transform .14s ease, box-shadow .18s ease;
}
.btn-hero:hover { transform:translateY(-2px); color:#0f2557;
  box-shadow:0 12px 26px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.9); }
.hero-stats { display:flex; gap:26px; flex-wrap:wrap; }
.hero-stat .hs-val { font-size:1.5rem; font-weight:800; line-height:1; }
.hero-stat .hs-lab { font-size:.68rem; text-transform:uppercase; letter-spacing:.08em; color:#9fb4dc; margin-top:3px; }

/* ---------- Cards, tables ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  background: var(--card); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 600;
  padding: 13px 18px; }
.table { --bs-table-hover-bg: #f6f9ff; margin-bottom: 0; }
.table thead th {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-soft); border-bottom: 1px solid var(--line);
  background: #fafbff; font-weight: 700; padding: 11px 12px;
}
.table td { vertical-align: middle; }
.table-responsive { border-radius: var(--radius); }

/* ---------- Status + phase badges ---------- */
.badge-soft { border-radius: 999px; font-weight: 600; padding: 0.36em 0.75em; font-size: 0.72rem;
  display: inline-flex; align-items: center; gap: 4px; }
.badge-soft.ok { background: var(--ok-soft); color: #047857; }
.badge-soft.warn { background: var(--warn-soft); color: #b45309; }  /* amber-800: AA on the pale warn tint */
.badge-soft.danger { background: var(--danger-soft); color: var(--danger); }
.badge-soft.info { background: var(--accent-soft); color: var(--accent-600); }
.badge-soft.muted { background: #eef1f6; color: var(--ink-soft); }
.badge-soft.purple { background: #f1e9fe; color: #7c3aed; }

/* ---------- Phase stepper ---------- */
.phase-stepper { display: flex; gap: 8px; flex-wrap: wrap; }
.phase-step {
  flex: 1; min-width: 128px; border-radius: 14px; padding: 12px 14px;
  border: 1px solid var(--line); background: #fff; position: relative;
  box-shadow: var(--shadow-xs); transition: transform .14s ease, box-shadow .16s ease;
}
.phase-step:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.phase-step .ph-num {
  width: 28px; height: 28px; border-radius: 50%; font-size: 0.8rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  background: #eef1f6; color: var(--ink-soft);
}
.phase-step.done { border-color: rgba(16, 185, 129, .35); background: linear-gradient(180deg,#f4fdf8,#fff); }
.phase-step.done .ph-num { background: linear-gradient(135deg,#34d399,#059669); color: #fff;
  box-shadow: 0 4px 10px rgba(16,185,129,.34); }
.phase-step.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.phase-step.active .ph-num { background: linear-gradient(135deg,#38bdf8,#2563eb); color: #fff;
  box-shadow: 0 4px 10px rgba(37,99,235,.34); }
.phase-step .ph-name { font-weight: 600; font-size: 0.8rem; margin-top: 6px; }
.phase-step .ph-meta { font-size: 0.72rem; color: var(--ink-soft); }
/* scoped-out (not applicable) phase — muted, hatched, dashed border */
.phase-step.na {
  border-style: dashed; opacity: .78;
  background: repeating-linear-gradient(45deg,#f8fafc,#f8fafc 6px,#f1f5f9 6px,#f1f5f9 12px);
}
.phase-step.na:hover { transform: none; box-shadow: var(--shadow-xs); }
.phase-step.na .ph-num { background: #e2e8f0; color: var(--ink-soft); box-shadow: none; }

/* ---------- KPI tiles (premium) ---------- */
.kpi-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 17px 19px; height: 100%; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, transform .18s ease; position: relative; overflow: hidden;
}
.kpi-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.kpi-tile .kpi-ic {
  width: 44px; height: 44px; border-radius: 13px; display: inline-grid; place-items: center;
  color: #fff; font-size: 1.25rem; margin-bottom: 12px;
  box-shadow: 0 6px 16px rgba(16,24,40,.16), inset 0 1px 0 rgba(255,255,255,.3);
}
.kpi-ic.g-blue { background: linear-gradient(135deg,#38bdf8,#2563eb); }
.kpi-ic.g-indigo { background: linear-gradient(135deg,#818cf8,#4f46e5); }
.kpi-ic.g-emerald { background: linear-gradient(135deg,#34d399,#059669); }
.kpi-ic.g-amber { background: linear-gradient(135deg,#fbbf24,#d97706); }
.kpi-ic.g-rose { background: linear-gradient(135deg,#fb7185,#e11d48); }
.kpi-ic.g-violet { background: linear-gradient(135deg,#a78bfa,#7c3aed); }
.kpi-ic.g-teal { background: linear-gradient(135deg,#2dd4bf,#0d9488); }
.kpi-tile .kpi-label { font-size: 0.7rem; color: var(--ink-soft); text-transform: uppercase;
  letter-spacing: .06em; font-weight: 700; }
.kpi-tile .kpi-value { font-size: 1.75rem; font-weight: 800; line-height: 1.1; }
.kpi-tile .kpi-sub { font-size: 0.74rem; color: var(--ink-soft); }
.kpi-tile.kpi-ok::after, .kpi-tile.kpi-warn::after, .kpi-tile.kpi-danger::after,
.kpi-tile.kpi-info::after { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; }
.kpi-tile.kpi-ok::after { background: var(--ok); }
.kpi-tile.kpi-warn::after { background: var(--warn); }
.kpi-tile.kpi-danger::after { background: var(--danger); }
.kpi-tile.kpi-info::after { background: var(--accent); }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 6px; background: #eef1f6; }
.progress-bar { background: linear-gradient(90deg, #2563eb, #38bdf8); border-radius: 6px; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: 0.82rem; }
.form-control, .form-select { border-color: var(--line); border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-control-sm, .form-select-sm { border-radius: 8px; }
.btn { border-radius: 11px; font-weight: 600; }
.btn-primary { background: linear-gradient(180deg,#2f6bf6,#2054d6); border-color: #2054d6;
  box-shadow: 0 6px 16px rgba(37,99,235,.28); }
.btn-primary:hover { background: linear-gradient(180deg,#2a61e6,#1b49c0); border-color: #1b49c0; }
.btn-sm { border-radius: 9px; }

/* ---------- Auth pages ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1100px 520px at 85% -10%, rgba(37, 99, 235, 0.16), transparent),
    radial-gradient(800px 420px at -10% 110%, rgba(20, 184, 166, 0.13), transparent),
    linear-gradient(180deg, #eef2fb, var(--bg));
  padding: 24px;
}
.auth-card { width: 100%; max-width: 440px; }
.auth-card .card { box-shadow: var(--shadow); border-radius: 20px; }
.auth-badge {
  width: 58px; height: 58px; border-radius: 17px; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #38bdf8 0%, #2563eb 55%, #14b8a6 100%);
  color: #fff; font-weight: 800; font-size: 1.3rem; letter-spacing: .5px;
  box-shadow: 0 12px 28px rgba(37, 99, 235, .45), inset 0 1px 0 rgba(255, 255, 255, .45);
}

/* ---------- Editable grids ---------- */
.grid-table td, .grid-table th { font-size: 0.82rem; }
.grid-table .cell-input {
  border: 1px solid transparent; background: transparent; width: 100%;
  border-radius: 7px; padding: 3px 6px; font-size: 0.82rem;
}
.grid-table .cell-input:hover { border-color: var(--line); background: #fff; }
.grid-table .cell-input:focus { border-color: var(--accent); background: #fff; outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft); }
/* Narrow S/O/D rating selects: drop the native dropdown arrow so the 1-2 digit
   value shows clean and centred (the arrow overlapped the number). */
.grid-table select.cell-input.text-center {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: none; text-align: center; text-align-last: center;
  padding-left: 2px; padding-right: 2px; font-weight: 600;
}
.grid-table select.cell-input.text-center::-ms-expand { display: none; }
.sticky-col { position: sticky; left: 0; background: #fff; z-index: 2; }

/* ---------- Project risk assessment (APQP §1.17 / App. C) ---------- */
.risk-matrix { border-collapse: separate; border-spacing: 3px; width: 100%; max-width: 340px; }
.risk-matrix td, .risk-matrix th { text-align: center; font-variant-numeric: tabular-nums; }
.rm-cell { height: 34px; font-weight: 700; color: #1f2937; border-radius: 6px; font-size: .8rem; }
.rm-low { background: #d1fae5; } .rm-medium { background: #fde68a; }
.rm-high { background: #fecaca; } .rm-unrated { background: #eef1f6; }
.rm-axis { font-weight: 700; font-size: .72rem; color: var(--ink-soft); padding-right: 6px;
  white-space: nowrap; text-align: right; }
.rm-axis-lab { display: block; font-weight: 500; font-size: .55rem; color: var(--ink-soft); }
.rm-axis-b { font-size: .72rem; color: var(--ink-soft); font-weight: 700; }
.rm-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin: 0 3px 0 8px; vertical-align: middle; }
.rm-key.rm-low { background: #6ee7b7; } .rm-key.rm-medium { background: #fbbf24; }
.rm-key.rm-high { background: #f87171; }
.risk-table .cell-input { border: 1px solid var(--line, #e5e7eb); background: #fff;
  border-radius: 6px; padding: 2px 5px; font-size: .75rem; }
.risk-table .cell-input:focus { border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft); }
.risk-table .cell-input.is-required { border-color: #dc2626; background: #fef2f2; }
.risk-row.risk-lvl-high > td:first-child { box-shadow: inset 3px 0 0 var(--danger, #dc2626); }
.risk-row.risk-lvl-medium > td:first-child { box-shadow: inset 3px 0 0 #d97706; }
.risk-guide th { font-size: .64rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); background: #f8fafc; font-weight: 700; vertical-align: middle; }
.risk-guide td { font-size: .72rem; vertical-align: top; line-height: 1.32; }

/* Project action plan — inline editable table; overdue rows tint red, the
   days-left badge blinks red (reuses .badge-blink / latepulse). */
.action-table .cell-input { border: 1px solid var(--line, #e5e7eb); background: #fff;
  border-radius: 6px; padding: 2px 6px; font-size: .78rem; width: 100%; }
.action-table .cell-input:focus { border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft); }
.action-table tr.action-overdue > td { background: rgba(220,38,38,.05); }
.action-table tr.action-overdue > td:first-child { box-shadow: inset 3px 0 0 var(--danger, #dc2626); }
/* Date cell: keep the "CW" (Wnn) week badge to the RIGHT of the date, not beneath it */
.action-date { display: flex; align-items: center; gap: 6px; }
.action-date .cell-input { flex: 1 1 auto; min-width: 0; width: auto; }
.action-date .wk-badge { flex: 0 0 auto; margin-left: 0; }

/* Trial-readiness checklist — fixed 4M+ rows, editable date/status cells */
.readiness-table .cell-input { border: 1px solid var(--line, #e5e7eb); background: #fff;
  border-radius: 6px; padding: 2px 6px; font-size: .78rem; width: 100%; }
.readiness-table .cell-input:focus { border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft); }
.readiness-table td:first-child { color: var(--ink); }
.readiness-status { font-weight: 600; }
.readiness-status.rs-ok     { color: #047857; border-color: rgba(4,120,87,.35); }
.readiness-status.rs-info   { color: var(--accent-600); border-color: rgba(37,99,235,.35); }
.readiness-status.rs-warn   { color: #b45309; border-color: rgba(180,83,9,.35); }
.readiness-status.rs-danger { color: var(--danger); border-color: rgba(225,29,72,.35); }
.readiness-status.rs-muted  { color: var(--ink-soft); }

/* Escalation ladder — configurable "after N weeks → position → responsible" */
.escalation-table .cell-input { border: 1px solid var(--line, #e5e7eb); background: #fff;
  border-radius: 6px; padding: 2px 6px; font-size: .78rem; }
.escalation-table .cell-input:focus { border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 2px var(--accent-soft); }
.escalation-table select.cell-input { width: 100%; }

/* Core Team phase cell — RASIC select + per-person task-load badge */
.ctm-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.ctm-load { display: inline-flex; align-items: center; gap: 3px; font-size: .62rem;
  font-weight: 700; line-height: 1; padding: 2px 6px; border-radius: 999px;
  color: var(--accent-600, #1d4ed8); background: var(--accent-soft, #eaf1fe);
  border: 1px solid rgba(37,99,235,.22); font-variant-numeric: tabular-nums; }
.ctm-load i { font-size: .6rem; opacity: .8; }

/* ============ Core Team — premium compact sheet ============ */
/* Slim legend strip */
.ctm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 16px;
  padding: 8px 14px; font-size: .74rem; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 13px; background: var(--card);
  box-shadow: var(--shadow-xs); }
.ctm-legend .lg-item { display: inline-flex; align-items: center; gap: 6px; }
.ctm-legend .sep { width: 1px; height: 15px; background: var(--line); }
.rasic-pill { display: inline-flex; align-items: center; justify-content: center;
  min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px;
  font-weight: 800; font-size: .66rem; line-height: 1; }
.rp-R { background: var(--accent-soft); color: var(--accent-600); }
.rp-A { background: var(--danger-soft); color: #dc2626; }
.rp-S { background: #d9f2ef; color: #0d9488; }
.rp-I { background: #eef1f6; color: #64748b; }
.rp-C { background: #f1e9fe; color: #7c3aed; }

/* Collapsible "add position" */
.ctm-add { border: 1px solid var(--line); border-radius: 13px; background: var(--card);
  box-shadow: var(--shadow-xs); overflow: hidden; }
.ctm-add > summary { cursor: pointer; list-style: none; padding: 10px 14px;
  font-weight: 600; font-size: .82rem; color: var(--ink);
  display: flex; align-items: center; gap: 8px; user-select: none; }
.ctm-add > summary::-webkit-details-marker { display: none; }
.ctm-add > summary:hover { color: var(--accent); }
.ctm-add > summary .chev { margin-left: auto; color: var(--ink-soft); transition: transform .2s ease; }
.ctm-add[open] > summary { border-bottom: 1px solid var(--line); }
.ctm-add[open] > summary .chev { transform: rotate(180deg); }
.ctm-add .ctm-add-body { padding: 13px 14px; }

/* The sheet: one continuous premium table with grouped sections */
.ctm-sheet { overflow: hidden; }
.ctm-table { border-collapse: separate; border-spacing: 0; }
.ctm-table thead th { text-transform: uppercase; letter-spacing: .045em;
  font-size: .62rem; font-weight: 700; color: var(--ink-soft);
  background: #fbfcfe; padding: 9px 13px; border-bottom: 1px solid var(--line); }
.ctm-table tbody td { padding: 6px 13px; border-bottom: 1px solid var(--line);
  vertical-align: middle; }
.ctm-table tbody tr:not(.ctm-group):hover td { background: #f7f9fd; }
.ctm-table tbody tr:last-child td { border-bottom: 0; }
.ctm-table tbody td:first-child { font-weight: 600; color: var(--ink); }

/* Section group header row */
.ctm-group td { padding: 8px 13px !important; background: #f2f5fb;
  font-weight: 700; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ctm-group:first-child td { border-top: 0; }
.ctm-group-dot { display: inline-block; width: 8px; height: 8px; border-radius: 3px;
  margin-right: 9px; vertical-align: middle; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.ctm-group-core .ctm-group-dot { background: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.ctm-group-daci .ctm-group-dot { background: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.14); }
.ctm-group-other .ctm-group-dot { background: #64748b; box-shadow: 0 0 0 3px rgba(100,116,139,.14); }
.ctm-group-count { margin-left: 9px; color: var(--ink-soft); font-weight: 600;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 9px; font-size: .62rem; letter-spacing: 0; }

/* Responsible person — avatar chip + inline select */
.ctm-person { display: flex; align-items: center; gap: 9px; }
.ctm-avatar { flex: 0 0 27px; width: 27px; height: 27px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  font-weight: 700; font-size: .64rem; letter-spacing: .3px; background: var(--a, #94a3b8);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 1px 3px rgba(16,24,40,.14); }
.ctm-avatar.is-empty { background: #eef1f6; color: #94a3b8; box-shadow: inset 0 0 0 1px var(--line); }
.ctm-avatar.is-empty i { font-size: .72rem; }
.ctm-person select.cell-input { font-weight: 600; }

/* RASIC cells rendered as filled pills (still editable selects) */
.ctm-table .ctm-cell { gap: 5px; }
.ctm-table select.cell-input.rasic { min-width: 44px; border-radius: 999px;
  padding: 4px 8px; font-weight: 800; font-size: .74rem;
  border: 1px solid transparent; background: transparent; color: #cbd5e1;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease; }
.ctm-table select.cell-input.rasic:hover { box-shadow: inset 0 0 0 1px var(--line); }
.ctm-table select.cell-input.rasic.rasic-R { background: var(--accent-soft); color: var(--accent-600); }
.ctm-table select.cell-input.rasic.rasic-A { background: var(--danger-soft); color: #dc2626; }
.ctm-table select.cell-input.rasic.rasic-S { background: #d9f2ef; color: #0d9488; }
.ctm-table select.cell-input.rasic.rasic-I { background: #eef1f6; color: #64748b; }
.ctm-table select.cell-input.rasic.rasic-C { background: #f1e9fe; color: #7c3aed; }
.ctm-table select.cell-input.rasic:focus { box-shadow: 0 0 0 3px var(--accent-soft); }

@media (max-width: 640px) {
  .ctm-table thead th, .ctm-table tbody td { padding-left: 9px; padding-right: 9px; }
  .ctm-avatar { flex-basis: 24px; width: 24px; height: 24px; }
}

/* ============ Phase deliverables board — premium compact sheet ============ */
/* Reuses grid-table (.cell-input), .ctm-avatar/.ctm-person, .ctm-add. Everything
   net-new is scoped under .del-* so it never leaks to other tables. */
.del-sheet { overflow: hidden; }
.del-table { border-collapse: separate; border-spacing: 0; }
.del-table thead th {
  text-transform: uppercase; letter-spacing: .045em; font-size: .62rem; font-weight: 700;
  color: var(--ink-soft); background: #fbfcfe; padding: 9px 13px;
  border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left;
}
.del-table tbody td {
  padding: 6px 13px; border-bottom: 1px solid var(--line);
  vertical-align: middle; font-size: .8rem;
}
.del-table tbody tr:hover td { background: #f7f9fd; }
.del-table tbody tr:last-child td { border-bottom: 0; }
.del-table td .badge-soft { white-space: nowrap; }

/* Overdue → single 3px danger left rail on the code cell */
.del-row.is-overdue > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.del-row.is-overdue .del-due input { color: var(--danger); font-weight: 700; }
/* NA → recessed & muted */
.del-row.is-na > td { background: #fbfcfd; color: #94a3b8; }
.del-row.is-na:hover > td { background: #f6f8fb; }
.del-row.is-na .ctm-avatar { opacity: .6; }

.del-code { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .74rem; color: var(--ink-soft); }
.del-name { font-weight: 600; color: var(--ink); font-size: .82rem; }
.del-name + .badge-soft, .del-code .badge-soft { font-size: .55rem; }

/* Secondary/destructive controls: reveal on hover, reachable on focus & touch */
.del-reveal { opacity: 0; transition: opacity .12s ease; }
.del-row:hover .del-reveal,
.del-reveal:focus-visible,
.del-reveal:focus-within { opacity: 1; }
@media (hover: none) { .del-reveal { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .del-reveal { transition: none; } }

.del-status-cell { display: flex; align-items: center; gap: 6px; min-height: 27px; }

/* Status as a filled pill-select: leading currentColor state-dot + faint caret */
.del-table select.del-status {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  border: 1px solid transparent; border-radius: 999px;
  padding: 4px 22px; font-weight: 700; font-size: .72rem; line-height: 1;
  cursor: pointer; min-width: 112px; max-width: 138px; font-variant-numeric: tabular-nums;
  background-repeat: no-repeat, no-repeat;
  background-position: left 8px center, right 7px center;
  background-size: 7px 7px, 9px 6px;
  background-image:
    radial-gradient(circle at center, currentColor 0 3px, transparent 3.5px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2394a3b8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  transition: box-shadow .12s ease, background-color .12s ease, color .12s ease;
}
.del-table select.del-status::-ms-expand { display: none; }
.del-table select.del-status:hover { box-shadow: inset 0 0 0 1px var(--line); }
.del-table select.del-status:focus,
.del-table select.del-status:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.del-table select.del-status:disabled {
  cursor: default; opacity: .9; padding-right: 12px;
  background-image: radial-gradient(circle at center, currentColor 0 3px, transparent 3.5px);
  background-position: left 8px center;
}
.del-status.st-not_started { background-color: #eef1f6;           color: #64748b; }
.del-status.st-in_progress { background-color: var(--warn-soft);   color: #b45309; }
.del-status.st-in_review   { background-color: var(--accent-soft); color: var(--accent-600); }
.del-status.st-released    { background-color: var(--ok-soft);     color: #047857; }
.del-status.st-na          { background-color: #eef1f6;            color: #94a3b8; }

/* Icon-only submit (send for approval) — always visible */
.del-submit {
  flex: 0 0 26px; width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid rgba(37,99,235,.22);
  background: var(--accent-soft); color: var(--accent-600);
  font-size: .8rem; line-height: 1; cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease, box-shadow .14s ease, transform .1s ease;
}
.del-submit:hover { background: var(--accent); border-color: var(--accent); color: #fff;
  transform: translateY(-1px); box-shadow: 0 2px 8px rgba(37,99,235,.28); }
.del-submit:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* Awaiting chip */
.del-await {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 8px;
  border-radius: 999px; font-size: .68rem; font-weight: 700; white-space: nowrap;
  background: var(--warn-soft); color: #b45309; border: 1px solid rgba(217,119,6,.18);
}
.del-await i { font-size: .72rem; }

/* Primary Approve keeps its label; reject is a coin */
.del-approve {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--ok); background: var(--ok); color: #fff;
  font-size: .7rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: filter .14s ease, box-shadow .14s ease;
}
.del-approve:hover { filter: brightness(.96); box-shadow: 0 2px 8px rgba(16,185,129,.3); }
.del-approve:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ok-soft); }

/* Shared coin button for reject / evidence-remove / custom-delete */
.del-icon {
  flex: 0 0 26px; width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink-soft); font-size: .8rem; line-height: 1; cursor: pointer;
  transition: background .14s ease, color .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.del-icon:hover { box-shadow: var(--shadow-xs); }
.del-icon:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.del-icon.reject { color: var(--danger); border-color: rgba(225,29,72,.22); background: var(--danger-soft); }
.del-icon.reject:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .del-submit, .del-icon, .del-approve { transition: none; }
  .del-submit:hover { transform: none; }
}

.del-unassigned { display: inline-flex; align-items: center; gap: 3px; margin-top: 2px;
  font-size: .64rem; font-weight: 600; color: #b45309; text-decoration: none; }
.del-unassigned:hover { text-decoration: underline; }
.del-due input { font-variant-numeric: tabular-nums; }

/* Legend strip (flush inside the card) */
.del-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 15px;
  padding: 7px 14px; font-size: .7rem; color: var(--ink-soft);
  border-bottom: 1px solid var(--line); background: var(--card); }
.del-legend .k { display: inline-flex; align-items: center; gap: 6px; }
.del-legend .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ============ Gate Reviews cockpit ============ */
.gr-sheet { overflow: hidden; }
/* Sheet table (mirrors .del-table / .ctm-table) */
.gr-table thead th { text-transform: uppercase; letter-spacing: .045em; font-size: .62rem;
  font-weight: 700; color: var(--ink-soft); background: #fbfcfe; padding: 9px 13px;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.gr-table tbody td { padding: 8px 13px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: .8rem; }
.gr-table tbody tr:hover td { background: #f7f9fd; }
.gr-table tbody tr:last-child td { border-bottom: 0; }
.gr-row.is-overdue > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.gr-row.is-mine > td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.gr-row.is-mine > td { background: rgba(217,119,6,.045); }
.gr-row.is-mine:hover > td { background: rgba(217,119,6,.08); }

/* Highlighted focus gate — the one gate to approve next in each project */
.gr-focus { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 8px; background: var(--accent-soft); border: 1px solid rgba(37,99,235,.28);
  color: var(--accent-600); font-weight: 700; font-size: .78rem; text-decoration: none;
  transition: background .12s ease, box-shadow .12s ease; }
.gr-focus:hover { background: #dbe6fe; box-shadow: var(--shadow-xs); }
.gr-focus > i { font-size: .72rem; }
.gr-focus .gr-focus-code { font-size: .56rem; font-weight: 700; background: #fff;
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--ink-soft); }
.gr-focus.is-mine { background: var(--warn-soft); border-color: rgba(217,119,6,.45); color: #92400e; }
.gr-focus.is-mine:hover { background: #fbe2c9; }
.gr-focus.is-overdue { background: var(--danger-soft); border-color: rgba(225,29,72,.4); color: #dc2626; }
.gr-focus.is-overdue:hover { background: #fbd5de; }

/* Awaiting-your-signature card accent */
.gr-mine { border-color: rgba(217,119,6,.4); }
.gr-mine > .card-header { background: var(--warn-soft); color: #92400e; }

/* Portfolio matrix */
.gr-matrix thead th { text-transform: uppercase; letter-spacing: .04em; font-size: .6rem;
  font-weight: 700; color: var(--ink-soft); background: #fbfcfe; padding: 8px 10px;
  border-bottom: 1px solid var(--line); }
.gr-matrix tbody td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.gr-matrix tbody tr:last-child td { border-bottom: 0; }
.gr-matrix tbody tr:hover td { background: #f9fbfe; }

.gr-cell { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 34px; border-radius: 9px; font-weight: 800; font-size: .82rem;
  text-decoration: none; color: #1f2937; border: 1px solid transparent;
  transition: transform .1s ease, box-shadow .12s ease; }
a.gr-cell:hover { transform: translateY(-1px); box-shadow: var(--shadow-xs); }
.gr-cell.is-current { outline: 2px solid rgba(37,99,235,.55); outline-offset: 1px; }
.rag-green { background: var(--ok-soft); color: #047857; }
.rag-amber { background: #f1e9fe; color: #7c3aed; }        /* conditional = purple/violet */
.rag-red   { background: var(--danger-soft); color: #dc2626; }
.rag-open  { background: var(--accent-soft); color: var(--accent-600); box-shadow: inset 0 0 0 1px rgba(37,99,235,.14); }
.rag-grey  { background: #eef1f6; color: #94a3b8; }
.rag-na    { background: repeating-linear-gradient(45deg,#f5f7fa,#f5f7fa 4px,#eef1f6 4px,#eef1f6 8px); color: #cbd5e1; cursor: default; }

.gr-missing { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: .6rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 3px; box-shadow: 0 0 0 2px #fff; }
.gr-dot { position: absolute; left: 4px; bottom: 4px; width: 7px; height: 7px; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.gr-dot.ok { background: var(--ok); } .gr-dot.warn { background: var(--warn); } .gr-dot.danger { background: var(--danger); }

/* Approver avatar stack + signature status rings */
.gr-stack { display: inline-flex; align-items: center; }
.gr-stack .gr-sig { width: 24px; height: 24px; font-size: .58rem; margin-left: -6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 0 0 2px #fff; }
.gr-stack .gr-sig:first-child { margin-left: 0; }
.gr-sig--approved { box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 0 0 2px var(--ok) !important; }
.gr-sig--rejected { box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 0 0 2px var(--danger) !important; }
.gr-sig--pending  { box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 0 0 2px var(--warn) !important; }

/* Deliverables progress bar */
.gr-prog { height: 6px; border-radius: 999px; background: #eef1f6; overflow: hidden; }
.gr-prog > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.gr-prog > span.full { background: var(--ok); }

/* Legend */
.gr-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: .66rem; color: var(--ink-soft); }
.gr-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.gr-key { width: 13px; height: 13px; border-radius: 4px; display: inline-block; }

/* Inline sign buttons (reuse the board's coin language) */
.gr-approve, .gr-reject { width: 28px; height: 28px; padding: 0; border-radius: 8px; border: 1px solid;
  display: inline-flex; align-items: center; justify-content: center; font-size: .82rem; cursor: pointer;
  transition: filter .12s ease, box-shadow .12s ease; }
.gr-approve { background: var(--ok); border-color: var(--ok); color: #fff; }
.gr-approve:hover { filter: brightness(.96); box-shadow: 0 2px 8px rgba(16,185,129,.3); }
.gr-reject { background: var(--danger-soft); border-color: rgba(225,29,72,.22); color: var(--danger); }
.gr-reject:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.gr-approve:focus-visible, .gr-reject:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

@media (prefers-reduced-motion: reduce) { a.gr-cell, .gr-approve, .gr-reject { transition: none; } }

/* Charter "Needs attention" — pulse red while there are critical items. Falls
   back to a static red tint when the viewer prefers reduced motion. */
@keyframes attnbg {
  0%, 100% { background: rgba(220,38,38,.07); }
  50%      { background: rgba(220,38,38,.18); }
}
.cc-head-alert { color: #b02a37; background: rgba(220,38,38,.08);
  animation: attnbg 1.4s ease-in-out infinite; }
.cc-head-alert i { color: var(--danger, #dc2626); }
.cc-head-alert .cc-attn-ic { display: inline-block; transform-origin: center;
  animation: alertpulse 1.15s ease-in-out infinite; }

/* ---------- Drag & drop evidence upload ---------- */
.evidence-drop {
  display: inline-flex; align-items: center; gap: 6px; margin: 0;
  padding: 5px 10px; border-radius: 9px; cursor: pointer;
  border: 1px dashed var(--line); background: #fbfcff; color: var(--ink-soft);
  font-size: .76rem; font-weight: 600; white-space: nowrap;
  transition: border-color .14s ease, background .14s ease, color .14s ease, box-shadow .14s ease;
}
.evidence-drop:hover, .evidence-drop:focus-visible {
  border-color: var(--accent); color: var(--accent); background: var(--accent-soft); outline: none;
}
.evidence-drop i { font-size: .95rem; }
.evidence-drop.dragging {
  border-style: solid; border-color: var(--accent); color: var(--accent-600);
  background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft);
  transform: translateY(-1px);
}

/* ---------- ISO week badge next to date fields + flatpickr theming ---------- */
.wk-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap;
  vertical-align: middle; color: var(--accent-600); background: var(--accent-soft);
}
.flatpickr-day.selected, .flatpickr-day.selected:hover,
.flatpickr-day.startRange, .flatpickr-day.endRange { background: var(--accent); border-color: var(--accent); }
.flatpickr-day.today { border-color: var(--accent); }
.flatpickr-weekwrapper .flatpickr-weekday { color: var(--accent-600); }
.flatpickr-weekwrapper span.flatpickr-day { color: var(--ink-soft); font-weight: 700; }
.flatpickr-calendar { box-shadow: var(--shadow); border-radius: 12px; }

/* ---------- Requirement help "?" icon + popover ---------- */
.help-q { color: var(--ink-faint, #9aa6bd); cursor: pointer; font-size: .92rem; vertical-align: -1px;
  transition: color .14s ease, transform .12s ease; }
.help-q:hover, .help-q:focus-visible { color: var(--accent); transform: scale(1.12); outline: none; }
.popover.help-popover { max-width: 340px; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); }
.popover.help-popover .popover-header { background: var(--accent-soft); color: var(--accent-600);
  font-weight: 700; font-size: .8rem; border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; }
.popover.help-popover .popover-body { font-size: .82rem; color: var(--ink); line-height: 1.5; }

/* ---------- Project Charter (premium cockpit) ---------- */
.ch-hero { position:relative; overflow:hidden; border-radius:20px; color:#eef3ff; padding:20px 24px; margin-bottom:14px;
  background:
    radial-gradient(120% 130% at 100% 0%, rgba(56,189,248,.20), transparent 55%),
    radial-gradient(120% 130% at 0% 100%, rgba(139,92,246,.18), transparent 55%),
    linear-gradient(120deg,#0a1020 0%,#122a52 55%,#1a3a78 100%);
  border:1px solid rgba(139,92,246,.22); box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.07); }
.ch-hero-top { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap;
  position:relative; z-index:1; }
.ch-hero h1 { font-size:1.5rem; font-weight:800; letter-spacing:-.015em; margin:0; color:#fff; }
.ch-hero .ch-sub { color:#9fb0da; font-size:.78rem; margin-top:3px; }
.ch-hero .ch-tag { font-size:.6rem; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
  background:rgba(255,255,255,.12); color:#dfe7fb; padding:3px 8px; border-radius:6px; }
.ch-hero .ch-tag.ok{ background:rgba(52,211,153,.2); color:#6ee7b7; } .ch-hero .ch-tag.warn{ background:rgba(251,191,36,.2); color:#fcd34d; }
.btn-ghost { background:rgba(255,255,255,.09); border:1px solid rgba(255,255,255,.16); color:#dfe7fb; }
.btn-ghost:hover { background:rgba(255,255,255,.18); color:#fff; border-color:rgba(255,255,255,.28); }
.ch-hero-divider { height:1px; margin:16px 0 14px; position:relative; z-index:1;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.14) 15%,rgba(255,255,255,.14) 85%,transparent); }
.ch-metrics { display:flex; flex-wrap:wrap; gap:14px 0; position:relative; z-index:1; }
.ch-metric { flex:1 1 150px; min-width:130px; padding:0 20px; border-left:1px solid rgba(255,255,255,.1); }
.ch-metric:first-child { border-left:none; padding-left:0; }
.cm-label { font-size:.58rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase; color:#8fa0c8; }
.cm-value { font-size:1.4rem; font-weight:800; line-height:1.1; color:#fff; margin-top:3px; letter-spacing:-.01em; }
.cm-sub { font-size:.68rem; color:#9fb0da; margin-top:2px; }
.cm-ok{ color:#6ee7b7!important; } .cm-warn{ color:#fcd34d!important; } .cm-danger{ color:#fda4af!important; }
.cm-bar { height:4px; border-radius:3px; background:rgba(255,255,255,.14); margin-top:8px; overflow:hidden; }
.cm-bar > span { display:block; height:100%; border-radius:3px; background:linear-gradient(90deg,#38bdf8,#818cf8); }

/* ============================================================
   PROJECT CHARTER — premium card system
   Base: "Refined Enterprise" instrument-panel shell (one card
   language) + grafts: phase-number qt-medallions, gradient
   progress bars, budget mini-bar, segmented risk strip,
   severity left-rails, and a single hero-tuned top line on the
   full-width feature card.

   DROP-IN: paste this whole block REPLACING the current
   "compact charter cards" section in static/css/app.css
   (lines ~598–675, i.e. `.charter-card` … `.cc-row .k`).
   The qt-* rules are reproduced VERBATIM inside so nothing is
   lost. Leave the `.cc-head-alert` rules (~519–527) untouched.
   All 9 header icons are styled IN PLACE via
   `.cc-head > .bi:first-child` — no span-wrapping required.
   ============================================================ */

/* ---- shared shell: raised, quietly premium "instrument panel" ---- */
.charter-card{
  --cc:var(--accent); --cc-soft:var(--accent-soft);
  position:relative;
  background:linear-gradient(180deg,#ffffff 0%, #fbfcfe 100%);
  border:1px solid var(--line);
  border-radius:var(--radius);                 /* 16px, up from flat 14 */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),        /* 1px top highlight */
    0 1px 2px rgba(16,24,40,.04),              /* contact shadow */
    0 8px 20px -12px rgba(16,24,40,.16);       /* soft ambient lift */
  margin-bottom:14px; overflow:hidden;
  transition:box-shadow .18s ease, border-color .18s ease;
}
.charter-card:hover{
  border-color:#e0e6f1;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 1px 2px rgba(16,24,40,.05),
    0 14px 30px -14px rgba(16,24,40,.22);
}

/* full-width Phase-timeline anchor: one elevation step higher + a
   single restrained top-accent line tuned to the hero's sky->blue glow */
.charter-card--feature{
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    0 1px 2px rgba(16,24,40,.05),
    0 16px 34px -16px rgba(16,24,40,.22);
}
.charter-card--feature::before{
  content:""; position:absolute; inset:0 0 auto 0; height:3px;
  background:linear-gradient(90deg,var(--sky),var(--accent));
}

/* ---- per-card accent (chip hue + hover wash). Darker hues chosen so
   the small chip icon holds AA contrast on its pale tint ---- */
.cc-accent-blue    { --cc:#2563eb; --cc-soft:#eaf1fe; }
.cc-accent-sky     { --cc:#0284c7; --cc-soft:#e5f4fd; }
.cc-accent-indigo  { --cc:#6366f1; --cc-soft:#ecedfd; }
.cc-accent-violet  { --cc:#8b5cf6; --cc-soft:#f1ecfe; }
.cc-accent-amber   { --cc:#d97706; --cc-soft:#fbeed3; }
.cc-accent-emerald { --cc:#059669; --cc-soft:#e2f5ed; }
.cc-accent-teal    { --cc:#0d9488; --cc-soft:#e0f4f1; }
.cc-accent-rose    { --cc:#e11d48; --cc-soft:#fce7ec; }
.cc-accent-slate   { --cc:#5b6b8c; --cc-soft:#edf0f6; }

/* ---- header + soft-tinted icon chip (styled in place, no HTML wrap) ---- */
.cc-head{ display:flex; align-items:center; gap:9px; padding:10px 14px;
  border-bottom:1px solid var(--line);
  font-size:.64rem; font-weight:800; letter-spacing:.09em;
  text-transform:uppercase; color:var(--ink-soft); }
.cc-head:not(.cc-head-alert){
  background:linear-gradient(180deg, rgba(248,250,253,.6), rgba(255,255,255,0)); }
/* leading icon -> soft chip; (0,3,0) beats legacy `.cc-head-alert i` (0,1,1)
   and `.cc-attn-ic` display (0,2,0), so the chip wins while the pulse keeps */
.cc-head > .bi:first-child{
  width:26px; height:26px; flex:none; border-radius:8px;
  display:inline-grid; place-items:center;
  font-size:.9rem; line-height:1;
  color:var(--cc); background:var(--cc-soft);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.7),
    inset 0 0 0 1px rgba(15,23,42,.04),
    0 1px 2px rgba(16,24,40,.06);
  transition:transform .18s cubic-bezier(.2,.75,.3,1.2), box-shadow .18s ease;
}
.charter-card:hover .cc-head > .bi:first-child{
  transform:translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.8),
    inset 0 0 0 1px rgba(15,23,42,.05),
    0 3px 7px -1px rgba(16,24,40,.12);
}
.cc-head .cc-link{ margin-left:auto; font-size:.68rem; text-transform:none;
  letter-spacing:0; font-weight:600; text-decoration:none; color:var(--cc); }
.cc-head .cc-count{ margin-left:auto; }
.cc-body{ padding:10px 12px; }
/* Notice board — frozen height, scrolls once full (like the project chat) */
.cc-body.notice-scroll{ max-height:360px; overflow-y:auto; }
.cc-body.notice-scroll::-webkit-scrollbar{ width:8px; }
.cc-body.notice-scroll::-webkit-scrollbar-thumb{ background:rgba(15,23,42,.18); border-radius:8px; }

/* ============ Project team chat — WhatsApp-style, near-real-time ============ */
.chat-card .cc-head{ }
.chat-live{ display:inline-flex; align-items:center; gap:6px; margin-left:auto;
  font-size:.6rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:#0d9488; }
.chat-live-dot{ width:7px; height:7px; border-radius:50%; background:#22c55e;
  box-shadow:0 0 0 3px rgba(34,197,94,.18); animation:chatLive 1.8s ease-in-out infinite; }
@keyframes chatLive{ 0%,100%{ opacity:1; } 50%{ opacity:.35; } }

.chat-scroll{ height:340px; overflow-y:auto;   /* frozen size — always scrolls when full */
  padding:12px 12px 8px; display:flex; flex-direction:column; gap:6px;
  background:#ece5dd;                         /* messenger wallpaper */
  background-image:
    radial-gradient(rgba(255,255,255,.55) 1px, transparent 1px),
    radial-gradient(rgba(15,23,42,.028) 1px, transparent 1px);
  background-size:22px 22px, 22px 22px; background-position:0 0, 11px 11px;
  scroll-behavior:smooth; }
/* Pin the thread to the bottom (newest visible) while keeping the top fully
   scrollable — auto margin collapses to 0 once messages overflow the box. */
.chat-scroll > :first-child{ margin-top:auto; }
.chat-scroll::-webkit-scrollbar{ width:8px; }
.chat-scroll::-webkit-scrollbar-thumb{ background:rgba(15,23,42,.18); border-radius:8px; }

.chat-msg{ display:flex; gap:7px; max-width:90%; align-items:flex-end; }
.chat-msg:not(.me){ align-self:flex-start; }
.chat-msg.me{ align-self:flex-end; flex-direction:row-reverse; }
.chat-avatar{ flex:0 0 26px; width:26px; height:26px; border-radius:50%;
  display:inline-flex; align-items:center; justify-content:center; color:#fff;
  font-weight:700; font-size:.6rem; letter-spacing:.3px; background:var(--a,#94a3b8);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.28), 0 1px 3px rgba(16,24,40,.18); }
.chat-bubble{ position:relative; padding:5px 9px 4px; border-radius:11px;
  background:#fff; box-shadow:0 1px 1.5px rgba(16,24,40,.14); font-size:.8rem;
  line-height:1.34; color:var(--ink); min-width:58px; max-width:100%; }
.chat-msg:not(.me) .chat-bubble{ border-top-left-radius:3px; }       /* tail notch */
.chat-msg.me .chat-bubble{ background:#d9fdd3; border-top-right-radius:3px; }
.chat-sender{ font-weight:700; font-size:.66rem; margin-bottom:1px; line-height:1.1; }
.chat-text{ white-space:pre-wrap; overflow-wrap:anywhere; }
.chat-text a{ color:var(--accent-600); }
.chat-time{ font-size:.58rem; color:rgba(15,23,42,.45); text-align:right;
  margin-top:1px; font-variant-numeric:tabular-nums; user-select:none; }

.chat-empty{ margin:auto; text-align:center; color:var(--ink-soft); font-size:.76rem;
  line-height:1.4; padding:26px 10px; }
.chat-empty i{ font-size:1.7rem; display:block; margin-bottom:8px; opacity:.5; }

.chat-input{ display:flex; align-items:center; gap:9px; padding:9px 11px;
  border-top:1px solid var(--line); background:#fff; }
.chat-field{ flex:1 1 auto; min-width:0; border:1px solid var(--line);
  border-radius:999px; padding:7px 14px; font-size:.82rem; background:#f5f7fb;
  color:var(--ink); outline:none; transition:border-color .14s ease, box-shadow .14s ease, background .14s ease; }
.chat-field::placeholder{ color:var(--ink-soft); }
.chat-field:focus{ border-color:var(--accent); background:#fff; box-shadow:0 0 0 3px var(--accent-soft); }
.chat-send{ flex:0 0 34px; width:34px; height:34px; border-radius:50%; border:none;
  display:inline-grid; place-items:center; color:#fff; font-size:.92rem; cursor:pointer;
  background:linear-gradient(135deg,#25d366,#128c7e);   /* WhatsApp green */
  box-shadow:0 3px 9px rgba(18,140,126,.38), inset 0 1px 0 rgba(255,255,255,.25);
  transition:transform .12s ease, filter .12s ease; }
.chat-send:hover{ transform:translateY(-1px); filter:brightness(1.06); }
.chat-send:active{ transform:translateY(0); }
.chat-send:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

/* critical state: chip follows the red alert header (rule placed AFTER the
   base chip so it wins on equal specificity); pulse animation still applies */
.cc-head-alert > .bi:first-child{
  color:var(--danger); background:var(--danger-soft);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.6),
    inset 0 0 0 1px rgba(225,29,72,.18),
    0 1px 2px rgba(225,29,72,.14); }

/* ---- Needs attention: severity left-rail + ringed icon squares ---- */
.charter-attn{ position:relative; display:flex; align-items:center; gap:10px;
  padding:8px 10px 8px 14px; border-radius:10px; text-decoration:none;
  transition:background .12s ease, transform .12s ease; }
.charter-attn::before{ content:""; position:absolute; left:4px; top:8px; bottom:8px;
  width:3px; border-radius:2px; background:#cbd3e1; }
.charter-attn.danger::before{ background:var(--danger); }
.charter-attn.warn::before  { background:var(--warn); }
.charter-attn.info::before  { background:var(--accent); }
.charter-attn:hover{ background:var(--cc-soft); transform:translateX(2px); }
.charter-attn .a-txt{ flex:1 1 auto; color:var(--ink); font-size:.86rem; font-weight:500; }
.charter-ico{ width:26px; height:26px; flex:none; border-radius:8px; display:grid;
  place-items:center; font-size:.8rem; }
.charter-ico.danger{ background:var(--danger-soft); color:var(--danger);
  box-shadow:inset 0 0 0 1px rgba(225,29,72,.18); }
.charter-ico.warn{ background:var(--warn-soft); color:var(--warn);
  box-shadow:inset 0 0 0 1px rgba(217,119,6,.18); }
.charter-ico.info{ background:var(--accent-soft); color:var(--accent);
  box-shadow:inset 0 0 0 1px rgba(37,99,235,.16); }

/* ---- Phase progress: qt-echo medallion number chips + gradient bars ---- */
.charter-phase{ display:flex; align-items:center; gap:10px; padding:5px 6px;
  border-radius:9px; text-decoration:none; transition:background .12s ease; }
.charter-phase:hover{ background:var(--cc-soft); }
.charter-phase-current{ background:var(--cc-soft); }
.charter-phase-n{ width:24px; height:24px; flex:none; border-radius:8px;
  display:grid; place-items:center; font-weight:800; font-size:.72rem;
  color:#64748b; background:linear-gradient(155deg,#f2f5fa,#dde4ee);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),
    inset 0 -2px 3px rgba(16,24,40,.09),
    0 1px 1px rgba(16,24,40,.05); }
.charter-phase-n.current{ color:#fff;
  background:linear-gradient(155deg,var(--sky) 8%, var(--accent-600) 92%);
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,.5),
    inset 0 -3px 5px rgba(0,0,0,.22),
    0 4px 9px -3px rgba(37,99,235,.55); }
.charter-phase-n.done{ color:#fff;
  background:linear-gradient(155deg,#34d399 8%, #059669 92%);
  box-shadow:
    inset 0 1.5px 0 rgba(255,255,255,.5),
    inset 0 -3px 5px rgba(0,0,0,.22),
    0 4px 9px -3px rgba(5,150,105,.5); }
.charter-phase .progress{ border-radius:99px; background:#eef1f7;
  box-shadow:inset 0 1px 1px rgba(16,24,40,.06); overflow:hidden; }
.charter-phase .progress-bar{ border-radius:99px; }
.charter-phase .progress-bar.bg-primary{ background:linear-gradient(90deg,var(--sky),var(--accent))!important; }
.charter-phase .progress-bar.bg-success{ background:linear-gradient(90deg,#34d399,var(--emerald))!important; }
.charter-phase .progress-bar.bg-secondary{ background:linear-gradient(90deg,#d3dae6,#aab4c6)!important; }

/* ---- Premium Quality-tools tiles — glossy 3D medallions (VERBATIM, kept) ---- */
.qt-tool { display:flex; flex-direction:column; align-items:center; gap:5px;
  padding:13px 4px 10px; border-radius:15px; text-decoration:none;
  border:1px solid transparent; transition:background .2s ease, border-color .2s ease; }
.qt-tool:hover { background:linear-gradient(180deg, rgba(148,163,184,.10), rgba(148,163,184,0));
  border-color:var(--line); }
.qt-ico {
  width:48px; height:48px; border-radius:14px; display:grid; place-items:center;
  color:#fff; font-size:1.4rem; line-height:1;
  background:linear-gradient(155deg, var(--qt-c1) 8%, var(--qt-c2) 92%);
  box-shadow:
    0 7px 15px -4px var(--qt-shadow),
    0 2px 4px rgba(16,24,40,.14),
    inset 0 1.5px 0 rgba(255,255,255,.6),
    inset 0 -4px 7px rgba(0,0,0,.22);
  transition:transform .22s cubic-bezier(.2,.75,.3,1.45), box-shadow .22s ease;
  will-change:transform; }
.qt-ico i { filter:drop-shadow(0 1.5px 1.5px rgba(0,0,0,.3)); }
.qt-tool:hover .qt-ico {
  transform:translateY(-4px) scale(1.22) rotate(-4deg);
  box-shadow:
    0 16px 26px -7px var(--qt-shadow),
    0 4px 8px rgba(16,24,40,.18),
    inset 0 2px 0 rgba(255,255,255,.7),
    inset 0 -4px 8px rgba(0,0,0,.25); }
.qt-tool:active .qt-ico { transform:translateY(-1px) scale(1.1); }
.qt-count { font-weight:800; font-size:1.15rem; line-height:1; color:var(--ink);
  font-variant-numeric:tabular-nums; }
.qt-label { font-size:.64rem; color:var(--ink-soft); text-align:center; line-height:1.2; }
.qt-tool:hover .qt-count { color:var(--qt-c2); }
.qt-fmea  { --qt-c1:#fbbf24; --qt-c2:#f59e0b; --qt-shadow:rgba(245,158,11,.55); }
.qt-cplan { --qt-c1:#34d399; --qt-c2:#059669; --qt-shadow:rgba(5,150,105,.5); }
.qt-ppap  { --qt-c1:#60a5fa; --qt-c2:#2563eb; --qt-shadow:rgba(37,99,235,.5); }
.qt-msa   { --qt-c1:#c084fc; --qt-c2:#7c3aed; --qt-shadow:rgba(124,58,237,.5); }
.qt-spc   { --qt-c1:#22d3ee; --qt-c2:#0891b2; --qt-shadow:rgba(8,145,178,.5); }
@media (prefers-reduced-motion: reduce) {
  .qt-tool:hover .qt-ico { transform:scale(1.08); }
}

/* ---- Notice board: accent hover wash + haloed semantic dots ---- */
.charter-notice{ display:flex; gap:10px; text-decoration:none; padding:7px 8px;
  border-radius:9px; transition:background .12s ease; }
.charter-notice:hover{ background:var(--cc-soft); }
.charter-notice:hover .cn-title{ color:var(--cc); }
.charter-dot{ width:7px; height:7px; border-radius:50%; margin-top:5px; flex:none;
  background:#94a3b8; box-shadow:0 0 0 3px rgba(148,163,184,.14); }
.charter-dot-warning{ background:var(--warn); box-shadow:0 0 0 3px rgba(217,119,6,.14); }
.charter-dot-success{ background:var(--emerald); box-shadow:0 0 0 3px rgba(16,185,129,.14); }
.charter-dot-danger { background:var(--danger); box-shadow:0 0 0 3px rgba(225,29,72,.14); }
.charter-dot-info   { background:var(--accent); box-shadow:0 0 0 3px rgba(37,99,235,.14); }
.charter-unread::after{ content:""; display:inline-block; width:6px; height:6px;
  border-radius:50%; background:var(--cc); margin-left:6px; vertical-align:middle; }

/* ---- Budget mini spend-bar (actual of approved) ---- */
.cc-minibar{ height:7px; border-radius:99px; margin-top:10px; background:#eef1f7;
  overflow:hidden; box-shadow:inset 0 1px 1px rgba(16,24,40,.06); }
.cc-minibar > span{ display:block; height:100%; max-width:100%; border-radius:99px;
  background:linear-gradient(90deg,#34d399,var(--emerald)); }
.cc-minibar.high > span{ background:linear-gradient(90deg,#fbbf24,var(--amber)); }  /* ≥90% consumed: caution, not a "good" green */
.cc-minibar.over > span{ background:linear-gradient(90deg,var(--amber),var(--danger)); }

/* Amber value text lifted off the white-on-gold ~1.6:1 floor (auditor figures) */
.charter-card .text-warning{ color:#b45309 !important; }

/* ---- Risk assessment segmented profile strip (H / M / L) ---- */
.cc-riskbar{ display:flex; gap:2px; height:8px; margin:6px 0 2px; border-radius:99px;
  overflow:hidden; background:#eef1f7; box-shadow:inset 0 1px 1px rgba(16,24,40,.06); }
.cc-riskbar > span{ display:block; min-width:0; }
.cc-riskbar .rs-h{ background:linear-gradient(90deg,#fb7185,var(--danger)); }
.cc-riskbar .rs-m{ background:linear-gradient(90deg,#fbbf24,var(--amber)); }
.cc-riskbar .rs-l{ background:linear-gradient(90deg,#34d399,var(--emerald)); }

/* ---- key/value rows + opt-in hairline list (Budget, Key info, Core team) ---- */
.cc-row{ display:flex; justify-content:space-between; align-items:center;
  font-size:.8rem; padding:3px 0; }
.cc-row .k{ color:var(--ink-soft); }
.cc-rows .cc-row{ padding:6px 0; border-top:1px solid var(--line); }
.cc-rows .cc-row:first-child{ border-top:0; padding-top:2px; }
.cc-rows .cc-row .v{ font-weight:600; color:var(--ink); }

/* ---- shared focus-visible rings (adopt the card accent) ---- */
.charter-attn:focus-visible,
.charter-phase:focus-visible,
.charter-notice:focus-visible,
.qt-tool:focus-visible{
  outline:2px solid var(--cc); outline-offset:2px; border-radius:10px; }

/* ---- reduced motion: keep all depth, drop movement ---- */
@media (prefers-reduced-motion: reduce){
  .charter-card, .cc-head > .bi:first-child,
  .charter-attn, .charter-phase, .charter-notice{ transition:none; }
  .charter-card:hover .cc-head > .bi:first-child{ transform:none; }
  .charter-attn:hover{ transform:none; }
}

/* ---------- FMEA AIAG-VDA banded worksheet (premium · frozen header + columns) ---------- */
/* Fixed-viewport grid so the header AND the Op/Step columns stay put through the
   long horizontal scroll — the single biggest UX win for hours-long editing. */
.fmea-scroll { max-height: calc(100vh - 250px); overflow: auto;
  border-radius: 0 0 var(--radius) var(--radius); }
.fmea-scroll::-webkit-scrollbar { width: 12px; height: 12px; }
.fmea-scroll::-webkit-scrollbar-thumb { background: rgba(100,116,139,.4); border-radius: 8px;
  border: 3px solid transparent; background-clip: content-box; }
.fmea-scroll::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,.6); background-clip: content-box; }

.fmea-grid { border-collapse: separate; border-spacing: 0; }
.fmea-grid > * > tr > td, .fmea-grid > * > tr > th {
  border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* frozen header (two rows) */
.fmea-grid thead th { position: sticky; z-index: 3; }
.fmea-groups th { top: 0; height: 30px; color: #fff; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; font-size: .62rem; text-align: center; padding: .42rem .5rem; }
.fmea-cols th { top: 30px; font-weight: 700; vertical-align: bottom; line-height: 1.18;
  font-size: .6rem; padding: .42rem .5rem; text-transform: uppercase; letter-spacing: .02em; }

/* band palette — CSS-var driven so Midnight can retint it */
.fmea-grp-structure { background: var(--fm-struct, #475569); }
.fmea-grp-function  { background: var(--fm-func,   #2563eb); }
.fmea-grp-failure   { background: var(--fm-fail,   #be123c); }
.fmea-grp-risk      { background: var(--fm-risk,   #b45309); }
.fmea-grp-opt       { background: var(--fm-opt,    #047857); }
.fmea-cols th.fmea-grp-structure { background: var(--fm-struct-s, #eef2f7); color: #334155; }
.fmea-cols th.fmea-grp-function  { background: var(--fm-func-s,   #eaf1fe); color: #1d4ed8; }
.fmea-cols th.fmea-grp-failure   { background: var(--fm-fail-s,   #fdeaef); color: #be123c; }
.fmea-cols th.fmea-grp-risk      { background: var(--fm-risk-s,   #fdf3e3); color: #92400e; }
.fmea-cols th.fmea-grp-opt       { background: var(--fm-opt-s,    #e7f7ef); color: #047857; }
.fmea-op-h { background: #1e293b; color: #fff; }

/* frozen first columns: Op (52px) + Process Step */
.fmea-sticky-op   { position: sticky; left: 0;    z-index: 2; background: var(--card); }
.fmea-sticky-step { position: sticky; left: 52px; z-index: 2; background: var(--card);
  box-shadow: 6px 0 8px -6px rgba(16,24,40,.28); }
.fmea-grid thead th.fmea-sticky-op, .fmea-grid thead th.fmea-sticky-step { z-index: 6; }

/* active row: light up the whole wide line so you never lose your place */
.fmea-grid tbody tr:hover > td { background: var(--fm-hover, #f4f8ff); }
.fmea-grid tbody tr:hover > .fmea-sticky-op,
.fmea-grid tbody tr:hover > .fmea-sticky-step { background: #ecf2fe; }
.fmea-grid tbody tr:focus-within > td { background: var(--fm-hover, #f4f8ff); }
.fmea-grid tbody tr:focus-within > .fmea-sticky-op,
.fmea-grid tbody tr:focus-within > .fmea-sticky-step { background: #ecf2fe; }
.fmea-grid .cell-input { min-height: 26px; }

/* Midnight retint */
:root[data-theme="midnight"]{
  --fm-struct:#3a4a68; --fm-func:#1e4fb0; --fm-fail:#8f2540; --fm-risk:#7a4a12; --fm-opt:#0f6b4a;
  --fm-struct-s:#1c2740; --fm-func-s:#152238; --fm-fail-s:#331821; --fm-risk-s:#33260c; --fm-opt-s:#0f2a20;
  --fm-hover:#1a2540;
}
[data-theme="midnight"] .fmea-cols th.fmea-grp-structure { color:#cbd6ea; }
[data-theme="midnight"] .fmea-cols th.fmea-grp-function  { color:#8fb4ff; }
[data-theme="midnight"] .fmea-cols th.fmea-grp-failure   { color:#fb7185; }
[data-theme="midnight"] .fmea-cols th.fmea-grp-risk      { color:#fbbf24; }
[data-theme="midnight"] .fmea-cols th.fmea-grp-opt       { color:#34d399; }
[data-theme="midnight"] .fmea-grid tbody tr:hover > .fmea-sticky-op,
[data-theme="midnight"] .fmea-grid tbody tr:hover > .fmea-sticky-step { background:#1e2941; }

/* Auto-growing free-text cells: the row height follows the words entered */
.fmea-grid tbody td { vertical-align: top; }
textarea.cell-grow { resize: none; overflow: hidden; min-height: 26px; height: 26px;
  line-height: 1.34; white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit;
  display: block; }
/* Textarea knowledge-base autocomplete (datalist doesn't bind to <textarea>) */
.cell-ac { position: absolute; z-index: 1090; background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: var(--shadow); max-height: 240px; overflow: auto; padding: 4px;
  font-size: .78rem; min-width: 170px; max-width: 380px; }
.cell-ac-item { padding: 5px 9px; border-radius: 6px; cursor: pointer; color: var(--ink);
  white-space: normal; line-height: 1.3; }
.cell-ac-item:hover, .cell-ac-item.active { background: var(--accent-soft); color: var(--accent-600); }

/* FMEA risk Pareto — three premium 3D charts (RPN · Occurrence · Detection) */
.fmea-pareto-box { position: relative; height: 330px; }
.pareto-panel { border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px 6px;
  background: var(--card); height: 100%; box-shadow: var(--shadow-xs); }
.pareto-title { font-size: .82rem; font-weight: 700; margin-bottom: 4px; display: flex;
  align-items: center; gap: 7px; }
.pareto-title .text-muted-2 { font-weight: 500; font-size: .68rem; }
.pareto-dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.pareto-note { font-size: .68rem; color: var(--ink-soft); line-height: 1.35; padding: 5px 2px 4px; }

/* ---------- Control Plan: merged operation cells (rowspan) ---------- */
.cp-op-cell { vertical-align: top; background: color-mix(in srgb, var(--accent) 4%, var(--card));
  border-right: 1px solid var(--line-strong, #cbd5e1); }

/* ---------- FMEA list (premium rows + risk profile) ---------- */
.fmea-list td { vertical-align: middle; }
.fmea-list-row { cursor: pointer; transition: background .12s ease; }
.fmea-list-row td:first-child { border-left: 3px solid transparent; }
.fmea-list-row.risk-high td:first-child { border-left-color: var(--danger); }
.fmea-list-row.risk-med td:first-child { border-left-color: var(--warn); }
.fmea-list-row:hover { background: var(--accent-soft); }
.risk-bar { display: flex; height: 8px; border-radius: 5px; overflow: hidden; background: var(--line);
  gap: 1px; max-width: 180px; }
.risk-seg { display: block; }
.rs-high { background: var(--danger); }
.rs-med { background: var(--warn); }
.rs-low { background: var(--ok); }
.rs-none { background: var(--line-strong, #cbd5e1); }
.risk-legend { display: flex; gap: 9px; margin-top: 5px; }
.status-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600;
  padding: 3px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.status-chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.status-chip.ok { color: var(--ok); } .status-chip.ok .dot { background: var(--ok); }
.status-chip.warn { color: var(--warn); } .status-chip.warn .dot { background: var(--warn); }
.status-chip.muted { color: var(--ink-soft); } .status-chip.muted .dot { background: var(--ink-soft); }

/* ---------- FMEA detail hero (premium header + KPI chips) ---------- */
.fmea-hero { position: relative; overflow: hidden; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm);
  padding: 16px 22px 18px; }
.fmea-hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(180deg, var(--accent), var(--accent-600)); }
.fmea-hero-draft::before { background: linear-gradient(180deg, #94a3b8, #64748b); }
.fmea-hero-in_review::before { background: linear-gradient(180deg, var(--warn), #c2820a); }
.fmea-hero-released::before { background: linear-gradient(180deg, var(--ok), #0f9d6e); }
.fmea-hero-top { display: flex; align-items: flex-start; gap: 14px; }
.fmea-hero-back { flex: none; }
.fmea-hero-id { min-width: 0; }
.fmea-hero-title { font-size: 1.42rem; font-weight: 800; letter-spacing: -.01em; }
.fmea-hero-sub { color: var(--ink-soft); font-size: .82rem; margin-top: 3px; }
.fmea-hero-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.fmea-stepper { display: inline-flex; align-items: center; font-size: .68rem; font-weight: 600; }
.fs-step { padding: 4px 11px; color: var(--ink-soft); background: var(--bg); border: 1px solid var(--line);
  border-right-width: 0; white-space: nowrap; }
.fs-step:first-child { border-radius: 8px 0 0 8px; }
.fs-step:last-child { border-radius: 0 8px 8px 0; border-right-width: 1px; }
.fs-step.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.fs-step.on { color: #fff; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.fmea-hero-kpis { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 15px; }
.fmea-kpi { display: flex; align-items: center; gap: 11px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 13px; padding: 9px 15px 9px 11px; min-width: 148px; transition: box-shadow .15s ease, transform .15s ease; }
.fmea-kpi:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.fk-ic { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.05rem; flex: none; box-shadow: var(--shadow-xs); background: #64748b; }
.fk-ic.g-indigo { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.fk-ic.g-rose { background: linear-gradient(135deg, #fb7185, #e11d48); }
.fk-ic.g-amber { background: linear-gradient(135deg, #fbbf24, #d97706); }
.fk-ic.g-emerald { background: linear-gradient(135deg, #34d399, #059669); }
.fk-val { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.fk-lbl { font-size: .64rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; margin-top: 3px; font-weight: 600; }

/* ---------- Configurable risk colours (RPN cell) ----------
   The worksheet RPN cell is coloured from the company Risk-display preference
   (threshold + colour per band; --rc carries the chosen hex). The high band can
   blink ("intermittent") — a soft pulsing glow + fade that works in any colour. */
.rpn-badge { display: inline-block; min-width: 2.4em; padding: .32em .7em; border-radius: 999px;
  font-weight: 800; font-size: .74rem; line-height: 1; text-align: center; letter-spacing: .2px;
  color: var(--rc, #334155);
  background: color-mix(in srgb, var(--rc, #64748b) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--rc, #64748b) 34%, transparent); }
.rpn-blink { animation: riskBlink 1.05s ease-in-out infinite; will-change: box-shadow, opacity; }
@keyframes riskBlink {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rc, #e11d48) 55%, transparent); opacity: 1; }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--rc, #e11d48) 0%, transparent); opacity: .4; }
}
@media (prefers-reduced-motion: reduce) { .rpn-blink { animation: none; } }

/* ---------- Risk-display settings preview ---------- */
.risk-swatch { width: 100%; height: 46px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-weight: 800; color: #fff; box-shadow: var(--shadow-xs);
  text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.risk-color-field { display: flex; align-items: center; gap: 10px; }
.risk-color-field input[type="color"] { width: 50px; height: 44px; padding: 2px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); cursor: pointer; }
/* Three-band editor rows (red / yellow / green): colour + threshold in one line */
.band-row { display: flex; align-items: center; gap: 14px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.band-row:last-child { border-bottom: 0; }
.band-row-main { flex: 1 1 auto; min-width: 0; }
.band-row-title { font-weight: 700; font-size: .92rem; display: flex; align-items: center; gap: 8px; }
.band-dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45); }
.band-row-cond { font-size: .82rem; color: var(--ink-soft); margin-top: 4px; display: flex;
  align-items: center; gap: 7px; flex-wrap: wrap; }
.band-input { width: 88px; display: inline-block; font-weight: 800; text-align: center; }
.band-blink { flex: none; padding-left: 2px; }

/* ---------- RPN risk-action worklist ---------- */
.ap-table td { vertical-align: top; }
.ap-overdue { background: color-mix(in srgb, var(--danger) 7%, transparent); }
.ap-due-late { color: var(--danger); font-weight: 700; border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.ap-residual { display: inline-flex; gap: 4px; }
.ap-residual .cell-input { width: 46px; padding-left: 4px; padding-right: 4px; }
.ap-reduction { font-size: .68rem; color: var(--ink-soft); margin-top: 3px; font-weight: 700; }
.ap-reduction.down { color: var(--ok); }

/* ---------- Live consistency-check panel ---------- */
.checks-card.checks-clean { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.check-tag { flex: none; min-width: 84px; text-align: center; font-size: .64rem; letter-spacing: .3px; text-transform: uppercase; }

/* ---------- Process risk tree (collapsible SVG mindmap) ---------- */
.tree-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tree-scroll { overflow: auto; max-height: 560px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); background-image: radial-gradient(var(--line) .8px, transparent .8px);
  background-size: 22px 22px; }
#risk-tree-svg { display: block; }
.tree-link { fill: none; stroke: var(--line-strong, var(--line)); stroke-width: 1.4; }
.tree-rect { fill: var(--card); stroke: var(--line); stroke-width: 1.2; filter: drop-shadow(0 1px 1px rgba(0,0,0,.05)); }
.tree-root .tree-rect { fill: #1f2a44; stroke: #1f2a44; }
.tree-root .tree-label { fill: #fff; font-weight: 800; }
.tree-op .tree-rect { fill: var(--card-raised, var(--card)); stroke: var(--line-strong, var(--line)); }
.tree-op .tree-label { font-weight: 700; }
.tree-label { fill: var(--ink); font-size: 12px; font-family: Inter, system-ui, sans-serif; pointer-events: none; }
.tree-detail .tree-rect { fill: var(--bg); stroke: var(--line); stroke-dasharray: 3 2; }
.tree-detail .tree-label { fill: var(--ink-soft); font-size: 11px; }
.tree-badge-t { fill: #fff; font-size: 10px; font-weight: 800; font-family: Inter, sans-serif; pointer-events: none; }
.tree-count { fill: var(--ink-soft); font-size: 10.5px; font-weight: 700; font-family: Inter, sans-serif; pointer-events: none; }
.tree-tog-c { fill: var(--card); stroke: var(--accent); stroke-width: 1.4; }
.tree-toggle:hover .tree-tog-c { fill: var(--accent); }
.tree-tog-s { fill: var(--accent); font-size: 13px; font-weight: 800; font-family: monospace; pointer-events: none; }
.tree-toggle:hover .tree-tog-s { fill: #fff; }
.tree-toggle { cursor: pointer; }
.tree-node:hover .tree-rect { stroke-width: 2; }

/* ---------- Severity-evaluation (plant / ship-to / end-user) ---------- */
.fe-cell { position: relative; }
.sev-eval-btn { position: absolute; top: 2px; right: 2px; border: 0; background: transparent;
  color: var(--ink-soft); opacity: .35; cursor: pointer; font-size: .78rem; line-height: 1; padding: 2px;
  transition: opacity .12s ease, color .12s ease; }
.fe-cell:hover .sev-eval-btn { opacity: .8; }
.sev-eval-btn:hover { color: var(--accent); opacity: 1; }
.sev-eval-btn.on { opacity: .95; color: var(--accent); }
.sev-area { border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px; margin-bottom: 10px; background: var(--card); }
.sev-area-head { font-size: .9rem; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.sev-area-head .text-muted-2 { font-weight: 400; }
.sev-result { border: 1px dashed color-mix(in srgb, var(--danger) 45%, var(--line)); border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 6%, transparent); font-size: .9rem; }
.sev-ref-table th { position: sticky; top: 0; background: var(--card-raised); font-size: .68rem; }
.sev-ref-table td { border-color: var(--line); }

/* ---------- FMEA worksheet focus/filter + bulk bar ---------- */
.fmea-focus { display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 8px 12px; border-top: 1px solid var(--line); background: var(--bg); }
.fmea-focus .ff-seg { display: flex; align-items: center; gap: 8px; }
.ff-chip { border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  border-radius: 999px; padding: 3px 11px; font-size: .76rem; font-weight: 600; cursor: pointer;
  transition: all .12s ease; }
.ff-chip:hover { border-color: var(--accent); color: var(--accent); }
.ff-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow-xs); }
.ff-count { font-weight: 700; }
.ff-bulk { padding-left: 12px; border-left: 1px solid var(--line); }
.fmea-row.row-dim { opacity: .32; transition: opacity .15s ease; }
.fmea-row.row-dim:hover { opacity: 1; }
.fmea-toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 10px; font-size: .82rem;
  font-weight: 600; box-shadow: var(--shadow-lg); opacity: 0; transition: all .28s ease; z-index: 1080; pointer-events: none; }
.fmea-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- FMEA scoring reference legend ---------- */
.scoring-legend td { padding: 3px 6px; vertical-align: top; border-color: var(--line); }
.scoring-legend tr:hover { background: var(--surface-2, rgba(37,99,235,.04)); }
.ap-matrix th, .ap-matrix td { padding: 4px 8px; border-color: var(--line); }
.ap-matrix th { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); font-weight: 700; }

/* ---------- PFMEA knowledge base (auto-learning) ---------- */
.kb-table thead th { text-transform: uppercase; letter-spacing: .04em; font-size: .6rem; font-weight: 700;
  color: var(--ink-soft); background: #fbfcfe; padding: 8px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.kb-table tbody td { padding: 7px 11px; border-bottom: 1px solid var(--line); font-size: .78rem; vertical-align: middle; }
.kb-table tbody tr:hover td { background: #f7f9fd; }
.kb-table tbody tr:last-child td { border-bottom: 0; }
.kb-learned > td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
.kb-learned > td { background: rgba(16,185,129,.035); }
.kb-learned:hover > td { background: rgba(16,185,129,.07); }
[data-theme="midnight"] .kb-table thead th { background: var(--card-raised); }
[data-theme="midnight"] .kb-table tbody tr:hover td { background: #1e2941; }
[data-theme="midnight"] .kb-learned > td { background: rgba(52,211,153,.06); }

/* ---------- Process Flow: graphical flowchart ---------- */
.pf-operation { --pf-c:#2563eb; } .pf-transport { --pf-c:#0d9488; }
.pf-inspection { --pf-c:#d97706; } .pf-storage { --pf-c:#7c3aed; } .pf-delay { --pf-c:#64748b; }
.pf-legend { display:flex; flex-wrap:wrap; gap:8px 16px; }
.pf-legend .lg { display:inline-flex; align-items:center; gap:7px; font-size:.78rem; color:var(--ink-soft); }
.pf-legend .lg .pf-mini { position:relative; width:18px; height:18px; }
.pf-flow { display:flex; flex-direction:column; align-items:center; }
.pf-node { display:flex; align-items:stretch; gap:14px; width:100%; max-width:640px; }
.pf-sym, .pf-mini { flex:none; display:grid; place-items:center; }
.pf-sym { position:relative; width:52px; height:52px; color:#fff; font-weight:800; font-size:.9rem; }
.pf-sym > span { position:relative; z-index:1; }
.pf-sym::before, .pf-mini::before { content:""; position:absolute; inset:0; background:var(--pf-c);
  box-shadow:0 4px 12px rgba(16,24,40,.16), inset 0 1px 0 rgba(255,255,255,.3); }
.pf-operation.pf-sym::before, .pf-operation.pf-mini::before { border-radius:50%; }
.pf-inspection.pf-sym::before, .pf-inspection.pf-mini::before { border-radius:10px; }
.pf-storage.pf-sym::before, .pf-storage.pf-mini::before { clip-path:polygon(50% 100%, 0 6%, 100% 6%); }
.pf-transport.pf-sym::before, .pf-transport.pf-mini::before { clip-path:polygon(0 30%, 58% 30%, 58% 10%, 100% 50%, 58% 90%, 58% 70%, 0 70%); }
.pf-delay.pf-sym::before, .pf-delay.pf-mini::before { clip-path:polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.pf-card { flex:1 1 auto; min-width:0; background:var(--card); border:1px solid var(--line);
  border-left:3px solid var(--pf-c); border-radius:12px; box-shadow:var(--shadow-xs); padding:11px 14px; }
.pf-card-top { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.pf-name { font-weight:700; font-size:.95rem; }
.pf-tag { font-size:.6rem; font-weight:800; letter-spacing:.05em; text-transform:uppercase;
  padding:2px 7px; border-radius:6px; background:color-mix(in srgb, var(--pf-c) 14%, transparent); color:var(--pf-c); }
.pf-chars { display:flex; flex-wrap:wrap; gap:4px 12px; margin-top:6px; }
.pf-chars > span { font-size:.75rem; color:var(--ink-soft); }
.pf-chars .bi { color:var(--pf-c); margin-right:2px; }
.pf-arrow { color:var(--line); font-size:1.1rem; line-height:1; margin:2px 0; }
.pf-arrow .bi { color:#c7cede; }

/* Branched process flow — parallel component streams that converge into common ops */
.pf-comp-chip { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:99px;
  border:1px solid var(--line); background:var(--card); font-size:.8rem; font-weight:600; box-shadow:var(--shadow-xs); }
.pf-comp-dot { width:11px; height:11px; border-radius:3px; background:var(--pf-c); flex:none; }
.pf-comp-n { font-size:.62rem; font-weight:800; background:var(--pf-c); color:#fff; border-radius:99px; padding:0 6px; }

.pf-branch { display:flex; flex-direction:column; align-items:center; }
/* lanes stay on ONE row (scroll for many components) so "parallel then converge" always holds */
.pf-lanes { display:flex; gap:18px; align-items:stretch; justify-content:center;
  flex-wrap:nowrap; overflow-x:auto; width:100%; padding-bottom:2px; }
.pf-lane { flex:0 1 320px; max-width:360px; min-width:230px; display:flex; flex-direction:column; align-items:stretch;
  border:1px solid var(--line); border-top:3px solid var(--pf-lane); border-radius:14px;
  padding:10px 12px 12px; background:var(--card); box-shadow:var(--shadow-xs); }
.pf-lane-head { display:flex; align-items:center; gap:7px; font-weight:800; font-size:.78rem;
  color:var(--pf-lane); text-transform:uppercase; letter-spacing:.04em; margin-bottom:10px; }
.pf-lane-dot { width:11px; height:11px; border-radius:3px; background:var(--pf-lane); flex:none; }
.pf-lane-pn { margin-left:auto; font-size:.64rem; font-weight:600; color:var(--ink-soft); text-transform:none; letter-spacing:0; }
.pf-lane .pf-node { width:100%; }
/* a colored connector rail fills the shorter lanes down to the funnel (the stream "waits" for the merge) */
.pf-lane-tail { align-self:center; width:3px; flex:1 0 18px; border-radius:2px; background:var(--pf-lane); opacity:.45; margin-top:6px; }
/* down-arrows sit under the node symbol column (52px), not floating at centre */
.pf-lane .pf-arrow { align-self:flex-start; width:52px; text-align:center; }

/* convergence: a colour funnel that collects every stream into the centre */
.pf-funnel { width:min(94%, 760px); height:38px; margin-top:2px;
  clip-path: polygon(0 0, 100% 0, 62% 100%, 38% 100%); }
.pf-merge-label { margin-top:8px; font-size:.72rem; font-weight:700; color:var(--ink-soft);
  background:var(--card); border:1px solid var(--line); border-radius:99px; padding:3px 14px; }
.pf-arrow-lg { font-size:1.5rem; margin:4px 0; }

.pf-common { display:flex; flex-direction:column; align-items:center; width:100%; margin-top:2px; }
.pf-common .pf-node { max-width:560px; }
.pf-common-head { font-size:.66rem; font-weight:800; letter-spacing:.06em; text-transform:uppercase;
  color:var(--ink-soft); margin-bottom:10px; }

/* ---------- Budget: unplanned cost row ---------- */
.cost-unplanned { box-shadow: inset 3px 0 0 var(--warn, #d97706); }
.cost-unplanned td:first-child { position: relative; }

/* ---------- Misc ---------- */
.page-title { font-weight: 800; font-size: 1.35rem; }
.text-muted-2 { color: var(--ink-soft); }
.hover-raise { transition: box-shadow .12s ease, transform .12s ease; }
.hover-raise:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-soft); }
.empty-state i { font-size: 2.4rem; color: #b9c3d4; }
.chart-box { position: relative; height: 260px; }
.list-group-item { border-color: var(--line); }
.card-eyebrow { font-size:.7rem; text-transform:uppercase; letter-spacing:1px; color:var(--ink-soft); font-weight:700; }

/* ============================================================
   Live / dynamic motion — tasteful micro-animations
   ============================================================ */
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes glowpulse {
  0%,100% { box-shadow: 0 6px 16px rgba(16,24,40,.16), inset 0 1px 0 rgba(255,255,255,.3); }
  50% { box-shadow: 0 8px 26px rgba(37,99,235,.45), inset 0 1px 0 rgba(255,255,255,.4); }
}
@keyframes livepulse {
  0% { box-shadow: 0 0 0 0 rgba(16,185,129,.55); }
  70% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
@keyframes alertpulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.18); opacity: .75; }
}
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spin360 { to { transform: rotate(360deg); } }
@keyframes ringdash { to { stroke-dashoffset: 0; } }

/* Late-project alert — blinking "Late" badge + row highlight on the projects list */
@keyframes latepulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.55); opacity: 1; }
  70%      { box-shadow: 0 0 0 7px rgba(220,38,38,0);   opacity: .55; }
}
.badge-blink { animation: latepulse 1.15s ease-out infinite; will-change: box-shadow, opacity; }
tr.row-late > td { background-color: rgba(220,38,38,.05); }
tr.row-late > td:first-child { box-shadow: inset 3px 0 0 var(--danger, #dc2626); }
tr.row-late:hover > td { background-color: rgba(220,38,38,.09); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }

/* Entrance: cards & tiles rise in, gently staggered */
.kpi-tile, .card { animation: fadeup .5s cubic-bezier(.22,.61,.36,1) both; }
.kpi-tile:nth-child(1) { animation-delay: .02s; }
.kpi-tile:nth-child(2) { animation-delay: .08s; }
.kpi-tile:nth-child(3) { animation-delay: .14s; }
.kpi-tile:nth-child(4) { animation-delay: .20s; }

/* Living gradient icon tiles — float + glow on hover, active quick-icon breathes */
.kpi-ic { transition: transform .25s cubic-bezier(.34,1.56,.64,1); }
.kpi-tile:hover .kpi-ic { animation: floaty 1.6s ease-in-out infinite; }
.nav-quick-icon.active { animation: glowpulse 2.8s ease-in-out infinite; }

/* Live status dots */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: #10b981; animation: livepulse 1.8s infinite;
}
.live-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .64rem;
  font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: #6ee7b7; padding: 3px 10px; border-radius: 999px;
  background: rgba(16,185,129,.14); border: 1px solid rgba(16,185,129,.3);
}

/* Alert / attention icons pulse to draw the eye */
.attn-danger i { animation: alertpulse 1.4s ease-in-out infinite; color: var(--danger); }
.attn-warn i { animation: alertpulse 2s ease-in-out infinite; color: var(--warn); }

/* Notification bell wiggles when there are unread items */
@keyframes bell { 0%,50%,100% { transform: rotate(0); } 10%,30% { transform: rotate(12deg); } 20%,40% { transform: rotate(-12deg); } }
.notif-bell.has-unread i { animation: bell 2.4s ease-in-out infinite; transform-origin: top center; }
.notif-badge { animation: alertpulse 1.6s ease-in-out infinite; }

/* Count-up numbers hold layout while animating */
.kpi-value[data-count], .hs-val[data-count] { font-variant-numeric: tabular-nums; }

/* Progress bars fill in on load */
.progress-bar { transition: width 1s cubic-bezier(.22,.61,.36,1); }

/* Shimmer skeleton (for any live-loading region) */
.shimmer {
  background: linear-gradient(90deg, #eef1f6 25%, #f7f9fc 37%, #eef1f6 63%);
  background-size: 800px 100%; animation: shimmer 1.4s infinite linear;
}

/* Button ripple-ish press + spring hover on primary actions */
.btn-primary, .btn-hero { transition: transform .14s cubic-bezier(.34,1.56,.64,1), box-shadow .18s ease, background .18s ease; }
.btn-primary:active, .btn-hero:active { transform: translateY(1px) scale(.98); }

/* Row hover lift on clickable table rows */
.table-hover tbody tr { transition: transform .12s ease, box-shadow .12s ease; }

/* Animated SVG capability ring */
.ring-track { stroke: #eef1f6; }
.ring-value { stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.22,.61,.36,1); }

/* ============================================================
   Gantt (phase timeline) — frozen label column + scrolling track
   ============================================================ */
.gantt-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.gantt-inner { min-width: var(--track-min, 900px); }
.gantt-head, .gantt-row { display: flex; align-items: stretch; }
.gantt-label-col {
  flex: 0 0 200px; width: 200px; border-right: 2px solid var(--line);
  background: #fff; position: sticky; left: 0; z-index: 3;
  padding: 8px 12px; display: flex; align-items: center;
}
.gantt-head .gantt-label-col { background: #fafbff; z-index: 4; align-items: flex-end; padding-bottom: 4px; }
.gantt-track-col { flex: 1 1 auto; position: relative; min-width: 700px; }
.gantt-head-track { border-bottom: 1px solid var(--line); }
.gantt-months-row { display: flex; }
.gantt-month-cell {
  font-size: .68rem; font-weight: 700; color: var(--ink-soft);
  text-align: center; border-left: 1px solid var(--line);
  padding: 5px 0; white-space: nowrap; overflow: hidden;
}
.gantt-row { border-bottom: 1px solid var(--line); min-height: 44px; }
.gantt-row:hover { background: #f6f9ff; }
.gantt-row:hover .gantt-label-col { background: #f6f9ff; }
.gantt-track-col.gantt-body { padding: 7px 0; }
.gantt-bar {
  position: absolute; height: 22px; border-radius: 6px; top: 50%;
  transform: translateY(-50%); color: #fff; font-size: .68rem; font-weight: 600;
  display: flex; align-items: center; padding: 0 7px; overflow: hidden;
  white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 3px rgba(16,24,40,.18);
  transition: filter .15s ease, transform .15s ease;
}
.gantt-bar:hover { filter: brightness(1.06); transform: translateY(-50%) scale(1.015); z-index: 2; }
.gantt-bar-current { outline: 2px solid rgba(37,99,235,.55); outline-offset: 1px; }
.gantt-bar-fill { position:absolute; left:0; top:0; bottom:0; background: rgba(255,255,255,.22); border-radius: 6px 0 0 6px; }
.gantt-today {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, #e11d48, rgba(225,29,72,.35)); z-index: 1;
}
.gantt-today::before {
  content: "Today"; position: absolute; top: -1px; left: 3px; font-size: .58rem;
  font-weight: 800; color: #e11d48; background: #fff; padding: 0 3px; border-radius: 3px;
}
.gantt-actual { position: absolute; top: 50%; transform: translate(-50%,-50%); color: #7c3aed; font-size: .7rem; z-index: 2; }
.gantt-legend-box { display:inline-block; width:12px; height:12px; border-radius:3px; margin-right:4px; vertical-align:-1px; }
.gantt-empty { padding: 40px; text-align: center; color: var(--ink-soft); }

/* ============================================================
   Smart dashboard — insights strip, radial gauges, premium charts
   ============================================================ */
.insight-strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.insight-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  min-width: 230px; position: relative; overflow: hidden;
  animation: fadeup .5s cubic-bezier(.22,.61,.36,1) both;
}
.insight-chip::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; }
.insight-chip.tone-ok::before { background: linear-gradient(180deg,#34d399,#059669); }
.insight-chip.tone-warn::before { background: linear-gradient(180deg,#fbbf24,#d97706); }
.insight-chip.tone-danger::before { background: linear-gradient(180deg,#fb7185,#e11d48); }
.insight-chip .ic {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  color: #fff; font-size: 1.05rem; flex: 0 0 36px;
}
.insight-chip.tone-ok .ic { background: linear-gradient(135deg,#34d399,#059669); }
.insight-chip.tone-warn .ic { background: linear-gradient(135deg,#fbbf24,#d97706); }
.insight-chip.tone-danger .ic { background: linear-gradient(135deg,#fb7185,#e11d48); }
.insight-chip .txt { font-size: .82rem; font-weight: 600; line-height: 1.2; }
.insight-chip .delta { font-size: .72rem; font-weight: 800; }
.insight-chip .delta.up { color: var(--ok); }
.insight-chip .delta.down { color: var(--danger); }

/* Radial gauges */
.gauge-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm); height: 100%;
  display: flex; flex-direction: column; align-items: center;
  transition: box-shadow .18s ease, transform .18s ease;
  animation: fadeup .5s cubic-bezier(.22,.61,.36,1) both;
}
.gauge-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.gauge-wrap { position: relative; width: 132px; height: 132px; }
.gauge-wrap canvas { position: relative; z-index: 1; }
.gauge-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.gauge-center .g-val { font-size: 1.6rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.gauge-center .g-unit { font-size: .8rem; font-weight: 700; }
.gauge-label { margin-top: 8px; font-size: .74rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-soft); text-align: center; }
.gauge-sub { font-size: .72rem; color: var(--ink-soft); }

/* Premium chart cards */
.chart-card { border-radius: var(--radius); overflow: hidden; }
.chart-card .card-header {
  background: linear-gradient(180deg, #fbfcff, #f4f7fd);
}
.chart-card .metric-big { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.donut-center .d-val { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.donut-center .d-cap { font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); font-weight: 700; }

/* ============================================================
   ProQ Intelligence (AI copilot) + premium dashboard widgets
   ============================================================ */
.command-hero {
  position: relative; overflow: hidden; border-radius: 22px; color: #eef3ff; padding: 24px 26px;
  background:
    url("../img/hero-automotive.3133761112b9.svg") right -6px bottom -14px / auto 150% no-repeat,
    radial-gradient(120% 110% at 100% 0%, rgba(139,92,246,.26) 0%, transparent 52%),
    radial-gradient(110% 120% at 0% 100%, rgba(56,189,248,.22) 0%, transparent 55%),
    linear-gradient(120deg, #0a1020 0%, #122a52 46%, #1a3a78 76%, #24489e 100%);
  border: 1px solid rgba(139,92,246,.24);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.08);
}
.ch-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px;
  flex-wrap:wrap; position:relative; z-index:1; }
.ch-divider { height:1px; margin:18px 0; position:relative; z-index:1;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.14) 30%, rgba(255,255,255,.14) 70%, rgba(255,255,255,0)); }

.ai-panel {
  position: relative; overflow: hidden; border-radius: 22px; color: #eef3ff; padding: 22px 24px;
  background:
    radial-gradient(130% 120% at 100% 0%, rgba(139,92,246,.32) 0%, transparent 55%),
    radial-gradient(120% 130% at 0% 100%, rgba(56,189,248,.26) 0%, transparent 55%),
    linear-gradient(125deg, #0b1130 0%, #14204d 48%, #1a2a63 100%);
  border: 1px solid rgba(139,92,246,.28);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.08);
}
.ai-panel-glow { position:absolute; inset:-40% -10% auto auto; width:60%; height:180%;
  background: radial-gradient(closest-side, rgba(129,140,248,.35), transparent);
  filter: blur(30px); pointer-events:none; animation: aiglow 8s ease-in-out infinite; }
@keyframes aiglow { 0%,100%{opacity:.5; transform:translateX(0);} 50%{opacity:.9; transform:translateX(-8%);} }
.ai-head { display:flex; align-items:center; gap:12px; position:relative; z-index:1; margin-bottom:16px; }
.ai-orb { width:44px; height:44px; border-radius:14px; display:grid; place-items:center; font-size:1.3rem; color:#fff;
  background: linear-gradient(135deg,#8b5cf6,#6366f1 45%,#38bdf8);
  box-shadow: 0 8px 22px rgba(139,92,246,.55), inset 0 1px 0 rgba(255,255,255,.4); animation: aiorb 3.4s ease-in-out infinite; }
@keyframes aiorb { 0%,100%{box-shadow:0 8px 22px rgba(139,92,246,.55), inset 0 1px 0 rgba(255,255,255,.4);}
  50%{box-shadow:0 10px 30px rgba(56,189,248,.6), inset 0 1px 0 rgba(255,255,255,.5);} }
.ai-title { font-weight:800; font-size:1.05rem; letter-spacing:-.01em; display:flex; align-items:center; gap:8px; }
.ai-badge { font-size:.56rem; font-weight:800; letter-spacing:.14em; padding:2px 7px; border-radius:6px;
  background: linear-gradient(135deg,#8b5cf6,#38bdf8); color:#fff; }
.ai-caption { font-size:.72rem; color:#9fb0da; }
.ai-live { display:inline-flex; align-items:center; gap:6px; font-size:.62rem; font-weight:800; letter-spacing:.12em; text-transform:uppercase; color:#6ee7b7; }
.ai-grid { display:grid; grid-template-columns: 1fr 1.25fr; gap:18px; position:relative; z-index:1; }
@media (max-width: 991.98px){ .ai-grid{ grid-template-columns:1fr; } }
.ai-summary { border-left:3px solid; padding-left:14px; }
.ai-summary.tone-ok{ border-color:#34d399; } .ai-summary.tone-warn{ border-color:#fbbf24; }
.ai-summary.tone-danger{ border-color:#fb7185; } .ai-summary.tone-muted{ border-color:#64748b; }
.ai-summary-head { font-size:1.15rem; font-weight:800; line-height:1.25; margin-bottom:6px; }
.ai-summary-body { font-size:.9rem; color:#cdd8f2; margin:0; }
.ai-forecast { margin-top:16px; }
.ai-forecast-label, .ai-recs-label { font-size:.64rem; font-weight:800; letter-spacing:.1em; text-transform:uppercase; color:#9fb0da; margin-bottom:8px; }
.ai-forecast-chip { display:inline-flex; align-items:center; gap:7px; margin:0 6px 6px 0; padding:5px 10px; border-radius:10px;
  background: rgba(255,255,255,.06); border:1px solid rgba(255,255,255,.12); color:#eef3ff; text-decoration:none; font-size:.76rem; transition:.15s; }
.ai-forecast-chip:hover{ background:rgba(255,255,255,.12); color:#fff; transform:translateY(-1px); }
.ai-forecast-chip.crit{ border-color: rgba(251,113,133,.5); }
.ai-forecast-chip .fc-code{ font-weight:700; }
.ai-forecast-chip .fc-risk{ font-size:.6rem; font-weight:800; text-transform:uppercase; letter-spacing:.06em; color:#fda4af; }
.ai-forecast-chip .fc-days{ color:#9fb0da; }
.ai-rec { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:13px; text-decoration:none; color:#eef3ff;
  background: rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.09); margin-bottom:8px;
  transition: transform .16s cubic-bezier(.34,1.56,.64,1), background .16s ease, border-color .16s ease; animation: fadeup .5s both; }
.ai-rec:hover { background: rgba(255,255,255,.1); border-color: rgba(139,92,246,.4); transform: translateX(3px); color:#fff; }
.ai-rec-ic { width:36px; height:36px; flex:0 0 36px; border-radius:10px; display:grid; place-items:center; font-size:1.05rem; color:#fff;
  background: linear-gradient(135deg, rgba(139,92,246,.55), rgba(56,189,248,.5)); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.ai-rec.impact-high .ai-rec-ic { background: linear-gradient(135deg,#fb7185,#e11d48); }
.ai-rec.impact-medium .ai-rec-ic { background: linear-gradient(135deg,#fbbf24,#d97706); }
.ai-rec.impact-low .ai-rec-ic { background: linear-gradient(135deg,#34d399,#059669); }
.ai-rec-body { flex:1 1 auto; min-width:0; line-height:1.25; }
.ai-rec-title { display:block; font-weight:650; font-size:.86rem; }
.ai-rec-detail { display:block; font-size:.74rem; color:#a9b7dc; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ai-rec-impact { flex:0 0 auto; font-size:.56rem; font-weight:800; text-transform:uppercase; letter-spacing:.06em; padding:2px 7px; border-radius:6px; }
.imp-high{ background:rgba(251,113,133,.2); color:#fda4af; } .imp-medium{ background:rgba(251,191,36,.2); color:#fcd34d; } .imp-low{ background:rgba(52,211,153,.2); color:#6ee7b7; }
.ai-rec-go { color:#7f8fc0; flex:0 0 auto; }
.ai-rec:hover .ai-rec-go { color:#c4b5fd; }

/* Premium KPI stat cards */
.stat-card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:16px 18px 12px;
  box-shadow:var(--shadow-sm); height:100%; position:relative; overflow:hidden; transition:box-shadow .18s, transform .18s; animation: fadeup .5s both; }
.stat-card:hover{ box-shadow:var(--shadow); transform:translateY(-2px); }
.stat-card::after{ content:""; position:absolute; left:0; top:0; bottom:0; width:4px; opacity:0; }
.stat-card.is-ok::after{ background:var(--ok); opacity:1; } .stat-card.is-warn::after{ background:var(--warn); opacity:1; }
.stat-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.stat-ic{ width:40px; height:40px; border-radius:12px; display:grid; place-items:center; color:#fff; font-size:1.1rem;
  box-shadow:0 6px 16px rgba(16,24,40,.16), inset 0 1px 0 rgba(255,255,255,.3); }
.stat-ic.g-blue{ background:linear-gradient(135deg,#38bdf8,#2563eb); }
.stat-ic.g-indigo{ background:linear-gradient(135deg,#818cf8,#4f46e5); }
.stat-ic.g-teal{ background:linear-gradient(135deg,#2dd4bf,#0d9488); }
.stat-ic.g-emerald{ background:linear-gradient(135deg,#34d399,#059669); }
.stat-ic.g-amber{ background:linear-gradient(135deg,#fbbf24,#d97706); }
.stat-ic.g-rose{ background:linear-gradient(135deg,#fb7185,#e11d48); }
.stat-target{ font-size:.64rem; font-weight:700; color:var(--ink-soft); background:#f1f5f9; padding:2px 8px; border-radius:999px; }
.stat-val{ font-size:2rem; font-weight:800; line-height:1; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.stat-label{ font-size:.76rem; color:var(--ink-soft); font-weight:600; margin-top:2px; }
.stat-foot{ margin-top:10px; height:26px; display:flex; align-items:flex-end; }
.spark{ width:100%; height:26px; }
.spark polyline{ fill:none; stroke:var(--accent); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.spark.up polyline{ stroke:var(--ok); } .spark.down polyline{ stroke:var(--danger); }

/* Program risk heatmap */
.heatmap{ display:flex; flex-direction:column; gap:5px; min-width:520px; }
.heatmap-row{ display:grid; grid-template-columns: minmax(120px, 1.4fr) repeat(6, 1fr); gap:5px; align-items:center; }
.heatmap-head .heatmap-h{ font-size:.64rem; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-soft); text-align:center; }
.heatmap-name{ font-size:.8rem; text-decoration:none; color:var(--ink); display:flex; gap:6px; align-items:center; overflow:hidden; white-space:nowrap; }
.heatmap-name:hover{ color:var(--accent); }
.heatmap-cell{ display:block; height:30px; border-radius:7px; cursor:pointer;
  transition:transform .12s ease, box-shadow .12s ease, filter .12s ease; }
.heatmap-cell:hover{ transform:scale(1.08); filter:brightness(1.05);
  box-shadow:0 4px 12px rgba(16,24,40,.22), inset 0 0 0 2px rgba(255,255,255,.6); }
.rag-green{ background:linear-gradient(135deg,#34d399,#059669); }
.rag-amber{ background:linear-gradient(135deg,#fbbf24,#d97706); }
.rag-red{ background:linear-gradient(135deg,#fb7185,#e11d48); }
.rag-grey{ background:#e6eaf1; }
.rag-na{ background:repeating-linear-gradient(45deg,#f1f5f9,#f1f5f9 5px,#e6eaf1 5px,#e6eaf1 10px); }
.heatmap-legend{ display:flex; gap:12px; flex-wrap:wrap; }
.heatmap-legend span{ display:inline-flex; align-items:center; gap:5px; }
.hm-key{ width:12px; height:12px; border-radius:4px; display:inline-block; }

/* RASIC code chips */
.rasic { font-weight: 800; font-size: .72rem; }
.rasic-R { color: #2563eb; } .rasic-A { color: #dc2626; }
.rasic-S { color: #0d9488; } .rasic-I { color: #64748b; } .rasic-C { color: #7c3aed; }

@media (max-width: 991.98px) {
  .content { padding: 14px; }
  .hero-title { font-size: 1.5rem; }
  .subbar-inner { padding: 8px 14px; }
  .proq-nav .container-fluid { padding-left: 14px; padding-right: 14px; }
  .proq-nav .navbar-collapse {
    background: rgba(10, 16, 32, .38); border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 14px; margin-top: 10px; padding: 8px;
  }
  .proq-nav .navbar-nav > .nav-item > .nav-link { color: #fff !important; }
  .proq-nav .dropdown-menu.qt-menu { width: 100%; }
  .brand-tag { display: none; }
}

@media print {
  .proq-nav, .subbar, .no-print { display: none !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
}

/* ============================================================
   APQP PROJECTS LIST — "Isometric Quality World"  (.pl-* scope)
   Camera (perspective) on .pl-stage; preserve-3d on .pl-world &
   each solid — so .ch-hero's overflow:hidden CLIPS without
   FLATTENING (never put overflow/filter on .pl-world/.pl-slab).
   ============================================================ */
.pl-hero { position: relative; padding-bottom: 18px; }
.pl-hero .ch-hero-top { min-height: 172px; }            /* room beside the ziggurat */

/* --- decorative 3D stage (right side of the hero) --- */
.pl-stage {
  position: absolute; inset: 0 0 0 auto;
  width: min(46%, 500px); z-index: 0;                   /* text/stats are z-index:1 */
  pointer-events: none;                                  /* never steals button clicks */
  perspective: 1400px; perspective-origin: 58% 36%;
  overflow: hidden;                                      /* soft-clip orbs to the panel */
  border-radius: 20px;
}
/* atmosphere orbs (static blurred glow — NO animation) */
.pl-orb { position: absolute; border-radius: 50%; filter: blur(42px); pointer-events: none; }
.pl-orb.a { width: 240px; height: 240px; top: -60px; right: -30px; opacity: .5;
  background: radial-gradient(circle at 42% 40%, rgba(56,189,248,.65), transparent 70%); }
.pl-orb.b { width: 210px; height: 210px; bottom: -66px; right: 34%; opacity: .45;
  background: radial-gradient(circle at 50% 50%, rgba(139,92,246,.55), transparent 70%); }

/* --- the ziggurat world (sways as one rigid body) --- */
.pl-world {
  position: absolute; left: 50%; top: 52%; width: 0; height: 0;   /* pure anchor */
  transform-style: preserve-3d;
  transform: rotateX(58deg) rotateZ(-45deg);            /* resting isometric pose */
  will-change: transform;
  animation: plWorldSway 17s ease-in-out infinite;
}
@keyframes plWorldSway {                                /* enterprise yaw, not a spin */
  0%,100% { transform: rotateX(58deg) rotateZ(-45deg); }
  50%     { transform: rotateX(56deg) rotateZ(-51deg); }
}

/* parametric phase slab: lit top cap + 4 walls (centered-cube convention) */
.pl-slab { position: absolute; left: 0; top: 0; width: var(--sz); height: var(--sz);
  transform-style: preserve-3d; transform: translate(-50%,-50%) translateZ(var(--lift)); }
.pl-slab .fc { position: absolute; left: 50%; top: 50%; }
.pl-slab .top { width: var(--sz); height: var(--sz);
  transform: translate(-50%,-50%) translateZ(calc(var(--th)/2));
  background: var(--f-top); box-shadow: inset 0 0 0 1px rgba(224,242,254,.30); }
.pl-slab .nS, .pl-slab .nN { width: var(--sz); height: var(--th); }
.pl-slab .nE, .pl-slab .nW { width: var(--th); height: var(--sz); }
.pl-slab .nS { transform: translate(-50%,-50%) rotateX(-90deg) translateZ(calc(var(--sz)/2)); background: var(--f-south); }
.pl-slab .nN { transform: translate(-50%,-50%) rotateX(90deg)  translateZ(calc(var(--sz)/2)); background: var(--f-south); }
.pl-slab .nE { transform: translate(-50%,-50%) rotateY(90deg)  translateZ(calc(var(--sz)/2)); background: var(--f-east); }
.pl-slab .nW { transform: translate(-50%,-50%) rotateY(-90deg) translateZ(calc(var(--sz)/2)); background: var(--f-east); }
/* engraved Pn glyph on the cap (counter-rotated so it reads upright in iso) */
.pl-slab .top b { position: absolute; right: 8px; bottom: 6px; transform: rotate(45deg);
  font: 800 .6rem/1 Inter, sans-serif; letter-spacing: .05em;
  color: rgba(255,255,255,.88); text-shadow: 0 1px 1px rgba(2,6,23,.4); }
/* GOTCHA: if any wall renders inside-out, flip that wall's translateZ sign — visual tune only. */

/* gate rings (flat circles in XY → read as isometric ellipses) */
.pl-gate { position: absolute; left: 50%; top: 50%; border-radius: 50%;
  border: 2px solid rgba(56,189,248,.5);                /* --sky blueprint cyan */
  transform: translate(-50%,-50%) translateZ(var(--gz)); }
.pl-gate--base { width: 210px; height: 210px; --gz: 3px; }
.pl-gate--apex { width: 84px; height: 84px; --gz: 121px;
  border-color: rgba(52,211,153,.75);                   /* --ok launch gate = the goal */
  box-shadow: 0 0 12px rgba(52,211,153,.45), inset 0 0 8px rgba(52,211,153,.30);
  animation: plGateGlow 4.5s ease-in-out infinite; }
@keyframes plGateGlow {
  0%,100% { box-shadow: 0 0 12px rgba(52,211,153,.45), inset 0 0 8px rgba(52,211,153,.30); }
  50%     { box-shadow: 0 0 22px rgba(52,211,153,.75), inset 0 0 12px rgba(52,211,153,.50); }
}

/* blueprint floor grid + soft contact shadow */
.pl-floor { position: absolute; left: 50%; top: 50%; width: 320px; height: 320px;
  transform: translate(-50%,-50%) translateZ(0);
  background:
    repeating-linear-gradient(0deg,  rgba(148,197,253,.13) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(90deg, rgba(148,197,253,.13) 0 1px, transparent 1px 26px);
  -webkit-mask-image: radial-gradient(50% 50% at 50% 50%, #000 42%, transparent 78%);
          mask-image: radial-gradient(50% 50% at 50% 50%, #000 42%, transparent 78%); }
.pl-shadow { position: absolute; left: 50%; top: 50%; width: 250px; height: 250px;
  transform: translate(-50%,-50%) translateZ(-1px);
  background: radial-gradient(50% 50% at 50% 50%, rgba(2,6,23,.55), rgba(2,6,23,0) 70%); }

/* --- KPI dark-glass stats (inside hero, below divider) --- */
.pl-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px;
  position: relative; z-index: 1; }
.pl-stat { position: relative; display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; border-radius: 14px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,16,32,.44);                        /* dark glass → text stays AA over shapes */
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06); overflow: hidden; }
.pl-stat .kpi-ic { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px;
  display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 1rem; }
.pl-stat-lbl { font-size: .58rem; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: #a9b8dc; }
.pl-stat-val { font-size: 1.5rem; font-weight: 800; line-height: 1.1; color: #fff; letter-spacing: -.01em; }
.pl-stat-val.cm-ok   { color: #6ee7b7; }
.pl-stat-val.cm-warn { color: #fcd34d; }

/* static iso-cube accent, one per stat (3 visible faces) */
.pl-cube { position: absolute; top: 12px; right: 13px; width: 28px; height: 28px;
  opacity: .9; pointer-events: none; transform-style: preserve-3d;
  transform: rotateX(58deg) rotateZ(-45deg); }
.pl-cube .cf { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; }
.pl-cube .t { transform: translate(-50%,-50%) translateZ(10px); background: var(--cb-top);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.pl-cube .s { transform: translate(-50%,-50%) rotateX(-90deg) translateZ(10px); background: var(--cb-s); }
.pl-cube .e { transform: translate(-50%,-50%) rotateY(90deg)  translateZ(10px); background: var(--cb-e); }

/* --- refined premium sheet --- */
.pl-sheet { --pl-code-c: var(--accent-600); }
.pl-sheet thead th {
  background: linear-gradient(180deg,#132c56,#0f2145); color: #c7d4f2;
  border-bottom: 1px solid rgba(139,92,246,.28);
  font-size: .62rem; letter-spacing: .08em; text-transform: uppercase;
  font-weight: 700; padding: 11px 12px; }
.pl-sheet thead th:first-child { border-top-left-radius: var(--radius); }
.pl-sheet thead th:last-child  { border-top-right-radius: var(--radius); }
.pl-sheet tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.pl-sheet tbody tr { transition: background .12s ease; }
.pl-row { cursor: pointer; }
.pl-code { font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-weight: 700;
  font-size: .78rem; color: var(--pl-code-c);
  background: var(--accent-soft); padding: 2px 7px; border-radius: 6px; }
/* 5-pip isometric phase stepper (static, cheap, safe at hundreds of rows) */
.pl-pips { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 6px; }
.pl-pip  { width: 7px; height: 11px; border-radius: 2px; background: var(--line); transform: skewX(-12deg); }
.pl-pip.on { background: linear-gradient(135deg,#38bdf8,#2563eb); box-shadow: 0 0 6px rgba(37,99,235,.45); }
.pl-prog { height: 7px; background: #eef1f6; border-radius: 999px; }
.pl-prog .progress-bar { background: linear-gradient(90deg,#38bdf8,#4f46e5); border-radius: 999px; }
.pl-pm { display: inline-flex; align-items: center; gap: 7px; }
.pl-av { flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .66rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg,#818cf8,#4f46e5);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }

/* clickable-row keyboard reach: real stretched-link, delete cell lifted above it */
.pl-link::after { content: ""; position: absolute; inset: 0; }   /* stretched hit-area */
.pl-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.pl-actions { position: relative; z-index: 2; }                  /* delete stays clickable/focusable */
tr.pl-row:focus-within > td { background-color: var(--accent-soft); }
.btn-ghost:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

/* --- responsive + reduced motion --- */
@media (max-width: 991.98px){ .pl-stats { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 767.98px){
  .pl-stage { display: none; }               /* decorative; frees hero to stack on phones */
  .pl-hero .ch-hero-top { min-height: auto; }
}
/* The global reset @ app.css:1416 (*{animation:none!important}) freezes plWorldSway
   & plGateGlow at their base (resting, fully-lit isometric) poses — still dimensional. */

/* ============================================================
   THEME SYSTEM — per-user 'Classic' (light, default) / 'Midnight'
   The switcher control (account dropdown). The Midnight palette
   override block is appended below this at file end.
   ============================================================ */
.theme-switch { display: flex; gap: 6px; }
.theme-switch .theme-form { flex: 1; }
.theme-opt { width: 100%; display: inline-flex; align-items: center; justify-content: center;
  gap: 5px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card); color: var(--ink-soft); font-size: .74rem; font-weight: 700;
  cursor: pointer; transition: border-color .12s ease, color .12s ease, background .12s ease; }
.theme-opt:hover { border-color: var(--accent); color: var(--accent-600); }
.theme-opt.is-on { border-color: var(--accent); color: var(--accent-600); background: var(--accent-soft); }
.theme-opt.is-on { box-shadow: 0 0 0 2px var(--accent-soft); }


/* ============================================================
   THEME: ProQ Midnight  (data-theme="midnight")
   Researched premium cool-navy soft-dark. Classic (light) stays the
   default (no override). Token block (AA-verified) + targeted sweeps of
   hard-coded light surfaces. Navbar + .ch-hero keep their brand navy.
   ============================================================ */
:root[data-theme="midnight"]{
  --bg:#0b1220; --card:#141d31; --card-raised:#1e2941;
  --ink:#e6ecf6; --ink-soft:#93a2ba; --ink-faint:#6b7a94;
  --line:#2b3852; --line-strong:#3a4a68;
  --accent:#4c8dff; --accent-600:#7dabff; --accent-soft:#172740;
  --focus-ring:rgba(76,141,255,.40);
  --sky:#38bdf8; --indigo:#818cf8; --violet:#a78bfa; --amber:#fbbf24;
  --emerald:#34d399; --teal:#2dd4bf; --rose:#fb7185;
  --ok:#34d399; --ok-soft:#0f2a20;
  --warn:#fbbf24; --warn-soft:#332707;
  --danger:#fb7185; --danger-soft:#3a1621;
  --shadow-xs:0 1px 2px rgba(0,0,0,.45);
  --shadow-sm:0 4px 18px rgba(0,0,0,.50), inset 0 1px 0 rgba(255,255,255,.04);
  --shadow:0 12px 30px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.05);
  --shadow-lg:0 22px 50px rgba(0,0,0,.62), inset 0 1px 0 rgba(255,255,255,.06);
  color-scheme: dark;
}

/* ---- Bootstrap base surfaces & controls ---- */
[data-theme="midnight"] body,
[data-theme="midnight"] .proq-body{ background:var(--bg); color:var(--ink); }
[data-theme="midnight"] .card,
[data-theme="midnight"] .modal-content,
[data-theme="midnight"] .list-group-item,
[data-theme="midnight"] .offcanvas{ background:var(--card); color:var(--ink); border-color:var(--line); }
[data-theme="midnight"] .dropdown-menu{ background:var(--card-raised); color:var(--ink); border-color:var(--line); }
[data-theme="midnight"] .dropdown-item{ color:var(--ink); }
[data-theme="midnight"] .dropdown-item:hover,[data-theme="midnight"] .dropdown-item:focus{ background:var(--card); color:var(--ink); }
[data-theme="midnight"] .dropdown-header{ color:var(--ink-soft); }
[data-theme="midnight"] .dropdown-divider,[data-theme="midnight"] hr{ border-color:var(--line); }
[data-theme="midnight"] .card-header,[data-theme="midnight"] .card-footer{ border-color:var(--line); color:var(--ink); }
[data-theme="midnight"] .form-control,[data-theme="midnight"] .form-select{ background:var(--card); color:var(--ink); border-color:var(--line-strong); }
[data-theme="midnight"] .form-control::placeholder{ color:var(--ink-faint); }
[data-theme="midnight"] .form-control:focus,[data-theme="midnight"] .form-select:focus{ background:var(--card); color:var(--ink); border-color:var(--accent); box-shadow:0 0 0 3px var(--focus-ring); }
[data-theme="midnight"] .form-select{ background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2393a2ba' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E"); }
[data-theme="midnight"] .text-muted,[data-theme="midnight"] .text-muted-2{ color:var(--ink-soft) !important; }
[data-theme="midnight"] .table{ color:var(--ink); --bs-table-color:var(--ink); }
[data-theme="midnight"] .table > :not(caption) > * > *{ background-color:transparent; color:inherit; }
[data-theme="midnight"] .table-hover > tbody > tr:hover > *{ --bs-table-hover-bg:#1e2941; --bs-table-hover-color:var(--ink); }
[data-theme="midnight"] .btn-outline-secondary{ color:var(--ink-soft); border-color:var(--line-strong); }
[data-theme="midnight"] .btn-outline-secondary:hover{ background:var(--card-raised); color:var(--ink); }
[data-theme="midnight"] .btn-close{ filter:invert(1) grayscale(1) brightness(1.4); }
[data-theme="midnight"] .btn-link{ color:var(--accent); }
[data-theme="midnight"] a{ color:var(--accent); }
[data-theme="midnight"] .page-title,[data-theme="midnight"] h1,[data-theme="midnight"] h2,[data-theme="midnight"] h3,[data-theme="midnight"] h4,[data-theme="midnight"] h5,[data-theme="midnight"] strong{ color:var(--ink); }

/* ---- editable grids / cell-input ---- */
[data-theme="midnight"] .grid-table .cell-input:hover,
[data-theme="midnight"] .grid-table .cell-input:focus{ background:var(--card-raised); border-color:var(--accent); }
[data-theme="midnight"] .action-table .cell-input,
[data-theme="midnight"] .risk-table .cell-input,
[data-theme="midnight"] .readiness-table .cell-input,
[data-theme="midnight"] .escalation-table .cell-input{ background:var(--card); color:var(--ink); border-color:var(--line-strong); }
[data-theme="midnight"] .sticky-col{ background:var(--card); }

/* ---- sheet/table chrome ---- */
[data-theme="midnight"] .ctm-table thead th,
[data-theme="midnight"] .del-table thead th,
[data-theme="midnight"] .gr-table thead th,
[data-theme="midnight"] .gr-matrix thead th{ background:var(--card-raised); color:var(--ink-soft); border-color:var(--line); }
[data-theme="midnight"] .ctm-table tbody tr:not(.ctm-group):hover td,
[data-theme="midnight"] .del-table tbody tr:hover td,
[data-theme="midnight"] .gr-table tbody tr:hover td,
[data-theme="midnight"] .gr-matrix tbody tr:hover td{ background:#1e2941; }
[data-theme="midnight"] .ctm-group td{ background:#101a2e; }
[data-theme="midnight"] .del-row.is-na > td{ background:#101828; color:var(--ink-faint); }
[data-theme="midnight"] .del-table thead th, [data-theme="midnight"] .gr-table thead th{ }
[data-theme="midnight"] .del-legend,[data-theme="midnight"] .gr-legend{ background:var(--card); }
[data-theme="midnight"] .rag-grey{ background:#1a2540; color:var(--ink-faint); }
[data-theme="midnight"] .rag-na{ background:repeating-linear-gradient(45deg,#141d31,#141d31 4px,#0f1626 4px,#0f1626 8px); color:var(--ink-faint); }
[data-theme="midnight"] .gr-focus-code{ background:var(--card); color:var(--ink-soft); border-color:var(--line); }
[data-theme="midnight"] .gr-missing{ box-shadow:0 0 0 2px var(--card); }
[data-theme="midnight"] .gr-stack .gr-sig{ box-shadow:inset 0 1px 0 rgba(255,255,255,.15), 0 0 0 2px var(--card); }
[data-theme="midnight"] .gr-prog,[data-theme="midnight"] .pl-prog{ background:#0f1626; }
[data-theme="midnight"] .pl-pip{ background:#26324c; }

/* ---- badge-soft foregrounds + RASIC/status pill colors ---- */
[data-theme="midnight"] .badge-soft.ok{ color:var(--ok); }
[data-theme="midnight"] .badge-soft.warn{ color:var(--warn); }
[data-theme="midnight"] .badge-soft.muted{ background:var(--card-raised); color:var(--ink-soft); }
[data-theme="midnight"] .badge-soft.purple{ background:#241a3d; color:var(--violet); }
[data-theme="midnight"] .rasic-R{ color:var(--accent-600); } [data-theme="midnight"] .rasic-A{ color:var(--danger); }
[data-theme="midnight"] .rasic-S{ color:var(--teal); } [data-theme="midnight"] .rasic-I{ color:var(--ink-soft); } [data-theme="midnight"] .rasic-C{ color:var(--violet); }
[data-theme="midnight"] .ctm-table select.cell-input.rasic{ color:var(--ink-faint); }
[data-theme="midnight"] .ctm-table select.cell-input.rasic.rasic-A{ color:var(--danger); }
[data-theme="midnight"] .ctm-table select.cell-input.rasic.rasic-S{ color:var(--teal); }
[data-theme="midnight"] .ctm-table select.cell-input.rasic.rasic-I{ color:var(--ink-soft); }
[data-theme="midnight"] .ctm-table select.cell-input.rasic.rasic-C{ color:var(--violet); }
[data-theme="midnight"] .rp-A{ background:var(--danger-soft); color:var(--danger); }
[data-theme="midnight"] .rp-S{ background:#0f2a26; color:var(--teal); }
[data-theme="midnight"] .rp-I{ background:var(--card-raised); color:var(--ink-soft); }
[data-theme="midnight"] .rp-C{ background:#241a3d; color:var(--violet); }
[data-theme="midnight"] .del-status.st-not_started,[data-theme="midnight"] .del-status.st-na{ background:var(--card-raised); color:var(--ink-soft); }
[data-theme="midnight"] .del-icon{ background:var(--card); border-color:var(--line-strong); color:var(--ink-soft); }
[data-theme="midnight"] .del-submit{ background:var(--accent-soft); }

/* ---- gradient icon chips: pull back so they don't bloom on dark ---- */
[data-theme="midnight"] .kpi-ic,[data-theme="midnight"] .qt-ico,[data-theme="midnight"] .stat-ic,[data-theme="midnight"] .del-icon.gradient{ filter:saturate(.85) brightness(.92); }

/* ---- charter cards ---- */
[data-theme="midnight"] .charter-card{ background:linear-gradient(180deg,var(--card),#111a2c); border-color:var(--line);
  box-shadow:var(--shadow-sm); }
[data-theme="midnight"] .cc-head:not(.cc-head-alert){ background:linear-gradient(180deg,rgba(30,41,65,.5),transparent); }
[data-theme="midnight"] .cc-head{ border-color:var(--line); color:var(--ink-soft); }
[data-theme="midnight"] .charter-notice.border-bottom{ border-color:var(--line) !important; }
[data-theme="midnight"] .qt-tool{ background:var(--card-raised); border-color:var(--line); }

/* ---- chat panel (messenger look, all raw hex) ---- */
[data-theme="midnight"] .chat-scroll{ background:#0f1626;
  background-image:radial-gradient(rgba(255,255,255,.04) 1px,transparent 1px),radial-gradient(rgba(255,255,255,.02) 1px,transparent 1px); }
[data-theme="midnight"] .chat-bubble{ background:var(--card-raised); color:var(--ink); box-shadow:0 1px 1.5px rgba(0,0,0,.4); }
[data-theme="midnight"] .chat-msg.me .chat-bubble{ background:#13351f; color:var(--ink); }
[data-theme="midnight"] .chat-input{ background:var(--card); border-color:var(--line); }
[data-theme="midnight"] .chat-field{ background:#1e2941; color:var(--ink); border-color:var(--line-strong); }
[data-theme="midnight"] .chat-field:focus{ background:var(--card-raised); box-shadow:0 0 0 3px var(--focus-ring); }
[data-theme="midnight"] .chat-time{ color:rgba(230,236,246,.45); }

/* ---- scrollbars + flatpickr ---- */
[data-theme="midnight"] .chat-scroll::-webkit-scrollbar-thumb,
[data-theme="midnight"] .cc-body.notice-scroll::-webkit-scrollbar-thumb{ background:rgba(230,236,246,.20); }
[data-theme="midnight"] .flatpickr-calendar{ background:var(--card-raised); color:var(--ink); border-color:var(--line); box-shadow:var(--shadow); }
[data-theme="midnight"] .flatpickr-day{ color:var(--ink); }
[data-theme="midnight"] .flatpickr-day:hover{ background:var(--card); }
[data-theme="midnight"] .flatpickr-day.flatpickr-disabled,[data-theme="midnight"] .flatpickr-day.prevMonthDay,[data-theme="midnight"] .flatpickr-day.nextMonthDay{ color:var(--ink-faint); }
[data-theme="midnight"] .flatpickr-months .flatpickr-month,[data-theme="midnight"] .flatpickr-weekday,[data-theme="midnight"] .flatpickr-current-month input.cur-year{ color:var(--ink-soft); }
[data-theme="midnight"] .flatpickr-months .flatpickr-prev-month svg,[data-theme="midnight"] .flatpickr-months .flatpickr-next-month svg{ fill:var(--ink-soft); }

/* ---- subbar + separators so heroes/navbar don't merge with page ---- */
[data-theme="midnight"] .subbar{ background:var(--card); border-color:var(--line); }
[data-theme="midnight"] .ch-hero,[data-theme="midnight"] .proq-nav{ border:1px solid var(--line); }
[data-theme="midnight"] .proq-nav{ border-width:0 0 1px 0; }
[data-theme="midnight"] .btn-icon{ background:var(--card-raised); border-color:var(--line); color:var(--ink-soft); }
[data-theme="midnight"] .empty-state{ color:var(--ink-soft); }
[data-theme="midnight"] .progress{ background:#0f1626; }

/* ---- Midnight: extra sweeps found in visual QA ---- */
/* RASIC pill backgrounds (S/I/C had hard-coded light tints) */
[data-theme="midnight"] .ctm-table select.cell-input.rasic.rasic-S{ background:#0f2a26; }
[data-theme="midnight"] .ctm-table select.cell-input.rasic.rasic-I{ background:var(--card-raised); }
[data-theme="midnight"] .ctm-table select.cell-input.rasic.rasic-C{ background:#241a3d; }
/* charter notice titles + any hard body text */
[data-theme="midnight"] .text-body{ color:var(--ink) !important; }
[data-theme="midnight"] .charter-notice .cn-title{ color:var(--ink) !important; }
[data-theme="midnight"] .charter-notice{ border-color:var(--line) !important; }
[data-theme="midnight"] .charter-notice:hover{ background:var(--card-raised); }
/* phase progress island rows */
[data-theme="midnight"] .pp-row .pp-name,[data-theme="midnight"] .phase-prog-name{ color:var(--ink); }
[data-theme="midnight"] .progress{ background:#0f1626; }


/* ============================================================
   BOARD (single program) — "You are here" ziggurat + hero
   Extends the .pl-* Isometric Quality World for one project's
   working board. Presentation only; reuses the shipped solids,
   stats and tokens verbatim. Scope: .brd-*, .pl-slab.is-*,
   .pl-gate--base.is-current, .pl-stat text/prog extras, and
   ONE new @keyframes plHerePulse. The Timeline hero reuses the
   shipped .pl-* verbatim and needs no rules from this block.
   ============================================================ */

/* The board hero hosts in-panel dropdowns (Automate / Status) that must
   ESCAPE the panel — .ch-hero's own overflow:hidden would clip them. The
   3D world still self-clips via .pl-stage{overflow:hidden}, so opening the
   hero up is safe. Lift the head layer above the stats so open menus never
   paint behind them. */
.brd-hero { overflow: visible; }
.brd-hero .ch-hero-top { z-index: 3; align-items: flex-start; }

/* left column: identity + toolbar, capped so it never covers the ziggurat */
.brd-head { display: flex; flex-direction: column; gap: 12px; max-width: 60%; min-width: 0; }
.brd-id { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.brd-back { flex: 0 0 auto; }
.brd-titles { min-width: 0; }
.brd-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brd-tags h1 { margin-right: 2px; }

/* the emerald "you are here" locator pill */
.brd-here { display: inline-flex; align-items: center; gap: 5px;
  font-size: .6rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: #6ee7b7; background: rgba(52,211,153,.16);
  border: 1px solid rgba(52,211,153,.34); padding: 3px 9px; border-radius: 999px;
  box-shadow: inset 0 0 12px rgba(52,211,153,.14); white-space: nowrap; }
.brd-here i { font-size: .72rem; }

/* action toolbar — ghost buttons, wraps within the left column */
.brd-tools { position: relative; display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }

/* dark-glass stat extras: secondary line, rose value, inline progress bar.
   .pl-stat>div is a safe additive (min-width:0 only enables ellipsis) and
   does not regress the shipped index/timeline stats. */
.pl-stat > div { min-width: 0; }
.pl-stat-sub { font-size: .62rem; color: #93a4cc; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-stat-val.cm-danger { color: #fda4af; }                 /* rose-300 — AA on dark glass */
.pl-stat .pl-prog { margin-top: 8px; width: 100%;
  background: rgba(255,255,255,.14); }                     /* dark track; bar gradient inherited */

/* ---- ziggurat focus: light the project's CURRENT phase ---- */
/* non-current slabs recede so the live phase is unmistakably the subject */
.pl-slab.is-dim { opacity: .38; }
.pl-slab.is-dim .top { box-shadow: inset 0 0 0 1px rgba(224,242,254,.16); }

/* current slab: lifted higher on its own axis (centering convention intact),
   brighter engraved cap, emerald rim-glow that gently pulses */
.pl-slab.is-current { transform: translate(-50%,-50%) translateZ(calc(var(--lift) + 18px)); }
.pl-slab.is-current .top {
  box-shadow: inset 0 0 0 1px rgba(236,253,245,.60),
              inset 0 0 20px rgba(110,231,183,.35),
              0 0 26px rgba(52,211,153,.50);
  animation: plHerePulse 4.6s ease-in-out infinite; }
.pl-slab.is-current .top b { color: #ecfdf5;
  text-shadow: 0 0 10px rgba(52,211,153,.9), 0 1px 1px rgba(2,6,23,.55); }

/* phase 0 (Program Concept) has no slab — light the base gate ring instead */
.pl-gate--base.is-current { border-color: rgba(52,211,153,.85);
  box-shadow: 0 0 16px rgba(52,211,153,.50), inset 0 0 10px rgba(52,211,153,.35);
  animation: plGateGlow 4.6s ease-in-out infinite; }   /* reuse the shipped emerald pulse */

@keyframes plHerePulse {
  0%,100% { box-shadow: inset 0 0 0 1px rgba(236,253,245,.60),
                        inset 0 0 20px rgba(110,231,183,.35), 0 0 22px rgba(52,211,153,.40); }
  50%     { box-shadow: inset 0 0 0 1px rgba(236,253,245,.78),
                        inset 0 0 26px rgba(110,231,183,.52), 0 0 34px rgba(52,211,153,.72); }
}
/* The global reduced-motion reset (app.css:1416 *{animation:none!important})
   freezes plHerePulse + this base-gate plGateGlow at the fully-lit resting
   box-shadow declared above — the current phase still reads raised + glowing.
   Only ONE new animated element (the current slab); the apex "goal" gate keeps
   its shipped pulse. Board animated total = 3 (plWorldSway + apex plGateGlow +
   current-slab pulse); Timeline animated total = 2 (the shipped pair). */

/* responsive: the shipped @media(max-width:767.98px){.pl-stage{display:none}}
   already hides the world; open the head to full width so it stacks cleanly */
@media (max-width: 767.98px){ .brd-head { max-width: 100%; } }

/* Board ziggurat — fully framed within the hero (scaled down + re-centred).
   The scale is carried in the sway keyframes so the animation never drops it;
   reduced-motion freezes at the scaled resting pose. Board-scoped only. */
.brd-hero .pl-stage { width: min(44%, 480px); }
.brd-hero .pl-world { left: 43%; top: 58%;
  transform: scale(.7) rotateX(58deg) rotateZ(-45deg);
  animation: brdWorldSway 17s ease-in-out infinite; }
@keyframes brdWorldSway {
  0%,100% { transform: scale(.7) rotateX(58deg) rotateZ(-45deg); }
  50%     { transform: scale(.7) rotateX(56deg) rotateZ(-51deg); }
}

/* ── Control Plan premium touches ─────────────────────────────────────────
   Index list: a status colour-stripe on the Part cell + a monospace part no.
   column; the detail hero reuses the shared .fmea-hero premium pattern. */
.cp-accent { display:inline-block; width:3px; height:1.1em; border-radius:2px;
  margin-right:.5rem; vertical-align:-2px; background:var(--line); }
.cp-accent-released  { background:var(--ok); }
.cp-accent-in_review { background:var(--warn); }
.cp-accent-draft     { background:var(--line); }
.cp-row:hover .cp-accent { filter:brightness(1.08); }
.mono-num { font-variant-numeric:tabular-nums;
  font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,Consolas,monospace;
  font-size:.86em; letter-spacing:-.01em; }

/* ── Company co-branding (tenant logo beside the retained ProQ brand) ──────
   The navbar stays navy in both themes, so the company logo sits in a white
   rounded chip to guarantee legibility for any logo (light or dark artwork). */
.co-brand { display:inline-flex; align-items:center; gap:.55rem; }
.co-brand-divider { width:1px; height:34px; background:rgba(255,255,255,.28); border-radius:1px; }
.co-brand-logo {
  height:42px; max-width:200px; width:auto; object-fit:contain; display:block;
  background:#fff; border-radius:7px; padding:3px 8px;
  box-shadow:0 1px 2px rgba(2,6,23,.22); border:1px solid rgba(255,255,255,.55);
}
@media (max-width: 991.98px){ .co-brand-logo{ height:36px; max-width:150px; } }
@media (max-width: 575.98px){ .co-brand-logo{ height:30px; max-width:112px; } }

/* Branding settings preview surface */
.brand-preview {
  display:flex; align-items:center; justify-content:center; min-height:120px;
  background:var(--bg); border:1px dashed var(--line); border-radius:12px; padding:1rem;
}
.brand-preview img { max-height:96px; max-width:100%; object-fit:contain; }
.brand-preview-navy {
  display:inline-flex; align-items:center; gap:.6rem; padding:.5rem .8rem;
  border-radius:10px; background:#0b1220;
}
.brand-preview-navy img { height:42px; max-width:200px; object-fit:contain; background:#fff; border-radius:7px; padding:3px 8px; border:1px solid rgba(255,255,255,.55); }

/* ── PPAP per-element comment thread ──────────────────────────────────────
   A collapsible discussion under each PPAP element row (what to upload, the
   reason for a rejection, follow-ups). Token-driven so it themes in Midnight. */
.ppap-cmt-toggle { color: var(--ink-3, #64748b); text-decoration: none; vertical-align: baseline; }
.ppap-cmt-toggle:hover { color: var(--accent); }
.ppap-cmt-count { font-size: .7rem; font-weight: 700; }
.ppap-cmt-count:not(:empty) {
  display: inline-block; min-width: 1.1em; padding: 0 .3em; margin-left: .2em;
  text-align: center; border-radius: 999px; color: #fff;
  background: var(--accent); line-height: 1.35;
}
.ppap-cmt-row > td { background: var(--bg); }
.ppap-comments {
  padding: .75rem 1rem; margin: 0 .5rem .35rem 2.2rem;
  border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0;
  background: var(--card);
}
.ppap-cmt-head { font-size: .78rem; color: var(--ink-3, #64748b); margin-bottom: .5rem; }
.ppap-cmt-thread { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .6rem; }
.ppap-cmt { padding: .45rem .65rem; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.ppap-cmt-meta { display: flex; gap: .5rem; align-items: baseline; margin-bottom: .15rem; }
.ppap-cmt-author { font-weight: 600; font-size: .82rem; color: var(--ink); }
.ppap-cmt-time { font-size: .72rem; color: var(--ink-3, #64748b); }
.ppap-cmt-body { font-size: .85rem; color: var(--ink); white-space: pre-wrap; }
.ppap-cmt-empty { font-size: .82rem; color: var(--ink-3, #64748b); font-style: italic; }
.ppap-cmt-form { display: flex; gap: .5rem; align-items: flex-start; }
.ppap-cmt-form textarea { resize: vertical; }

/* ── PPAP create: requirements-applicability checklist ────────────────────── */
.ppap-req-config { max-height: 300px; overflow-y: auto; padding: .25rem; background: var(--card); }
.ppap-req-item { display: flex; align-items: center; gap: .6rem; padding: .35rem .55rem;
  margin: 0; border-radius: 6px; cursor: pointer; }
.ppap-req-item:hover { background: var(--bg); }
.ppap-req-item input { margin: 0; flex: 0 0 auto; }
.ppap-req-item.req-off { opacity: .5; }
.ppap-req-code { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .82rem;
  min-width: 46px; color: var(--ink); }
.ppap-req-name { flex: 1 1 auto; font-size: .85rem; color: var(--ink); }
.ppap-req-badge { flex: 0 0 auto; min-width: 82px; text-align: center; }

/* ══ SPC premium — 3D icons + capability visuals ═══════════════════════════ */
/* Genuinely dimensional icon chips: gradient face + glossy top + solid
   extrusion (stacked shadows) + floating drop shadow. Used across SPC KPIs. */
.ic3d { position: relative; width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center; color: #fff; font-size: 1.35rem; flex: 0 0 auto;
  background: linear-gradient(150deg, var(--i1), var(--i2));
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,.55), inset 0 -7px 11px rgba(0,0,0,.20),
    0 2px 0 var(--is), 0 3px 0 var(--is), 0 4px 0 var(--is), 0 5px 0 var(--is),
    0 6px 0 var(--is), 0 13px 20px -5px rgba(2,6,23,.42);
  transition: transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .2s ease; }
.ic3d::after { content:""; position:absolute; inset:3px 3px 52% 3px;
  border-radius: 10px 10px 42% 42%;
  background: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0));
  pointer-events:none; }
.ic3d i { position: relative; z-index: 1; filter: drop-shadow(0 1px 1px rgba(0,0,0,.28)); }
.ic3d:hover { transform: translateY(-3px); }
.ic3d-indigo  { --i1:#818cf8; --i2:#4f46e5; --is:#3730a3; }
.ic3d-teal    { --i1:#2dd4bf; --i2:#0d9488; --is:#115e59; }
.ic3d-emerald { --i1:#34d399; --i2:#059669; --is:#065f46; }
.ic3d-amber   { --i1:#fbbf24; --i2:#d97706; --is:#92400e; }
.ic3d-rose    { --i1:#fb7185; --i2:#e11d48; --is:#9f1239; }
.ic3d-slate   { --i1:#94a3b8; --i2:#475569; --is:#334155; }
.ic3d-violet  { --i1:#a78bfa; --i2:#7c3aed; --is:#5b21b6; }
.ic3d-sm { width:40px; height:40px; font-size:1.15rem; border-radius:11px; }

/* SPC hero KPI stat (3D icon + value) */
.spc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 1rem 1.1rem; }
.spc-stat { display: flex; align-items: center; gap: .8rem; }
.spc-stat-body { min-width: 0; }
.spc-stat-val { font-size: 1.5rem; font-weight: 800; line-height: 1; color: var(--ink);
  font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.spc-stat-val.sm { font-size: 1.15rem; }
.spc-stat-lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--ink-3,#64748b); margin-top: .28rem; font-weight: 600; }
.spc-stat-sub { font-size: .74rem; color: var(--ink-3,#64748b); margin-top: .1rem; }
.spc-stat-sub.ok { color: var(--ok); } .spc-stat-sub.warn { color: var(--warn); }
.spc-stat-sub.danger { color: var(--danger); }

/* Capability statistics table (Minitab-style) */
.cap-table { width: 100%; font-size: .85rem; border-collapse: collapse; }
.cap-table caption { text-align: left; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--ink-3,#64748b); font-weight: 700; padding: .2rem 0 .3rem; }
.cap-table th { text-align: right; font-weight: 600; color: var(--ink-3,#64748b);
  font-size: .72rem; padding: .3rem .5rem; }
.cap-table th:first-child { text-align: left; }
.cap-table td { padding: .34rem .5rem; border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); }
.cap-table td:first-child { text-align: left; font-weight: 600; }
.cap-table tr.cap-hi td { background: color-mix(in srgb, var(--accent) 7%, transparent); }

/* Capability plot — process spread vs spec, as positioned bars */
.cap-plot { display: flex; flex-direction: column; gap: .55rem; }
.cap-plot-row { display: grid; grid-template-columns: 68px 1fr; align-items: center; gap: .6rem; }
.cap-plot-lbl { font-size: .74rem; color: var(--ink-3,#64748b); text-align: right; }
.cap-plot-track { position: relative; height: 16px; border-radius: 8px; background: var(--bg);
  border: 1px solid var(--line); }
.cap-plot-fill { position: absolute; top: 2px; bottom: 2px; border-radius: 6px; }
.cap-plot-fill.spec { background: repeating-linear-gradient(90deg, color-mix(in srgb,var(--ink) 12%,transparent) 0 6px, transparent 6px 12px); border:1px dashed var(--ink-3,#94a3b8); }
.cap-plot-fill.overall { background: linear-gradient(90deg,#818cf8,#4f46e5); }
.cap-plot-fill.within  { background: linear-gradient(90deg,#2dd4bf,#0d9488); }
.cap-plot-mean { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--danger); }

/* Quadrant chip */
.spc-quad { display:inline-flex; align-items:center; gap:.4rem; padding:.25rem .6rem;
  border-radius: 999px; font-size:.78rem; font-weight:600; }
.spc-quad .q-num { font-weight:800; font-variant-numeric: tabular-nums; }

/* Chart canvas sizing */
.spc-chart-box { position: relative; height: 260px; }
.spc-chart-box.tall { height: 320px; }

/* ── Spreadsheet data-grid (SPC / MSA measurement entry) ─────────────────── */
.dgrid { --dg-line: var(--line); }
.dgrid table { border-collapse: separate; border-spacing: 0; width: 100%;
  font-variant-numeric: tabular-nums; }
.dgrid thead th { position: sticky; top: 0; z-index: 2; background: var(--card);
  border-bottom: 2px solid var(--dg-line); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .03em; color: var(--ink-3,#64748b); font-weight: 700;
  padding: .45rem .5rem; text-align: center; white-space: nowrap; }
.dgrid tbody td { padding: 0; border-bottom: 1px solid var(--dg-line);
  border-right: 1px solid color-mix(in srgb, var(--dg-line) 55%, transparent); }
.dgrid tbody td:last-child { border-right: 0; }
.dgrid .dgrid-rn, .dgrid thead th.dgrid-rn-h { width: 42px; min-width: 42px; text-align: center;
  color: var(--ink-3,#64748b); font-size: .76rem; background: var(--bg);
  border-right: 1px solid var(--dg-line); font-weight: 600; }
.dgrid-cell { width: 100%; min-width: 66px; border: 0; background: transparent;
  padding: .42rem .5rem; text-align: center; color: var(--ink);
  font-variant-numeric: tabular-nums; font-size: .9rem; }
.dgrid-cell:focus { outline: none; }
.dgrid tbody td:focus-within { background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: inset 0 0 0 2px var(--accent); border-radius: 4px; }
.dgrid tbody tr:hover { background: var(--bg); }
.dgrid-del { border: 0; background: transparent; color: var(--danger); opacity: .35;
  width: 30px; height: 30px; border-radius: 6px; cursor: pointer; line-height: 1; }
.dgrid tbody tr:hover .dgrid-del { opacity: .8; }
.dgrid-del:hover { opacity: 1; background: color-mix(in srgb, var(--danger) 12%, transparent); }
.dgrid-hint { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .6rem;
  border-radius: 8px; background: color-mix(in srgb, var(--accent) 8%, transparent);
  color: var(--ink-2, #475569); font-size: .78rem; }

/* ── Collapsible calculation-formula panel (SPC / MSA) ────────────────────── */
.formula-toggle { cursor: pointer; user-select: none; }
.formula-chev { transition: transform .2s ease; }
.formula-toggle[aria-expanded="true"] .formula-chev { transform: rotate(180deg); }
.fx-section { padding: .5rem 0; border-top: 1px solid var(--line); }
.fx-section:first-child { border-top: 0; padding-top: 0; }
.fx-title { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-2, #475569); margin-bottom: .35rem; display: flex; align-items: baseline; gap: .5rem; }
.fx-cite { font-size: .68rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-3,#64748b); }
.fx-row { display: grid; grid-template-columns: 160px 1fr; gap: .5rem 1rem; align-items: baseline;
  padding: .2rem 0; }
.fx-label { font-size: .82rem; font-weight: 600; color: var(--ink); }
.fx-formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem; color: var(--ink-2, #475569); font-variant-numeric: tabular-nums; }
.fx-eq { color: var(--accent); font-weight: 600; margin-left: .5rem; }
@media (max-width: 575.98px){ .fx-row { grid-template-columns: 1fr; gap: .1rem; } }

/* ══ Premium polish layer — micro-interactions, toasts, command palette ═══ */
/* Elevation: subtle shadow bloom on all cards; lift reserved for KPI tiles. */
.card { transition: box-shadow .25s ease, transform .2s cubic-bezier(.2,.7,.3,1); }
.card:hover { box-shadow: var(--shadow-sm); }
.kpi-tile, .kpi-card { transition: box-shadow .25s ease, transform .2s cubic-bezier(.2,.7,.3,1); }
.kpi-tile:hover, .kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

/* Staggered entrance: content cards rise in softly on page load. */
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
main .card, .kpi-tile, .fmea-hero { animation: riseIn .45s cubic-bezier(.2,.7,.3,1) both; }
main .card:nth-child(2), .kpi-tile:nth-of-type(2) { animation-delay: .05s; }
main .card:nth-child(3), .kpi-tile:nth-of-type(3) { animation-delay: .1s; }
main .card:nth-child(4), .kpi-tile:nth-of-type(4) { animation-delay: .15s; }
main .card:nth-child(n+5) { animation-delay: .2s; }

/* Keyboard focus — a crisp, branded focus ring everywhere. */
:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent) !important; border-radius: 6px; }

/* Slim premium scrollbars. */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink-3,#94a3b8) 45%, transparent) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink-3,#94a3b8) 40%, transparent); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--ink-3,#94a3b8) 65%, transparent); background-clip: content-box; border: 2px solid transparent; }
*::-webkit-scrollbar-track { background: transparent; }

/* Buttons: tactile press. */
.btn:active { transform: scale(.97); }

/* ── Flash messages → floating glass toasts ── */
.toast-stack { position: fixed; top: 76px; right: 18px; z-index: 1085;
  display: flex; flex-direction: column; gap: .6rem; width: min(400px, calc(100vw - 36px)); }
.toast-stack .alert.toastified { position: relative; overflow: hidden; margin: 0;
  border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(8,17,45,.28), inset 0 1px 0 rgba(255,255,255,.25);
  animation: toastIn .38s cubic-bezier(.2,.8,.25,1.1) both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(.97); } to { opacity: 1; transform: none; } }
.toast-stack .alert.toast-out { transition: opacity .3s ease, transform .3s ease; opacity: 0; transform: translateX(24px); }
.toast-life { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent));
  transform-origin: left; animation: toastLife linear forwards; border-radius: 0 2px 2px 0; }
@keyframes toastLife { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ── Command palette (⌘K / Ctrl+K) ── */
.cmdk-overlay { position: fixed; inset: 0; z-index: 1090; display: none;
  background: rgba(8, 13, 28, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cmdk-overlay.open { display: flex; align-items: flex-start; justify-content: center;
  padding: min(14vh, 130px) 16px 16px; animation: cmdkFade .18s ease both; }
@keyframes cmdkFade { from { opacity: 0; } to { opacity: 1; } }
.cmdk { width: min(620px, 100%); border-radius: 18px; overflow: hidden;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: 0 40px 90px rgba(4, 9, 24, .5), inset 0 1px 0 rgba(255,255,255,.2);
  animation: cmdkPop .22s cubic-bezier(.2,.8,.25,1.1) both; }
@keyframes cmdkPop { from { opacity: 0; transform: translateY(-14px) scale(.98); } to { opacity: 1; transform: none; } }
.cmdk-input { display: flex; align-items: center; gap: .7rem; padding: .95rem 1.1rem;
  border-bottom: 1px solid var(--line); }
.cmdk-input i { color: var(--ink-3,#64748b); font-size: 1.05rem; }
.cmdk-input input { flex: 1; border: 0; outline: none; background: transparent;
  color: var(--ink); font-size: 1.02rem; }
.cmdk-input input::placeholder { color: var(--ink-3,#94a3b8); }
.cmdk-input kbd { font-size: .68rem; color: var(--ink-3,#64748b); border: 1px solid var(--line);
  border-radius: 6px; padding: .15rem .45rem; background: var(--bg); }
.cmdk-list { max-height: 340px; overflow-y: auto; padding: .45rem; }
.cmdk-item { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem;
  border-radius: 10px; cursor: pointer; color: var(--ink); font-size: .93rem; }
.cmdk-item i { color: var(--ink-3,#64748b); width: 18px; text-align: center; }
.cmdk-item .cmdk-sec { margin-left: auto; font-size: .7rem; color: var(--ink-3,#94a3b8);
  text-transform: uppercase; letter-spacing: .04em; }
.cmdk-item.active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cmdk-item.active i { color: var(--accent); }
.cmdk-empty { padding: 1.2rem; text-align: center; color: var(--ink-3,#64748b); font-size: .9rem; }
.cmdk-hint { display: inline-flex; align-items: center; gap: .3rem; margin-right: .5rem;
  padding: .28rem .6rem; border-radius: 8px; cursor: pointer; font-size: .72rem; font-weight: 600;
  color: rgba(255,255,255,.75); border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08); }
.cmdk-hint:hover { background: rgba(255,255,255,.16); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  main .card, .kpi-tile, .fmea-hero, .toast-stack .alert.toastified, .cmdk, .cmdk-overlay.open { animation: none !important; }
  .card, .kpi-tile, .kpi-card, .btn { transition: none !important; }
}
