/* Portfolio Intelligence: the builder at /portfolio (the fat layer). Linked after /assets/base.css,
   which holds the tokens, fonts, nav, buttons, badge and reveal motion. Order on the page: nav,
   page head and builder (#build), footnote, footer. */

.app {
  --content-w: 1240px;
  --pad: 28px;
  --ok-ink: #157a46;
  --bad-ink: #c23439;
  --ok-soft: #1f9d551a;
  --bad-soft: #e5484d17;
  --nd-soft: #0000000a;
  --track: #0000000f;
  --band: #1f9d5524;
  --hm-mid: #efeff1;
  --row: 36px;
  --sticky-gap: 16px;
  overflow-x: clip;
}

/* In-page targets take focus after a jump, without a ring around a whole section. */
[tabindex="-1"]:focus { outline: none; }

/* ---------- Builder frame ---------- */

.build {
  scroll-margin-top: var(--nav-h);
  --reveal-base: 80ms;
}

.page {
  width: min(var(--content-w), 100% - 2 * var(--gutter));
  margin: 0 auto;
  padding-bottom: 48px;
}

.build-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  padding: 40px 0 32px;
}

/* The page headline: "Fat layer: portfolio construction". */
.build-title {
  font-size: clamp(38px, 5.4vw, 68px);
  letter-spacing: -0.07em;
  line-height: .98;
  padding-bottom: .04em;
  text-wrap: balance;
}

/* The fat layer, defined in 1 line under the headline. */
.build-intro {
  max-width: 640px;
  font-size: 17px;
  line-height: 1.5;
  letter-spacing: -0.022em;
  color: var(--text-2);
  text-wrap: pretty;
}

@media (max-width: 640px) {
  .build-head { padding-top: 28px; gap: 14px; }
  .build-intro { font-size: 15.5px; }
}

.live-word { color: var(--accent); }

.data-strip {
  scroll-margin-top: calc(var(--nav-h) + 16px);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  font-size: 13px;
  color: var(--text-2);
  letter-spacing: -0.01em;
}

.data-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 4px #c98a0021;
}

.data-strip.is-live .data-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.data-strip.has-missing .data-dot { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.ds-part { white-space: nowrap; }
.ds-bad { color: var(--bad-ink); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 20px;
  align-items: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

@media (min-width: 960px) {
  .col {
    position: sticky;
    top: var(--stick-top, calc(var(--nav-h) + var(--sticky-gap)));
  }
}

@media (max-width: 959px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

/* The footnote the asterisk on "Asset checks*" points to. */
.footnote {
  scroll-margin-top: calc(var(--nav-h) + 16px);
  padding: 2px 4px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted-text);
}

.fn-star {
  margin-right: 2px;
  font-weight: 700;
  color: var(--accent);
}

.fn-ref {
  margin-left: .04em;
  color: var(--accent);
  border-radius: 4px;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.fn-ref:hover { opacity: .7; }

.page-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px var(--gutter) 40px;
  text-align: center;
}

.foot-dates { color: var(--muted-text); }

/* ---------- Cards ---------- */

.card {
  scroll-margin-top: calc(var(--nav-h) + 16px);
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: var(--pad);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 20px;
}

.title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.06em;
  color: var(--text);
}

.sub-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-note,
.ex-note {
  font-size: 13px;
  color: var(--muted-text);
  letter-spacing: -0.01em;
}

.card-foot {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--muted-text);
}

.foot-link {
  color: var(--text);
  border-bottom: 1px solid var(--hairline-strong);
  transition: border-color 200ms var(--ease-out);
}
.foot-link:hover,
.foot-link:focus-visible { border-bottom-color: var(--text); }

.count-pill {
  font-size: 13px;
  color: var(--muted-text);
}

.error { margin-bottom: 20px; }
.error p { margin-top: 8px; color: var(--text-2); }

/* ---------- Saved portfolios ---------- */

