:root {
  --ink: #101315;
  --ink-2: #171b1f;
  --graphite: #22272c;
  --panel: #f4f1ea;
  --paper: #fffaf0;
  --muted: #535d58;
  --line: #d8d1c3;
  --cyan: #31d6c7;
  --accent-on-panel: #00766f;
  --signal: #b8f36a;
  --caveat: #ffbf4e;
  --model: #9b7cff;
  --danger: #ff6b5f;
  --radius: 8px;
  --shadow: 0 18px 50px rgb(16 19 21 / 16%);
  --mono: "SFMono-Regular", "Cascadia Mono", "Liberation Mono", monospace;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
  color: var(--ink);
  font-family: var(--sans);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

a,
button,
input {
  -webkit-tap-highlight-color: rgb(49 214 199 / 20%);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--caveat);
  outline-offset: 3px;
}

.app-shell {
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgb(49 214 199 / 8%) 0 1px, transparent 1px 64px),
    linear-gradient(180deg, rgb(49 214 199 / 7%) 0 1px, transparent 1px 64px),
    var(--ink);
}

.sidebar {
  min-height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid rgb(244 241 234 / 12%);
  color: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 28px;
  background:
    radial-gradient(circle at 30% 10%, rgb(49 214 199 / 18%), transparent 28%),
    linear-gradient(180deg, #101315 0%, #171b1f 100%);
}

.brand {
  min-height: 44px;
  color: inherit;
  text-decoration: none;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  font-weight: 760;
}

.brand img {
  width: 42px;
  height: 42px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 44px;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 10px;
  color: rgb(244 241 234 / 74%);
  text-decoration: none;
  padding: 10px;
  border-radius: var(--radius);
}

.nav-item:hover,
.nav-item.is-active,
.nav-item[aria-current="page"] {
  color: var(--paper);
  background: rgb(244 241 234 / 9%);
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: block;
  position: relative;
}

.lake-icon,
.dataset-icon,
.feature-icon,
.experiment-icon,
.prediction-icon,
.report-icon,
.source-icon {
  border: 1px solid currentColor;
  border-radius: 4px;
}

.lake-icon::before,
.dataset-icon::before,
.feature-icon::before,
.experiment-icon::before,
.prediction-icon::before,
.report-icon::before,
.source-icon::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-left: 2px solid var(--cyan);
  transform: skewX(-18deg);
}

.sync-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgb(244 241 234 / 13%);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  background: rgb(244 241 234 / 7%);
}

.sync-panel strong {
  font-size: 20px;
}

.sync-panel span {
  color: rgb(244 241 234 / 66%);
}

.sync-meter {
  height: 6px;
  background: rgb(244 241 234 / 12%);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
}

.sync-meter span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--signal));
}

.workspace {
  min-width: 0;
  padding: 24px;
  display: grid;
  gap: 18px;
}

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--paper);
}

.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(28px, 3vw, 46px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.eyebrow,
.metric-kicker {
  margin: 0 0 6px;
  color: var(--cyan);
  text-transform: uppercase;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
}

.metric-kicker,
.panel .eyebrow {
  color: var(--accent-on-panel);
}

.topbar .eyebrow {
  color: var(--cyan);
}

.command-box {
  height: 48px;
  width: 100%;
  min-width: min(420px, 100%);
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid rgb(244 241 234 / 16%);
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--caveat);
  background: rgb(244 241 234 / 8%);
}

.command-box input {
  height: 100%;
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--paper);
  background: transparent;
}

.command-box input::placeholder {
  color: rgb(244 241 234 / 62%);
}

.identity-strip,
.metrics-grid,
.main-grid {
  display: grid;
  gap: 14px;
}

