:root {
  --bg: #050915;
  --rail: #07111f;
  --rail-2: #0b1728;
  --panel: #0b1322;
  --panel-2: #101b2d;
  --panel-3: #160b1f;
  --line: #1b3154;
  --line-hot: #4d7dff;
  --text: #e8edf9;
  --muted: #8e9ab2;
  --dim: #556176;
  --cyan: #22f0d0;
  --blue: #5d8dff;
  --purple: #9b5cff;
  --pink: #ff5cae;
  --red: #ff4f67;
  --amber: #ffca4f;
  --green: #32e59f;
  --shadow: 0 0 34px rgba(78, 125, 255, 0.16);
  --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Menlo, monospace;
  --sans: "Avenir Next", "Trebuchet MS", Verdana, sans-serif;
  color-scheme: dark;
  font-family: var(--sans);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 12%, rgba(93, 141, 255, 0.18), transparent 25rem),
    radial-gradient(circle at 88% 18%, rgba(155, 92, 255, 0.14), transparent 28rem),
    linear-gradient(180deg, #030712 0%, var(--bg) 52%, #040612 100%);
  color: var(--text);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(93, 141, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93, 141, 255, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  content: "";
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.65), transparent 78%);
}

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

button {
  cursor: pointer;
}

code,
pre {
  font-family: var(--mono);
}

.shell {
  display: grid;
  grid-template-columns: 13.5rem minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid #203b66;
  background:
    linear-gradient(180deg, rgba(9, 22, 39, 0.96), rgba(5, 12, 23, 0.98)),
    var(--rail);
  box-shadow: 12px 0 36px rgba(0, 0, 0, 0.32);
}

.mascot {
  display: grid;
  height: 4.4rem;
  place-items: end center;
  font-size: 1.85rem;
  filter: drop-shadow(0 0 12px rgba(255, 92, 174, 0.52));
}

.mission-lockup {
  display: grid;
  gap: 0.22rem;
  margin: 0.72rem 0.95rem 0.72rem;
  padding: 0.86rem 0.4rem;
  border: 1px solid #294978;
  border-radius: 0.34rem;
  background: linear-gradient(180deg, rgba(14, 29, 50, 0.95), rgba(7, 18, 33, 0.94));
  box-shadow: inset 0 0 0 1px rgba(93, 141, 255, 0.18), 0 0 22px rgba(93, 141, 255, 0.14);
  color: #f6f8ff;
  font-weight: 900;
  letter-spacing: 0.28em;
  line-height: 1.28;
  text-align: center;
  text-transform: uppercase;
}

.online {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.52rem;
  padding-bottom: 1.18rem;
  border-bottom: 1px solid #203b66;
  color: #abb7cc;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

.online-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
}

.tabs {
  display: grid;
  gap: 0.4rem;
  padding: 1.1rem 0.45rem;
}

.tab {
  display: flex;
  align-items: center;
  gap: 0.74rem;
  width: 100%;
  padding: 0.78rem 0.86rem;
  border: 1px solid transparent;
  border-radius: 0.34rem;
  background: transparent;
  color: #a7b2c7;
  text-align: left;
}

.tab:hover,
.tab.active {
  border-color: #4d7dff;
  background: linear-gradient(90deg, rgba(93, 141, 255, 0.2), rgba(155, 92, 255, 0.08));
  box-shadow: inset 0 0 0 1px rgba(93, 141, 255, 0.18), 0 0 16px rgba(93, 141, 255, 0.24);
  color: #f4f7ff;
}

.tab .nav-icon {
  width: 1.3rem;
  font-size: 1rem;
}

.tab .nav-label {
  flex: 1;
  font-weight: 800;
}

.tab .nav-pulse {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 999px;
  background: transparent;
}

.tab.active .nav-pulse {
  background: var(--cyan);
  box-shadow: 0 0 11px var(--cyan);
}

.sidebar-card {
  margin: auto 0.65rem 0.9rem;
  padding: 0.72rem;
  border-top: 1px solid #203b66;
  color: var(--dim);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--purple);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.main {
  min-width: 0;
  padding: 1.55rem 1.7rem 2.5rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.05rem;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
  letter-spacing: -0.04em;
}

.topbar p {
  margin: 0.28rem 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.live-chip,
.tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 0.35rem;
  padding: 0.24rem 0.48rem;
  border: 1px solid rgba(155, 92, 255, 0.25);
  border-radius: 0.32rem;
  background: rgba(155, 92, 255, 0.12);
  color: #c9b7ff;
  font-family: var(--mono);
  font-size: 0.69rem;
  font-weight: 800;
  text-transform: uppercase;
}

.live-chip {
  border-color: rgba(34, 240, 208, 0.24);
  background: rgba(34, 240, 208, 0.08);
  color: var(--cyan);
}

