/* Transformation Office — custom layer on top of Bootstrap 5 (CDN).
   Colours and typography follow the AI Staff Trafic UI (202607_AI_Staff_Trafic/src/ui): white background,
   Trafic red primary, yellow accent, Source Sans 3 headings, Roboto body. Tune the variables to follow the brand. */

:root {
  --trafic-red: #eb1428;
  --trafic-red-dark: #c11021;
  --trafic-yellow: #f8a523;
  --ink: #333333;
  --muted: #6c6c6c;
  --bg-soft: #f9f9f9;
  --border: #e2e2e2;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(51, 51, 51, 0.06), 0 8px 24px rgba(51, 51, 51, 0.08);
  --font-body: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-heading: "Source Sans 3", "Source Sans Pro", var(--font-body);

  /* Traffic light: reserved status colours, always shown with a shape and a label */
  --health-on_track: #2f8f1f;
  --health-at_risk: #e07b00;
  --health-off_track: #c11021;
  --health-no_report: #9aa0a6;

  --bs-body-font-family: var(--font-body);
  --bs-body-color: var(--ink);
  --bs-link-color-rgb: 193, 16, 33;
  --bs-link-hover-color-rgb: 235, 20, 40;
}

body { -webkit-font-smoothing: antialiased; background: #fff; }
h1, h2, h3, h4 { font-family: var(--font-heading); }
.page { max-width: 1320px; }

/* --- Header ------------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 1020;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 3px solid var(--trafic-red);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 16px; text-decoration: none; }
.brand img { height: 34px; width: auto; display: block; }
.brand-name { font-family: var(--font-heading); font-weight: 900; font-size: 1.25rem; color: var(--ink); letter-spacing: -0.01em; }
.site-nav { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.site-nav a.nav-item-link { text-decoration: none; color: var(--muted); font-weight: 500; font-size: 0.95rem; }
.site-nav a.nav-item-link:hover { color: var(--ink); }
.site-nav a.nav-item-link.active { color: var(--trafic-red); }
.nav-user { color: var(--ink); font-size: 0.9rem; font-weight: 500; }
.nav-logout { border: 1px solid var(--border); background: #fff; color: var(--muted); border-radius: 8px; padding: 6px 12px; font-size: 0.85rem; font-weight: 500; }
.nav-logout:hover { color: var(--ink); background: var(--bg-soft); }

.demo-banner {
  background: #fff6e3; border-bottom: 1px solid #f3d9a4; color: #6b4a00;
  font-size: 0.88rem; padding: 7px 0; text-align: center;
}
.demo-banner strong { font-weight: 700; }

/* --- Page head ----------------------------------------------------------------- */
.hero { padding: 48px 0 8px; background: radial-gradient(1200px 300px at 85% -80px, rgba(248, 165, 35, 0.12), transparent 70%); }
.hero-title, .page-title { margin: 0 0 8px; font-weight: 900; color: var(--trafic-red); line-height: 1.2; }
.hero-title { font-size: 2.3rem; }
.page-title { font-size: 1.9rem; }
.hero-sub, .page-sub { margin: 0; max-width: 72ch; color: var(--muted); font-size: 1.02rem; }
.page-head { padding: 32px 0 20px; }
.section-title {
  margin: 0 0 14px; font-family: var(--font-body); font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted);
}
.section { padding: 8px 0 32px; }
.crumb { font-size: 0.88rem; color: var(--muted); margin-bottom: 8px; }
.crumb a { color: var(--muted); }