.starts-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.starts {
  scroll-margin-top: calc(var(--nav-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 26px;
}

.start-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.start-count:empty { display: none; }

.start-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
}

.saved {
  border: 1px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
}

.saved[hidden] { display: none; }

.saved li {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 360ms var(--ease-out), opacity 300ms var(--ease-out);
}

.saved li.is-entering { grid-template-rows: 0fr; opacity: 0; }
.saved li + li { border-top: 1px solid var(--hairline); }

.saved-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 40px;
  min-width: 0;
  overflow: hidden;
  padding: 8px 12px 8px 14px;
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.saved-row:hover { background: #0000000a; }
.saved-row:focus-visible { outline-offset: -2px; }
.saved-row[aria-pressed="true"] { background: var(--accent-soft); }

.saved-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.saved-row[aria-pressed="true"] .saved-name { color: #0060d0; }

.saved-meta {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted-text);
}

.saved-score {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
}

.saved-score[data-band="ok"] { background: var(--ok-soft); color: var(--ok-ink); }
.saved-score[data-band="warn"] { background: #c98a001f; color: #855b00; }
.saved-score[data-band="bad"] { background: var(--bad-soft); color: var(--bad-ink); }

.saved-note {
  font-size: 12.5px;
  color: var(--muted-text);
}

/* While the database answers, placeholder rows hold the room the saved rows will take, so the
   builder below never jumps when they land. */
.saved-skel {
  box-sizing: content-box; /* 40px plus the row's top border, as a real row */
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px; /* the height of a .saved-row */
  padding: 0 12px 0 14px;
}

.saved-skel::before,
.saved-skel::after {
  content: "";
  height: 10px;
  border-radius: 5px;
  background: var(--bg);
}

.saved-skel::before { flex: 0 1 46%; }
.saved-skel::after { flex: none; width: 76px; margin-left: auto; }

.saved.is-loading .saved-skel::before,
.saved.is-loading .saved-skel::after { animation: skel-pulse 1.4s var(--ease-out) infinite alternate; }

@keyframes skel-pulse {
  from { opacity: 1; }
  to { opacity: .45; }
}

/* Its room is held while the list loads, out of sight. */
.saved-more.is-placeholder { visibility: hidden; }

/* Rows that change size inside Saved portfolios never serve as the scroll anchor: the browser holds the
   lines below still instead. */
.starts { overflow-anchor: none; }

.saved-more {
  align-self: flex-start;
  padding: 2px 0;
  font-size: 12.5px;
  color: var(--link);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.saved-more:hover { border-bottom-color: currentColor; }
.saved-more[hidden] { display: none; }

.fchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--hairline-strong);
  background: var(--panel);
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.fchip:hover { border-color: #00000033; }
.fchip:active { transform: scale(.97); }

.fchip { height: 30px; padding: 0 10px; gap: 5px; font-size: 12.5px; }

.fchip.is-on {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.fcount {
  font-size: 11.5px;
  color: var(--muted-text);
  transition: color var(--dur) var(--ease-out);
}

.fchip.is-on .fcount { color: #ffffff99; }

/* ---------- Search and results ---------- */

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 46px;
  padding: 0 96px 0 40px;
  border-radius: 14px;
  border: 1px solid var(--hairline-strong);
  background: var(--bg);
  font: inherit;
  font-size: 15px;
  letter-spacing: var(--track-ui);
  color: var(--text);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color var(--dur) var(--ease-out),
    background-color var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out);
}

.search-box input::placeholder { color: var(--muted-text); }
.search-box input::-webkit-search-cancel-button { display: none; }

.search-box input:focus-visible,
.search-box input:focus {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.search-kbd {
  position: absolute;
  right: 10px;
  height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--hairline-strong);
  background: var(--panel);
  font-family: var(--font-ui);
  font-size: 11.5px;
  line-height: 22px;
  color: var(--muted-text);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
}

.search-box input:focus ~ .search-kbd { opacity: 1; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 10px;
}

.results-wrap {
  position: relative;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
}

.results {
  max-height: calc(7.5 * 46px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #00000026 transparent;
}

.results li + li { border-top: 1px solid var(--hairline); }
.results li[hidden] { display: none; }

.result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 7px 12px 7px 14px;
  text-align: left;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.result:hover,
.result.is-active { background: #0000000a; }

.result:focus-visible {
  outline-offset: -2px;
  border-radius: 0;
}

.result-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.result-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* Country, ticker and type may shorten. The danger score never does. */
.result-meta {
  display: flex;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted-text);
  white-space: nowrap;
}

.rm-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rm-danger { flex: none; }
.rm-danger::before { content: "\00b7"; margin-right: 4px; }

.result-add {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  transition:
    background-color var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
}

.result-add svg { width: 14px; height: 14px; }
.result:hover .result-add { background: var(--text); color: #fff; }
.result.is-held .result-add { background: var(--ok-soft); color: var(--ok-ink); }
.result.is-held:hover .result-add { background: var(--ok-soft); color: var(--ok-ink); }
.result .ico-check { display: none; }
.result.is-held .ico-plus { display: none; }
.result.is-held .ico-check { display: block; }

.results-empty {
  padding: 18px 14px;
  font-size: 13px;
  color: var(--muted-text);
}

.results-count {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted-text);
}

/* ---------- Lines ---------- */

.lines-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 26px 0 4px;
}

.total {
  font-size: 13px;
  color: var(--muted-text);
  transition: color var(--dur) var(--ease-out);
}

.total.is-off { color: var(--text); }

.lines { margin: 0 calc(-1 * var(--pad)); }

.line {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transform: none;
  transition:
    grid-template-rows 360ms var(--ease-out),
    opacity 300ms var(--ease-out),
    transform 360ms var(--ease-out),
    background-color var(--dur) var(--ease-out);
}

.line.is-entering {
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(10px);
}

.line.is-leaving {
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}

.line-clip {
  min-height: 0;
  overflow: hidden;
}

.line-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 104px 28px;
  grid-template-areas:
    "name chips dots remove"
    "slider slider num num";
  align-items: center;
  gap: 8px 10px;
  padding: 14px var(--pad);
  border-top: 1px solid var(--hairline);
  transition: background-color var(--dur) var(--ease-out);
}

.line.is-flag .line-body { background: #0a84ff0a; }
.line.is-zero .line-name { color: var(--muted-text); }

.line-name {
  grid-area: name;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  /* Up to 2 lines, so the part of the name that tells lines apart stays on screen. */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  transition: color var(--dur) var(--ease-out);
}

.line-chips {
  grid-area: chips;
  display: flex;
  gap: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text-2);
  white-space: nowrap;
}

.chip-code {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.line-dots {
  grid-area: dots;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  margin: -6px -4px;
  border-radius: 8px;
  cursor: default;
}

.dot {
  /* Each state has its own shape, so colour is never the only cue:
     pass = round with a tick, fail = square with a cross, no data = open ring, does not apply = dash. */
  --dot: 9px;
  display: inline-block;
  flex: none;
  width: var(--dot);
  height: var(--dot);
  border-radius: 50%;
  background-color: #8e8e93;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 80%;
  transition:
    background-color var(--dur) var(--ease-out),
    border-radius var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
}

.dot.is-pass { background-color: var(--ok); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5.5 12.5 4.2 4.2L18.5 7.8' fill='none' stroke='%23fff' stroke-width='3.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.dot.is-fail { background-color: var(--bad); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 7l10 10M17 7 7 17' fill='none' stroke='%23fff' stroke-width='3.8' stroke-linecap='round'/%3E%3C/svg%3E"); border-radius: 26%; }
.dot.is-nodata { background-color: transparent; box-shadow: inset 0 0 0 1.5px #8e8e93; }
.dot.is-na { background-color: transparent; background-image: linear-gradient(#8e8e93, #8e8e93); background-size: 64% 1.5px; border-radius: 0; }

.line-remove {
  grid-area: remove;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: -4px -6px -4px 0;
  border-radius: 8px;
  color: var(--muted);
  transition:
    color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out);
}

.line-remove svg { width: 14px; height: 14px; }
.line-remove:hover { color: var(--text); background: var(--bg); }

.line-slider {
  grid-area: slider;
  display: flex;
  align-items: center;
  min-width: 0;
}

.line-num {
  grid-area: num;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.num-field {
  position: relative;
  display: flex;
  align-items: center;
}

.num-field input {
  width: 64px;
  height: 34px;
  padding: 0 22px 0 10px;
  border-radius: 10px;
  border: 1px solid var(--hairline-strong);
  background: var(--panel);
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
  transition:
    border-color var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out);
}

.num-field input::-webkit-outer-spin-button,
.num-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.num-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.num-field span {
  position: absolute;
  right: 9px;
  font-size: 13px;
  color: var(--muted-text);
  pointer-events: none;
}

.line.is-out .num-field input { color: var(--bad-ink); border-color: #e5484d66; }

.line-norm {
  min-width: 0;
  font-size: 11.5px;
  color: var(--muted-text);
  white-space: nowrap;
  text-align: right;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  transition:
    max-width var(--dur) var(--ease-out),
    opacity var(--dur) var(--ease-out);
}

.line-norm.is-on { max-width: 80px; opacity: 1; }

/* Range: 4px track, the 10% to 25% band tinted, filled part in accent. */
.range {
  --v: 0;
  --ba: 0;
  --bb: 0;
  --thumb: 20px;
  --fill-at: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--v));
  --band-a: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--ba));
  --band-b: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--bb));
  width: 100%;
  height: 34px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.range:focus { outline: none; }
.range:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background:
    linear-gradient(to right, var(--accent) var(--fill-at), transparent var(--fill-at)),
    linear-gradient(to right, transparent var(--band-a), var(--band) var(--band-a), var(--band) var(--band-b), transparent var(--band-b)),
    var(--track);
}

.range::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background:
    linear-gradient(to right, var(--accent) var(--fill-at), transparent var(--fill-at)),
    linear-gradient(to right, transparent var(--band-a), var(--band) var(--band-a), var(--band) var(--band-b), transparent var(--band-b)),
    var(--track);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--thumb);
  height: var(--thumb);
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 0 0 1px #0000001f, 0 2px 6px -1px #00000033;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.range::-moz-range-thumb {
  width: var(--thumb);
  height: var(--thumb);
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 0 0 1px #0000001f, 0 2px 6px -1px #00000033;
  transition: transform var(--dur-fast) var(--ease-out);
}

.range:hover::-webkit-slider-thumb { transform: scale(1.08); }
.range:active::-webkit-slider-thumb { transform: scale(1.14); box-shadow: 0 0 0 1px #0000001f, 0 0 0 6px var(--accent-soft), 0 2px 6px -1px #00000033; }
.range:active::-moz-range-thumb { transform: scale(1.14); }

.line.is-out .range { --band: #e5484d1f; }

.lines-empty {
  padding: 22px 0 6px;
  font-size: 13.5px;
  color: var(--muted-text);
}

.line-actions {
  display: flex;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}

.lines:empty + .lines-empty + .line-actions,
.lines-empty:not([hidden]) + .line-actions { border-top: 0; }

.btn-ghost {
  border: 1px solid var(--hairline-strong);
  background: var(--panel);
  color: var(--text);
}

.btn-ghost:hover { border-color: #00000038; transform: translateY(-1px); }
.btn-ghost:disabled { opacity: .45; cursor: default; transform: none; }

/* ---------- Save ---------- */

.save-btn { margin-left: auto; }
.save-btn .btn-glyph { width: 12px; height: 12px; margin: 0 -1px 0 -2px; }
.save-btn.is-open { background: #000; }

.btn-dark:disabled,
.btn-dark:disabled:hover {
  background: #0000000f;
  color: var(--muted-text);
  box-shadow: none;
  transform: none;
  cursor: default;
}

.save-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted-text);
  text-align: right;
}

.save-note[hidden] { display: none; }

.save-form {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--bg);
  animation: rise-in 360ms var(--ease-out) both;
}

.save-form[hidden] { display: none; }
.save-form .field-label { margin-bottom: 8px; }

.save-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.save-row input {
  flex: 1 1 180px;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-nav-btn);
  border: 1px solid var(--hairline-strong);
  background: var(--panel);
  font: inherit;
  font-size: 14px;
  letter-spacing: var(--track-ui);
  color: var(--text);
  outline: none;
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.save-row input::placeholder { color: var(--muted-text); }
.save-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.save-msg {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted-text);
}

.save-msg:empty { display: none; }
.save-msg.is-bad { color: var(--bad-ink); }

/* ---------- Score card ---------- */

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted-text);
}

