@font-face {
  font-family: 'EdictDisplay';
  src: local('Edict Display'), local('EdictDisplay');
  font-weight: 400;
  font-style: normal;
  font-display: swap
}

:root {
  --ink: #2F2F2F;
  --paper: #FFFDF9;
  --surface: #FFFDFC;
  --line: #EFE3D8;
  --muted: #6E6863;
  --faint: #9E958D;
  --teal: #697A69;
  --teal-bright: #839879;
  --teal-tint: #EEF3EA;
  --brass: #AA6B39;
  --brass-deep: #744626;
  --brass-tint: #F7E2CC;
  --brass-line: #E3B988;
  --coral: #D87458;
  --coral-deep: #8F3F30;
  --coral-tint: #FBE1D7;
  --red: #A2463E;
  --red-tint: #F8DEDA;
  --fig: #6A4B56;
  --fig-tint: #F0E4E8;
  --r: 10px;
  --r-sm: 8px;
  --fd: 'EdictDisplay', 'Edict Display', Georgia, 'Times New Roman', serif;
  --fs: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --fn: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --fm: var(--fn);
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--fs);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased
}

#app {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px 48px
}

h1,
h2,
h3 {
  font-family: var(--fd);
  font-weight: 400;
  margin: 0
}

button {
  font-family: var(--fs);
  cursor: pointer
}

.mono {
  font-family: var(--fn);
  font-weight: 700;
  font-variant-numeric: tabular-nums
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 14px;
  gap: 16px;
  flex-wrap: wrap
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px
}

.brand .mark {
  display: inline-flex;
  gap: 3px
}

.brand .mark i {
  width: 4px;
  height: 18px;
  border-radius: 1px;
  display: block
}

.brand .name {
  font-family: var(--fd);
  font-weight: 400;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0
}

.meta {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 13px;
  flex-wrap: wrap
}

.meta .pill {
  display: flex;
  align-items: center;
  gap: 6px
}

.meta .user-pill {
  gap: 7px;
  color: var(--ink)
}

.meta .pill.picker {
  gap: 4px
}

.meta .pill.picker select {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--line);
  padding: 1px 16px 1px 2px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%235F6670' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center
}

.meta .pill.picker select:hover {
  border-bottom-color: var(--muted)
}

.range-picker {
  position: relative
}

.range-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 0;
  max-width: 260px
}

.range-trigger span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.range-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 40;
  width: min(380px, calc(100vw - 40px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 14px 40px rgba(21, 23, 28, .16);
  padding: 13px
}

.range-pop-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px
}

.range-pop-head strong {
  font-size: 13px;
  color: var(--ink)
}

.range-pop-head span {
  font-size: 11px;
  color: var(--faint);
  text-align: right
}

.range-quick {
  display: grid;
  gap: 5px;
  margin-bottom: 12px
}

.range-quick span {
  font-size: 11px;
  color: var(--faint)
}

.meta .pill.picker .range-quick select {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px 8px;
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  background-image: none;
  appearance: auto;
  -webkit-appearance: auto
}

.range-granularity {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px
}

.range-granularity button {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600
}

.range-granularity button.active {
  background: var(--teal-tint);
  border-color: var(--teal-bright);
  color: var(--teal)
}

.range-values {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px
}

.range-values strong {
  font-family: var(--fn);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.range-values strong:last-child {
  text-align: right
}

.range-values span {
  font-size: 11px;
  color: var(--faint)
}

.range-dual {
  position: relative;
  height: 34px;
  margin: 4px 2px 13px;
  --range-a: 0%;
  --range-z: 100%
}

.range-dual::before,
.range-dual::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 15px;
  height: 4px;
  border-radius: 999px
}

.range-dual::before {
  background: var(--line)
}

.range-dual::after {
  left: var(--range-a);
  right: calc(100% - var(--range-z));
  background: var(--teal-bright)
}

.range-dual input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 34px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  pointer-events: none
}

.range-dual input:focus {
  box-shadow: none
}

.range-dual input::-webkit-slider-runnable-track {
  height: 4px;
  background: transparent;
  border: none
}

.range-dual input::-moz-range-track {
  height: 4px;
  background: transparent;
  border: none
}

.range-dual input::-webkit-slider-thumb {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(21, 23, 28, .18)
}

.range-dual input::-moz-range-thumb {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(21, 23, 28, .18)
}

.range-dual input#period-range-end::-webkit-slider-thumb {
  border-color: var(--brass)
}

.range-dual input#period-range-end::-moz-range-thumb {
  border-color: var(--brass)
}

.range-apply {
  width: 100%;
  border: 1px solid var(--teal-bright);
  background: var(--teal);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 700
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--r-sm);
  font-size: 16px
}

.logout-btn:hover {
  color: var(--ink);
  border-color: var(--faint);
  background: var(--paper)
}

.cohort-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted)
}

.cohort-filter select,
.cohort-filter input[type=date] {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  cursor: pointer
}

.cohort-filter select:hover,
.cohort-filter input[type=date]:hover {
  border-color: var(--muted)
}

.cohort-filter {
  flex-wrap: wrap
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block
}

