:root {
  --ink: #19151f;
  --muted: #696071;
  --line: #e9e1ef;
  --paper: #fffaf1;
  --panel: #ffffff;
  --purple: #6c31d4;
  --violet: #8e45ff;
  --yellow: #ffd447;
  --green: #36d399;
  --red: #f05a5a;
  --shadow: 0 18px 50px rgba(46, 26, 74, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 12px clamp(18px, 5vw, 64px);
  background: rgba(255, 250, 241, 0.94);
  border-bottom: 1px solid rgba(108, 49, 212, 0.14);
  backdrop-filter: blur(16px);
}

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

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-button,
.ghost,
.primary,
.danger,
.pill {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
}

.nav-button[aria-current="page"] {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.primary {
  color: #160b28;
  background: var(--yellow);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(255, 212, 71, 0.28);
}

.ghost {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.danger {
  color: #fff;
  background: var(--red);
}

.hamburger {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.hamburger::before,
.hamburger::after,
.hamburger span {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: var(--purple);
  transform: translate(-50%, -50%);
}

.hamburger::before {
  transform: translate(-50%, -9px);
}

.hamburger::after {
  transform: translate(-50%, 7px);
}

.shell {
  padding: 0 clamp(16px, 5vw, 64px) 56px;
}

.login-band {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.75fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  min-height: calc(100vh - 72px);
  padding: 40px 0;
}

.login-copy h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.8rem, 8vw, 6.6rem);
  line-height: 0.93;
  letter-spacing: 0;
}

.login-copy p {
  max-width: 640px;
  color: #493d54;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.55;
}

.mascot-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 280px;
}

.mascot-stage::before {
  content: "";
  position: absolute;
  inset: 16% 2% 12%;
  border: 1px solid rgba(108, 49, 212, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 16px 16px 0 var(--yellow);
}

.mascot-stage img {
  position: relative;
  width: min(420px, 85vw);
  max-height: 440px;
  object-fit: contain;
  filter: drop-shadow(0 30px 48px rgba(65, 31, 110, 0.18));
}

.login-panel,
.panel,
.item-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  padding: 18px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.tab.active {
  color: #160b28;
  border-color: transparent;
  background: var(--yellow);
}

.field {
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.field label {
  color: #4e4359;
  font-size: 0.86rem;
  font-weight: 800;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fffdfa;
  color: var(--ink);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.notice {
  border-left: 4px solid var(--purple);
  margin: 14px 0;
  padding: 12px;
  color: #4b3d59;
  background: #f4edff;
  border-radius: 0 8px 8px 0;
}

.dashboard {
  display: none;
}

.dashboard.active {
  display: block;
}

.hero-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 34px 0 18px;
}

.hero-row h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  letter-spacing: 0;
}

.hero-row p {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.stats-grid,
.modules-grid,
.cards-grid {
  display: grid;
  gap: 14px;
}

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

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

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

.panel {
  margin: 18px 0;
  padding: clamp(16px, 3vw, 24px);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head h2,
.item-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.item-card {
  padding: 16px;
  box-shadow: none;
}

.item-card p,
.small,
.meta {
  color: var(--muted);
  line-height: 1.5;
}

.item-card audio {
  width: 100%;
  margin: 12px 0 4px;
}

.stat {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat strong {
  display: block;
  font-size: 2rem;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #efe7fa;
  color: #4d238e;
  font-size: 0.82rem;
  font-weight: 800;
}

.status.ok {
  background: #ddf8ec;
  color: #11633d;
}

.status.warn {
  background: #fff1c2;
  color: #7b5200;
}

.module-row,
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdfa;
  color: #42384d;
  font-size: 0.82rem;
  font-weight: 800;
}

.toggle-pill input {
  width: 16px;
  height: 16px;
  accent-color: var(--purple);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
}

.graph-wrap {
  min-height: 420px;
  background: #19151f;
  border-radius: 8px;
  overflow: hidden;
}

.graph-wrap svg {
  display: block;
  width: 100%;
  height: 420px;
}

.doc-list {
  display: grid;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.doc-list button {
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  background: #fff;
  text-align: left;
}

.doc-view {
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  padding: 14px;
  background: #fffdfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .login-band,
  .split {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .hamburger {
    display: block;
  }

  .topnav {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 76px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .topnav.open {
    display: flex;
  }

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

  .hero-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