.live-dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--ok);
  opacity: 0;
}

.live-dot.is-ping::after { animation: dot-pulse 900ms var(--ease-out); }

.score-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}

.ring {
  position: relative;
  width: 148px;
  height: 148px;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 9;
}

.ring-track { stroke: var(--track); }

.ring-bar {
  stroke: var(--faint);
  stroke-linecap: round;
  transition:
    stroke-dashoffset 700ms var(--ease-out),
    stroke var(--dur) var(--ease-out);
}

.ring[data-band="ok"] .ring-bar { stroke: var(--ok); }
.ring[data-band="warn"] .ring-bar { stroke: var(--warn); }
.ring[data-band="bad"] .ring-bar { stroke: var(--bad); }

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 50px;
  line-height: 1;
  letter-spacing: -0.06em;
  color: var(--text);
  padding-right: .04em;
}

.ring-num.is-empty { font-size: 22px; letter-spacing: -0.04em; color: var(--muted-text); }

.ring-of {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted-text);
}

.score-count {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.score-wait {
  min-height: 20px;
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted-text);
}

.verdict {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

.verdict p {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-2);
}

.verdict p:first-child { color: var(--text); }

.fixes-wrap {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

.fixes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  counter-reset: fix;
}

.fix {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  counter-increment: fix;
  animation: rise-in 420ms var(--ease-out) both;
}