.nav {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none
}

.nav::-webkit-scrollbar {
  display: none
}

.nav a {
  flex: 0 0 auto;
  padding: 10px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px
}

.nav a:hover {
  color: var(--ink)
}

.nav a.active {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: var(--teal-bright)
}

.eyebrow {
  color: var(--faint);
  font-size: 13px;
  margin: 26px 0 14px
}

.hero-ends {
  display: flex;
  justify-content: space-between;
  align-items: flex-end
}

.big {
  font-family: var(--fn);
  font-weight: 800;
  font-size: 30px;
  line-height: 1;
  font-variant-numeric: tabular-nums
}

.big .u {
  font-size: 15px
}

.sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px
}

.rail-track {
  stroke: var(--teal-bright);
  stroke-width: 3;
  stroke-linecap: round
}

.node-in {
  fill: var(--brass)
}

.node-kept {
  fill: var(--teal-bright)
}

.leak-line {
  stroke: var(--coral);
  stroke-width: 2
}

.leak-fill {
  fill: var(--coral)
}

.rail-amt {
  font-family: var(--fn);
  font-weight: 700;
  font-size: 13px;
  fill: var(--coral);
  text-anchor: middle
}

.rail-cap {
  font-size: 11px;
  fill: var(--muted);
  text-anchor: middle
}

.payoff {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 16px 18px;
  background: var(--brass-tint);
  border: 1px solid var(--brass-line);
  border-radius: var(--r)
}

.payoff .amt {
  font-family: var(--fn);
  font-weight: 800;
  font-size: 24px;
  color: var(--brass-deep);
  font-variant-numeric: tabular-nums
}

.payoff .amt .u {
  font-size: 13px
}

.payoff .lbl {
  color: var(--brass-deep);
  font-size: 13px;
  margin-left: 8px
}

.payoff .note {
  font-size: 12px;
  color: var(--brass-deep);
  opacity: .85;
  margin-top: 4px;
  max-width: 400px
}

.btn {
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-sm);
  padding: 9px 14px;
  border: 1px solid var(--brass);
  background: transparent;
  color: var(--brass-deep)
}

.btn:hover {
  background: #F6E2BD
}

.overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px
}

.overview-head h3 {
  font-size: 28px
}

.metric-section {
  margin-top: 18px
}

.metric-section-h {
  font-size: 11px;
  font-weight: 700;
  color: var(--fig);
  margin-bottom: 8px;
  text-transform: uppercase
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px
}

.hero-metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal-bright);
  border-radius: var(--r-sm);
  padding: 13px 15px 14px;
  min-height: 124px;
  display: grid;
  grid-template-rows: 30px 47px minmax(32px, auto);
  align-items: center;
  box-shadow: 0 1px 0 rgba(47, 47, 47, .03)
}

.hero-metric.brass {
  border-left-color: var(--brass)
}

.hero-metric.red {
  border-left-color: var(--coral)
}

.hero-metric .hm-top {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.25;
  align-self: start
}

.hero-metric .hm-value {
  font-family: var(--fn);
  font-weight: 800;
  font-size: clamp(31px, 3.05vw, 39px);
  line-height: .95;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
  align-self: center
}

.hero-metric .hm-detail {
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
  align-self: start;
  padding-top: 3px
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 20px
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px
}

.kpi .k {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px
}

.kpi .v {
  font-family: var(--fn);
  font-weight: 800;
  font-size: 22px;
  font-variant-numeric: tabular-nums
}

.kpi .kdelta {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--fm);
  font-size: 12px;
  margin-top: 6px
}

.kdelta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--fm);
  font-size: 13px
}

.lower {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-top: 24px;
  align-items: start
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden
}

.panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line)
}

.panel-h h3 {
  font-size: 19px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.panel-h .hint {
  font-size: 12px;
  color: var(--faint)
}

.arow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit
}

.arow:last-child {
  border-bottom: none
}

.arow:hover {
  background: #FAFAF8
}

.ico {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 18px
}

.ico.coral {
  background: var(--coral-tint);
  color: var(--coral-deep)
}

.ico.red {
  background: var(--red-tint);
  color: var(--red)
}

.ico.brass {
  background: var(--brass-tint);
  color: var(--brass-deep)
}

.ico.teal {
  background: var(--teal-tint);
  color: var(--teal)
}

.arow .t {
  font-size: 14px;
  font-weight: 500
}

.arow .s {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px
}

.arow .m {
  font-family: var(--fn);
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums
}

.arow .m.red {
  color: var(--red)
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 104px;
  padding: 18px 18px 8px
}

.bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  height: 100%
}

.bar .col {
  width: 100%;
  background: var(--teal-bright);
  border-radius: 3px 3px 0 0;
  min-height: 3px
}

.bar .bl {
  font-size: 11px;
  color: var(--muted)
}

.bar .bv {
  font-family: var(--fn);
  font-weight: 700;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums
}

.linechart {
  min-height: 130px;
  padding: 8px 10px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface), var(--paper) 38%);
  position: relative
}

.linechart.compact {
  min-height: 118px
}

