/* ============================================================
   Ascenix — the live product surfaces.

   Redrawn in HTML/CSS rather than shipped as screenshots, so
   they stay sharp at any density, animate, respond to a click,
   and port straight into the app's own components.

   All data below is placeholder. No real resident appears on
   this site.
   ============================================================ */

/* ---------- App frame ------------------------------------ */

.app {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--white);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  font-size: 13px;
  color: var(--text);
}

/* Floating the hero shot: a wider, softer shadow so it lifts
   off the page the way the reference sites' shots do. */
.app--hero {
  box-shadow:
    0 2px 6px rgba(11, 18, 32, .04),
    0 18px 40px rgba(11, 18, 32, .08),
    0 48px 120px rgba(11, 18, 32, .12);
}

.app__rail {
  background: var(--subtle);
  border-right: 1px solid var(--border);
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.app__railbtn {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-muted);
}
.app__railbtn svg { width: 15px; height: 15px; }
.app__railbtn--on { background: var(--brand); color: #fff; box-shadow: var(--sh-glow); }

.app__main { min-width: 0; display: flex; flex-direction: column; }

.app__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}
.app__crumb {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-2);
}
.app__crumb b { color: var(--ink); font-weight: 600; }
.app__crumb .sep { color: var(--n-300); }
.app__baricons { display: flex; align-items: center; gap: 8px; color: var(--text-muted); }
.app__baricons svg { width: 14px; height: 14px; }
.app__dot {
  position: relative; display: grid; place-items: center;
  width: 22px; height: 22px;
}
.app__dot::after {
  content: '1';
  position: absolute; top: -2px; right: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 8px; font-weight: 700;
  display: grid; place-items: center;
}

.app__body { padding: 10px 16px 16px; background: var(--subtle); flex: 1; }

.app__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.app__title { font-size: 19px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.app__sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.app__compare { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

.app__controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Filters, chips ------------------------------- */

.dchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-out);
}
.dchip svg { width: 12px; height: 12px; opacity: .7; }
.dchip:hover { border-color: var(--n-300); color: var(--ink); }
.dchip[aria-pressed='true'],
.dchip--on {
  border-color: var(--brand);
  background: var(--info-bg);
  color: var(--cyan-700);
}
.dchip--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #04212A;
  box-shadow: var(--sh-glow);
}

.dfilters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* ---------- Metric cards --------------------------------- */

.dgrid { display: grid; gap: 12px; }
.dgrid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dgrid--split { grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); }
@media (max-width: 780px) {
  .dgrid--3 { grid-template-columns: minmax(0, 1fr); }
  .dgrid--split { grid-template-columns: minmax(0, 1fr); }
}

.dcard {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px 14px;
  box-shadow: var(--sh-xs);
}
.dcard__head {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 8px;
}
.dcard__label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.dcard__note { font-size: 10.5px; color: var(--text-muted); }
.dcard__value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.dcard__value--danger  { color: var(--danger); }
.dcard__value--success { color: var(--success); }
.dcard__value--warning { color: var(--warning); }

.dicon { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; }
.dicon svg { width: 12px; height: 12px; }
.dicon--danger  { background: var(--danger-bg);  color: var(--danger); }
.dicon--success { background: var(--success-bg); color: var(--success); }
.dicon--warning { background: var(--warning-bg); color: var(--warning); }

.dcard__foot {
  margin-top: 10px;
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: right;
}

/* ---------- Panel (chart / ring holder) ------------------ */