.fix::before {
  content: counter(fix);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #0060d0;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.fixes-none {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-2);
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Status chip (cross-fades between 3 stacked labels) ---------- */

.status {
  position: relative;
  display: inline-grid;
  align-items: center;
  justify-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--nd-soft);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition:
    background-color var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out);
}

.status > span {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
  transform: translateY(3px);
  transition:
    opacity var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
}

.status svg { width: 11px; height: 11px; }

.status[data-status="pass"] { background: var(--ok-soft); color: var(--ok-ink); }
.status[data-status="fail"] { background: var(--bad-soft); color: var(--bad-ink); }
.status[data-status="pass"] .s-pass,
.status[data-status="fail"] .s-fail,
.status[data-status="nodata"] .s-nodata { opacity: 1; transform: none; }

/* ---------- Portfolio checks ---------- */

.pchecks { margin: -6px calc(-1 * var(--pad)) calc(-1 * var(--pad) + 8px); }

.pcheck {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  grid-template-areas:
    "chip name val"
    "chip detail lim";
  gap: 2px 16px;
  align-items: start;
  padding: 16px var(--pad);
  border-top: 1px solid var(--hairline);
  transition: background-color var(--dur) var(--ease-out);
}

.pcheck:first-child { border-top: 0; }
.pcheck:hover { background: #00000005; }
.pcheck .status { grid-area: chip; justify-self: start; margin-top: -2px; }
.pcheck-main,
.pcheck-val { display: contents; }
.pcheck-name { grid-area: name; }
.pcheck-detail { grid-area: detail; }
.pv { grid-area: val; text-align: right; }
.pl { grid-area: lim; text-align: right; }

.pcheck-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.pcheck-detail {
  margin-top: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}

.pv {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  transition: color var(--dur) var(--ease-out);
}

.pcheck[data-status="fail"] .pv { color: var(--bad-ink); }
.pcheck[data-status="nodata"] .pv { color: var(--muted-text); }

.pl {
  font-size: 12px;
  color: var(--muted-text);
  white-space: nowrap;
}

/* ---------- Exposure ---------- */

.ex-block + .ex-block {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}

.ex-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 12px;
}

