/* ============================================================
   PSI — CRM Development Roadmap  ·  app styles
   Brand tokens come from psi-tokens.css
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--psi-paper);
  color: var(--psi-ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#root { min-height: 100vh; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--impact-orange); color: #fff; }

/* ---------- status palette (on-brand semantics) ---------- */
.app {
  --st-completed:   #3A8A58;
  --st-indev:       #3B6E8F;
  --st-invalidation:#6D8899;
  --st-pending:     #9A6B1F;
  --st-waiting:     #B98A3E;
  --st-behind:      #C24A3D;
  --st-notstarted:  #98A4AD;
}

/* ============================================================
   HEADER
   ============================================================ */
.hdr {
  position: relative;
  background: var(--carbon-black);
  color: #fff;
  overflow: hidden;
  border-bottom: 3px solid var(--impact-orange);
}
.hdr__pattern {
  position: absolute; inset: 0;
  background-image: url("assets/psi-pattern.svg");
  background-size: 88px;
  opacity: 0.06;
  pointer-events: none;
}
.hdr__inner {
  position: relative;
  max-width: 1480px; margin: 0 auto;
  padding: 26px clamp(20px, 4vw, 48px) 0;
}
.hdr__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hdr__brand { display: flex; align-items: center; gap: 18px; }
.hdr__logo { height: 60px; width: auto; display: block; }
.hdr__brandtext .eyebrow { color: var(--impact-orange); display: block; margin-bottom: 6px; }
.hdr__title {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(1.6rem, 2.6vw, 2.4rem); line-height: 1.0; letter-spacing: 0.01em; margin: 0;
}
.hdr__sub { font-size: var(--fs-14); color: #B8C3CD; margin: 8px 0 0; max-width: 560px; line-height: 1.5; }

/* summary stat strip */
.stats { display: flex; gap: 0; flex-wrap: wrap; margin-top: 24px; border-top: 1px solid var(--psi-navy-500); }
.stat {
  flex: 1 1 0; min-width: 132px;
  padding: 16px 22px 18px 0; margin-right: 22px;
  border-right: 1px solid var(--psi-navy-500);
}
.stat:last-child { border-right: 0; margin-right: 0; }
.stat__num { font-family: var(--font-display); font-weight: 600; font-size: var(--fs-32); line-height: 1; }
.stat__num.accent { color: var(--impact-orange); }
.stat__lbl { font-size: var(--fs-12); color: #9FB0BC; text-transform: uppercase; letter-spacing: 0.12em; margin-top: 8px; }
.stat__sub { font-size: var(--fs-12); color: #7E909D; margin-top: 3px; }
.stat .prog { height: 5px; border-radius: 999px; background: var(--psi-navy-500); margin-top: 10px; overflow: hidden; }
.stat .prog > i { display: block; height: 100%; background: var(--impact-orange); border-radius: 999px; }

/* ============================================================
   CONTROLS BAR (sticky)
   ============================================================ */
.controls {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246,244,239,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--psi-stone-200);
}
.controls__inner {
  max-width: 1480px; margin: 0 auto;
  padding: 12px clamp(20px, 4vw, 48px);
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.viewtabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--psi-stone-200); border-radius: var(--r-md); padding: 3px; }
.viewtabs button {
  border: 0; background: transparent; color: var(--psi-stone-500);
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em;
  font-size: var(--fs-12); font-weight: 600; padding: 8px 16px; border-radius: var(--r-sm);
  display: flex; align-items: center; gap: 7px; transition: all var(--dur-fast) var(--ease-out);
}
.viewtabs button:hover { color: var(--carbon-black); }
.viewtabs button.on { background: var(--carbon-black); color: #fff; }
.viewtabs svg { width: 15px; height: 15px; }

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--psi-stone-200); background: #fff; color: var(--psi-stone-700);
  font-size: var(--fs-13, 0.82rem); font-weight: 500; padding: 7px 13px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 7px; transition: all var(--dur-fast) var(--ease-out);
  line-height: 1;
}
.chip:hover { border-color: var(--harbor-steel); }
.chip.on { background: var(--carbon-black); color: #fff; border-color: var(--carbon-black); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cdot, currentColor); }
.chip .ct { font-variant-numeric: tabular-nums; opacity: 0.7; font-size: 0.78em; }

.search { position: relative; margin-left: auto; }
.search input {
  width: 230px; max-width: 46vw; padding: 8px 12px 8px 32px;
  border: 1px solid var(--psi-stone-200); border-radius: var(--r-md);
  font-family: var(--font-body); font-size: var(--fs-14); background: #fff; color: var(--psi-ink);
}
.search input:focus { outline: 2px solid var(--impact-orange); outline-offset: 1px; border-color: transparent; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--psi-stone-500); }
.resetbtn { border: 0; background: none; color: var(--psi-stone-500); font-size: var(--fs-13,0.82rem); text-decoration: underline; padding: 4px; }
.resetbtn:hover { color: var(--impact-orange); }

