:root {
  --bg: #040712;
  --bg-soft: #07111f;
  --card: rgba(10, 18, 36, 0.9);
  --card-strong: rgba(14, 24, 48, 0.96);
  --text: #f7fbff;
  --muted: #9aabc7;
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.16);
  --purple: #a855f7;
  --purple-soft: rgba(168, 85, 247, 0.2);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.14);
  --yellow: #facc15;
  --red: #fb7185;
  --border: rgba(34, 211, 238, 0.26);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
  --radius: 18px;
  --mono: "Cascadia Code", "Fira Code", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(
      circle at top left,
      rgba(34, 211, 238, 0.16),
      transparent 28rem
    ),
    radial-gradient(
      circle at top right,
      rgba(168, 85, 247, 0.15),
      transparent 32rem
    ),
    linear-gradient(135deg, var(--bg) 0%, #06101f 52%, var(--bg) 100%);
  color: var(--text);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

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

a:hover {
  color: var(--green);
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: rgba(4, 7, 18, 0.95);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem;
  margin-bottom: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  color: #020617;
  font-family: var(--mono);
  font-weight: 900;
}

.brand-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 850;
  letter-spacing: 0;
}

.brand-subtitle {
  margin: 0.12rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-label {
  margin: 1.1rem 0 0.6rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
}

.module-nav {
  display: grid;
  gap: 0.45rem;
}

.module-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.72rem 0.78rem;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--muted);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.module-link:hover,
.module-link:focus-visible {
  border-color: var(--border);
  background: var(--cyan-soft);
  color: var(--text);
  outline: none;
  transform: translateX(2px);
}

.module-link.active {
  border-color: var(--cyan);
  background: linear-gradient(135deg, var(--cyan-soft), var(--purple-soft));
  color: var(--text);
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.16);
}