.linechart svg {
  display: block;
  width: 100%;
  height: 156px;
  overflow: visible
}

.linechart.compact svg {
  height: 104px
}

.linechart .line-grid {
  stroke: color-mix(in srgb, var(--line), transparent 28%);
  stroke-width: 1
}

.linechart .line-cursor {
  stroke: color-mix(in srgb, var(--ink), transparent 74%);
  stroke-width: 1;
  stroke-dasharray: 3 4;
  pointer-events: none
}

.linechart .line-area {
  fill: color-mix(in srgb, var(--line-color, var(--teal-bright)), transparent 84%)
}

.linechart .line-path {
  fill: none;
  stroke: var(--line-color, var(--teal-bright));
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round
}

.linechart .line-dot {
  fill: var(--surface);
  stroke: var(--line-color, var(--teal-bright));
  stroke-width: 2
}

.linechart .line-hit {
  fill: transparent;
  stroke: transparent;
  cursor: help;
  pointer-events: all
}

.linechart .line-hit.active {
  fill: var(--surface);
  stroke: var(--line-color, var(--teal-bright));
  stroke-width: 2.5
}

.line-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 138px;
  max-width: 220px;
  padding: 8px 9px 9px;
  border: 1px solid color-mix(in srgb, var(--ink), transparent 82%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface), white 72%);
  box-shadow: 0 10px 26px rgba(42, 31, 20, .14);
  color: var(--ink);
  font-family: var(--fn);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  pointer-events: none
}

.line-tooltip[hidden] {
  display: none
}

.line-tooltip strong {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--muted)
}

.line-tooltip span {
  display: grid;
  grid-template-columns: 10px minmax(54px, 1fr) auto;
  align-items: center;
  gap: 7px;
  line-height: 1.35
}

.line-tooltip i {
  width: 8px;
  height: 8px;
  border-radius: 50%
}

.line-tooltip em {
  font-style: normal;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.line-tooltip b {
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap
}

.line-axis {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-family: var(--fn);
  font-size: 11px;
  font-variant-numeric: tabular-nums
}

.line-axis strong {
  color: var(--muted);
  font-weight: 700
}

.line-axis span:last-child {
  text-align: right
}

.line-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--fn);
  font-size: 11px
}

.line-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap
}

.line-legend i {
  width: 16px;
  height: 3px;
  border-radius: 3px
}

.line-empty {
  min-height: 104px;
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 12px
}

.sidefoot {
  padding: 0 16px 14px;
  font-size: 12px;
  color: var(--faint)
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  max-width: 90%;
  z-index: 50
}

