:root {
  --crust: #181926;
  --mantle: #1e2030;
  --base: #24273a;
  --surface0: #363a4f;
  --surface1: #494d64;
  --text: #cad3f5;
  --subtext: #a5adcb;
  --lavender: #b7bdf8;
  --blue: #8aadf4;
  --sapphire: #7dc4e4;
  --sky: #91d7e3;
  --teal: #8bd5ca;
  --green: #a6da95;
  --yellow: #eed49f;
  --peach: #f5a97f;
  --red: #ed8796;
  --pink: #f5bde6;
  --mauve: #c6a0f6;
  --outline: #0f111b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(145, 215, 227, 0.15) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(198, 160, 246, 0.15) 0 1px, transparent 1px), var(--crust);
  background-size: 12px 12px, 16px 16px, auto;
  padding: 1.2rem;
}

.panel {
  border: 3px solid var(--outline);
  border-radius: 14px;
  background: var(--base);
  box-shadow: 8px 8px 0 var(--outline);
}

.banner {
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.banner h1 {
  margin: 0.2rem 0;
  font-size: clamp(2rem, 6vw, 3.6rem);
  letter-spacing: 0.06em;
  color: var(--yellow);
  text-shadow: 3px 3px 0 var(--outline);
}

.subtitle {
  margin: 0;
  color: var(--sky);
  font-weight: 700;
}

.tagline,
.mvp-note {
  margin: 0.35rem 0;
  color: var(--subtext);
}

.main-nav {
  padding: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.nav-btn,
button {
  border: 3px solid var(--outline);
  border-radius: 12px;
  background: var(--blue);
  color: var(--crust);
  font-weight: 800;
  padding: 0.55rem 0.8rem;
  box-shadow: 4px 4px 0 var(--outline);
  cursor: pointer;
}

.nav-btn.active {
  background: var(--yellow);
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.grid {
  display: grid;
  gap: 0.8rem;
}

.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.hero-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ── Mission Control ── */

.mc-feed-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 0.8rem 0;
}

.feed-title {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--lavender);
}

.heroes-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.status-chip {
  border: 2px solid var(--outline);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 3px 3px 0 var(--outline);
  cursor: pointer;
  transition: transform 0.08s;
}

.status-chip:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--outline);
}

.section-label {
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--subtext);
}

.compact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.compact-list li {
  font-size: 0.9rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ── Heroes layout ── */

.heroes-intro {
  color: var(--subtext);
  font-size: 0.92rem;
  margin: 0 0 1rem;
}

.heroes-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0.8rem;
  align-items: start;
}

.heroes-nav {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.6rem;
}

.hero-nav-btn {
  background: none;
  border: 2px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.4rem 0.6rem;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: none;
  cursor: pointer;
}

.hero-nav-btn:hover {
  background: var(--surface0);
  border-color: var(--outline);
}

.hero-nav-active {
  background: var(--surface1) !important;
  border-color: var(--outline) !important;
  box-shadow: 3px 3px 0 var(--outline);
}

.hero-nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--outline);
  flex-shrink: 0;
}

.hero-detail-panel {
  padding: 1rem;
}

.hero-detail-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.hero-detail-header h3 {
  margin: 0;
  font-size: 1.3rem;
}

/* ── Hero tabs ── */

.hero-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--surface1);
  padding-bottom: 0.5rem;
  margin-bottom: 0.8rem;
}

.hero-tab {
  border: 2px solid var(--surface1);
  border-radius: 10px 10px 0 0;
  border-bottom: none;
  background: var(--surface0);
  color: var(--subtext);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  box-shadow: none;
  cursor: pointer;
}

.hero-tab.active {
  background: var(--base);
  color: var(--text);
  border-color: var(--outline);
}

.tab-count {
  background: var(--surface1);
  border-radius: 999px;
  padding: 0 0.4rem;
  font-size: 0.75rem;
  margin-left: 0.25rem;
}

.hero-tab-pane {
  display: none;
}

.hero-tab-pane.active {
  display: block;
}

.hero-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  margin: 0.6rem 0;
}

.hero-dl dt {
  color: var(--subtext);
  font-size: 0.85rem;
}

.hero-dl dd {
  margin: 0;
  font-size: 0.9rem;
}

.kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.kpi-pill {
  border: 2px solid var(--outline);
  border-radius: 10px;
  background: var(--surface0);
  padding: 0.35rem 0.6rem;
  display: flex;
  flex-direction: column;
  font-size: 0.82rem;
  box-shadow: 3px 3px 0 var(--outline);
}

.kpi-pill-label {
  color: var(--subtext);
  font-size: 0.75rem;
}

.kpi-pill-value {
  color: var(--teal);
  font-weight: 700;
}

.doc-link {
  display: block;
  padding: 0.8rem 1rem;
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
  margin-top: 0.5rem;
  box-shadow: 4px 4px 0 var(--outline);
}

