/* Bayut Studios — proposal pipeline dashboard.
   Palette and type follow the Bayut Studios Design System (Brand Guidelines v1.0, SEPT2025):
   dark #083438 → ink #010C21 ground, mint #2FED97 accent, DM Sans, translucent 16px cards,
   no shadows, no icons. The white + mint wordmark only works on dark, so the page is dark-only. */

:root {
  color-scheme: dark;

  /* Official palette */
  --brand-mint: #2FED97;
  --brand-dark: #083438;
  --brand-cyan: #06B0B1;
  --brand-ink: #010C21;
  --brand-ice: #CCEEF0;
  --bayut-green: #28B06C;

  /* Deck ramp + neutrals */
  --teal-950: #05181C;
  --teal-900: #061E22;
  --teal-800: #0C3A3F;
  --teal-700: #124647;
  --white: #FFFFFF;
  --bone: #FBFAF7;
  --sage: #AFBCB8;
  --sage-dim: #8A9B99;

  /* Semantic */
  --ground: linear-gradient(170deg, var(--brand-dark) 0%, #062A30 45%, var(--brand-ink) 100%);
  --ground-flat: #041E24;
  --surface: rgba(12, 58, 63, 0.42);
  --surface-hover: rgba(18, 70, 71, 0.5);
  --surface-strong: rgba(18, 70, 71, 0.62);
  --surface-sunk: rgba(1, 12, 33, 0.34);
  --hairline: #124647;
  --hairline-soft: rgba(18, 70, 71, 0.65);
  --text-heading: var(--white);
  --text-body: var(--sage);
  --text-emphasis: var(--bone);
  --text-muted: var(--sage-dim);
  --accent: var(--brand-mint);
  --warn: #F5B942;
  --link: var(--brand-mint);
  --focus: var(--brand-mint);

  /* Pipeline stages (semantic, separate from the accent) */
  --st-submitted: #9DB9BC;
  --st-discussion: #2BC6C7;
  --st-negotiation: #F5B942;
  --st-contracting: #A7F5CF;
  --st-won: #2FED97;
  --st-lost: #FF7B6E;

  --font: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --gutter: clamp(16px, 4vw, 56px);
}

* { box-sizing: border-box; }
html { background: var(--ground-flat); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  background-attachment: fixed;
  color: var(--text-body);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--link); text-decoration: none; transition: color 160ms var(--ease); }
a:hover { color: var(--white); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Stage colour hook ---------- */
.st-submitted { --st: var(--st-submitted); }
.st-discussion { --st: var(--st-discussion); }
.st-negotiation { --st: var(--st-negotiation); }
.st-contracting { --st: var(--st-contracting); }
.st-won { --st: var(--st-won); }
.st-lost { --st: var(--st-lost); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--st, var(--st-submitted)); }

/* ---------- Chrome & frame ---------- */
.chrome-top { height: 6px; background: var(--bayut-green); }
.chrome-bottom { height: 6px; background: var(--teal-800); margin-top: 56px; }
.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding-inline: var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.wrap > * { min-width: 0; }

/* ---------- Masthead ---------- */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  padding-block: 30px 22px;
  border-bottom: 1px solid var(--hairline);
}
.masthead-id { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.logo { height: 26px; width: auto; opacity: .9; align-self: flex-start; }
.eyebrow {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.02;
  font-weight: 500;
  color: var(--text-heading);
  letter-spacing: -.015em;
}
.masthead-meta { margin: 0; color: var(--text-body); font-size: 14px; text-align: right; line-height: 1.6; }
.masthead-meta strong { color: var(--text-emphasis); font-weight: 500; }

/* ---------- Lede & how-to ---------- */
.lede-block { display: flex; flex-direction: column; gap: 14px; }
.lede {
  margin: 0;
  font-size: clamp(19px, 2vw, 26px);
  line-height: 1.4;
  color: var(--text-body);
  max-width: 62ch;
  text-wrap: pretty;
}
.lede b { color: var(--text-heading); font-weight: 500; }
.lede b.m { color: var(--accent); }
.lede b.w { color: var(--warn); }

.howto { align-self: flex-start; max-width: 100%; }
.howto summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--link);
  padding: 6px 0;
}
.howto summary::-webkit-details-marker { display: none; }
.howto summary::before { content: "+"; display: inline-grid; place-items: center; width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; font-size: 13px; line-height: 1; }
.howto[open] summary::before { content: "–"; }
.howto summary:hover { color: var(--white); }
.howto-grid {
  margin-top: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 20px 32px;
}
.howto h4 { margin: 0 0 6px; font-size: 13px; font-weight: 500; color: var(--text-heading); }
.howto p { margin: 0 0 12px; font-size: 13.5px; color: var(--text-body); max-width: 60ch; }
.stage-defs { margin: 0; display: flex; flex-direction: column; gap: 7px; }
.stage-defs div { display: grid; grid-template-columns: 118px 1fr; gap: 10px; font-size: 13px; }
.stage-defs dt { display: flex; align-items: center; gap: 8px; color: var(--text-emphasis); }
.stage-defs dd { margin: 0; color: var(--text-body); }