/* ── Auth ─────────────────────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: center;
  padding: 24px 0 48px
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink)
}

.auth-brand .mark {
  display: inline-flex;
  gap: 3px
}

.auth-brand .mark i {
  width: 4px;
  height: 18px;
  border-radius: 1px;
  display: block
}

.auth-brand span:last-child {
  font-family: var(--fd);
  font-size: 25px;
  line-height: 1
}

.auth-card {
  width: min(420px, 100%);
  justify-self: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px;
  box-shadow: 0 14px 40px rgba(47, 47, 47, .08)
}

.auth-eyebrow {
  color: var(--faint);
  font-size: 12px;
  margin-bottom: 7px
}

.auth-card h1 {
  font-size: 34px;
  margin-bottom: 18px
}

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px
}

.auth-card label span {
  font-size: 12px;
  color: var(--muted)
}

.auth-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  border: 1px solid var(--teal-bright);
  background: var(--teal);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 10px 13px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px
}

.auth-submit:hover {
  background: var(--teal-bright)
}

.auth-submit:disabled {
  opacity: .72;
  cursor: wait
}

.auth-error {
  margin-top: 12px;
  background: var(--coral-tint);
  border: 1px solid var(--brass-line);
  color: var(--coral-deep);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  font-size: 12px
}

.kpis {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr))
}

.screen {
  padding-top: 2px
}

.hbar {
  margin: 11px 0
}

.hbar .hb-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
  margin-bottom: 5px
}

.hbar .hb-top .lab {
  color: var(--ink)
}

.track {
  height: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden
}

.fill {
  height: 100%
}

.tag {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: var(--r-sm);
  white-space: nowrap
}

.tag.leakage {
  background: var(--coral-tint);
  color: var(--coral-deep)
}

.tag.at_risk {
  background: var(--red-tint);
  color: var(--red)
}

.tag.captured {
  background: var(--teal-tint);
  color: var(--teal)
}

.wl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line)
}

.wl-row:last-child {
  border-bottom: none
}

.wl-hand {
  font-size: 12px;
  margin-top: 2px
}

.pips {
  display: flex;
  gap: 3px;
  flex: none
}

.pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line)
}

.dbtn {
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--ink)
}

.dbtn:hover {
  background: var(--paper)
}

.mgrp {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  height: 100%
}

.mgrp .pair {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  width: 100%
}

.mgrp .mc2 {
  width: 14px;
  border-radius: 3px 3px 0 0;
  min-height: 3px
}

.schedule-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px
}

.schedule-head h3 {
  font-size: 28px
}

.schedule-note {
  max-width: 520px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: right
}

.schedule-map {
  overflow-x: auto;
  background: linear-gradient(180deg, var(--surface), var(--paper));
  padding: 12px 14px 14px;
  position: relative
}

.slot-grid {
  min-width: 860px
}

.slot-head,
.slot-lane {
  display: grid;
  gap: 5px;
  align-items: stretch;
  margin-bottom: 5px
}

.slot-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, var(--surface), rgba(255, 253, 252, .94));
  padding-bottom: 3px
}

.slot-head span {
  font-size: 11px;
  color: var(--faint);
  text-align: center;
  white-space: nowrap;
  font-weight: 700;
  text-transform: uppercase
}

.slot-head .lane-label,
.slot-lane .lane-label {
  position: sticky;
  left: -18px;
  z-index: 2;
  text-align: left;
  background: var(--surface);
  margin-left: -18px;
  padding-left: 18px;
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 12px rgba(47, 47, 47, .06)
}

.slot-head .lane-label {
  height: 100%
}

.slot-lane .lane-label {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
  font-family: var(--fn);
  font-variant-numeric: tabular-nums
}

.slot-cell {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px 7px 6px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 2px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35)
}

.slot-cell.hot {
  background: #DDE8D7;
  border-color: #B8CBAF
}

.slot-cell.warm {
  background: #EAF0DD;
  border-color: #D4DFBD
}

.slot-cell.steady {
  background: #F4E4CC;
  border-color: #E4C495
}

.slot-cell.cool {
  background: #F7DED7;
  border-color: #E7BBB0
}

.slot-cell.cold {
  background: #F1E2E5;
  border-color: #DDC6CE
}

.slot-cell.empty {
  background: repeating-linear-gradient(135deg, #FFFDF9 0, #FFFDF9 6px, #F6EFE9 6px, #F6EFE9 12px);
  color: var(--faint);
  align-items: center;
  justify-items: center
}

.slot-fill {
  font-family: var(--fn);
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink)
}

.slot-count {
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums
}

.slot-class {
  font-size: 10px;
  line-height: 1.15;
  color: var(--muted);
  align-self: end;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden
}

.slot-empty {
  font-size: 15px
}

.slot-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px 14px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line)
}

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

.slot-legend i {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 4px;
  border: 1px solid var(--line)
}

.slot-legend .hot {
  background: #DDE8D7;
  border-color: #B8CBAF
}

.slot-legend .warm {
  background: #EAF0DD;
  border-color: #D4DFBD
}

.slot-legend .steady {
  background: #F4E4CC;
  border-color: #E4C495
}

.slot-legend .cool {
  background: #F7DED7;
  border-color: #E7BBB0
}

.slot-legend .empty {
  background: repeating-linear-gradient(135deg, #FFFDF9 0, #FFFDF9 4px, #F6EFE9 4px, #F6EFE9 8px)
}

.schedule-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px
}

.schedule-baseline {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface)
}

.schedule-baseline span {
  font-size: 12px;
  color: var(--muted);
  margin-right: 2px
}

.schedule-baseline button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  border-radius: var(--r-sm);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 500
}

.schedule-baseline button:hover {
  color: var(--ink);
  border-color: var(--muted)
}

.schedule-baseline button.active {
  background: var(--teal-tint);
  border-color: var(--teal-bright);
  color: var(--teal)
}

.schedule-baseline button:focus-visible {
  outline: 2px solid var(--teal-bright);
  outline-offset: 2px
}

.schedule-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  border-left: 1px solid var(--line);
  padding-left: 12px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600
}

.schedule-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--teal)
}

.schedule-filter-note {
  font-size: 12px;
  color: var(--faint)
}

.schedule-explain {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 16px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35
}

.schedule-explain span {
  max-width: 300px
}

.schedule-explain strong {
  color: var(--ink);
  font-weight: 700
}

.window-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line)
}

.window-row:last-child {
  border-bottom: none
}

.wr-time {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink)
}

.wr-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px
}

.wr-score {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 1px
}

.wr-score strong {
  font-family: var(--fn);
  font-size: 17px;
  font-variant-numeric: tabular-nums
}

.wr-score span {
  font-size: 11px;
  color: var(--faint)
}

.slot-start-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.35fr) minmax(86px, .55fr) minmax(86px, .55fr) minmax(96px, .55fr);
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line)
}

.slot-start-row:last-child {
  border-bottom: none
}

.ss-main {
  min-width: 0
}

.ss-main strong {
  display: block;
  font-size: 14px;
  color: var(--ink)
}

.ss-main span,
.ss-fill span,
.ss-delta span {
  display: block;
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.ss-fill strong,
.ss-delta strong {
  display: block;
  margin-top: 2px;
  font-family: var(--fn);
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--ink)
}

.ss-fill em {
  display: block;
  margin-top: 1px;
  font-style: normal;
  font-size: 11px;
  color: var(--muted)
}

.ss-delta {
  border-radius: var(--r-sm);
  padding: 7px 9px;
  border: 1px solid var(--line);
  background: var(--surface)
}

.ss-delta.up {
  background: var(--teal-tint);
  border-color: #C8D8C0
}

.ss-delta.down {
  background: var(--coral-tint);
  border-color: #E6B7AA
}

.ss-delta.up strong {
  color: var(--teal)
}

.ss-delta.down strong {
  color: var(--coral-deep)
}

.instructor-slot-row {
  border-bottom: 1px solid var(--line)
}

.instructor-slot-row.is-hidden {
  display: none
}

.instructor-slot-row:last-child {
  border-bottom: none
}

.instructor-summary {
  display: grid;
  grid-template-columns: minmax(170px, 1.05fr) minmax(116px, .62fr) minmax(270px, 1.4fr) 78px;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none
}

.instructor-summary::-webkit-details-marker {
  display: none
}

.instructor-summary:hover {
  background: var(--surface)
}

.is-name {
  min-width: 0
}

.is-name strong {
  display: block;
  font-size: 14px
}

.is-name span,
.is-compare > span,
.instructor-detail span {
  display: block;
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.is-lift {
  background: var(--teal-tint);
  border: 1px solid #C8D8C0;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  min-width: 0;
  display: flex;
  align-items: center
}

.is-lift.negative {
  background: var(--coral-tint);
  border-color: #E6B7AA
}

.is-lift.neutral {
  background: var(--paper);
  border-color: var(--line)
}

.is-lift strong {
  display: block;
  font-family: var(--fn);
  font-weight: 900;
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-top: 0
}

.is-lift strong.up {
  color: var(--teal)
}

.is-lift strong.down {
  color: var(--coral-deep)
}

.is-lift strong.neutral {
  color: var(--muted)
}

.is-compare {
  min-width: 0
}

.is-compare > span {
  margin-bottom: 7px;
  white-space: normal;
  overflow: visible;
  line-height: 1.35
}

.is-compare strong {
  font-family: var(--fn);
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums
}

.lift-stack {
  position: relative;
  height: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper)
}

.lift-stack i {
  position: absolute;
  top: 0;
  bottom: 0;
  display: block
}

.lift-base {
  left: 0;
  background: var(--fig)
}

.lift-delta {
  background: var(--teal-bright)
}

.lift-stack.negative .lift-delta {
  background: var(--coral-deep)
}

.lift-stack.neutral .lift-delta {
  background: var(--faint)
}

.is-detail-cta {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 5px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600
}

.is-detail-cta::after {
  content: "+";
  font-family: var(--fn);
  font-weight: 800;
  color: var(--teal)
}

.instructor-slot-row[open] .is-detail-cta {
  border-color: var(--teal-bright);
  background: var(--teal-tint);
  color: var(--ink)
}

.instructor-slot-row[open] .is-detail-cta::after {
  content: "-"
}

.instructor-detail {
  display: block;
  padding: 0 16px 14px 16px
}

.instructor-detail > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px;
  max-width: none
}

.instructor-detail > div > strong {
  display: block;
  margin-top: 4px;
  font-family: var(--fn);
  font-weight: 800;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: var(--ink)
}

.instructor-detail > div > em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted)
}

.mini-schedule {
  overflow-x: auto
}

.mini-schedule-head,
.mini-schedule-row {
  display: grid;
  gap: 4px;
  min-width: 560px;
  margin-bottom: 4px
}

.mini-schedule-head {
  align-items: end
}

.mini-schedule-head span {
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase
}

.mini-time {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-family: var(--fn);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums
}

.mini-cell {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 6px;
  overflow: hidden
}

.mini-cell.hot {
  background: #DDE8D7;
  border-color: #B8CBAF
}

.mini-cell.warm {
  background: #EAF0DD;
  border-color: #D4DFBD
}

.mini-cell.steady {
  background: #F4E4CC;
  border-color: #E4C495
}

.mini-cell.cool {
  background: #F7DED7;
  border-color: #E7BBB0
}

.mini-cell.cold {
  background: #F1E2E5;
  border-color: #DDC6CE
}

.mini-cell.empty {
  background: color-mix(in srgb, var(--paper), transparent 25%);
  border-color: color-mix(in srgb, var(--line), transparent 30%)
}

.mini-cell strong {
  display: block;
  color: var(--ink);
  font-family: var(--fn);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums
}

.mini-cell span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.mini-schedule-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px
}

.geo-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px
}

.geo-head h3 {
  font-size: 28px
}

.geo-address {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  max-width: 420px
}

.geo-map-shell {
  background: #FBF5EA;
  position: relative;
  overflow: hidden;
  min-height: 430px
}

.geo-google-map {
  height: 430px;
  width: 100%;
  background: #FBF5EA
}

.geo-map-loading {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px
}

.geo-map-loading .mark {
  width: 28px;
  height: 18px
}

.geo-map-fallback {
  display: none;
  background: #FBF5EA
}

.geo-map-fallback svg {
  display: block;
  width: 100%;
  min-height: 380px
}

.geo-map-fallback-note {
  display: none;
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 2;
  max-width: 360px;
  background: rgba(251, 245, 234, .94);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px
}

.geo-map-shell.map-fallback .geo-google-map {
  display: none
}

.geo-map-shell.map-fallback .geo-map-fallback,
.geo-map-shell.map-fallback .geo-map-fallback-note {
  display: block
}

.geo-map-shell.map-loaded .geo-map-fallback,
.geo-map-shell.map-loaded .geo-map-fallback-note {
  display: none
}

.geo-info {
  min-width: 170px;
  color: #2C2828;
  font-family: Helvetica Neue, Arial, sans-serif
}

.geo-info strong {
  display: block;
  font-size: 14px;
  margin-bottom: 3px
}

.geo-info span,
.geo-info em {
  display: block;
  font-size: 12px;
  color: #6E6661;
  font-style: normal;
  line-height: 1.35
}

.geo-info em {
  color: #4C7058;
  font-weight: 700;
  margin-top: 5px
}

.geo-river {
  fill: none;
  stroke: #C7D7CF;
  stroke-width: 18;
  stroke-linecap: round;
  opacity: .72
}

.geo-road {
  fill: none;
  stroke: #E7D7C7;
  stroke-width: 4;
  stroke-linecap: round;
  opacity: .82
}

.geo-road.main {
  stroke: #D2BEA8;
  stroke-width: 7;
  opacity: .75
}

.geo-ring {
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.2;
  stroke-dasharray: 5 7;
  opacity: .32
}

.geo-ring-label {
  font-size: 11px;
  fill: var(--brass-deep);
  opacity: .62
}

.geo-zip circle {
  fill: var(--coral);
  stroke: var(--coral-deep);
  stroke-width: 1
}

.geo-zip circle,
.geo-zip text {
  transition: r .18s ease, opacity .18s ease, fill .18s ease, stroke .18s ease
}

.geo-zip text {
  font-family: var(--fn);
  font-size: 12px;
  font-weight: 800;
  fill: #fff;
  text-anchor: middle;
  pointer-events: none;
  font-variant-numeric: tabular-nums
}

.geo-zip:focus circle {
  stroke: var(--ink);
  stroke-width: 2;
  outline: none
}

.geo-zip-label {
  font-size: 11px;
  font-weight: 700;
  fill: var(--fig);
  paint-order: stroke;
  stroke: #FBF5EA;
  stroke-width: 4;
  stroke-linejoin: round
}

.geo-home circle {
  fill: var(--teal);
  stroke: #fff;
  stroke-width: 3
}

.geo-home text {
  font-size: 13px;
  font-weight: 700;
  fill: var(--teal);
  paint-order: stroke;
  stroke: #FBF5EA;
  stroke-width: 4;
  stroke-linejoin: round
}

.geo-studio rect {
  fill: var(--ink);
  opacity: .7;
  transform-origin: center;
  transform-box: fill-box;
  transform: rotate(45deg)
}

.geo-mode {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface)
}

.geo-mode span {
  font-size: 12px;
  color: var(--muted);
  margin-right: 2px
}

.geo-mode button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  border-radius: var(--r-sm);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 500
}

.geo-mode button:hover {
  color: var(--ink);
  border-color: var(--muted)
}

.geo-mode button.active {
  background: var(--teal-tint);
  border-color: var(--teal-bright);
  color: var(--teal)
}

.geo-mode button em {
  font-style: normal;
  color: var(--faint);
  font-weight: 700;
  margin-left: 2px
}

.geo-mode button.active em {
  color: var(--teal)
}

.geo-mode button:focus-visible {
  outline: 2px solid var(--teal-bright);
  outline-offset: 2px
}

.geo-note {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 16px 13px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted)
}

.geo-lower {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px
}

.geo-competitors {
  display: grid;
  grid-template-columns: repeat(2, 1fr)
}

.geo-competitor {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px
}

.geo-competitor:nth-last-child(-n+2) {
  border-bottom: none
}

.geo-competitor span {
  font-weight: 500
}

.geo-competitor em {
  font-style: normal;
  color: var(--muted);
  text-align: right;
  font-size: 12px
}

@media(max-width:920px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr)
  }
}

@media(max-width:820px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr)
  }

  .lower,
  .schedule-side,
  .geo-lower {
    grid-template-columns: 1fr
  }

  .schedule-head,
  .geo-head {
    align-items: flex-start;
    flex-direction: column
  }

  .schedule-note,
  .geo-address {
    text-align: left
  }
}

@media(max-width:820px) {
  .schedule-toggle {
    margin-left: 0;
    border-left: none;
    padding-left: 0
  }

  .slot-start-row,
  .instructor-summary {
    grid-template-columns: 1fr
  }

  .is-detail-cta {
    justify-self: start
  }

  .instructor-detail {
    grid-template-columns: 1fr
  }

  .schedule-explain span {
    max-width: none
  }
}

@media(max-width:700px) {
  .geo-competitors {
    grid-template-columns: 1fr
  }

  .geo-competitor:nth-last-child(-n+2) {
    border-bottom: 1px solid var(--line)
  }

  .geo-competitor:last-child {
    border-bottom: none
  }

  .geo-google-map,
  .geo-map-shell {
    height: 340px;
    min-height: 340px
  }

  .geo-map-fallback svg {
    min-height: 300px
  }
}

@media(max-width:560px) {
  .metric-grid {
    grid-template-columns: 1fr
  }

  .overview-head {
    align-items: flex-start;
    flex-direction: column
  }

  .hero-metric {
    min-height: 118px
  }

  .hero-metric .hm-value {
    font-size: 36px
  }
}

/* ── Settings ─────────────────────────────────────────────────────── */
.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px
}