.button {
  min-height: 2.15rem;
  padding: 0.52rem 0.78rem;
  border: 1px solid rgba(155, 92, 255, 0.6);
  border-radius: 0.34rem;
  background: linear-gradient(180deg, #a75dff, #6f38e9);
  color: white;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(155, 92, 255, 0.28);
}

.button.ghost {
  border-color: #294978;
  background: rgba(13, 25, 45, 0.74);
  color: #cdd7eb;
  box-shadow: none;
}

.button.small {
  min-height: 1.85rem;
  padding: 0.34rem 0.55rem;
  font-size: 0.74rem;
}

.metric-grid {
  display: none;
}

.view,
.grid {
  display: grid;
  gap: 0.9rem;
}

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

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.card,
.panel {
  min-width: 0;
  border: 1px solid #223d68;
  border-radius: 0.42rem;
  background:
    linear-gradient(180deg, rgba(14, 26, 45, 0.94), rgba(9, 16, 30, 0.96)),
    var(--panel);
  box-shadow: inset 0 0 0 1px rgba(93, 141, 255, 0.06), var(--shadow);
}

.card {
  padding: 1rem;
}

.card h3,
.panel h3 {
  margin: 0 0 0.9rem;
  color: #f4f7ff;
}

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

.tiny {
  font-size: 0.75rem;
}

.list {
  display: grid;
  gap: 0.68rem;
}

.list-item {
  display: grid;
  gap: 0.42rem;
  padding: 0.88rem 0.96rem;
  border: 1px solid rgba(55, 86, 137, 0.78);
  border-radius: 0.42rem;
  background: rgba(12, 22, 39, 0.76);
}

.list-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.list-item p {
  margin: 0;
  line-height: 1.5;
}

.watch-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(61, 88, 136, 0.5);
}

.watch-tab {
  padding: 0.74rem 1rem;
  border: 1px solid rgba(155, 92, 255, 0.3);
  border-radius: 0.32rem;
  background: rgba(155, 92, 255, 0.16);
  color: #d7c5ff;
  font-weight: 900;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin: 1rem 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.35rem;
  border-radius: 999px;
  background: var(--blue);
}

.dot.red {
  background: var(--red);
}

.dot.amber {
  background: var(--amber);
}

.dot.dim {
  background: #9ba7bc;
}

.watch-card {
  position: relative;
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid rgba(255, 79, 103, 0.38);
  border-radius: 0.45rem;
  background:
    linear-gradient(90deg, rgba(255, 79, 103, 0.1), rgba(155, 92, 255, 0.06)),
    #170a1d;
  box-shadow: inset 0 0 24px rgba(255, 79, 103, 0.05);
}

.watch-card.watch-mid {
  border-color: rgba(255, 202, 79, 0.34);
  background: linear-gradient(90deg, rgba(255, 202, 79, 0.08), rgba(155, 92, 255, 0.05)), #14101c;
}

.watch-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.make-now {
  padding: 0.24rem 0.44rem;
  border-radius: 0.24rem;
  background: rgba(255, 79, 103, 0.16);
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 900;
}

.score-row {
  display: grid;
  grid-template-columns: 5rem 3rem 1fr;
  align-items: center;
  gap: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.score-bar {
  height: 0.33rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(155, 92, 255, 0.2);
}

.score-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--purple));
  box-shadow: 0 0 16px rgba(255, 79, 103, 0.65);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.chip {
  padding: 0.22rem 0.46rem;
  border-radius: 0.28rem;
  background: rgba(155, 92, 255, 0.12);
  color: #b999ff;
  font-family: var(--mono);
  font-size: 0.68rem;
}

.memory-layout {
  display: grid;
  grid-template-columns: minmax(17rem, 23rem) minmax(0, 1fr);
  gap: 0.9rem;
}

.log-list {
  display: grid;
  gap: 0.55rem;
  max-height: calc(100vh - 14rem);
  overflow: auto;
}

.log-card {
  padding: 0.95rem;
  border: 1px solid #28466f;
  border-radius: 0.38rem;
  background: rgba(13, 25, 45, 0.85);
  cursor: pointer;
}

.log-card.active,
.log-card:hover {
  border-color: var(--purple);
  box-shadow: inset 0 0 0 1px rgba(155, 92, 255, 0.28), 0 0 18px rgba(155, 92, 255, 0.18);
}

.reader {
  min-height: calc(100vh - 12rem);
  max-height: calc(100vh - 8rem);
  overflow: auto;
  padding: 1.25rem;
  border: 1px solid #315381;
  border-radius: 0.42rem;
  background: #0a1424;
  color: #c4ccdb;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.scheduler-card {
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid rgba(49, 83, 129, 0.85);
  border-left: 0.22rem solid var(--cyan);
  border-radius: 0.42rem;
  background: rgba(13, 25, 45, 0.78);
}

.scheduler-card.disabled {
  opacity: 0.62;
  border-left-color: var(--pink);
}