/* secondary control row (status legend filters) */
.controls__row2 {
  max-width: 1480px; margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px) 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.controls__row2 .lbl { font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.12em; color: var(--psi-stone-500); margin-right: 4px; font-weight: 600; }

/* ============================================================
   MAIN SHELL
   ============================================================ */
.main { max-width: 1480px; margin: 0 auto; padding: 28px clamp(20px, 4vw, 48px) 96px; }
.emptymsg { padding: 60px; text-align: center; color: var(--psi-stone-500); font-size: var(--fs-16); }

/* ============================================================
   TIMELINE / GANTT VIEW
   ============================================================ */
.tl { position: relative; }
.tl__scroll { overflow-x: auto; border: 1px solid var(--psi-stone-200); border-radius: var(--r-md); background: #fff; }
.tl__grid { position: relative; min-width: 1000px; }

/* month axis */
.tl__axis { display: grid; position: sticky; top: 0; z-index: 6; background: var(--carbon-black); color: #fff; }
.tl__axis .mcell {
  border-right: 1px solid var(--psi-navy-500); padding: 9px 10px;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em;
  font-size: var(--fs-12); font-weight: 500; white-space: nowrap;
}
.tl__axis .mcell .yr { color: #8FA0AC; margin-left: 5px; font-size: 0.85em; }
.tl__labelhead {
  position: sticky; left: 0; z-index: 7; background: var(--carbon-black); color: #fff;
  border-right: 2px solid var(--impact-orange); padding: 9px 14px;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em; font-size: var(--fs-12); font-weight: 600;
  display: flex; align-items: center;
}

/* phase band header */
.tl__phase { display: flex; align-items: center; gap: 12px; background: var(--hs-faded); border-top: 1px solid var(--psi-stone-200); border-bottom: 1px solid var(--psi-stone-200);
  padding: 8px 14px; position: sticky; left: 0; z-index: 5; }
.tl__phase .pnum { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-14); background: var(--carbon-black); color: #fff; padding: 3px 10px; border-radius: var(--r-sm); letter-spacing: 0.05em; }
.tl__phase .pttl { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; font-size: var(--fs-16); color: var(--carbon-black); }
.tl__phase .pmeta { font-size: var(--fs-12); color: var(--psi-stone-500); margin-left: auto; padding-right: 4px; }

/* rows */
.tl__row { display: grid; align-items: stretch; border-bottom: 1px solid var(--psi-stone-100); }
.tl__row:hover { background: var(--hs-faded); }
.tl__rowlabel {
  position: sticky; left: 0; z-index: 4; background: inherit;
  border-right: 2px solid var(--psi-stone-200);
  padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start;
  background-clip: padding-box;
}
.tl__row:hover .tl__rowlabel { background: var(--hs-faded); }
.tl__rowlabel .rn { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--psi-stone-500); font-weight: 600; min-width: 30px; padding-top: 2px; }
.tl__rowlabel .rt { font-size: var(--fs-13, 0.84rem); line-height: 1.3; font-weight: 500; color: var(--psi-ink); }
.tl__rowlabel .rt .sdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--st); }