.settings-head h3 {
  font-size: 20px
}

.settings-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  max-width: 760px
}

.setting-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line)
}

.setting-row:last-child {
  border-bottom: none
}

.setting-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted)
}

.provider-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap
}

.provider-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500
}

.provider-btn:hover {
  background: var(--paper)
}

.provider-btn.active {
  border-color: var(--teal-bright);
  background: var(--teal-tint);
  color: var(--teal)
}

.provider-btn i {
  font-size: 16px
}

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px
}

select,
input {
  font-family: var(--fs);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  min-width: 0;
  width: 100%;
  outline: none
}

select:focus,
input:focus {
  border-color: var(--teal-bright);
  box-shadow: 0 0 0 3px var(--teal-tint)
}

.hidden {
  display: none !important
}

@media(max-width:700px) {
  .settings-head {
    align-items: flex-start;
    flex-direction: column
  }

  .setting-row {
    grid-template-columns: 1fr;
    gap: 8px
  }
}

/* ── Ask Ava chat ─────────────────────────────────────────────────── */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 46vh;
  padding: 6px 0 14px
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 100%
}

.msg.user {
  align-items: flex-end
}

.msg.user .ub {
  background: var(--teal-tint);
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.55
}

.msg.ai {
  align-items: flex-start;
  gap: 10px
}