.scheduler-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.scheduler-title {
  color: var(--cyan);
  font-weight: 900;
}

.cron {
  color: #c8d0de;
  font-family: var(--mono);
}

.team-mission {
  padding: 1.35rem;
  border-color: rgba(155, 92, 255, 0.28);
  background:
    radial-gradient(circle at 84% 28%, rgba(255, 92, 174, 0.12), transparent 12rem),
    rgba(16, 9, 26, 0.86);
}

.mission-quote {
  margin: 0;
  color: #f3f4ff;
  font-size: 1.08rem;
  font-style: italic;
  line-height: 1.7;
}

.section-rule {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
  margin: 1.4rem 0 0.85rem;
  color: #737d94;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.section-rule::before,
.section-rule::after {
  height: 1px;
  background: linear-gradient(90deg, transparent, #263d64, transparent);
  content: "";
}

.person-card {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid rgba(155, 92, 255, 0.32);
  border-radius: 0.44rem;
  background: rgba(17, 10, 30, 0.74);
}

.avatar {
  display: grid;
  width: 2.9rem;
  height: 2.9rem;
  place-items: center;
  color: var(--agent-color, var(--purple));
  font-size: 2rem;
  text-shadow: 0 0 18px currentColor;
}

.office-board {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: 13rem 13rem;
  gap: 0.8rem;
  min-height: 28rem;
  padding: 0.8rem;
  border: 1px solid #223d68;
  border-radius: 0.5rem;
  background:
    radial-gradient(circle at 35% 30%, rgba(155, 92, 255, 0.12), transparent 18rem),
    linear-gradient(180deg, rgba(8, 14, 26, 0.96), rgba(5, 9, 18, 0.96));
}

.room {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(93, 141, 255, 0.25);
  border-radius: 0.24rem;
  background:
    linear-gradient(rgba(93, 141, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93, 141, 255, 0.035) 1px, transparent 1px),
    rgba(12, 24, 39, 0.58);
  background-size: 22px 22px;
}

.room.command {
  grid-column: span 2;
  border-color: rgba(34, 240, 208, 0.28);
}

.room.wide {
  grid-column: span 2;
  border-color: rgba(255, 202, 79, 0.18);
}

.room.danger {
  border-color: rgba(255, 79, 103, 0.34);
  background-color: rgba(49, 11, 23, 0.45);
}

.room-label {
  position: absolute;
  top: 0.65rem;
  left: 0.7rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.terminal-lines {
  position: absolute;
  top: 2.4rem;
  right: 1rem;
  left: 1rem;
  display: grid;
  gap: 0.35rem;
}

.terminal-lines span {
  display: block;
  height: 0.28rem;
  border-radius: 999px;
  background: rgba(34, 240, 208, 0.35);
  box-shadow: 0 0 8px rgba(34, 240, 208, 0.24);
}

.pixel-agent {
  position: absolute;
  right: 1.8rem;
  bottom: 1.4rem;
  display: grid;
  width: 3.4rem;
  height: 3.4rem;
  place-items: center;
  color: var(--agent-color, var(--purple));
  font-size: 2.6rem;
  filter: drop-shadow(0 0 14px currentColor);
}

.agent-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 0.75rem;
}

.form {
  display: grid;
  gap: 0.7rem;
}

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

label {
  display: grid;
  gap: 0.38rem;
  color: #9ba8bf;
  font-size: 0.78rem;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #294978;
  border-radius: 0.32rem;
  background: #080f1d;
  color: var(--text);
  padding: 0.66rem 0.72rem;
}

textarea {
  min-height: 6.6rem;
  resize: vertical;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.8rem;
  border-bottom: 1px solid rgba(49, 83, 129, 0.45);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.progress {
  height: 0.42rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(93, 141, 255, 0.14);
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
}

.doc-layout {
  display: grid;
  grid-template-columns: minmax(15rem, 22rem) minmax(0, 1fr);
  gap: 0.9rem;
}

.doc-reader {
  min-height: calc(100vh - 12rem);
  max-height: calc(100vh - 8rem);
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.65;
}

.clickable {
  cursor: pointer;
}

.clickable:hover {
  border-color: var(--blue);
}

.empty {
  padding: 1rem;
  border: 1px dashed rgba(93, 141, 255, 0.32);
  border-radius: 0.38rem;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  max-width: min(30rem, calc(100vw - 2rem));
  padding: 0.86rem 1rem;
  border: 1px solid rgba(34, 240, 208, 0.26);
  border-radius: 0.42rem;
  background: #07111f;
  color: #e9fff9;
  box-shadow: 0 0 28px rgba(34, 240, 208, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.65rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8 {
    grid-column: span 12;
  }

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

  .office-board {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, 12rem);
  }

  .room,
  .room.command,
  .room.wide {
    grid-column: span 1;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 1rem;
  }

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

  .tabs,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
