:root {
  --bg: #f4f8fb;
  --bg-alt: #e8f0f8;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-border: rgba(25, 44, 66, 0.1);
  --ink: #123047;
  --ink-soft: #3f5d75;
  --accent: #007a78;
  --accent-soft: #14a098;
  --warn: #e48b2c;
  --danger: #cf4d39;
  --ok: #167c45;
  --shadow: 0 20px 50px rgba(8, 34, 52, 0.12);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: linear-gradient(160deg, #eef5fb 0%, #f8fcff 48%, #ecf5f3 100%);
  font-family: "Avenir Next", "Sora", "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 15% 10%, rgba(16, 160, 160, 0.18), transparent 32%),
    radial-gradient(circle at 84% 14%, rgba(24, 104, 214, 0.13), transparent 36%),
    radial-gradient(circle at 78% 85%, rgba(235, 146, 40, 0.16), transparent 34%);
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.2rem clamp(1rem, 3vw, 2.2rem) 3rem;
}

.glass {
  border: 1px solid var(--surface-border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius-xl);
  animation: rise 0.45s ease both;
}

.title-wrap h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  font-family: "Avenir Next Condensed", "Bebas Neue", "Franklin Gothic Medium", sans-serif;
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.71rem;
  color: var(--accent);
  font-weight: 600;
}

.muted {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(104px, 1fr));
  gap: 0.65rem;
}

.meta-pill {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.8), rgba(234, 245, 248, 0.72));
  border: 1px solid rgba(25, 44, 66, 0.08);
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
  display: grid;
  gap: 0.2rem;
}