/* ---------- KPI tiles ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  text-align: left;
  color: inherit;
}
.kpi .label, .label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.kpi .value {
  font-size: clamp(24px, 2.2vw, 32px);
  line-height: 1.1;
  font-weight: 500;
  color: var(--text-heading);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi .value small { font-size: .5em; font-weight: 500; color: var(--text-muted); margin-right: 4px; letter-spacing: .06em; }
.kpi .value .sep { color: var(--text-muted); }
.kpi .sub { font-size: 12.5px; color: var(--text-body); }
.kpi.lead .value { color: var(--accent); }
.kpi.warn .value { color: var(--warn); }
.kpi-btn { cursor: pointer; transition: background 160ms var(--ease), transform 160ms var(--ease); }
.kpi-btn:hover { background: var(--surface-hover); transform: translateY(-2px); }

/* ---------- Panels ---------- */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.panel h3 { margin: 0; font-size: 16px; font-weight: 500; color: var(--text-heading); }
.panel .hint { margin: -10px 0 0; font-size: 12.5px; color: var(--text-muted); }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.panel-sub { font-size: 13px; color: var(--text-body); font-variant-numeric: tabular-nums; }

/* ---------- Needs attention ---------- */
.attention { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; scroll-margin-top: 16px; }
.alist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.aitem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(118px, auto);
  align-items: center;
  gap: 4px 16px;
  padding: 11px 10px;
  margin-inline: -10px;
  border-radius: var(--radius-sm);
  border-top: 1px solid var(--hairline-soft);
  cursor: pointer;
  transition: background 160ms var(--ease);
}
.aitem:first-child { border-top: 0; }
.aitem:hover { background: var(--surface-sunk); }
.a-main { display: flex; flex-direction: column; min-width: 0; }
.a-client { color: var(--text-heading); font-weight: 500; }
.a-proj { color: var(--text-body); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-amt { color: var(--text-emphasis); font-weight: 500; white-space: nowrap; text-align: right; }
.a-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.a-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.days { color: var(--warn); font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.linkbtn { font-size: 13.5px; color: var(--link); background: none; border: 0; padding: 4px 0; cursor: pointer; align-self: flex-start; }
.linkbtn:hover { color: var(--white); }

/* ---------- Charts ---------- */
.insights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.hbars { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.hbar {
  display: grid;
  grid-template-columns: minmax(92px, 132px) minmax(40px, 1fr) auto;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin-inline: -8px;
  min-height: 34px;
}
.hbar.clickable { cursor: pointer; }
.hbar.clickable:hover { background: var(--surface-sunk); }
.hbar.active { background: var(--surface-strong); }
.hbar .name { color: var(--text-emphasis); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { position: relative; height: 12px; }
.hbar .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  border-radius: 0 4px 4px 0;
  background: var(--st, var(--accent));
  min-width: 3px;
  transition: width 480ms var(--ease);
}
.hbar .figure { color: var(--text-body); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hbar .figure b { color: var(--text-emphasis); font-weight: 500; }

.vchart { display: flex; flex-direction: column; gap: 8px; }
.vbars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 18px;
  align-items: end;
  height: 180px;
  border-bottom: 1px solid var(--hairline);
  padding-inline: 4px;
}
.vbar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 6px; cursor: pointer; border-radius: 6px 6px 0 0; }
.vbar .cap { text-align: center; font-size: 12.5px; color: var(--text-emphasis); }
.vbar .col { background: var(--accent); border-radius: 4px 4px 0 0; min-height: 3px; transition: height 480ms var(--ease), opacity 160ms var(--ease); }
.vbar:hover .col { opacity: .85; }
.vbar.dim .col { opacity: .3; }
.vaxis { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 18px; padding-inline: 4px; }
.vaxis span { text-align: center; font-size: 12px; color: var(--text-muted); }
.vaxis span b { display: block; color: var(--text-body); font-weight: 500; font-size: 13px; }

/* ---------- Section heads ---------- */
.section-head { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; scroll-margin-top: 16px; }
.rule { display: block; width: 44px; height: 6px; background: var(--accent); border-radius: 1px; }
h2 { margin: 0; font-size: 24px; font-weight: 500; color: var(--text-heading); line-height: 1.15; }
.section-note { margin: 0; font-size: 13.5px; color: var(--text-muted); max-width: 70ch; }

/* ---------- Controls ---------- */
.controls { display: flex; flex-direction: column; gap: 12px; margin-top: -10px; }
.ctl-row { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: center; }
.ctl-more { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1 1 auto; }
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: var(--surface-sunk);
  border: 1px solid var(--hairline);
}
.seg button {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-body);
  background: transparent;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--brand-ink); }