.module-index {
  display: inline-grid;
  min-width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  border: 1px solid rgba(154, 171, 199, 0.26);
  border-radius: 999px;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.main-shell {
  min-width: 0;
  padding: 1.4rem;
}

.hero,
.page-header,
.status-bar,
.panel,
.dashboard-card,
.stat-card,
.feed-item,
.endpoint-card,
.history-item,
.collection-item,
.diff-row,
.table-panel {
  border: 1px solid rgba(34, 211, 238, 0.2);
  background: var(--card);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: 1.45rem;
  margin-bottom: 1rem;
  border-color: var(--border);
  border-radius: var(--radius);
  background: linear-gradient(
    135deg,
    rgba(10, 18, 36, 0.94),
    rgba(14, 24, 48, 0.72)
  );
  box-shadow: var(--shadow);
}

.hero-kicker,
.page-kicker {
  margin: 0 0 0.35rem;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-title {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.4rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.hero-subtitle,
.page-subtitle {
  max-width: 820px;
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.hero-actions,
.toolbar,
.item-actions,
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero-actions {
  justify-content: flex-end;
}

.page-header {
  padding: 1.2rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: linear-gradient(
    135deg,
    rgba(10, 18, 36, 0.92),
    rgba(14, 24, 48, 0.72)
  );
}

.page-title {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 3rem);
  font-weight: 900;
  letter-spacing: 0;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.78rem 1rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  color: var(--muted);
}

.status-message {
  margin: 0;
}

.status-message.success {
  color: var(--green);
}

.status-message.warning {
  color: var(--yellow);
}

.status-message.error {
  color: var(--red);
}

.status-chip,
.stat-pill,
.method-badge,
.type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.73rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-chip,
.stat-pill {
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: var(--cyan-soft);
  color: var(--cyan);
}

.method-badge {
  border: 1px solid rgba(74, 222, 128, 0.3);
  background: var(--green-soft);
  color: var(--green);
}

.method-badge.post,
.method-badge.put {
  border-color: rgba(250, 204, 21, 0.34);
  background: rgba(250, 204, 21, 0.12);
  color: var(--yellow);
}

.method-badge.delete,
.type-badge.error {
  border-color: rgba(251, 113, 133, 0.34);
  background: rgba(251, 113, 133, 0.12);
  color: var(--red);
}

.type-badge {
  border: 1px solid rgba(168, 85, 247, 0.28);
  background: var(--purple-soft);
  color: #e9d5ff;
}

.stats-grid,
.dashboard-grid {
  display: grid;
  gap: 0.85rem;
}

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

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

.stat-card,
.dashboard-card,
.panel,
.table-panel {
  border-radius: var(--radius);
}

.stat-card,
.dashboard-card,
.panel {
  padding: 1rem;
}

.dashboard-card {
  display: grid;
  min-height: 190px;
  align-content: space-between;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.dashboard-card:hover,
.dashboard-card:focus-visible {
  border-color: var(--cyan);
  background: var(--card-strong);
  transform: translateY(-2px);
  outline: none;
}

.dashboard-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 850;
}

.dashboard-card p {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-top: 1rem;
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-value {
  margin: 0.28rem 0 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 850;
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

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

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.panel-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 850;
}

.panel-subtitle {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.toolbar {
  margin-bottom: 0.85rem;
}

.form-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.form-control,
.form-select {
  border: 1px solid rgba(34, 211, 238, 0.24);
  background-color: rgba(4, 7, 18, 0.76);
  color: var(--text);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--cyan);
  background-color: rgba(4, 7, 18, 0.92);
  color: var(--text);
  box-shadow: 0 0 0 0.2rem rgba(34, 211, 238, 0.16);
}

.form-control::placeholder {
  color: rgba(154, 171, 199, 0.62);
}

textarea.code-input,
pre.code-output {
  width: 100%;
  min-height: 340px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 16px;
  background:
    linear-gradient(rgba(34, 211, 238, 0.035) 1px, transparent 1px),
    rgba(2, 6, 23, 0.86);
  background-size: 100% 28px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.6;
}

textarea.code-input {
  padding: 1rem;
  resize: vertical;
}

pre.code-output {
  max-height: 560px;
  padding: 1rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-panel {
  min-height: 340px;
  max-height: 620px;
  overflow: auto;
  padding: 1rem;
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.72);
}

.btn {
  border-radius: 999px;
  font-weight: 750;
}

.btn-cyber {
  border: 1px solid var(--cyan);
  background: var(--cyan-soft);
  color: var(--cyan);
}

.btn-cyber:hover,
.btn-cyber:focus-visible {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #020617;
}

.btn-purple {
  border: 1px solid var(--purple);
  background: var(--purple-soft);
  color: #e9d5ff;
}

.btn-purple:hover,
.btn-purple:focus-visible {
  border-color: var(--purple);
  background: var(--purple);
  color: #fff;
}

.btn-ghost {
  border: 1px solid rgba(154, 171, 199, 0.28);
  background: rgba(154, 171, 199, 0.08);
  color: var(--text);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  color: var(--cyan);
}

.api-url-row,
.row-editor,
.inline-form-row {
  display: grid;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.api-url-row {
  grid-template-columns: 130px minmax(0, 1fr);
}

.inline-form-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.row-editor {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.response-tabs {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.tab-button {
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(154, 171, 199, 0.22);
  border-radius: 999px;
  background: rgba(154, 171, 199, 0.08);
  color: var(--muted);
}

.tab-button.active {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  color: var(--cyan);
}

.tree-list,
.tree-list ul {
  margin: 0;
  padding-left: 1rem;
  list-style: none;
}

.tree-list li {
  position: relative;
  padding: 0.18rem 0 0.18rem 0.8rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.84rem;
}

.tree-list li::before {
  position: absolute;
  left: 0;
  color: var(--cyan);
  content: ">";
}

.tree-key {
  color: var(--cyan);
}

.tree-value {
  color: var(--green);
}

.tree-type {
  color: var(--purple);
}

.feed-item,
.endpoint-card,
.history-item,
.collection-item,
.diff-row {
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  border-radius: var(--radius);
}

.feed-item h4,
.endpoint-card h4,
.history-item h4,
.collection-item h4,
.diff-row h4 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.item-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
}

.item-description {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.diff-row.added {
  border-color: rgba(74, 222, 128, 0.34);
}

.diff-row.removed {
  border-color: rgba(251, 113, 133, 0.34);
}

.diff-row.changed {
  border-color: rgba(250, 204, 21, 0.34);
}

.diff-row.unchanged {
  opacity: 0.75;
}

.empty-state {
  display: grid;
  min-height: 180px;
  place-items: center;
  padding: 1.2rem;
  border: 1px dashed rgba(154, 171, 199, 0.28);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: rgba(34, 211, 238, 0.18);
  margin-bottom: 0;
}

.table thead {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.table td,
.table th {
  vertical-align: middle;
}

.search-row {
  margin-bottom: 0.85rem;
}

.footer-note {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(4, 7, 18, 0.8);
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.34);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(34, 211, 238, 0.58);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

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

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

  .module-grid,
  .module-grid.equal {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

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

  .main-shell {
    padding: 1rem;
  }

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

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

  .api-url-row,
  .row-editor,
  .inline-form-row {
    grid-template-columns: 1fr;
  }

  .row-editor .btn,
  .inline-form-row .btn {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .sidebar,
  .main-shell,
  .hero,
  .page-header,
  .panel {
    padding: 0.85rem;
  }

  .module-nav,
  .stats-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .pill-row,
  .status-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar .btn,
  .hero-actions .btn {
    width: 100%;
  }

  textarea.code-input,
  pre.code-output,
  .preview-panel {
    min-height: 260px;
    font-size: 0.8rem;
  }
}