.ex-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }

.cap-key {
  width: 0;
  height: 12px;
  border-left: 1.5px dashed var(--text-2);
}

/* Bars share one geometry: label | track | value. */
.cbars,
.tbars {
  --lw: 132px;
  --vw: 48px;
  --bg-gap: 12px;
  position: relative;
}

.cbars { height: calc(var(--n, 0) * var(--row)); transition: height 360ms var(--ease-out); }

.brow {
  display: grid;
  grid-template-columns: var(--lw) minmax(0, 1fr) var(--vw);
  gap: var(--bg-gap);
  align-items: center;
  height: var(--row);
}

.cbars .brow {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  transform: translateY(calc(var(--y, 0) * var(--row)));
  transition:
    transform 420ms var(--ease-out),
    opacity 300ms var(--ease-out);
}

.brow.is-entering { opacity: 0; }
.brow.is-leaving { opacity: 0; pointer-events: none; }

.blabel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
}

.blabel .chip { flex: none; }

.blabel-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btrack {
  position: relative;
  height: 10px;
  border-radius: 5px;
  background: var(--track);
}

.bfill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--w, 0%);
  border-radius: 5px;
  background: var(--accent);
  transition:
    width 420ms var(--ease-out),
    background-color var(--dur) var(--ease-out);
}

.brow.is-over .bfill { background: var(--bad); }
.brow.is-free .bfill { background: #b9b9be; }
.brow.is-zero .bval { color: var(--bad-ink); }

.bval {
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  transition: color var(--dur) var(--ease-out);
}

.cap-line {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: calc(var(--lw) + var(--bg-gap) + (100% - var(--lw) - var(--vw) - 2 * var(--bg-gap)) * var(--cap, .5));
  width: 0;
  border-left: 1.5px dashed #6e6e7399;
  pointer-events: none;
  transition: left 420ms var(--ease-out), opacity var(--dur) var(--ease-out);
}

.cbars.is-empty .cap-line { opacity: 0; }

.ex-empty {
  font-size: 13px;
  color: var(--muted-text);
  padding: 6px 0;
}

/* Fragility stacked bar. The fragile segment should end inside the band between the 2 markers. */
.frag-bar {
  position: relative;
  display: flex;
  gap: 2px;
  height: 14px;
  margin: 4px 0 26px;
}

.fseg {
  height: 100%;
  border-radius: 4px;
  flex: 0 1 var(--w, 0%);
  min-width: 0;
  transition: flex-basis 420ms var(--ease-out), opacity var(--dur) var(--ease-out);
}

.frag-bar.is-empty .fseg { opacity: 0; }
.frag-bar.is-empty { background: var(--track); border-radius: 4px; }

.fseg-fragile { background: var(--text); }
.fseg-robust { background: #c7c7cc; }
.fseg-antifragile { background: var(--accent); }

.fmark {
  position: absolute;
  top: -6px;
  bottom: -6px;
  width: 0;
  border-left: 1.5px dashed #6e6e73;
  pointer-events: none;
}

.fzone {
  position: absolute;
  top: calc(100% + 4px);
  height: 3px;
  border-radius: 2px;
  background: var(--ok);
  opacity: .45;
  pointer-events: none;
}

.fmark span {
  position: absolute;
  top: calc(100% + 4px);
  font-size: 11px;
  color: var(--muted-text);
  white-space: nowrap;
  transform: translateX(-50%);
}

.frag-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 12px;
}

.fkey {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-2);
}