.seg button:not([aria-pressed="true"]):hover { color: var(--white); }
.search, .select {
  font-size: 14px;
  color: var(--text-emphasis);
  background: var(--surface-sunk);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 42px;
}
.search { flex: 1 1 260px; min-width: 0; }
.search::placeholder { color: var(--text-muted); }
.search::-webkit-calendar-picker-indicator { display: none !important; }
.select { max-width: 100%; padding-right: 12px; }
.select option { background: var(--teal-900); color: var(--bone); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 7px 13px 7px 11px;
  min-height: 36px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: border-color 160ms var(--ease), color 160ms var(--ease), background 160ms var(--ease);
}
.chip:hover { color: var(--white); border-color: var(--sage-dim); }
.chip[aria-pressed="true"] { background: var(--surface-strong); color: var(--white); border-color: var(--st, var(--accent)); }
.chip .n { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.followchip { --st: var(--warn); }
.btn-ghost {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--link);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 9px 16px;
  min-height: 40px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}
.btn-ghost:hover { color: var(--white); border-color: var(--sage-dim); }
.btn-ghost.sm { font-size: 12.5px; padding: 5px 12px; min-height: 32px; align-self: flex-start; }
.filters-toggle { display: none; }
.filters-toggle.has { color: var(--brand-ink); background: var(--accent); border-color: var(--accent); }
.resultline { font-size: 13.5px; color: var(--text-body); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }
.resultline b { color: var(--text-emphasis); font-weight: 500; font-variant-numeric: tabular-nums; }
.searchfix { flex-basis: 100%; font-style: italic; }
.empty .linkbtn { font-size: inherit; padding: 0; }

/* ---------- List ---------- */
.list { display: flex; flex-direction: column; gap: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.dev-grid { grid-template-columns: minmax(180px, 1.6fr) 112px minmax(170px, 1.5fr) 150px 116px minmax(170px, 1.3fr) 20px; }
.prop-grid { grid-template-columns: minmax(190px, 1.5fr) 128px 140px minmax(220px, 2fr) 128px 150px 20px; }
.lhead {
  display: grid;
  gap: 16px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(1, 12, 33, 0.22);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.r { text-align: right; justify-content: flex-end; }
.lrow {
  display: grid;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline-soft);
  cursor: pointer;
  transition: background 160ms var(--ease);
  scroll-margin-top: 80px;
}
.lrow:hover { background: rgba(1, 12, 33, 0.2); }
.lrow[aria-expanded="true"] { background: var(--surface-sunk); border-bottom-color: transparent; }
.lrow > span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lrow > .r { align-items: flex-end; }
.lrow.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 40% { background: rgba(47, 237, 151, 0.16); } 100% { background: var(--surface-sunk); } }