.doc-link:hover {
  background: var(--surface0);
}

/* ── Feed items (heroes tabs + news flash) ── */

.feed-item {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--surface0);
}

.feed-item:last-child {
  border-bottom: none;
}

.feed-item-header {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.3rem;
}

/* ── News Flash page ── */

.news-topic-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem;
  margin-bottom: 0.5rem;
}

.news-type-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.news-aux-bar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.aux-select {
  width: auto;
  min-width: 160px;
}

.aux-search {
  flex: 1;
  min-width: 180px;
}

.topic-pill,
.type-pill {
  border: 2px solid var(--outline);
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface0);
  color: var(--text);
  box-shadow: 2px 2px 0 var(--outline);
  cursor: pointer;
}

.topic-pill.active {
  background: var(--mauve);
  color: var(--crust);
}

.type-pill.active {
  background: var(--blue);
  color: var(--crust);
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.feed-entry {
  padding: 0.85rem;
}

.feed-entry-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.feed-date {
  margin-left: auto;
}

.feed-entry-title {
  margin: 0 0 0.3rem;
  font-size: 1rem;
}

.feed-entry-summary {
  margin: 0 0 0.5rem;
  color: var(--subtext);
  font-size: 0.9rem;
}

.feed-entry-details summary {
  font-size: 0.85rem;
  color: var(--blue);
  cursor: pointer;
}

.feed-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 0.8rem;
  margin: 0.6rem 0 0;
  font-size: 0.88rem;
}

.feed-dl dt {
  color: var(--subtext);
}

.feed-dl dd {
  margin: 0;
}

.no-results {
  padding: 1.5rem;
  text-align: center;
}

/* ── Chips ── */

.chip {
  display: inline-block;
  border: 1.5px solid var(--outline);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.chip-announcement { background: var(--blue);   color: var(--crust); }
.chip-changelog    { background: var(--teal);   color: var(--crust); }
.chip-roadmap      { background: var(--mauve);  color: var(--crust); }
.chip-incident     { background: var(--red);    color: var(--crust); }
.chip-topic        { background: var(--surface1); color: var(--text); }

.chip-priority-high   { background: var(--red);    color: var(--crust); }
.chip-priority-medium { background: var(--yellow); color: var(--crust); }
.chip-priority-low    { background: var(--green);  color: var(--crust); }

/* ── Control Room tabs ── */

.cr-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--surface1);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.cr-pane {
  display: none;
}

.cr-pane.active {
  display: block;
}

/* ── Manage Heroes grid ── */

.heroes-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.7rem;
}

.manage-hero-card {
  padding: 0.8rem;
}

.manage-hero-name {
  font-weight: 800;
  margin-bottom: 0.15rem;
}

.manage-hero-meta {
  font-size: 0.8rem;
  color: var(--subtext);
  margin-bottom: 0.6rem;
}

.status-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.status-pick-btn {
  border: 2px solid var(--outline);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 2px 2px 0 var(--outline);
  cursor: pointer;
  opacity: 0.45;
}

.status-pick-btn.active {
  opacity: 1;
  box-shadow: 3px 3px 0 var(--outline);
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid var(--outline);
  border-radius: 10px;
  padding: 0.5rem;
  background: var(--surface0);
  color: var(--text);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

label {
  font-size: 0.9rem;
  color: var(--subtext);
  display: block;
  margin-bottom: 0.3rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.sticker {
  background: var(--peach);
}

.kpi-card,
.hero-card,
.feed-card,
.form-panel,
.preview-panel {
  padding: 0.85rem;
}

.status-badge {
  display: inline-block;
  border: 2px solid var(--outline);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.status-new          { background: var(--mauve);  color: var(--crust); }
.status-healthy      { background: var(--green);  color: var(--crust); }
.status-watch        { background: var(--yellow); color: var(--crust); }
.status-deprecated   { background: var(--surface1); color: var(--subtext); }

/* legacy aliases kept for chips */
.healthy    { background: var(--green);  color: var(--crust); }
.watch      { background: var(--yellow); color: var(--crust); }

.split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.8rem;
}

.preview-box {
  white-space: pre-wrap;
  background: var(--mantle);
  border: 2px dashed var(--mauve);
  border-radius: 10px;
  padding: 0.8rem;
}

.meta {
  font-size: 0.85rem;
  color: var(--subtext);
}

.kpi-callout {
  margin: 0;
  color: var(--pink);
  font-weight: 900;
}

.kpi-value {
  margin: 0.5rem 0 0;
  color: var(--teal);
  font-size: 1.5rem;
  font-weight: 900;
}

@media (max-width: 900px) {
  .heroes-layout {
    grid-template-columns: 1fr;
  }
  .heroes-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .mc-feed-row {
    grid-template-columns: 1fr;
  }
  .split {
    grid-template-columns: 1fr;
  }
}
