:root {
  --paper: #f5f3ed;
  --ink: #171713;
  --muted: #66645b;
  --line: #d4cec0;
  --panel: #fffdf7;
  --panel-2: #ece7dc;
  --green: #246b4f;
  --acid: #b3e045;
  --blue: #315b8d;
  --rust: #9d4d28;
  --shadow: 0 18px 44px rgba(43, 37, 25, 0.13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 23, 19, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(23, 23, 19, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif;
}

button, input, select {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 18px;
}

.eyebrow, .section-kicker {
  margin: 0 0 8px;
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(44px, 7vw, 108px);
  line-height: 0.86;
  letter-spacing: 0;
  max-width: 780px;
}

.status-strip {
  border: 1px solid var(--ink);
  padding: 10px 12px;
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 0 3px rgba(179, 224, 69, 0.24);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 16px;
  margin: 22px 0 18px;
}

.hero-panel, .radar-panel, .toolbar, .card, .contract-row, .gap-card {
  background: rgba(255, 253, 247, 0.94);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 28px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-panel h2 {
  font-size: clamp(34px, 4.4vw, 72px);
  line-height: 0.95;
  max-width: 920px;
  margin-bottom: 18px;
}

.hero-copy {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
  max-width: 760px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.metric {
  border-top: 3px solid var(--ink);
  padding-top: 10px;
}

.metric strong {
  display: block;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.radar-panel {
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.radar-panel::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px dashed rgba(23, 23, 19, 0.22);
  pointer-events: none;
}

.radar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  font-size: 12px;
  position: relative;
  z-index: 1;
}

.radar-head strong {
  font-size: 28px;
  color: var(--green);
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 12px;
  position: relative;
  z-index: 1;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  border: 1px solid var(--ink);
  background: var(--ink);
  gap: 1px;
  margin-bottom: 12px;
}

.tab {
  border: 0;
  min-height: 48px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.tab.is-active {
  background: var(--ink);
  color: var(--paper);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 220px 220px;
  gap: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.search-wrap, .select-wrap {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
}

input, select {
  width: 100%;
  border: 1px solid var(--ink);
  background: #fff;
  color: var(--ink);
  padding: 12px;
  min-height: 44px;
}

.view { display: none; }
.view.is-visible { display: block; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card {
  padding: 18px;
  min-height: 190px;
  position: relative;
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  right: -34px;
  top: -34px;
  width: 110px;
  height: 110px;
  border: 1px solid rgba(23, 23, 19, 0.16);
  transform: rotate(18deg);
}

.card h3 {
  font-size: 26px;
  margin-bottom: 10px;
  line-height: 1;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 4px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--ink);
}

.pill.high { background: #dfeedd; border-color: #a8c9a0; }
.pill.medium { background: #e6edf8; border-color: #aabbd4; }
.pill.watch { background: #f4e1d8; border-color: #d1aa95; }

.bar {
  height: 9px;
  background: var(--panel-2);
  border: 1px solid var(--ink);
  margin-top: 12px;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--acid));
}

.contract-list {
  display: grid;
  gap: 10px;
}

.contract-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.contract-title {
  font-size: 18px;
  font-weight: 800;
}

.addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--blue);
  overflow-wrap: anywhere;
}

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

.icon-btn, .link-btn {
  min-width: 38px;
  min-height: 38px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 800;
}

.gap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.gap-card {
  padding: 18px;
  border-left-width: 8px;
}

.gap-card.high { border-left-color: var(--rust); }
.gap-card.medium { border-left-color: var(--blue); }
.gap-card.watch { border-left-color: var(--green); }
.gap-card.good { border-left-color: var(--green); }

.ava-shell {
  display: grid;
  gap: 16px;
}

.ava-hero, .ava-product, .ava-contract, .check-card, .limitations, .drift-card {
  background: rgba(255, 253, 247, 0.94);
  border: 1px solid var(--ink);
  box-shadow: var(--shadow);
}

.ava-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  gap: 20px;
  padding: 24px;
}

.ava-hero h2, .section-head h2 {
  margin-bottom: 10px;
  font-size: clamp(28px, 4vw, 58px);
  line-height: 0.98;
}

.ava-metrics, .ava-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ava-products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ava-product {
  padding: 18px;
}

.ava-product h3 {
  font-size: 34px;
  margin-bottom: 14px;
}

.holder-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 14px;
}

.holder-strip a {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 46px;
  padding: 7px 8px;
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.holder-strip span,
.holder-strip strong {
  display: block;
  line-height: 1.1;
}

.holder-strip span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.holder-strip strong {
  font-size: 13px;
}

.ava-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 16px;
}

.section-head {
  margin-bottom: 10px;
}

.ava-contract-list, .check-grid {
  display: grid;
  gap: 10px;
}

.ava-contract {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.ava-contract strong {
  display: block;
  font-size: 17px;
}

.control-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.check-card {
  padding: 16px;
  border-left-width: 8px;
}

.drift-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.drift-card {
  padding: 16px;
  border-left-width: 8px;
}

.check-card.ok, .drift-card.ok { border-left-color: var(--green); }
.check-card.watch, .drift-card.watch { border-left-color: var(--blue); }
.check-card.high, .drift-card.high { border-left-color: var(--rust); }

.check-card h3, .drift-card h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

.check-card p, .limitations p, .drift-card p {
  color: var(--muted);
  line-height: 1.38;
}

.monitor-shell {
  display: grid;
  gap: 16px;
}

.row-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-row {
  display: grid;
  grid-template-columns: 1.3fr repeat(3, minmax(140px, 0.6fr));
  gap: 10px;
  align-items: center;
  border: 1px solid var(--ink);
  background: rgba(255, 253, 247, 0.94);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.history-row strong {
  font-size: 13px;
}

.source-stack {
  display: grid;
  gap: 10px;
  align-content: start;
}

.source-stack a {
  display: grid;
  gap: 5px;
  min-height: 74px;
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  padding: 12px;
}

.source-stack span {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.source-stack strong {
  line-height: 1.15;
}

.secz-hero {
  background:
    linear-gradient(135deg, rgba(179, 224, 69, 0.18), transparent 42%),
    rgba(255, 253, 247, 0.94);
}

.chart-panel {
  border: 1px solid var(--ink);
  background: rgba(255, 253, 247, 0.94);
  box-shadow: var(--shadow);
  padding: 18px;
}

.chart-panel h3 {
  font-size: 24px;
  margin-bottom: 12px;
}

.history-chart {
  width: 100%;
  height: 220px;
  border: 1px solid var(--ink);
  background:
    linear-gradient(90deg, rgba(23,23,19,0.08) 1px, transparent 1px),
    linear-gradient(rgba(23,23,19,0.08) 1px, transparent 1px),
    #fff;
  background-size: 10% 25%;
}

.history-chart path {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.6;
  vector-effect: non-scaling-stroke;
}

.limitations {
  margin-top: 10px;
  padding: 14px 16px;
}

.limitations p {
  margin-bottom: 8px;
}

.limitations p:last-child {
  margin-bottom: 0;
}

.text-link {
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.empty {
  border: 1px dashed var(--ink);
  padding: 40px;
  text-align: center;
  color: var(--muted);
  background: rgba(255,255,255,0.55);
}

@media (max-width: 980px) {
  .hero-grid, .toolbar, .grid, .gap-grid, .ava-hero, .ava-products, .ava-columns, .drift-grid, .history-row {
    grid-template-columns: 1fr;
  }

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

  .contract-row, .ava-contract {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: flex-start;
  }

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

  .status-strip {
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 16px;
  }

  h1 {
    font-size: 46px;
  }

  .hero-panel {
    padding: 18px;
    min-height: 0;
  }

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

  .ava-metrics, .ava-product-grid {
    grid-template-columns: 1fr;
  }

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

  .metric-row {
    grid-template-columns: 1fr;
  }
}