.identity-strip {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.wordmark-panel,
.token-stack,
.metric-card,
.panel {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.wordmark-panel {
  min-height: 170px;
  min-width: 0;
  display: grid;
  align-items: center;
  grid-template-columns: minmax(240px, 520px) 1fr;
  gap: 20px;
  padding: 22px;
  overflow: hidden;
}

.wordmark-panel img {
  min-width: 0;
  width: min(100%, 520px);
  max-height: 126px;
  display: block;
}

.wordmark-panel p {
  min-width: 0;
  width: 100%;
  margin: 0;
  line-height: 1.55;
  color: #3c433f;
  max-width: min(48ch, 100%);
  overflow-wrap: anywhere;
}

.token-stack {
  padding: 18px;
  display: grid;
  gap: 10px;
}

.token-stack span {
  min-height: 22px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 10px;
  color: #3c433f;
  font-family: var(--mono);
  font-size: 12px;
}

.token-stack span::before {
  content: "";
  width: 28px;
  height: 22px;
  background: var(--swatch);
  border: 1px solid rgb(16 19 21 / 14%);
  border-radius: 4px;
}

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

.metric-card {
  min-height: 154px;
  min-width: 0;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  opacity: 0.34;
}

.metric-card.bronze::after {
  background: var(--caveat);
}

.metric-card.silver::after {
  background: var(--cyan);
}

.metric-card.gold::after {
  background: var(--signal);
}

.metric-card.catalog::after {
  background: var(--model);
}

.metric-card strong {
  font-size: clamp(30px, 4vw, 48px);
  display: block;
  margin-bottom: 10px;
}

.metric-card p,
.panel-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.main-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 18px;
  overflow: hidden;
  scroll-margin-top: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.panel h2 {
  font-size: 20px;
}

.icon-button {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.section-anchor {
  display: block;
  height: 0;
  scroll-margin-top: 18px;
}

.refresh-icon {
  width: 16px;
  height: 16px;
  border: 2px solid var(--ink);
  border-left-color: transparent;
  border-radius: 50%;
}

.lineage {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.lineage li {
  min-height: 46px;
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.lineage span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.lineage strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.status-dot {
  border: 1px solid rgb(255 191 78 / 62%);
  background: rgb(255 191 78 / 18%);
  color: #7a4f00;
  padding: 6px 9px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
}

.bars {
  display: grid;
  gap: 11px;
  margin-bottom: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 56px 1fr 46px;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 12px;
}

.bar-row i {
  height: 12px;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--model));
  transform-origin: left center;
  scale: max(var(--value), 1%) 1;
}

.source-list,
.ticket-list {
  display: grid;
  gap: 10px;
}

.source-row,
.ticket-row {
  min-height: 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.source-row strong,
.ticket-row strong {
  font-size: 14px;
}

.source-row span,
.ticket-row span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.ticket-row .numbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.ticket-row b {
  min-width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--signal);
  font-family: var(--mono);
  font-size: 12px;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 100%;
    max-width: 100vw;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgb(244 241 234 / 12%);
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sync-panel {
    display: none;
  }

  .identity-strip,
  .main-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .sidebar {
    padding: 16px;
    gap: 16px;
  }

  .brand {
    grid-template-columns: 40px 1fr;
  }

  .brand img {
    width: 40px;
    height: 40px;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    max-width: 100%;
    padding: 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

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

  .nav-item {
    min-width: 142px;
    scroll-snap-align: start;
  }

  .workspace {
    width: 100%;
    max-width: 100vw;
    padding: 16px;
  }

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

  .command-box {
    min-width: 0;
  }

  .topbar h1 {
    line-height: 1.1;
  }

  .wordmark-panel {
    grid-template-columns: 1fr;
  }

  .identity-strip,
  .metrics-grid,
  .main-grid,
  .wordmark-panel,
  .token-stack,
  .metric-card,
  .panel {
    width: 100%;
    max-width: calc(100vw - 32px);
  }

  .wordmark-panel img {
    width: min(100%, 286px);
    max-height: none;
  }

  .wordmark-panel p {
    max-width: 280px;
    font-size: 15px;
  }

  .metric-card p,
  .panel-note {
    max-width: 280px;
  }

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

  .lineage li,
  .source-row,
  .ticket-row {
    grid-template-columns: 1fr;
  }

  .ticket-row .numbers {
    justify-content: flex-start;
  }
}
