:root {
  --accent: #0f766e;
  --accent2: #0d9488;
  --good: #15803d;
  --warn: #d97706;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  background:
    radial-gradient(900px 420px at 8% -12%, rgba(13, 148, 136, 0.18), transparent),
    radial-gradient(840px 520px at 96% -8%, rgba(14, 116, 144, 0.14), transparent),
    var(--bg);
}

.container {
  padding: clamp(14px, 3.2vw, 30px);
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 12;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(150%) blur(12px);
  box-shadow: 0 16px 28px rgba(2, 6, 23, 0.1);
}

.logo {
  width: min(8vw, 34px);
  height: min(8vw, 34px);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

.h1 {
  font-size: clamp(18px, 2.8vw, 24px);
  letter-spacing: 0.2px;
}

.sub {
  max-width: 58ch;
  font-size: 12px;
  color: #475569;
}

.headerRight .btn,
.headerRight .pill {
  min-height: 44px;
}

.btn {
  font-family: inherit;
  font-weight: 800;
  border-color: #c6d2e2;
  min-height: 44px;
}

.inp,
.sel {
  min-height: 44px;
}

.btn:hover {
  background-color: rgba(13, 148, 136, 0.08);
}

.btn:active {
  transform: scale(0.98);
}

.btnPrimary {
  background: linear-gradient(135deg, #0f766e, #0369a1);
}

.btn:focus-visible,
.tabBtn:focus-visible,
.inp:focus-visible,
.sel:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.24);
}

.inp:focus,
.sel:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.15);
}

.card {
  border-width: 1.5px;
  border-color: rgba(148, 163, 184, 0.3);
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 34px rgba(2, 6, 23, 0.12);
}

.cardHd {
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.04), rgba(255, 255, 255, 0));
}

.grid > div > .card:nth-of-type(even) {
  background: rgba(247, 250, 252, 0.95);
}

.cardHd h2 {
  font-size: 12px;
  letter-spacing: 0.09em;
}

.lbl {
  letter-spacing: 0.05em;
}

.chartBox {
  padding: 8px;
}

.esterBtn {
  min-height: 44px;
}

.tabBtn {
  min-height: 44px;
}

.esterBtn--active {
  padding-left: 12px;
  box-shadow: inset 3px 0 0 rgba(45, 212, 191, 0.95), 0 10px 18px rgba(2, 6, 23, 0.12);
}

.kpi strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

#statPeak,
#statTrough,
#statLoad {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  min-height: 30px;
  border-radius: 999px;
  padding: 2px 10px;
}

#statPeak {
  color: #14532d;
  background: rgba(21, 128, 61, 0.12);
  border: 1px solid rgba(21, 128, 61, 0.24);
}

#statTrough {
  color: #1e3a8a;
  background: rgba(37, 99, 235, 0.11);
  border: 1px solid rgba(37, 99, 235, 0.24);
}

#statLoad {
  color: #92400e;
  background: rgba(217, 119, 6, 0.14);
  border: 1px solid rgba(217, 119, 6, 0.24);
}

.gauge {
  position: relative;
  background:
    linear-gradient(90deg, rgba(59, 130, 246, 0.22) 0 33%, rgba(245, 158, 11, 0.22) 33% 66%, rgba(239, 68, 68, 0.22) 66% 100%);
}

.gauge::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background: repeating-linear-gradient(90deg, rgba(15, 23, 42, 0.16) 0 1px, transparent 1px 10%);
}

.note {
  line-height: 1.5;
}

#e2-chart-title {
  letter-spacing: 0.04em;
}

.btn:disabled,
.tabBtn:disabled,
.inp:disabled,
.sel:disabled,
select:disabled,
input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (min-width: 981px) {
  .grid > div:first-child {
    position: sticky;
    top: 96px;
    align-self: start;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .brand {
    width: 100%;
    min-width: 0;
  }

  .brand > div {
    min-width: 0;
  }

  .h1 {
    font-size: clamp(16px, 5vw, 20px);
  }

  .sub {
    max-width: 100%;
  }

  .cardHd {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  #doseActiveHint {
    max-width: 100%;
    white-space: normal;
    text-align: left;
    line-height: 1.2;
    font-size: 10px;
  }

  .esterWrap {
    gap: 6px;
  }

  .esterBtn {
    font-size: 10px;
    padding: 8px 9px;
  }

  .headerRight {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .headerRight .btn,
  .headerRight .pill {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    padding: 12px;
    margin-bottom: 12px;
  }

  .headerRight {
    width: 100%;
  }

  .headerRight .btn,
  .headerRight .pill {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .card,
  .topbar {
    border-radius: 14px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .topbar {
    animation: enter-down 0.45s ease both;
  }

  .grid > div > .card,
  .container > section.card {
    animation: enter-up 0.45s ease both;
  }

  .grid > div:nth-child(1) > .card:nth-of-type(1) {
    animation-delay: 0.04s;
  }

  .grid > div:nth-child(1) > .card:nth-of-type(2) {
    animation-delay: 0.08s;
  }

  .grid > div:nth-child(2) > .card:nth-of-type(1) {
    animation-delay: 0.12s;
  }

  .grid > div:nth-child(2) > .card:nth-of-type(2) {
    animation-delay: 0.16s;
  }

  @keyframes enter-up {
    from {
      opacity: 0;
      transform: translateY(8px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes enter-down {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