.fkey i { width: 9px; height: 9px; border-radius: 3px; }
.fkey b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; transition: color var(--dur) var(--ease-out); }
.fkey.is-low b { color: var(--bad-ink); }

/* Crisis cushions */
.cushions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.cushion {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid transparent;
  transition:
    background-color var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out);
}

.cushion-top {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted-text);
  transition: color var(--dur) var(--ease-out);
}

.cushion-top i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--muted);
  transition: background-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.cushion-w {
  font-size: 12px;
  color: var(--muted-text);
  font-variant-numeric: tabular-nums;
}

.cushion.is-on {
  background: var(--ok-soft);
  border-color: #1f9d5526;
}

.cushion.is-on .cushion-top { color: var(--ok-ink); }
.cushion.is-on .cushion-top i { background: var(--ok); box-shadow: 0 0 0 3px #1f9d5526; }
.cushion.is-on .cushion-w { color: var(--ok-ink); }

/* ---------- Correlation heatmap ---------- */

.heat-wrap { min-width: 0; }
.heat-wrap.is-scroll { overflow-x: auto; padding: 3px 0; scrollbar-width: thin; overscroll-behavior-x: contain; }

.heat {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  table-layout: fixed;
  margin: -3px;
  width: calc(100% + 6px);
}

.heat th {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heat thead th {
  height: 26px;
  padding: 0 2px;
  text-align: center;
  vertical-align: bottom;
}

.heat tbody th {
  padding-right: 8px;
  text-align: left;
}

.heat .heat-corner { width: 76px; }

.heat .row-n,
.heat .col-n {
  display: none;
  color: var(--muted-text);
  font-variant-numeric: tabular-nums;
}

.hcell {
  position: relative;
  height: 40px;
  border-radius: 8px;
  background: var(--hm-mid);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
  cursor: default;
  transition: background-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
  animation: fade-in 420ms var(--ease-out) both;
}

.hcell.is-fail { box-shadow: inset 0 0 0 2px var(--bad); }

.hcell.is-nodata {
  background:
    repeating-linear-gradient(135deg, #00000010 0 2px, transparent 2px 6px),
    #f7f7f8;
  color: var(--muted-text);
  font-weight: 500;
}

.hcell.is-void { background: transparent; animation: none; }

.hcell:hover { box-shadow: inset 0 0 0 2px var(--text); }
.hcell.is-void:hover { box-shadow: none; }

.heat-empty {
  padding: 18px 0;
  font-size: 13.5px;
  color: var(--muted-text);
}

.heat-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-2);
}

.hl-scale {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 168px;
}

.hl-bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right,
    color-mix(in oklab, var(--accent) 62%, var(--hm-mid)) 0%,
    var(--hm-mid) 50%,
    color-mix(in oklab, var(--bad) 78%, var(--hm-mid)) 100%);
}

/* Ticks at -0.5, 0, 0.5 and 1 over a -0.5 to 1 domain, with the neutral at 0.25. */
.hl-ticks {
  position: relative;
  height: 14px;
  font-size: 10.5px;
  color: var(--muted-text);
}

.hl-ticks span { position: absolute; transform: translateX(-50%); }
.hl-ticks span:nth-child(1) { left: 0; transform: none; }
.hl-ticks span:nth-child(2) { left: 33.3%; }
.hl-ticks span:nth-child(3) { left: 66.7%; }
.hl-ticks span:nth-child(4) { right: 0; transform: none; }

.hl-key { display: inline-flex; align-items: center; gap: 7px; }

.hl-sw {
  width: 16px;
  height: 16px;
  border-radius: 5px;
}