.client { color: var(--text-heading); font-weight: 500; font-size: 15px; line-height: 1.25; }
.sub { color: var(--text-body); font-size: 13px; line-height: 1.35; }
.c-name .sub { color: var(--text-muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; flex-direction: row !important; }
.tag { font-size: 11px; color: var(--brand-ice); border: 1px solid var(--hairline); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.tag.cls { color: var(--brand-ink); background: var(--brand-ice); border-color: var(--brand-ice); }
.tag.cnt { color: var(--accent); border-color: var(--accent); font-weight: 500; }
.big { font-size: 22px; font-weight: 500; color: var(--text-heading); line-height: 1; }
.big small { font-size: 13px; font-weight: 400; color: var(--text-body); letter-spacing: 0; }
.c-stage { flex-direction: row !important; flex-wrap: wrap; gap: 6px !important; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  color: var(--text-emphasis);
  padding: 4px 10px 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--st, var(--hairline));
  background: rgba(1, 12, 33, 0.25);
  align-self: flex-start;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--st, var(--st-submitted)); }
.pill .pn { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.amt { color: var(--text-heading); font-weight: 500; font-size: 15px; white-space: nowrap; }
.amt.na { color: var(--text-muted); font-weight: 400; font-size: 13px; }
.amt-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.date { color: var(--text-emphasis); white-space: nowrap; }
.when-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.when-sub.stale { color: var(--warn); }
.em { color: var(--text-emphasis); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.c-svc { color: var(--text-body); font-size: 13.5px; }
.c-links, .m-links { flex-direction: row !important; flex-wrap: wrap; gap: 8px !important; align-items: center; }
.btn-link {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 500;
  color: var(--brand-ink); background: var(--accent);
  border-radius: 999px; padding: 6px 12px; min-height: 32px;
  white-space: nowrap;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.btn-link:hover { background: var(--white); color: var(--brand-ink); }
.btn-link.sec { color: var(--link); background: transparent; border: 1px solid var(--hairline); }
.btn-link.sec:hover { color: var(--white); border-color: var(--sage-dim); background: transparent; }
.chev { width: 20px; height: 20px; justify-self: end; position: relative; }
.chev::before {
  content: ""; position: absolute; inset: 0; margin: auto; width: 8px; height: 8px;
  border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: translateY(-2px) rotate(45deg); transition: transform 260ms var(--ease);
}
.lrow[aria-expanded="true"] .chev::before { transform: translateY(2px) rotate(-135deg); border-color: var(--accent); }

/* Expanded panels */
.lpanel { background: var(--surface-sunk); padding: 4px 20px 22px; border-bottom: 1px solid var(--hairline); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 18px 28px; }
.dblock, .dev-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dblock p, .dev-side p { margin: 0; color: var(--text-body); font-size: 13.5px; }
.dblock ul, .dev-side ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.plist li { color: var(--text-emphasis); }
.opts li { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px dashed var(--hairline-soft); padding-bottom: 5px; color: var(--text-body); }
.opts b { color: var(--text-emphasis); font-weight: 500; white-space: nowrap; }
.hist li { color: var(--text-body); font-size: 13px; padding-left: 12px; position: relative; }
.hist li::before { content: ""; position: absolute; left: 0; top: .6em; width: 5px; height: 5px; border-radius: 50%; background: var(--sage-dim); }
.clist .em { white-space: normal; overflow-wrap: anywhere; }
.dev-side .label { margin-top: 10px; }
.dev-side .label:first-child { margin-top: 0; }

.dev-detail { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 1fr); gap: 20px 32px; }
.dev-props { display: flex; flex-direction: column; min-width: 0; }
.dev-props > .label { margin-bottom: 4px; }
.mini {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) 120px 130px 122px 150px;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--hairline-soft);
}
.mini > span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mini > .r { align-items: flex-end; }
.m-proj b { color: var(--text-emphasis); font-weight: 500; }
.m-proj .tag { align-self: flex-start; margin-top: 2px; }