/* track area */
.tl__track { position: relative; }
.tl__track .gl { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--psi-stone-100); }
.tl__bar {
  position: absolute; top: 50%; transform: translateY(-50%); height: 12px; border-radius: 999px;
  background: var(--st); opacity: 0.9; min-width: 4px;
  cursor: pointer; transition: filter var(--dur-fast) var(--ease-out);
}
.tl__bar.hollow { background: repeating-linear-gradient(90deg, var(--st) 0 5px, transparent 5px 9px); opacity: 0.5; }
.tl__milestone {
  position: absolute; top: 50%; transform: translate(-50%, -50%) rotate(45deg);
  width: 15px; height: 15px; background: var(--st); border: 2px solid #fff; box-shadow: var(--shadow-xs);
  cursor: pointer; transition: transform var(--dur-fast) var(--ease-out);
}
.tl__row:hover .tl__milestone { transform: translate(-50%, -50%) rotate(45deg) scale(1.18); }
.tl__datelbl { position: absolute; top: 50%; transform: translateY(-50%); font-size: var(--fs-12); color: var(--psi-stone-500); white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none; }

/* today line */
.tl__today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--impact-orange); z-index: 5; pointer-events: none; }
.tl__today::before { content: "TODAY"; position: absolute; top: 2px; left: 4px; font-family: var(--font-display); font-size: 10px; letter-spacing: 0.12em; font-weight: 700; color: var(--impact-orange); background: rgba(246,244,239,0.85); padding: 1px 4px; border-radius: 3px; }
.tl__milestone.big { width: 19px; height: 19px; border-width: 3px; }

/* ============================================================
   BOARD (KANBAN) VIEW
   ============================================================ */
.board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; }
.bcol { flex: 0 0 288px; display: flex; flex-direction: column; }
.bcol__head { display: flex; align-items: center; gap: 9px; padding: 4px 4px 12px; position: sticky; top: 0; }
.bcol__head .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--st); flex: none; }
.bcol__head .nm { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; font-size: var(--fs-14); color: var(--carbon-black); line-height: 1.15; }
.bcol__head .ct { margin-left: auto; font-variant-numeric: tabular-nums; font-size: var(--fs-12); color: var(--psi-stone-500); background: #fff; border: 1px solid var(--psi-stone-200); border-radius: 999px; padding: 1px 9px; }
.bcol__body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 3px; border-top: 2px solid var(--st); padding-top: 12px; }

.card {
  background: #fff; border: 1px solid var(--psi-stone-200); border-radius: var(--r-md);
  padding: 13px 14px; cursor: pointer; transition: all var(--dur-base) var(--ease-out); position: relative;
}
.card:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); border-color: var(--harbor-steel); }
.card__top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.card .pill { font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 7px; border-radius: var(--r-pill); font-family: var(--font-display); }
.card .pill.p1 { background: var(--hs-pastel); color: var(--midnight-slate); }
.card .pill.p2 { background: #EFE2CB; color: #7A551A; }
.card .pill.p3 { background: #E3D7D5; color: #8A3A30; }
.card .rn { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--psi-stone-500); font-weight: 600; }
.card__ttl { font-size: var(--fs-14); font-weight: 600; line-height: 1.3; color: var(--psi-ink); margin-bottom: 9px; }
.card__meta { display: flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--psi-stone-500); flex-wrap: wrap; }
.card__meta .who { display: inline-flex; align-items: center; gap: 5px; }
.card__meta .dt { margin-left: auto; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 4px; }
.card__meta svg { width: 13px; height: 13px; }
.card.behind { border-left: 3px solid var(--st-behind); }

/* ============================================================
   LIST / TABLE VIEW
   ============================================================ */
.tbl-wrap { border: 1px solid var(--psi-stone-200); border-radius: var(--r-md); overflow: hidden; background: #fff; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.tbl thead th {
  background: var(--carbon-black); color: #fff; text-align: left; padding: 11px 14px;
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.07em; font-size: var(--fs-12); font-weight: 600;
  white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0;
}
.tbl thead th .arr { color: var(--impact-orange); margin-left: 4px; }
.tbl tbody tr { border-top: 1px solid var(--psi-stone-100); cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.tbl tbody tr:hover { background: var(--hs-faded); }
.tbl td { padding: 11px 14px; vertical-align: top; line-height: 1.4; }
.tbl td.c-num { font-family: var(--font-mono); color: var(--psi-stone-500); font-weight: 600; white-space: nowrap; }
.tbl td.c-act { font-weight: 600; color: var(--psi-ink); max-width: 360px; }
.tbl td.c-act .desc { font-weight: 400; color: var(--psi-stone-500); font-size: var(--fs-12); margin-top: 3px; display: block; line-height: 1.4; }
.tbl td.c-who { color: var(--psi-stone-500); font-size: var(--fs-13, 0.84rem); max-width: 200px; }
.tbl td.c-date { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--psi-stone-700); }
.tbl .phase-tag { font-family: var(--font-display); font-weight: 700; font-size: 11px; }