.bubble {
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink);
  max-width: 760px
}

.bubble.err {
  background: var(--coral-tint);
  border: 1px solid var(--brass-line);
  color: var(--coral-deep);
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 13.5px
}

.trace {
  display: flex;
  flex-wrap: wrap;
  gap: 6px
}

.trace .tc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--faint);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px 9px
}

.trace .tc i {
  font-size: 12px
}

.tool-wait {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 10px;
  font-size: 12px;
  box-shadow: 0 1px 0 rgba(47, 47, 47, .03)
}

.mini-spin {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--teal-bright);
  animation: spin .8s linear infinite
}

.ava-cursor {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  width: 1em;
  height: 1em;
  margin-left: .2em;
  vertical-align: -.12em;
  opacity: .82
}

.ava-cursor i {
  display: block;
  width: 3px;
  height: .36em;
  border-radius: 1px;
  transform-origin: bottom;
  animation: avaWave 1.05s ease-in-out infinite
}

.ava-cursor i:nth-child(1) {
  background: var(--teal-bright);
  animation-delay: 0s
}

.ava-cursor i:nth-child(2) {
  background: var(--brass);
  animation-delay: .14s
}

.ava-cursor i:nth-child(3) {
  background: var(--coral);
  animation-delay: .28s
}

.art {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  max-width: 760px;
  width: 100%
}