.hl-fail { background: color-mix(in oklab, var(--bad) 40%, var(--hm-mid)); box-shadow: inset 0 0 0 2px var(--bad); }
.hl-nodata { background: repeating-linear-gradient(135deg, #00000014 0 2px, transparent 2px 5px), #f7f7f8; }

/* ---------- Asset checks table ---------- */

.rt-wrap {
  margin: 0 calc(-1 * var(--pad));
  overflow-x: auto;
  scrollbar-width: thin;
}

.rt {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 13px;
}

.rt th,
.rt td {
  height: 44px;
  padding: 0 6px;
  border-top: 1px solid var(--hairline);
  text-align: center;
}

.rt thead th {
  height: 34px;
  border-top: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-text);
  font-variant-numeric: tabular-nums;
}

.rt thead th[data-tip] { cursor: help; }
.rt thead th span { border-bottom: 1px dotted var(--faint); white-space: nowrap; }

/* Narrow card: the short titles turn sideways and read bottom to top. */
.rt.is-tall thead th { height: auto; padding-top: 8px; padding-bottom: 8px; vertical-align: bottom; }
.rt.is-tall thead th.rt-check span {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  /* The dotted cue stays under the letters: turned 180deg, the left border sits on their baseline side. */
  border: 0;
  border-left: 1px dotted var(--faint);
  padding-left: 1px;
  line-height: 1.2;
}

.rt th:first-child,
.rt td:first-child {
  padding-left: var(--pad);
  text-align: left;
}

.rt th:last-child,
.rt td:last-child { padding-right: var(--pad); }

.rt tbody th {
  font-weight: 500;
  max-width: 220px;
}

.rt-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rt-name span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rt tbody tr { animation: fade-in 420ms var(--ease-out) both; transition: background-color var(--dur) var(--ease-out); }
.rt tbody tr:hover { background: #00000005; }

.rt td .dot { --dot: 13px; vertical-align: middle; }
.rt td[data-tip] { cursor: default; }

.rt .rt-tag { display: none; }

/* #rt-wrap runs edge to edge for the table, so its empty message needs the card padding back. */
.rt-wrap .rt-empty { padding-left: var(--pad); padding-right: var(--pad); }

.hcell .nd {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

/* Heatmap fit. app.js measures the cells and sets these classes:
   is-numcols: column tags do not fit, so columns show line numbers and a key maps them.
   is-short: values drop the leading zero (.33, -.18).
   is-dense: values do not fit at all, so cells keep colour, fail border and tooltip only. */
.hv { display: inline-block; white-space: nowrap; }
.hv-s { display: none; }
.heat.is-short .hv-l { display: none; }
.heat.is-short .hv-s { display: inline-block; }
.heat.no-nd .nd,
.heat.is-dense .hv { display: none; }
.heat.is-numcols .col-tag { display: none; }
.heat.is-numcols thead th { padding: 0; text-overflow: clip; }
.heat.is-dense thead th { font-size: 10px; letter-spacing: -0.04em; }
.heat.is-numcols .col-n,
.heat.is-numcols .row-n { display: inline; }

.heat-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-2);
}

.heat-key[hidden] { display: none; }
.heat-key span { white-space: nowrap; }
.heat-key b { margin-right: 4px; font-weight: 600; color: var(--muted-text); font-variant-numeric: tabular-nums; }

.hcell:focus-visible,
.rt td[data-check]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.rt-score {
  font-size: 12px;
  color: var(--muted-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rt-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-2);
}

.rt-legend span { display: inline-flex; align-items: center; gap: 7px; }

/* ---------- Tooltip, toast, mini score ---------- */

.tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 80;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: 12px;
  background: #1d1d1ff2;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  box-shadow: 0 10px 30px -10px #00000059;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.tip.is-on { opacity: 1; transform: none; }
.tip b { font-weight: 600; }
.tip .tip-muted { color: #ffffffa6; }
.tip ul { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.tip li { display: grid; grid-template-columns: 9px minmax(0, 1fr); gap: 8px; align-items: start; }
.tip li .dot { margin-top: 5px; }
.tip .dot.is-nodata { box-shadow: inset 0 0 0 1.5px #aeaeb2; }
.tip .dot.is-na { background-image: linear-gradient(#aeaeb2, #aeaeb2); }

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--nav-h) + 12px);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--text);
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 10px 30px -10px #00000066;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -8px) scale(.98);
  transition: opacity 260ms var(--ease-out), transform 360ms var(--ease-out);
}

.toast::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.toast.is-on { opacity: 1; transform: translate(-50%, 0) scale(1); }

.mini {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px 0 12px;
  border-radius: 999px;
  background: #1d1d1fee;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 13.5px;
  white-space: nowrap;
  box-shadow: 0 12px 30px -12px #00000080;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 300ms var(--ease-out), transform 420ms var(--ease-out);
}

.mini[hidden] { display: none; }
.mini.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.mini b { font-weight: 700; }
.mini-sep { color: #ffffff66; }
.mini-ring { width: 22px; height: 22px; transform: rotate(-90deg); }
.mini-ring circle { fill: none; stroke-width: 3; }
.mini-track { stroke: #ffffff2e; }
.mini-bar { stroke: #fff; stroke-linecap: round; transition: stroke-dashoffset 700ms var(--ease-out), stroke var(--dur) var(--ease-out); }
.mini[data-band="ok"] .mini-bar { stroke: #34c473; }
.mini[data-band="warn"] .mini-bar { stroke: #f5b83d; }
.mini[data-band="bad"] .mini-bar { stroke: #ff6b6f; }

.noscript {
  padding: 24px;
  text-align: center;
  color: var(--text-2);
}

/* ---------- Highlight lines named by a hovered portfolio check ---------- */

.line.is-hl .line-body { background: #e5484d0d; }

/* ---------- Narrower screens ---------- */

@media (max-width: 1100px) and (min-width: 960px) {
  .app { --pad: 22px; }
  .cbars, .tbars { --lw: 108px; }
}

@media (max-width: 640px) {
  .app { --pad: 20px; --row: 34px; }

  .app .nav-name { font-size: 14px; }
  .share-label { display: none; }
  #share { width: 36px; padding: 0; }
  #share .btn-glyph { margin: 0; }

  .build-head { padding: 28px 0 24px; gap: 14px; }
  .build-title { font-size: clamp(34px, 10.4vw, 46px); }
  .data-strip { align-items: flex-start; line-height: 1.45; }
  .data-dot { margin-top: 6px; }

  .layout, .col { gap: 14px; }
  .title { font-size: 25px; }
  .card-head { margin-bottom: 16px; }

  .score-row { grid-template-columns: 112px minmax(0, 1fr); gap: 0 18px; align-items: center; }
  .score-row .ring { width: 112px; height: 112px; grid-row: 1 / span 2; }
  .score-side { display: contents; }
  .score-count { align-self: end; font-size: 16px; }
  .score-wait { align-self: start; }
  .verdict { grid-column: 1 / -1; margin-top: 18px; }
  .ring-num { font-size: 40px; }
  .ring-num.is-empty { font-size: 17px; }

  .pcheck {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "chip name val"
      "detail detail lim";
    gap: 6px 10px;
    padding: 14px var(--pad);
  }
  .pcheck .status { margin-top: -3px; }
  .pl { align-self: end; }


  .cbars, .tbars { --lw: 124px; --vw: 38px; --bg-gap: 10px; }
  .blabel { gap: 6px; }
  .blabel-name {
    font-size: 12px;
    line-height: 1.15;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .cushions { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .heat { border-spacing: 2px; margin: -2px; width: calc(100% + 4px); }
  .heat tbody th { padding-right: 4px; }
  .heat .heat-corner { width: 64px; }
  .hcell { height: 34px; font-size: 10.5px; border-radius: 6px; }

  .rt { min-width: 0; }
  .rt th, .rt td { padding: 0 3px; }
  .rt tbody th { max-width: 120px; }
  .rt .rt-full { display: none; }
  .rt .rt-tag { display: inline; }
  .rt-score { display: none; }
}

@media (max-width: 520px) {
  /* The name takes the full row; Save and Cancel sit under it. */
  .save-row input { flex-basis: 100%; }

  .line-body {
    grid-template-columns: minmax(0, 1fr) 104px 28px;
    grid-template-areas:
      "name name name"
      "chips dots remove"
      "slider num num";
    gap: 6px 10px;
  }

}


/* ---------- Touch: 44px hit areas, same visual size ---------- */

/* Hit areas grow up into the name row and out to the card edge, never down onto the slider
   and never from remove toward the check dots, so a tap near one never lands on the other. */
@media (pointer: coarse), (max-width: 640px) {
  .line-remove,
  .line-dots { position: relative; }
  .line-remove::before,
  .line-dots::before {
    content: "";
    position: absolute;
    bottom: -4px;
    height: 40px;
  }
  .line-dots::before {
    left: 50%;
    width: max(100%, 44px);
    transform: translateX(-50%);
  }
  .line-remove::before {
    left: 0;
    width: 44px;
  }
}

/* ---------- Floating score ---------- */

/* The bar floats at the bottom on every screen, so keep focused fields clear of it. The footer keeps
   room under its last line at all times (the bar is 44px high, 18px up), so the data dates never sit
   under it and the page height never changes when the bar comes and goes. */
html.has-mini { scroll-padding-bottom: 84px; }
.page-foot { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Reduced motion: instant, no movement ---------- */

@media (prefers-reduced-motion: reduce) {
  .line,
  .line.is-entering,
  .line.is-leaving,
  .tbars .brow,
  .fix,
  .hcell,
  .rt tbody tr,
  .status > span,
  .toast,
  .mini,
  .tip { transform: none !important; animation: none !important; }

  .live-dot.is-ping::after { animation: none; }
  .saved li,
  .saved-skel::before,
  .saved-skel::after,
  .save-form { transition: none !important; animation: none !important; }

  /* Country rows get their slot from the transform: keep it, drop the slide. */
  .cbars .brow { transition: none !important; animation: none !important; }
  .cbars { transition: none; }
}

/* ---------- Inside the /wealth fat layer (/portfolio?embed) ---------- */

html.embed body { min-height: 0; }
html.embed .nav,
html.embed .page-foot,
html.embed .build-head,
html.embed .mini { display: none; }
html.embed .build { padding-top: 0; }
html.embed .page { width: 100%; }