/* status chip (shared) */
.schip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: var(--r-pill);
  font-size: var(--fs-12); font-weight: 600; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--st) 35%, transparent);
  background: color-mix(in srgb, var(--st) 12%, #fff); color: color-mix(in srgb, var(--st) 78%, #000); }
.schip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st); flex: none; }

/* ============================================================
   DETAIL DRAWER
   ============================================================ */
.scrim { position: fixed; inset: 0; background: rgba(26,38,49,0.55); z-index: 90; opacity: 0; transition: opacity var(--dur-base) var(--ease-out); }
.scrim.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 94vw); background: #fff; z-index: 91;
  box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform var(--dur-slow) var(--ease-out);
  display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer__hd { background: var(--carbon-black); color: #fff; padding: 22px 26px; position: relative; overflow: hidden; }
.drawer__hd .pat { position: absolute; inset: 0; background-image: url("assets/psi-pattern.svg"); background-size: 80px; opacity: 0.07; }
.drawer__close { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,0.1); border: 0; color: #fff; width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; transition: background var(--dur-fast); }
.drawer__close:hover { background: var(--impact-orange); }
.drawer__close svg { width: 18px; height: 18px; }
.drawer__eyebrow { position: relative; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.14em; font-size: var(--fs-12); color: var(--impact-orange); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.drawer__rn { font-family: var(--font-mono); color: #B8C3CD; }
.drawer__ttl { position: relative; font-family: var(--font-display); text-transform: uppercase; font-weight: 700; font-size: var(--fs-24); line-height: 1.1; margin: 12px 0 16px; letter-spacing: 0.01em; }
.drawer__body { padding: 24px 26px; overflow-y: auto; flex: 1; }
.drawer__desc { font-size: var(--fs-16); line-height: 1.65; color: var(--psi-stone-700); }
.drawer__desc.serif { font-family: var(--font-body); }
.dfield { padding: 16px 0; border-top: 1px solid var(--psi-stone-100); }
.dfield:first-of-type { border-top: 0; }
.dfield .k { font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.12em; color: var(--psi-stone-500); font-weight: 600; margin-bottom: 6px; }
.dfield .v { font-size: var(--fs-14); color: var(--psi-ink); line-height: 1.5; }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.dgrid .dfield { border-top: 0; padding: 6px 0; }
.drawer__meta { margin-top: 20px; border-top: 1px solid var(--psi-stone-100); padding-top: 4px; }

/* ============================================================
   FOOTER CREDIT (Mutiny Labs — canonical pattern)
   ============================================================ */
.credit { max-width: 1480px; margin: -64px auto 0; padding: 0 clamp(20px, 4vw, 48px) 40px; display: flex; justify-content: center; }
.mutiny-credit {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  opacity: 0.6;
  transition: opacity 0.2s;
  text-decoration: none;
  color: inherit;
  border: 0;
}
.mutiny-credit:hover { opacity: 1; color: inherit; }
/* logom.png is white-on-transparent; this page sits on light paper, so invert. */
.mutiny-logo { height: 14px; display: inline-block; filter: invert(1); }

/* density */
.dens-compact .tl__rowlabel { padding: 5px 14px; }
.dens-compact .card { padding: 9px 11px; }
.dens-compact .tbl td { padding: 7px 14px; }
.dens-compact .tbl td.c-act .desc { display: none; }
.dens-compact .bcol__body { gap: 7px; }

@media (max-width: 700px) {
  .stat { border-right: 0; }
  .hdr__logo { height: 46px; }
}