.art-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line)
}

.art-h h4 {
  font-family: var(--fd);
  font-weight: 400;
  font-size: 18px;
  margin: 0
}

.art-h .sub2 {
  font-size: 12px;
  color: var(--faint)
}

.art .kpis {
  margin: 0;
  padding: 14px 16px
}

.wl-row .t {
  font-size: 14px;
  font-weight: 500
}

.mdraft {
  padding: 14px 16px
}

.mdraft-body {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.6;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px
}

.copybtn {
  margin-top: 10px
}

.ctable-wrap {
  overflow-x: auto
}

.ctable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}

.ctable th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap
}

.ctable td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--fn);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap
}

.ctable tr:last-child td {
  border-bottom: none
}

.risk-body {
  padding: 14px 16px 16px
}

.risk-controls {
  display: grid;
  grid-template-columns: 1.5fr repeat(4, minmax(84px, .7fr)) auto auto;
  gap: 9px;
  align-items: end;
  margin-bottom: 14px
}

.risk-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0
}

.risk-controls label span {
  font-size: 11px;
  color: var(--faint)
}

.risk-controls select,
.risk-controls input {
  font-size: 12px;
  padding: 7px 8px;
  border-radius: var(--r-sm)
}

.risk-check {
  align-self: center;
  flex-direction: row !important;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  gap: 6px !important;
  white-space: nowrap
}

.risk-check input {
  width: auto
}

.risk-update {
  height: 34px;
  white-space: nowrap
}

.risk-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px
}

.risk-metric {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 10px
}

.risk-metric .k {
  font-size: 11px;
  color: var(--muted)
}

.risk-metric .v {
  font-family: var(--fn);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums
}

.risk-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-sm)
}

.risk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px
}

.risk-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap
}

.risk-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap
}

.risk-table tr:last-child td {
  border-bottom: none
}

.risk-handoff {
  font-weight: 700;
  color: var(--teal)
}

.risk-handoff span {
  font-weight: 500;
  color: var(--faint);
  margin-left: 3px
}

.risk-none {
  color: var(--faint)
}