.empty { margin: 0; padding: 40px 20px; text-align: center; color: var(--text-muted); }

/* ---------- Upcoming ---------- */
.upcoming { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px; }
.up { background: var(--surface); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 5px; }
.up .when { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-variant-numeric: tabular-nums; }
.up .who { color: var(--text-heading); font-weight: 500; }
.up .what { color: var(--text-emphasis); }
.up .why { color: var(--text-body); font-size: 13px; }

/* ---------- Footer ---------- */
.foot {
  border-top: 1px solid var(--hairline);
  padding-top: 20px;
  display: flex; flex-wrap: wrap; gap: 16px 40px; justify-content: space-between;
  font-size: 12.5px; color: var(--text-muted);
}
.foot ul { margin: 0; padding: 0 0 0 16px; display: flex; flex-direction: column; gap: 4px; max-width: 80ch; }
.brandline { letter-spacing: .24em; text-transform: uppercase; font-size: 11px; color: var(--text-muted); align-self: flex-end; }

/* ---------- Tooltip & toast ---------- */
.tip {
  position: fixed; z-index: 20; pointer-events: none;
  background: var(--teal-950); color: var(--bone);
  border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 12.5px; line-height: 1.45; max-width: 280px;
  font-variant-numeric: tabular-nums;
}
.tip b { color: var(--white); font-weight: 500; }
.toast {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--accent); color: var(--brand-ink);
  font-weight: 500; font-size: 13.5px;
  padding: 10px 18px; border-radius: 999px; max-width: calc(100% - 32px); text-align: center;
}

/* =========================================================
   Tablet
   ========================================================= */
