:root {
  --bg: #f2f4f8;
  --ink: #111827;
  --card: #ffffff;
  --line: #dce3ef;
  --brand: #b9384f;
  --accent: #2c5fb1;
  --ok: #0f7b4e;
  --muted: #5b6475;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 14% 14%, #ffdcca 0%, transparent 36%),
    radial-gradient(circle at 80% 22%, #d8e7ff 0%, transparent 42%),
    radial-gradient(circle at 65% 80%, #eef4ff 0%, transparent 32%), var(--bg);
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
}

.bg-shape {
  position: fixed;
  width: 38vw;
  height: 38vw;
  border-radius: 999px;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.45;
}

.bg-shape-a {
  background: #ffe3d6;
  top: -12vw;
  right: -8vw;
}

.bg-shape-b {
  background: #d8ecff;
  bottom: -15vw;
  left: -10vw;
}

.layout {
  width: min(1520px, 94vw);
  margin: 2.4rem auto 3.4rem;
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 1.2rem;
}

.sidebar {
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #fff, #fdfdf8);
  border-radius: 20px;
  padding: 1.6rem;
  height: fit-content;
  position: sticky;
  top: 1.1rem;
  animation: slide-in 0.5s ease;
  box-shadow: 0 20px 45px -38px rgba(23, 34, 60, 0.45);
}

.content {
  display: grid;
  gap: 1.2rem;
}

.eyebrow {
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

h1 {
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(2rem, 3vw, 2.75rem);
  margin: 0.3rem 0;
  line-height: 1.04;
}

.subtitle {
  margin: 0.15rem 0 0;
  max-width: 42ch;
  color: #303845;
  font-size: 1.15rem;
  line-height: 1.4;
}

.refresh-btn {
  margin-top: 1.1rem;
  border: none;
  border-radius: 12px;
  padding: 0.9rem 1.15rem;
  font-weight: 700;
  font-size: 1rem;
  background: linear-gradient(135deg, #121a28, #1e2c40);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.refresh-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px -12px rgba(22, 31, 47, 0.95);
}

.side-nav {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.25rem;
}

.nav-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 0.95rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 1.08rem;
  font-weight: 600;
  transition: border-color 0.2s ease, transform 0.18s ease, box-shadow 0.2s ease;
}

.nav-item strong {
  font-size: 0.9rem;
  color: #32425f;
  background: #eef3ff;
  border: 1px solid #d4def6;
  border-radius: 999px;
  padding: 0.2rem 0.62rem;
  min-width: 2rem;
  text-align: center;
}

.nav-item:hover {
  transform: translateY(-1px);
  border-color: #c8d5f0;
  box-shadow: 0 12px 16px -16px rgba(35, 58, 105, 0.9);
}

.nav-item.is-active {
  border-color: #97b4eb;
  background: linear-gradient(135deg, #fdfefe, #f5f9ff);
  box-shadow: 0 14px 24px -20px rgba(28, 69, 151, 1);
}

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.15rem;
  animation: rise 0.45s ease both;
  min-height: 124px;
  box-shadow: 0 16px 30px -28px rgba(24, 40, 73, 0.45);
}

.card h3 {
  margin: 0;
  font-size: 1.01rem;
  color: #34445f;
}

.card p {
  margin: 0.55rem 0 0;
  font-size: clamp(2rem, 3.3vw, 2.6rem);
  font-weight: 700;
  line-height: 1;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  animation: rise 0.55s ease both;
  min-height: 560px;
  box-shadow: 0 20px 40px -36px rgba(22, 39, 71, 0.45);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  border-bottom: 1px solid var(--line);
  padding: 1.05rem 1.25rem;
}

.panel-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
}

.pill {
  font-size: 0.84rem;
  border-radius: 999px;
  border: 1px solid #cad5ee;
  background: #edf3ff;
  padding: 0.24rem 0.64rem;
}

.table-wrap {
  overflow-x: auto;
  min-height: 470px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.99rem;
}

th,
td {
  text-align: left;
  padding: 0.88rem 1rem;
  border-bottom: 1px solid #edf0e6;
  white-space: nowrap;
  vertical-align: middle;
}

th {
  background: #fafcff;
  font-size: 0.81rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #405372;
}

.empty,
.error {
  padding: 1.25rem;
  color: #576070;
  font-size: 1.03rem;
}

.error {
  color: #a83344;
}

.image-preview-btn {
  border: 1px solid #cad8f3;
  background: #eef4ff;
  color: #234271;
  border-radius: 10px;
  padding: 0.38rem 0.72rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.image-preview-btn:hover {
  transform: translateY(-1px);
  border-color: #aac2eb;
  box-shadow: 0 10px 16px -14px rgba(35, 66, 113, 0.8);
}

.image-preview {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  z-index: 2000;
}

.image-preview.is-open {
  display: grid;
}

.image-preview__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 20, 33, 0.6);
  backdrop-filter: blur(3px);
}

.image-preview__dialog {
  position: relative;
  margin: 0;
  width: min(92vw, 1080px);
  max-height: 88vh;
  background: #ffffff;
  border: 1px solid #d9e2f2;
  border-radius: 14px;
  padding: 0.8rem;
  box-shadow: 0 30px 60px -35px rgba(14, 24, 40, 0.9);
  animation: rise 0.2s ease;
}

.image-preview__close {
  border: 1px solid #d6deec;
  background: #f5f8ff;
  border-radius: 8px;
  padding: 0.34rem 0.56rem;
  font-family: inherit;
  font-weight: 600;
  color: #2c3d5f;
  cursor: pointer;
  margin-bottom: 0.65rem;
}

.image-preview__img {
  display: block;
  width: 100%;
  max-height: calc(88vh - 4.6rem);
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #e4e9f3;
}

.image-preview__error {
  border: 1px solid #ecd7dd;
  background: #fff6f8;
  border-radius: 10px;
  padding: 0.9rem;
}

.image-preview__error-text {
  margin: 0;
  color: #7a2f3d;
  font-weight: 600;
}

.image-preview__source {
  display: inline-block;
  margin-top: 0.55rem;
  color: #234271;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid #cddbf4;
  background: #eef4ff;
  border-radius: 8px;
  padding: 0.33rem 0.56rem;
}

.image-preview__source:hover {
  border-color: #aac2eb;
}

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

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

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    width: min(1100px, 94vw);
  }

  .sidebar {
    position: static;
    padding: 1.15rem;
  }

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

  .panel {
    min-height: 440px;
  }

  .table-wrap {
    min-height: 360px;
  }

  th,
  td {
    font-size: 0.88rem;
    padding: 0.72rem 0.8rem;
  }
}