.dpanel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--sh-xs);
  display: flex;
  flex-direction: column;
  /* A board sets its own alignment, and this is not defensive
     tidiness — it is a bug that has already shipped twice.
     `text-align` inherits, and a board drops into centred
     containers all over this site: the module rail centres its
     segments, the sticky split centres its stage, a hero band
     centres everything in it. The board then comes out with its
     title, its subline and every table cell centred, which reads
     as a broken component rather than as an inherited property.
     Fixed 2026-08-19 after Owen caught it on the behaviours and
     hydration boards in the module rail. */
  text-align: left;
}
.dpanel__head {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 10px;
  /* 10px put the subline hard against the top of the chart and the
     two read as one block. The head is a caption for what is under
     it and needs to look like one. */
  margin-bottom: 18px;
}
.dpanel__title { font-size: 13px; font-weight: 600; color: var(--ink); }
.dpanel__sub { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ---------- Stat ring ------------------------------------ */

.dring { display: grid; place-items: center; padding: 6px 0 2px; flex: 1; }
.dring svg { width: 148px; height: 148px; transform: rotate(-90deg); }
.dring__track { fill: none; stroke: var(--n-100); stroke-width: 13; }
/* Offset 0 = a full ring. JS rewinds it to 396 and animates back
   in, so with JS off the ring still reads correctly. */
.dring__arc {
  fill: none;
  stroke: var(--danger);
  stroke-width: 13;
  stroke-linecap: round;
  stroke-dasharray: 396;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.1s var(--ease-spring);
}
.dring__wrap { position: relative; display: grid; place-items: center; }
.dring__mid {
  position: absolute;
  text-align: center;
  display: grid;
  gap: 1px;
}
.dring__value {
  font-size: 32px; font-weight: 700; color: var(--ink); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.dring__cap { font-size: 11px; color: var(--text-muted); }
.dring__note { margin-top: 12px; font-size: 11px; color: var(--text-2); text-align: center; }

/* ---------- Bar chart ------------------------------------ */

.dchart { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 6px; flex: 1; }

.dchart__ticks {
  display: flex; flex-direction: column;
  justify-content: space-between;
  font-size: 9.5px; color: var(--text-muted);
  text-align: right;
  height: 150px;
  padding-bottom: 1px;
}

.dchart__plot {
  position: relative;
  height: 150px;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}
.dchart__plot::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    to top, transparent 0, transparent calc(25% - 1px),
    var(--n-100) calc(25% - 1px), var(--n-100) 25%
  );
  pointer-events: none;
}

.dbar {
  position: relative;
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.dbar__fill {
  width: 58%;
  max-width: 34px;
  border-radius: 6px 6px 0 0;
  transition: height 1.1s var(--ease-spring), opacity var(--dur-fast) var(--ease-out);
}
.dbar:hover .dbar__fill { opacity: .88; }
.dbar__val {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.dchart__labels {
  grid-column: 2;
  display: flex;
  justify-content: space-around;
  gap: 4px;
  margin-top: 7px;
}
.dchart__labels span {
  flex: 1;
  font-size: 9px;
  line-height: 1.25;
  color: var(--text-muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.dchart__avg {
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--text-2);
  text-align: center;
}

/* Chart variants swap by hiding, so no-JS still shows one. */
[data-chart][hidden] { display: none; }

/* ---------- Data table ----------------------------------- */

.dtable-wrap { overflow-x: auto; }
.dtable {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  background: var(--white);
  font-size: 11.5px;
}
.dtable th {
  text-align: left;
  padding: 9px 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--subtle);
  white-space: nowrap;
}
.dtable td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--n-100);
  color: var(--text);
  vertical-align: middle;
}
.dtable tr[data-flag='non-compliant'] td { background: #FDECEC; }
.dtable tr:hover td { background: var(--cyan-50); }
.dtable tr[data-flag='non-compliant']:hover td { background: #FCE3E3; }
.dtable .name { font-weight: 600; color: var(--ink); white-space: nowrap; }
.dtable .date { color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dtable .cause { color: var(--text-2); }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.tag--neutral { background: var(--n-100); color: var(--text-2); }
.tag--danger  { background: var(--danger-bg); color: #B42318; }

/* Why a row is red — the part prospects react to. */
.whyflag { position: relative; display: inline-flex; align-items: center; gap: 5px; }
.whyflag__mark {
  width: 14px; height: 14px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--danger-bg);
  color: #B42318;
  font-size: 9px; font-weight: 800;
  cursor: help;
}
.whyflag__pop {
  position: absolute;
  top: calc(100% + 8px);
  left: -8px;
  z-index: 5;
  width: 196px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--sh-md);
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--text);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              visibility var(--dur-fast);
}
.whyflag:hover .whyflag__pop,
.whyflag:focus-within .whyflag__pop { opacity: 1; visibility: visible; transform: translateY(0); }
.whyflag__pop b { color: var(--ink); }
.whyflag__pop .tag { margin-top: 6px; }

/* ---------- Insight rows (the trends view) ---------------
   The Key Insights list off the trends screen: the analysis
   arrives as a plain sentence with a coloured spine, not as
   another chart to interpret. The row's own --c carries the
   severity colour, the way the module boards carry theirs. */

.dinsight { display: grid; gap: 7px; }
.dinsight__row {
  --c: var(--cyan-700);
  border-left: 3px solid var(--c);
  background: var(--subtle);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-2);
}
.dinsight__row b {
  display: block;
  font-size: 11.5px;
  color: var(--ink);
  margin-bottom: 1px;
}

/* ---------- Glenn AI panel ------------------------------- */

.glenn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 430px;
}