/* --- Buttons ----------------------------------------------------------------- */
.btn-trafic { background: var(--trafic-red); border-color: var(--trafic-red); color: #fff; font-weight: 700; }
.btn-trafic:hover, .btn-trafic:focus { background: var(--trafic-red-dark); border-color: var(--trafic-red-dark); color: #fff; }
.btn-ghost { background: #fff; border: 1px solid var(--border); color: var(--muted); font-weight: 500; }
.btn-ghost:hover { background: var(--bg-soft); color: var(--ink); }

/* --- Home tiles ---------------------------------------------------------------- */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  gap: 20px; min-height: 180px; padding: 22px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
a.tile:hover { transform: translateY(-2px); border-color: var(--trafic-red); color: var(--ink); }
.tile-deco { position: absolute; right: 0; bottom: 0; width: 150px; height: auto; pointer-events: none; }
.tile-body { display: flex; flex-direction: column; gap: 6px; position: relative; }
.tile-eyebrow { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.tile-title { font-family: var(--font-heading); font-weight: 900; font-size: 1.35rem; color: var(--trafic-red); }
.tile-sub { font-size: 0.92rem; color: var(--muted); max-width: 34ch; }
.tile-cta { position: relative; font-weight: 700; font-size: 0.9rem; color: var(--trafic-red); }
.tile-soon { background: var(--bg-soft); box-shadow: none; }
.tile-soon .tile-title, .tile-soon .tile-cta { color: var(--muted); }

/* --- Cards / panels ------------------------------------------------------------ */
.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-pad { padding: 20px 24px; }

/* --- Traffic light ------------------------------------------------------------- */
.health { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.health::before { content: ""; flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--health-no_report); }
.health-on_track::before { background: var(--health-on_track); }
.health-at_risk::before { background: var(--health-at_risk); border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.health-off_track::before { background: var(--health-off_track); border-radius: 2px; }
.health-no_report::before { background: transparent; border: 2px solid var(--health-no_report); }

/* --- Synthetic view ------------------------------------------------------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 991px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.kpi-value { font-family: var(--font-heading); font-weight: 900; font-size: 2.4rem; line-height: 1.1; color: var(--ink); }
.kpi-label { font-size: 0.9rem; color: var(--muted); }
.kpi-total { border-top: 4px solid var(--ink); }
.kpi-on_track { border-top: 4px solid var(--health-on_track); }
.kpi-at_risk { border-top: 4px solid var(--health-at_risk); }
.kpi-off_track { border-top: 4px solid var(--health-off_track); }
.kpi-no_report { border-top: 4px solid var(--health-no_report); }

.stack { display: flex; gap: 2px; height: 14px; width: 100%; }
.stack-seg { height: 100%; min-width: 4px; }
.stack-seg:first-child { border-radius: 4px 0 0 4px; }
.stack-seg:last-child { border-radius: 0 4px 4px 0; }
.stack-seg:only-child { border-radius: 4px; }
.seg-on_track { background: var(--health-on_track); }
.seg-at_risk { background: var(--health-at_risk); }
.seg-off_track { background: var(--health-off_track); }
.seg-no_report { background: var(--health-no_report); }
.stack-empty { height: 14px; border-radius: 4px; background: var(--bg-soft); border: 1px dashed var(--border); }

.table-pmo { margin: 0; font-size: 0.88rem; }
.table-pmo thead th {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  background: var(--bg-soft); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table-pmo td, .table-pmo th { padding: 10px 12px; vertical-align: top; }
.table-pmo td.num, .table-pmo th.num { text-align: right; font-variant-numeric: tabular-nums; }
.phase-table td { vertical-align: middle; }
.phase-table .bar-cell { width: 34%; }

.portfolio-table { table-layout: fixed; }
.portfolio-table tbody tr { cursor: pointer; }
.portfolio-table tbody tr:hover td { background: #fff8f0; }
.portfolio-table .title-link { font-weight: 700; color: var(--ink); text-decoration: none; }
.portfolio-table tr:hover .title-link { color: var(--trafic-red); text-decoration: underline; }
.code { font-family: var(--font-heading); font-weight: 900; color: var(--trafic-red); }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
.sub { color: var(--muted); font-size: 0.82rem; }
.phase-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg-soft); font-size: 0.8rem; font-weight: 500; color: var(--ink);
}

/* --- Initiative detail ----------------------------------------------------------- */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; }
@media (max-width: 767px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.facts dt { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 500; }

.report { border-left: 4px solid var(--health-no_report); }
.report-on_track { border-left-color: var(--health-on_track); }
.report-at_risk { border-left-color: var(--health-at_risk); }
.report-off_track { border-left-color: var(--health-off_track); }
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.report-date { font-family: var(--font-heading); font-weight: 700; font-size: 1.05rem; }
.p3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 767px) { .p3 { grid-template-columns: 1fr; } }
.p3 h4 { margin: 0 0 4px; font-family: var(--font-body); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.p3 p { margin: 0; font-size: 0.93rem; white-space: pre-line; }
.badge-latest { background: var(--ink); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.06em; }

/* --- Status form ----------------------------------------------------------------- */
.form-label-q { font-family: var(--font-heading); font-weight: 700; font-size: 1.1rem; margin-bottom: 2px; }
.form-hint { color: var(--muted); font-size: 0.88rem; margin-bottom: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--trafic-red); box-shadow: 0 0 0 0.2rem rgba(235, 20, 40, 0.15); }
.health-choices { display: flex; gap: 12px; flex-wrap: wrap; }
.health-choice { position: relative; }
.health-choice input { position: absolute; opacity: 0; }
.health-choice label { border: 1px solid var(--border); border-radius: 8px; padding: 10px 16px; cursor: pointer; background: #fff; }
.health-choice input:checked + label { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--bg-soft); }
.health-choice input:focus-visible + label { outline: 2px solid var(--trafic-red); outline-offset: 2px; }

/* --- Login ------------------------------------------------------------------------ */
.auth-wrap { padding: 72px 0; background: radial-gradient(1200px 300px at 85% -80px, rgba(248, 165, 35, 0.12), transparent 70%); min-height: calc(100vh - 140px); }
.auth-card { max-width: 440px; margin: 0 auto; padding: 32px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-title { margin: 4px 0 6px; font-weight: 900; font-size: 1.8rem; color: var(--trafic-red); }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 0.82rem; padding: 18px 0; margin-top: 24px; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; }
.footer-support a { color: inherit; }