@media (max-width: 1180px) {
  .dev-grid { grid-template-columns: minmax(170px, 1.4fr) 96px minmax(150px, 1.3fr) 130px 108px 20px; }
  .dev-grid .c-contacts, .lhead.dev-grid span:nth-child(6) { display: none; }
  .prop-grid { grid-template-columns: minmax(180px, 1.4fr) 118px 130px minmax(180px, 1.6fr) 124px 20px; }
  .prop-grid .c-links, .lhead.prop-grid span:nth-child(6) { display: none; }
  .mini { grid-template-columns: minmax(180px, 2fr) 116px 120px 120px; }
  .mini .m-links { grid-column: 1 / -1; }
  .dev-detail { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .attention, .insights { grid-template-columns: 1fr; }

  /* List becomes stacked cards */
  .list { background: transparent; border-radius: 0; overflow: visible; gap: 10px; }
  .lhead { display: none; }
  .lrow {
    background: var(--surface);
    border-radius: var(--radius);
    border: 0;
    padding: 16px 16px 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 14px;
    align-items: start;
  }
  .lrow[aria-expanded="true"] { border-radius: var(--radius) var(--radius) 0 0; background: var(--surface-strong); }
  .lpanel { border-radius: 0 0 var(--radius) var(--radius); margin-top: -10px; padding: 16px; border: 0; background: var(--surface-strong); }

  /* developer card */
  .dev-grid .c-name { grid-column: 1; grid-row: 1; }
  .dev-grid .c-amt { grid-column: 2; grid-row: 1; }
  .dev-grid .c-proj { grid-column: 1; grid-row: 2; flex-direction: row !important; align-items: baseline; gap: 8px !important; }
  .dev-grid .c-when { grid-column: 2; grid-row: 2; align-items: flex-end; text-align: right; }
  .dev-grid .c-stage { grid-column: 1 / -1; grid-row: 3; }
  .dev-grid .c-contacts { display: none; }
  .dev-grid .chev { display: none; }
  .big { font-size: 18px; }

  /* proposal card */
  .prop-grid .c-name { grid-column: 1; grid-row: 1; }
  .prop-grid .c-amt { grid-column: 2; grid-row: 1; }
  .prop-grid .c-svc { grid-column: 1 / -1; grid-row: 2; }
  .prop-grid .c-when { grid-column: 1; grid-row: 3; }
  .prop-grid .c-stage { grid-column: 2; grid-row: 3; justify-content: flex-end; }
  .prop-grid .c-links { display: flex; grid-column: 1 / -1; grid-row: 4; }
  .prop-grid .chev { display: none; }

  .mini { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px 0; }
  .mini .m-proj { grid-column: 1 / -1; }
  .mini .m-when { grid-column: 1; }
  .mini .m-amt { grid-column: 2; align-items: flex-end; }
  .mini .m-stage { grid-column: 1; }
  .mini .m-links { grid-column: 1 / -1; }
}

/* =========================================================
   Phone
   ========================================================= */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { gap: 22px; }
  .chrome-top { height: 4px; }
  .masthead { padding-block: 20px 16px; align-items: flex-start; }
  .logo { height: 22px; }
  .masthead-meta { text-align: left; font-size: 13px; }
  .lede { font-size: 18px; }

  /* KPI strip: swipe sideways */
  .kpis {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .kpis::-webkit-scrollbar { display: none; }
  .kpi { flex: 0 0 72%; scroll-snap-align: start; padding: 16px 18px; }
  .kpi .value { font-size: 28px; }

  .panel { padding: 18px 16px; }
  .aitem { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 8px; margin-inline: -8px; }
  .a-meta { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .hbar { grid-template-columns: minmax(84px, 108px) minmax(30px, 1fr) auto; gap: 10px; min-height: 40px; }
  .vbars { height: 150px; gap: 12px; }
  .vaxis { gap: 12px; }

  /* Controls: primary row, filters in a drawer */
  .controls { margin-top: -6px; }
  .ctl-row { gap: 8px; }
  .seg { width: 100%; }
  .seg button { flex: 1 1 0; padding: 10px 8px; min-height: 42px; }
  .search { flex: 1 1 100%; font-size: 16px; min-height: 46px; }
  .select { flex: 1 1 0; min-width: 0; font-size: 15px; min-height: 44px; }
  .filters-toggle { display: inline-flex; align-items: center; min-height: 44px; }
  .ctl-more { display: none; background: var(--surface); border-radius: var(--radius); padding: 14px; }
  .ctl-more.open { display: flex; }
  .ctl-more .select { flex: 1 1 100%; }
  .ctl-more .spacer { display: none; }
  .ctl-more .btn-ghost { flex: 1 1 100%; min-height: 44px; }
  .chip { min-height: 40px; }

  .lrow { padding: 16px; }
  .client { font-size: 16px; }
  .amt { font-size: 16px; }
  .btn-link { min-height: 40px; padding: 8px 16px; font-size: 13.5px; flex: 1 1 0; }
  .stage-defs div { grid-template-columns: 1fr; gap: 2px; }
  .foot { flex-direction: column; }
}

@media (hover: none) {
  .kpi-btn:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Declined RFPs */
.subhead { margin: 0; font-size: 16px; font-weight: 500; color: var(--text-heading); }
.up.declined { background: var(--surface-sunk); border: 1px solid var(--hairline-soft); }
.up.declined .when { color: var(--st-lost); }
.up.declined .who, .up.declined .what { color: var(--text-body); }
.up.declined { grid-column: 1 / -1; }
.up.declined .why { max-width: 90ch; }

/* ---------- Opportunity funnel ---------- */
.funnel-wrap { display: grid; grid-template-columns: minmax(0, 460px) minmax(0, 1fr); gap: 20px 40px; align-items: center; }
.funnel { position: relative; width: 100%; }
.funnel-svg { display: block; width: 100%; height: auto; }
.fslice { fill: var(--st); transition: opacity 160ms var(--ease); }
.fslice.dim { opacity: .3; }
.flabel { fill: var(--brand-ink); font: 500 14px var(--font); font-variant-numeric: tabular-nums; pointer-events: none; }
.funnel-hits { position: absolute; inset: 0; display: grid; grid-template-rows: repeat(var(--rows, 5), 1fr); row-gap: 2.35%; }
.fhit { display: flex; justify-content: center; }
.fhit-btn { width: 64%; height: 100%; background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
.fhit-btn:hover { background: rgba(255, 255, 255, 0.08); }
.fhit-btn[aria-pressed="true"] { outline: 2px solid var(--white); outline-offset: 1px; }
.funnel-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.funnel-legend li { display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.funnel-legend .sw, .olegend .sw { width: 14px; height: 14px; border-radius: 3px; background: var(--st); flex: none; }
.funnel-legend .ln { color: var(--text-emphasis); }
.funnel-legend .lv { color: var(--text-body); }

/* ---------- Month on month by owner ---------- */
.olegend { list-style: none; margin: -4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--text-emphasis); }
.olegend li { display: flex; align-items: center; gap: 8px; }
.gchart { display: flex; flex-direction: column; gap: 8px; }
.gplot {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 22px;
  height: 200px; align-items: end; padding-inline: 4px;
  border-bottom: 1px solid var(--hairline);
  background-image: linear-gradient(to top, var(--hairline-soft) 1px, transparent 1px);
  background-size: 100% 25%;
}
.ggroup { display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.gbar {
  flex: 1 1 0; height: 100%; min-width: 0; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 4px; border-radius: 6px 6px 0 0;
}
.gbar:hover { background: rgba(255, 255, 255, 0.05); }
.gbar.active { outline: 2px solid var(--white); outline-offset: 1px; }
.gcol { display: block; min-height: 2px; border-radius: 4px 4px 0 0; transition: height 480ms var(--ease); }
.gval { font-size: 11.5px; color: var(--text-emphasis); text-align: center; white-space: nowrap; }
.gaxis { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 22px; padding-inline: 4px; }
.gaxis span { text-align: center; font-size: 12.5px; color: var(--text-body); }
.insights.owners { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .funnel-wrap { grid-template-columns: 1fr; }
  .funnel { max-width: 460px; margin-inline: auto; }
  .insights.owners { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .flabel { font-size: 15px; }
  .gplot, .gaxis { gap: 12px; }
  .gval { font-size: 10.5px; }
}

/* ---------- Sales funnel v2 ---------- */
.funnel2 { display: flex; flex-direction: column; gap: 0; }
.frow { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: center; transition: opacity 160ms var(--ease); }
.frow.dim { opacity: .38; }
.fband {
  height: 64px; width: 100%; border: 0; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font: inherit; transition: filter 160ms var(--ease);
}
.fband:hover { filter: brightness(1.12); }
.frow.on .fband { filter: brightness(1.18); }
.fb-val { font-size: 18px; font-weight: 500; line-height: 1.1; }
.fb-n { font-size: 12px; opacity: .85; }
.finfo { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding-block: 8px; border-bottom: 1px solid var(--hairline-soft); }
.fi-step { color: var(--accent); font-size: 12px; letter-spacing: .08em; }
.fi-body { display: flex; flex-direction: column; min-width: 0; }
.fi-name { color: var(--text-heading); font-weight: 500; font-size: 15px; }
.fi-def { color: var(--text-muted); font-size: 12.5px; }
.fi-share { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.fi-share b { color: var(--text-emphasis); font-weight: 500; font-size: 16px; }
.fi-share span { color: var(--text-muted); font-size: 11px; }
.fconv { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; height: 30px; align-items: center; }
.fconv-line { justify-self: center; width: 1px; height: 100%; background: var(--hairline); }
.fconv-txt { font-size: 12.5px; color: var(--text-body); }
.fconv-txt b { color: var(--text-emphasis); font-weight: 500; }
.fconv .arr { color: var(--bayut-green); }
.funnel-exit { margin: 4px 0 0; font-size: 13px; color: var(--text-body); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.funnel-exit b { color: var(--text-emphasis); font-weight: 500; }
@media (max-width: 640px) {
  .frow, .fconv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .fband { height: 58px; }
  .fb-val { font-size: 15px; }
  .fb-n { font-size: 11px; }
  .finfo { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .fi-step, .fi-def { display: none; }
  .fconv-txt { font-size: 11.5px; }
}

/* Signed-in user */
.masthead-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.whoami { margin: 0; font-size: 13px; color: var(--text-body); }
.whoami strong { color: var(--text-emphasis); font-weight: 500; }
@media (max-width: 640px) { .masthead-side { align-items: flex-start; } }