.risk-note {
  font-size: 11px;
  color: var(--faint);
  margin-top: 10px;
  line-height: 1.4
}

.sched-controls {
  display: grid;
  grid-template-columns: 1.5fr 1.1fr .5fr repeat(4, minmax(78px, .55fr)) auto;
  gap: 9px;
  align-items: end;
  margin-bottom: 14px
}

.sched-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0
}

.sched-controls label span {
  font-size: 11px;
  color: var(--faint)
}

.sched-controls select,
.sched-controls input {
  font-size: 12px;
  padding: 7px 8px;
  border-radius: var(--r-sm)
}

.sched-update {
  height: 34px;
  white-space: nowrap
}

.sched-metrics {
  grid-template-columns: repeat(5, 1fr)
}

.sched-bench {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px
}

.bench-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 10px
}

.bench-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted)
}

.bench-top strong {
  font-family: var(--fn);
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums
}

.bench-track {
  height: 5px;
  background: var(--soft);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 7px
}

.bench-track i {
  display: block;
  height: 100%;
  background: var(--teal-bright);
  border-radius: 999px
}

.bench-sub {
  font-size: 10px;
  color: var(--faint);
  margin-top: 5px
}

.sched-diagnosis {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 12px
}

.sched-table td:nth-child(2) {
  font-family: var(--fn);
  font-variant-numeric: tabular-nums
}

.chat-bar {
  position: sticky;
  bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 10px 10px 16px;
  box-shadow: 0 8px 28px rgba(21, 23, 28, .10);
  margin-top: 8px
}

.chat-bar textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--fs);
  font-size: 14.5px;
  line-height: 1.5;
  background: transparent;
  color: var(--ink);
  max-height: 160px;
  padding: 6px 0
}

.sendbtn {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--fig);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px
}

.sendbtn:hover {
  background: var(--teal-bright)
}

.suggest {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  margin-top: 16px
}

.chip {
  text-align: left;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 8px 14px;
  line-height: 1.4;
  max-width: 100%
}

.chip:hover {
  border-color: var(--teal-bright);
  color: var(--teal)
}

.intro {
  padding: 18px 0 4px
}

.intro h2 {
  font-size: 30px;
  margin-bottom: 8px
}

.intro p {
  color: var(--muted);
  font-size: 14px;
  max-width: 580px;
  margin: 0
}

.typing {
  display: inline-flex;
  gap: 5px;
  padding: 8px 2px
}

.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  display: inline-block;
  animation: ad 1.1s infinite ease-in-out
}

.typing i:nth-child(2) {
  animation-delay: .18s
}

.typing i:nth-child(3) {
  animation-delay: .36s
}

@keyframes ad {

  0%,
  80%,
  100% {
    opacity: .25;
    transform: translateY(0)
  }

  40% {
    opacity: 1;
    transform: translateY(-3px)
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

@keyframes avaWave {

  0%,
  100% {
    height: .34em;
    opacity: .48
  }

  35% {
    height: .92em;
    opacity: .95
  }

  70% {
    height: .52em;
    opacity: .62
  }
}

@media(max-width:820px) {

  .bubble,
  .art,
  .msg.user .ub {
    max-width: 100%
  }
}

@media(max-width:820px) {
  .risk-controls {
    grid-template-columns: 1fr 1fr
  }

  .risk-update {
    grid-column: 1/-1
  }

  .risk-metrics {
    grid-template-columns: repeat(2, 1fr)
  }
}

@media(max-width:820px) {
  .sched-controls {
    grid-template-columns: 1fr 1fr
  }

  .sched-update {
    grid-column: 1/-1
  }

  .sched-metrics,
  .sched-bench {
    grid-template-columns: repeat(2, 1fr)
  }
}

/* chat toolbar + history popover */
.chat-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 20px 0 8px
}

.chat-actions {
  display: flex;
  gap: 8px;
  align-items: center
}

.ghostbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px 11px
}

.ghostbtn:hover {
  color: var(--ink);
  border-color: var(--faint);
  background: var(--surface)
}

.ghostbtn i {
  font-size: 15px
}

.hist-wrap {
  position: relative
}

.chat-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: min(340px, 86vw);
  max-height: 62vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 12px 32px rgba(21, 23, 28, .16)
}

.pop-h {
  font-size: 12px;
  font-weight: 500;
  color: var(--faint);
  padding: 12px 14px 8px
}

.pop-list {
  padding-bottom: 6px
}

.pop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 14px;
  cursor: pointer;
  border-top: 1px solid var(--line)
}

.pop-row:hover {
  background: var(--paper)
}

.pop-row.active {
  background: var(--teal-tint)
}

.pop-meta {
  flex: 1;
  min-width: 0
}

.pop-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.pop-time {
  font-size: 11px;
  color: var(--faint);
  margin-top: 1px
}

.pop-del {
  flex: none;
  color: var(--faint);
  background: transparent;
  border: none;
  padding: 5px;
  border-radius: var(--r-sm);
  font-size: 15px;
  line-height: 1;
  cursor: pointer
}

.pop-del:hover {
  color: var(--red);
  background: var(--red-tint)
}

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