.glenn__bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--cyan-50), var(--white));
}
.glenn__spark {
  width: 24px; height: 24px;
  border-radius: 7px;
  display: grid; place-items: center;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--sh-glow);
  flex: 0 0 auto;
}
.glenn__spark svg { width: 13px; height: 13px; }
.glenn__name { font-size: 13px; font-weight: 700; color: var(--ink); }
.glenn__meta { font-size: 10.5px; color: var(--text-muted); }

/* Fixed minimum so switching beats doesn't resize the card and
   shove the rest of the page around. */
.glenn__body { padding: 15px; flex: 1; overflow: hidden; min-height: 292px; }

/* A nurse's note, unedited — beat 1 */
.note {
  border: 1px solid var(--border);
  border-left: 2px solid var(--n-300);
  border-radius: var(--r-sm);
  background: var(--subtle);
  padding: 11px 13px;
  font-size: 12px;
  line-height: 1.62;
  color: var(--text);
}
.note__src {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.note + .note { margin-top: 9px; }
.note mark { background: var(--cyan-100); color: var(--cyan-800); border-radius: 3px; padding: 0 2px; }

/* The report Glenn returns — beat 2 */
.report { display: grid; gap: 11px; }
.report__item { font-size: 12px; line-height: 1.6; color: var(--text); }
.report__item b { color: var(--ink); font-weight: 700; }

/* Follow-up exchange — beat 3 */
.ask {
  display: inline-block;
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 14px 14px 4px 14px;
  background: var(--info-bg);
  border: 1px solid var(--cyan-100);
  color: var(--cyan-800);
  font-size: 12px;
  font-weight: 600;
  margin-left: auto;
}
.answer {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.62;
  color: var(--text);
}
.exchange { display: grid; gap: 2px; }
.exchange__row { display: flex; }

/* The drafted note — beat 4 */
.draft {
  border: 1px dashed var(--cyan-200);
  border-radius: var(--r-sm);
  background: var(--cyan-50);
  padding: 12px 13px;
  font-size: 12px;
  line-height: 1.62;
  color: var(--text);
}
.draft__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.draft__label {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--cyan-700);
}

.glenn__chips {
  display: flex; gap: 7px; flex-wrap: wrap;
  padding: 0 15px 11px;
}
.glenn__composer {
  display: flex; align-items: center; gap: 8px;
  margin: 0 15px 15px;
  padding: 9px 9px 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--white);
}
.glenn__composer input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 12px; color: var(--text);
}
.glenn__composer input::placeholder { color: var(--text-muted); }
.glenn__send {
  width: 26px; height: 26px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #04212A;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.glenn__send svg { width: 12px; height: 12px; }

.glenn__disclaimer {
  padding: 0 15px 13px;
  font-size: 9.5px;
  color: var(--text-muted);
  text-align: center;
}

/* ---------- Risk Radar: rank list + severity heatmap ----- */

.rank { display: grid; gap: 6px; }
.rank__row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 54px 88px;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--white);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.rank__row:hover { border-color: var(--cyan-200); box-shadow: var(--sh-xs); }
.rank__n {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  text-align: right;
}
.rank__name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.rank__unit { font-size: 10.5px; color: var(--text-muted); }
.rank__score {
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.rank__bar {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--n-100);
  overflow: hidden;
}
.rank__bar i {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 1.1s var(--ease-spring);
}

.heat { display: grid; gap: 3px; }
.heat__row { display: grid; grid-template-columns: 96px repeat(12, minmax(0, 1fr)); gap: 3px; align-items: center; }
.heat__label { font-size: 10.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat__cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--n-100);
}
.heat__head { font-family: var(--font-mono); font-size: 8.5px; color: var(--text-muted); text-align: center; }
.heat__key { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-muted); margin-top: 10px; }
.heat__key i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

@media (max-width: 560px) {
  .heat__row { grid-template-columns: 60px repeat(12, minmax(0, 1fr)); }
  .rank__row { grid-template-columns: 20px minmax(0, 1fr) 44px 60px; }
}

/* ---------- Sample-data footnote ------------------------- */

.sample-note {
  margin-top: var(--space-4);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.section--ink .sample-note { color: rgba(255, 255, 255, .4); }

/* ---------- Scale down on small screens ------------------
   The dashboard has a real information density; shrinking the
   whole board is honest, reflowing it into something the app
   never shows is not. */

@media (max-width: 720px) {
  .app { font-size: 12px; }
  .app__body { padding: 12px; }
  .app__title { font-size: 16px; }
  .dring svg { width: 124px; height: 124px; }
  .dring__value { font-size: 26px; }
}
