:root {
  --page-pad: 18px;
  --bg: #f4f5ef;
  --bg-accent: #ebe8dd;
  --surface: #fcfcf8;
  --surface-2: #f7f7f2;
  --surface-3: #fffffe;
  --ink: #19202b;
  --ink-muted: #5b6475;
  --primary: #136b67;
  --primary-2: #0f4d4b;
  --accent: #cc6f1a;
  --line: #d7d8cf;
  --line-strong: #bfc2b6;
  --ok: #0d7d57;
  --warn: #9a5700;
  --error: #ac1e30;
  --shadow-soft: 0 10px 34px rgba(25, 32, 43, 0.08);
  --shadow-card: 0 12px 22px rgba(30, 39, 55, 0.07);
  --radius-lg: 18px;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(95rem 42rem at -8% -10%, #ffffff 0, transparent 45%),
    radial-gradient(88rem 40rem at 110% -5%, #eef8f4 0, transparent 43%),
    linear-gradient(180deg, #f9faf6 0%, var(--bg) 48%, var(--bg-accent) 100%);
  font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.42;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

input,
textarea,
select,
button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid #4e9a96;
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.topbar {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-bottom: 1px solid #104341;
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  display: grid;
  grid-template-columns: minmax(260px, auto) minmax(280px, 1fr) auto;
  gap: 18px;
  align-items: center;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px var(--page-pad);
}

.brand-wrap {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    linear-gradient(145deg, #ffb03a, #f17f1f 54%, #d66714),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 6px 10px rgba(0, 0, 0, 0.2);
}

.title {
  display: inline-block;
  max-width: 100%;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 12px;
  letter-spacing: 0.15px;
  overflow-wrap: anywhere;
}

.quick-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-link {
  color: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.pill-link:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.14);
}

.search {
  position: relative;
  min-width: 0;
}

.search::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  transform: translateY(-55%);
  opacity: 0.95;
  pointer-events: none;
}

.search::after {
  content: "";
  position: absolute;
  left: 25px;
  top: calc(50% + 5px);
  width: 7px;
  height: 2px;
  background: rgba(255, 255, 255, 0.76);
  transform: rotate(45deg);
  border-radius: 2px;
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0 14px 0 34px;
  backdrop-filter: blur(2px);
}

.search input::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.link-btn,
.ghost,
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 35px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}

.link-btn:hover,
.ghost:hover,
.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.link-btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.06);
}

.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.btn {
  background: var(--primary);
  color: #fff;
  border-color: #0f4f4b;
  box-shadow: 0 6px 16px rgba(19, 107, 103, 0.24);
}

.btn.alt {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  gap: 18px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 18px var(--page-pad);
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 12px;
  position: sticky;
  top: 88px;
  height: fit-content;
}

.panel {
  background: linear-gradient(180deg, var(--surface), var(--surface-3));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-card);
}

.panel-note {
  background: linear-gradient(170deg, #f5f8f3, #f2f2ea);
}

.panel-title {
  margin: 0 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.95px;
  color: var(--ink-muted);
  font-weight: 700;
}

.muted {
  color: var(--ink-muted);
}

.kv {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  align-items: start;
}

code,
pre {
  font-family: "Berkeley Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.content {
  min-width: 0;
  overflow: hidden;
}

.flash {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 11px 12px;
  margin-bottom: 12px;
  background: var(--surface-2);
  box-shadow: var(--shadow-card);
  animation: rise-in 160ms ease;
}

.flash.ok {
  color: var(--ok);
  border-color: #b9e4d4;
  background: #f1fbf7;
}

.flash.warn {
  color: var(--warn);
  border-color: #f0d8b6;
  background: #fff8ee;
}

.flash.error {
  color: var(--error);
  border-color: #f0c1c8;
  background: #fff4f6;
}

.view-root {
  display: grid;
  gap: 12px;
}

.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-3));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
  animation: rise-in 180ms ease;
  min-width: 0;
}

.card + .card {
  margin-top: 0;
}

.pkg-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.pkg-name {
  margin: 0;
  font-weight: 700;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.pkg-name:hover {
  text-decoration: none;
}

.pkg-meta {
  color: var(--ink-muted);
  font-size: 13px;
  margin: 0;
  overflow-wrap: anywhere;
}

.pkg-desc {
  margin: 10px 0 0;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-muted);
  font-size: 11px;
  padding: 2px 9px;
  font-weight: 600;
}

.card-heading {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.3px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface-2);
}

.stat span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink-muted);
}

.stat strong {
  font-size: 18px;
}

.empty-state {
  text-align: center;
  padding: 22px;
}

.empty-state p {
  margin: 8px auto;
  max-width: 56ch;
}

.grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

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

.list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.version-list {
  padding-left: 0;
  list-style: none;
}

.version-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 8px 10px;
}

.version-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.version-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  max-height: 480px;
  line-height: 1.45;
}

.form {
  display: grid;
  gap: 10px;
}

.form .row {
  display: grid;
  gap: 6px;
}

.form .row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #4a9894;
  box-shadow: 0 0 0 3px rgba(19, 107, 103, 0.12);
  outline: none;
}

.token-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 9px;
}

.token-key {
  overflow-wrap: anywhere;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

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

@media (max-width: 1100px) {
  .topbar-inner {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .topbar {
    position: static;
  }

  .sidebar {
    position: static;
  }

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

@media (max-width: 760px) {
  :root {
    --page-pad: 12px;
  }

  .layout {
    gap: 12px;
  }

  .topbar-inner {
    padding-top: 12px;
    padding-bottom: 12px;
  }

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

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

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

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

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .kv {
    grid-template-columns: 82px minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  :root {
    --page-pad: 10px;
  }

  .layout {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .panel,
  .card {
    padding: 12px;
  }

  .title {
    font-size: 16px;
  }

  .subtitle {
    font-size: 11px;
  }

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

  .top-actions > * {
    width: 100%;
  }

  .kv {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .form-actions .btn,
  .form-actions .btn.alt,
  .version-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
