/* Growth Atlas internal app.
   ------------------------------------------------------------------------
   BRAND: change these three and the whole app follows -- nav, buttons,
   links, headings, focus rings, the pacing bars' neutral state. Everything
   below them is greys and traffic-light status colours, which are deliberately
   NOT brand colours: red/amber/green have to mean "wrong/watch/fine" no matter
   what the brand is.
   ------------------------------------------------------------------------ */
:root {
  /* Growth Atlas brand */
  --brand: #513F65;        /* purple: nav, primary buttons, links, headings */
  --brand-dark: #3F314F;   /* button hover */
  --brand-tint: #EEECF0;   /* pale wash for hovers */
  --accent: #4C6444;       /* brand green -- confirmations and the Launched
                              stage. Deliberately NOT a status colour: the
                              palette validator flags it as below the chroma
                              floor (it reads grey) and too close to amber. */

  --ink: #1c2733;
  --muted: #5E6B77;
  --line: #E3E3E7;         /* neutral hairline */
  --bg: #F7F7F8;           /* page: barely off-white, so a white card still
                              reads as a card. On pure #fff the only thing
                              separating the two is the hairline border. */
  --card: #fff;

  /* Status. Chosen by running the palette validator, not by eye. The previous
     red/amber pair was ΔE 5.0 under deuteranopia -- indistinguishable to
     red-green colourblind readers, which is most of the point of a status
     colour. This trio passes CVD separation, chroma and contrast. */
  --green: #146C2E;
  --red: #C0342B;
  --amber: #8A5D00;        /* as TEXT: #D19100 is only 2.71:1 on a badge */
  --amber-fill: #D19100;   /* as a BAR: validated for separation from red */

  --good-bg: #E3EDE6;
  --warn-bg: #F9F2E0;
  --bad-bg:  #F7E7E6;
  --flat-bg: #F0F0F2;      /* neutral chip */
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand); }