.meta-pill span {
  color: var(--ink-soft);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meta-pill strong {
  font-size: 0.95rem;
}

.meta-action {
  align-content: center;
}

.logout-btn {
  margin-top: 0.05rem;
  border: 1px solid rgba(15, 53, 77, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #18425b;
  padding: 0.38rem 0.62rem;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

.view-nav {
  margin-top: 0.9rem;
  border-radius: 999px;
  padding: 0.3rem;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  animation: rise 0.6s ease both;
}

.view-btn {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  padding: 0.65rem 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s ease;
}

.view-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
}

.view-btn.is-active {
  background: linear-gradient(120deg, #0f7f7a, #0f8ea8);
  color: #fff;
  box-shadow: 0 10px 24px rgba(2, 88, 108, 0.28);
}

.content {
  margin-top: 1rem;
}

.view-panel {
  display: none;
  opacity: 0;
  transform: translateY(8px);
}

.view-panel.is-visible {
  display: block;
  animation: panel-in 0.32s ease both;
}

.view-panel > .panel {
  margin-top: 0.8rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.compact-metrics {
  margin-top: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.metric-card {
  border-radius: var(--radius-lg);
  padding: 0.85rem 0.95rem;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.87), rgba(233, 246, 243, 0.78));
  border: 1px solid rgba(18, 48, 71, 0.08);
  transform: translateY(0);
  transition: transform 0.22s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
}

.metric-card p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-card strong {
  display: block;
  font-size: 1.35rem;
  margin-top: 0.35rem;
}

.panel-grid {
  display: grid;
  gap: 0.8rem;
  margin-top: 0.8rem;
}

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

.panel-grid.three-up {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  border-radius: var(--radius-xl);
  padding: 0.9rem;
}

.panel h2 {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #1f4c67;
}

.chart {
  margin-top: 0.7rem;
  min-height: 220px;
}

.chart-context {
  margin-top: 0.55rem;
  border: 1px solid rgba(20, 61, 84, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  padding: 0.55rem 0.62rem;
}

.chart-context p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #315f7a;
}

.chart-center {
  display: grid;
  place-items: center;
}

.card-stack {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.45rem;
}

.ratio-card {
  border: 1px solid rgba(16, 52, 78, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  padding: 0.65rem 0.75rem;
}

.ratio-head {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: baseline;
}

.ratio-head strong {
  font-size: 1.1rem;
}

.ratio-meta {
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.79rem;
}

.finding-list {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.5rem;
}

.finding-item {
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(15, 48, 71, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.finding-item h3 {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.finding-item p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.35;
}

.finding-meta {
  margin-top: 0.34rem;
  font-size: 0.72rem;
  color: #2a607a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.panel-subtle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.action-panel {
  margin-top: 0.8rem;
}

.action-grid {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.62rem;
}

.action-card {
  border: 1px solid rgba(12, 55, 80, 0.12);
  border-radius: 14px;
  padding: 0.68rem 0.72rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(228, 243, 250, 0.76));
  display: grid;
  gap: 0.4rem;
}

.action-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #26617e;
  font-weight: 700;
}

.action-card h3 {
  margin: 0;
  font-size: 0.95rem;
}

.action-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.35;
}

.action-foot {
  margin-top: 0.15rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.55rem;
}

.jump-btn {
  border: 1px solid rgba(20, 64, 89, 0.2);
  background: rgba(255, 255, 255, 0.92);
  color: #1f5370;
  border-radius: 999px;
  padding: 0.29rem 0.62rem;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.jump-btn:hover {
  background: linear-gradient(120deg, rgba(17, 130, 126, 0.18), rgba(21, 128, 165, 0.18));
  border-color: rgba(11, 109, 129, 0.42);
}

.chip-row {
  display: inline-flex;
  gap: 0.4rem;
}

.chip {
  border: 1px solid rgba(13, 63, 85, 0.2);
  background: rgba(255, 255, 255, 0.76);
  color: #24556f;
  border-radius: 999px;
  padding: 0.36rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.chip.active {
  border-color: #0f7f7a;
  color: #fff;
  background: linear-gradient(120deg, #0f7f7a, #0f8ea8);
}

.tool-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.search,
.select {
  border: 1px solid rgba(10, 50, 72, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.47rem 0.6rem;
  color: var(--ink);
}

.search {
  min-width: min(280px, 70vw);
}

.table-wrap {
  margin-top: 0.65rem;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(18, 48, 71, 0.1);
  background: rgba(255, 255, 255, 0.85);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.56rem 0.58rem;
  font-size: 0.82rem;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.67rem;
  color: #2a556f;
  background: rgba(225, 238, 247, 0.95);
}

tbody tr:nth-child(even) {
  background: rgba(243, 248, 252, 0.75);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  border-radius: 999px;
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.24rem 0.56rem;
  font-weight: 700;
}

.badge.high,
.badge.risk,
.badge.very-high {
  background: rgba(207, 77, 57, 0.15);
  color: #a22d1d;
}

.badge.moderate,
.badge.intermediate {
  background: rgba(228, 139, 44, 0.19);
  color: #7f4d12;
}

.badge.low,
.badge.in-range,
.badge.in-control,
.badge.negative {
  background: rgba(26, 124, 69, 0.16);
  color: #125830;
}

.compact-table {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.44rem;
}

.row-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.6rem;
  align-items: center;
  padding: 0.56rem 0.62rem;
  border: 1px solid rgba(15, 53, 77, 0.1);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 12px;
}

.row-card h3 {
  margin: 0;
  font-size: 0.84rem;
}

.row-card span {
  font-size: 0.77rem;
  color: var(--ink-soft);
}

.note-panel p {
  margin: 0.7rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.4;
}

.collapse-panel {
  margin-top: 0.8rem;
  padding: 0.72rem 0.82rem;
}

.collapse-panel summary {
  cursor: pointer;
  font-size: 0.82rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #1f4c67;
  font-weight: 700;
  list-style: none;
}

.collapse-panel summary::-webkit-details-marker {
  display: none;
}

.collapse-panel[open] summary {
  margin-bottom: 0.55rem;
}

.tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 20;
  padding: 0.4rem 0.52rem;
  border-radius: 10px;
  background: rgba(19, 42, 59, 0.92);
  color: #f2f8ff;
  font-size: 0.74rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.chart svg {
  width: 100%;
  height: 100%;
}

.heat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
}

.heat-cell {
  border-radius: 12px;
  padding: 0.54rem;
  border: 1px solid rgba(17, 62, 83, 0.1);
  background: rgba(255, 255, 255, 0.84);
  min-height: 76px;
  display: grid;
  gap: 0.25rem;
}

.heat-cell strong {
  font-size: 1.06rem;
}

.heat-cell span {
  font-size: 0.74rem;
  color: #315f7a;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .panel-grid.two-up,
  .panel-grid.three-up {
    grid-template-columns: 1fr;
  }

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

  .topbar {
    flex-direction: column;
  }

  .meta-grid {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 0.7rem 0.7rem 2rem;
  }

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

  .row-card {
    grid-template-columns: 1fr;
    gap: 0.26rem;
  }

  th,
  td {
    font-size: 0.78rem;
  }
}