nav {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--brand); color: #fff; padding: 0 20px; height: 52px;
}
nav a { color: #D6CFDD; text-decoration: none; font-size: 14px; }
nav a:hover, nav a.on { color: #fff; }
nav a.on { box-shadow: inset 0 -2px 0 #fff; line-height: 50px; }
nav .brand { font-weight: 650; color: #fff; font-size: 15px; letter-spacing: .2px; }
nav .spacer { flex: 1; }
nav .who { font-size: 13px; color: #D6CFDD; }
nav .role { background: rgba(255,255,255,.15); border-radius: 3px; padding: 1px 6px; margin-left: 7px; font-size: 11px; }
button.link { background: none; border: 0; color: #D6CFDD; cursor: pointer; font-size: 13px; padding: 0; }
button.link:hover { color: #fff; }

main { max-width: 1060px; margin: 0 auto; padding: 24px 20px 64px; }
h1 { font-size: 21px; margin: 0; font-weight: 650; }
h2 { font-size: 15px; margin: 0 0 10px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.ok { color: var(--accent); }
.bad { color: var(--red); }
.crumb { margin: 0 0 14px; font-size: 13px; }
.crumb a { text-decoration: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 20px; margin-bottom: 18px; }
.card.narrow { max-width: 420px; margin: 64px auto; }
.card.empty { text-align: center; padding: 44px 20px; }

.head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; }
.tabs.right { margin-left: auto; }
.tabs a {
  text-decoration: none; font-size: 13px; padding: 4px 10px; border-radius: 5px;
  color: var(--muted); border: 1px solid transparent;
}
.tabs a.on { background: #fff; border-color: var(--line); color: var(--ink); font-weight: 600; }
.tabs b { color: var(--brand); }

table.findings { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
table.findings th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line);
  background: #FAFAFB;
}
table.findings td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.findings tr:last-child td { border-bottom: 0; }
table.findings tr.off { opacity: .5; }
.acct { font-weight: 600; white-space: nowrap; }
.acct a { text-decoration: none; }
td.act { text-align: right; white-space: nowrap; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.s1 { background: var(--red); }
.dot.s2 { background: var(--amber-fill); }

.kind { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; margin-right: 7px; white-space: nowrap; }
.k-disapproval { background: var(--bad-bg); color: var(--red); }
.k-conv_tracking { background: var(--bad-bg); color: var(--red); }
.k-negative_keyword { background: var(--warn-bg); color: var(--amber); }
.k-test_review { background: var(--brand-tint); color: var(--brand); }

.age { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.age.stale { color: var(--red); font-weight: 600; }
.flag { font-size: 11px; background: var(--bad-bg); color: var(--red); border-radius: 4px; padding: 1px 6px; margin-left: 6px; font-weight: 600; }

.status { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 4px; }
.st-open { background: var(--bad-bg); color: var(--red); }
.st-done { background: var(--good-bg); color: var(--green); }
.st-snoozed { background: var(--warn-bg); color: var(--amber); }
.st-resolved { background: var(--flat-bg); color: var(--muted); }

.fhead { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.fhead h1 { margin: 6px 0 4px; }
.lead { margin: 0; font-size: 15px; }
.status-block { text-align: right; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.actions form, form.inline, form.row { display: flex; gap: 8px; align-items: center; }
form.row { flex-wrap: wrap; }
.noteform { display: flex; gap: 8px; margin-bottom: 14px; }
.noteform input { flex: 1; }

input, select { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
input.money { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
input.days { width: 62px; }
.card.narrow input { width: 100%; margin-bottom: 10px; }
.card.narrow button { width: 100%; }

button { font: inherit; font-weight: 600; padding: 7px 14px; border: 1px solid var(--brand); border-radius: 6px; background: var(--brand); color: #fff; cursor: pointer; }
button:hover { background: var(--brand-dark); }
button.ghost { background: #fff; color: var(--brand); }
button.ghost:hover { background: var(--brand-tint); }
button.tiny { font-size: 12px; padding: 4px 10px; }

.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.ev { font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-right: 6px; }
.ev-done { color: var(--green); }
.ev-reopened { color: var(--red); }
.ev-opened { color: var(--brand); }
.note { margin-top: 4px; padding-left: 10px; border-left: 2px solid var(--line); color: var(--ink); }

.role-tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; }
.r-admin { background: var(--brand-tint); color: var(--brand); }
.r-analyst { background: var(--flat-bg); color: var(--muted); }

code { background: var(--flat-bg); padding: 1px 5px; border-radius: 3px; font-size: 12px; }

@media (max-width: 640px) {
  .tabs.right { margin-left: 0; }
  table.findings { display: block; overflow-x: auto; }
}

/* ---- Pacing ------------------------------------------------------------ */
.right { margin-left: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.w40 { width: 34%; }
td.over { color: var(--red); font-weight: 600; }

.pbar {
  position: relative; height: 16px; border-radius: 4px;
  background: var(--flat-bg); overflow: hidden; min-width: 120px;
}
.pfill { height: 100%; border-radius: 4px 0 0 4px; transition: width .2s; }
/* The notch is where spend would be if it were perfectly even for the month. */
.pmark {
  position: absolute; top: -2px; bottom: -2px; width: 2px;
  background: var(--ink); opacity: .55;
}
/* Bar fill only. These MUST stay scoped to .pfill -- unscoped, the same
   classes on the % figures paint them as solid blocks. */
.pfill.p-on    { background: var(--green); }
.pfill.p-under { background: var(--amber-fill); }
.pfill.p-over  { background: var(--red); }
.pfill.p-risk  { background: var(--red); }
.pfill.p-none  { background: #CFC6B4; }
b.p-on { color: var(--green); } b.p-under { color: var(--amber); }
b.p-over, b.p-risk { color: var(--red); } b.p-none { color: var(--muted); }

.st-p-on    { background: var(--good-bg); color: var(--green); }
.st-p-under { background: var(--warn-bg); color: var(--amber); }
.st-p-over, .st-p-risk { background: var(--bad-bg); color: var(--red); }
.st-p-none  { background: var(--flat-bg); color: var(--muted); }

.card.total .trow { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.card.total .big { font-size: 26px; margin: 2px 0 0; font-weight: 650; }
.card.total .big .muted { font-weight: 400; font-size: 19px; }
.tright { text-align: right; display: flex; align-items: center; gap: 10px; }
.pct { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.pct.p-on { color: var(--green); } .pct.p-under { color: var(--amber); }
.pct.p-over, .pct.p-risk { color: var(--red); } .pct.p-none { color: var(--muted); }
.card.total .pbar { height: 22px; }

/* ---- Build board ------------------------------------------------------- */
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: start; }
.col { background: #F0F0F2; border-radius: 8px; padding: 10px; min-height: 90px; }
.colhead {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin: 2px 0 10px; display: flex; justify-content: space-between;
}
.count { background: #fff; border-radius: 10px; padding: 0 7px; color: var(--ink); }
.colempty { text-align: center; color: #CFC6B4; margin: 12px 0; }

.bcard {
  display: block; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 6px; padding: 10px; margin-bottom: 8px; text-decoration: none; color: var(--ink);
}
.bcard:hover { border-color: var(--brand); }
.bcard.stale { border-left-color: #A2542A; background: #fdf6f2; }
.bcard.overdue { border-left-color: var(--red); }
.btitle { display: block; font-weight: 600; font-size: 13px; line-height: 1.35; }
.bclient { display: block; font-size: 12px; color: var(--brand); margin-top: 2px; }
.bmeta { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; }
.bmeta .stale { color: #A2542A; font-weight: 600; }
.bmeta .overdue, .overdue { color: var(--red); font-weight: 600; }
.bowner { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }

details.newbuild summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details.newbuild[open] summary { margin-bottom: 12px; }

.stagebar { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.stagestep { margin: 0; }
button.step { background: #fff; color: var(--muted); border-color: var(--line); font-size: 13px; }
button.step:hover { background: var(--brand-tint); color: var(--brand); border-color: var(--brand); }
button.step.on { background: var(--brand); color: #fff; border-color: var(--brand); cursor: default; }
button.step:disabled { opacity: 1; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.grid2 label, label.full { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.full { margin-bottom: 12px; }
textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; color: var(--ink); }
form.archive { display: inline; margin-left: 8px; }

@media (max-width: 900px) {
  .board { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .board { grid-template-columns: 1fr; } }

/* ---- Performance ------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 2px; }
.tlabel { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.tval { font-size: 21px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink); }
.card.total .tiles + p { margin: 14px 0 0; }
/* The perf table is genuinely wide; let it scroll rather than crush columns. */
.scroller { overflow-x: auto; }
table.perf { min-width: 940px; }
table.perf td, table.perf th { padding-left: 9px; padding-right: 9px; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* ---- Paused accounts ---------------------------------------------------- */
tr.paused td { opacity: .55; }
tr.paused td.act { opacity: 1; }          /* the way back must stay legible */
.chip-paused {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px;
  background: var(--flat-bg); color: var(--muted); margin-left: 6px;
}
input:disabled { background: var(--flat-bg); color: var(--muted); }

/* ---- Account detail ----------------------------------------------------- */
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.twocol > div { min-width: 0; }
table.kv { width: 100%; border-collapse: collapse; }
table.kv th {
  text-align: left; font-weight: 600; font-size: 13px; color: var(--muted);
  padding: 7px 12px 7px 0; vertical-align: top; width: 42%;
}
table.kv td { padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
table.kv tr:last-child td, table.kv tr:last-child th { border-bottom: 0; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
ul.plain li:first-child { border-top: 0; }
.tiles.six { grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.tiles.six .tval { font-size: 17px; }
.warnstrip {
  background: var(--warn-bg); border-left: 3px solid var(--amber-fill);
  padding: 10px 14px; border-radius: 6px; font-size: 13px; margin: 0 0 18px;
}
@media (max-width: 900px) {
  .twocol { grid-template-columns: 1fr; }
  .tiles.six { grid-template-columns: repeat(2, 1fr); }
}

/* ---- Intake ------------------------------------------------------------- */
h1.sub { font-size: 16px; }
ol.steps { margin: 0 0 10px; padding-left: 20px; line-height: 1.9; font-size: 14px; }
ol.steps code { font-size: 12px; }
