:root {
  --bg: #002b36;
  --bg-elevated: #073642;
  --panel: #0b3540;
  --panel-2: #103c47;
  --line: #1d5561;
  --line-strong: #2f6a74;
  --text: #eee8d5;
  --muted: #93a1a1;
  --accent: #268bd2;
  --accent-soft: rgba(38, 139, 210, 0.14);
  --warn: #b58900;
  --warn-soft: rgba(181, 137, 0, 0.18);
  --success: #859900;
  --success-soft: rgba(133, 153, 0, 0.18);
  --danger: #dc322f;
  --danger-soft: rgba(220, 50, 47, 0.16);
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
  --space-1: 10px;
  --space-2: 14px;
  --space-3: 16px;
  --space-4: 18px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(38, 139, 210, 0.16), transparent 28%),
    linear-gradient(180deg, #073642 0%, #002b36 100%);
}

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

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-2) 28px;
}

.topbar,
.topbar-actions,
.section-head,
.detail-headline,
.row-actions,
.chip-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar,
.section-head,
.row-actions {
  justify-content: space-between;
}

.topbar {
  margin-bottom: var(--space-4);
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}

.section-head {
  margin-bottom: var(--space-2);
}

.section-head-mobile {
  margin-bottom: 2px;
}

.title-wrap {
  min-width: 0;
  display: grid;
  gap: var(--space-2);
}

.detail-title-wrap {
  display: grid;
  gap: 10px;
}

.topbar-actions {
  width: 100%;
  flex-direction: row;
  align-items: stretch;
  gap: var(--space-2);
}

.topbar-actions button {
  flex: 1 1 0;
}

.eyebrow,
.meta,
.field-note {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 21px;
}

h3 {
  font-size: 17px;
}

.banner {
  margin: var(--space-3) 0 var(--space-4);
  padding: 12px var(--space-2);
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 54, 66, 0.82);
}

.hidden {
  display: none !important;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.panel {
  background: linear-gradient(180deg, rgba(11, 53, 64, 0.98), rgba(7, 54, 66, 0.98));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 22px;
  padding: var(--space-3);
}

.service-list,
.detail-stack,
.memory-list,
.detail-grid,
.facts-grid,
.chips-grid {
  display: grid;
  gap: var(--space-2);
}

.service-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.service-card,
.card-block,
.memory-item {
  background: linear-gradient(180deg, rgba(16, 60, 71, 0.92), rgba(11, 53, 64, 0.92));
  border: 1px solid var(--line);
  border-radius: 18px;
}

.service-card {
  cursor: pointer;
  padding: var(--space-3);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.service-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.2);
}

.service-main,
.service-foot,
.status-line,
.section-stack {
  display: grid;
  gap: 10px;
}

.service-foot {
  margin-top: var(--space-2);
}

.service-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.service-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.service-detail-head {
  align-items: flex-start;
}

.service-detail-title-text {
  display: grid;
  gap: 4px;
}

.service-id {
  font-size: 17px;
  font-weight: 600;
  word-break: break-word;
}

.service-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.service-detail-subtitle {
  margin-top: 0;
}

.service-detail-stack {
  gap: 6px;
}

.indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.indicator.ok {
  background: var(--success);
}

.indicator.bad {
  background: var(--danger);
}

.indicator.unknown {
  background: var(--muted);
}

.status-pill,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  line-height: 1.2;
}

.status-pill {
  background: rgba(147, 161, 161, 0.12);
  color: var(--text);
}

.status-pill.ok {
  background: var(--success-soft);
  color: #b8cc4b;
}

.status-pill.bad {
  background: var(--danger-soft);
  color: #ff7f7d;
}

.chip {
  background: var(--accent-soft);
  color: #77c1ff;
}

.chip.warn {
  background: var(--warn-soft);
  color: #e0b74b;
}

.chip.neutral {
  background: rgba(147, 161, 161, 0.12);
  color: var(--muted);
}

.card-block,
.memory-item {
  padding: var(--space-3);
}

.models-disclosure {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(7, 54, 66, 0.36);
  overflow: hidden;
}

.models-disclosure summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  color: var(--text);
  font-weight: 600;
}

.models-disclosure summary::-webkit-details-marker {
  display: none;
}

.models-disclosure[open] summary {
  border-bottom: 1px solid var(--line);
}

.disclosure-content {
  padding: 12px;
}

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

.detail-grid .card-block.full {
  grid-column: 1 / -1;
}

.detail-grid .status-flat.full {
  grid-column: 1 / -1;
}

.status-flat {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

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

.fact {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0, 43, 54, 0.35);
  border: 1px solid rgba(29, 85, 97, 0.7);
}

.fact-key {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fact-value {
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.fact-value.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

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

.chips-grid .chip,
.chips-grid .status-pill {
  justify-content: center;
}

label {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: rgba(0, 43, 54, 0.9);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 11px 12px;
}

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

button {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  min-height: 42px;
  padding: 10px 14px;
  background: transparent;
  color: #93d5ff;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-weight: 500;
  letter-spacing: 0.02em;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(38, 139, 210, 0.12);
}

button.danger {
  background: var(--danger);
  color: #fdf6e3;
  border-color: rgba(220, 50, 47, 0.55);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.row-actions {
  flex-wrap: wrap;
  margin-top: var(--space-2);
}

.compact-actions {
  margin-top: 8px;
}

.row-actions > * {
  flex: 0 0 auto;
}

.actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

.detail-empty {
  color: var(--muted);
  padding: 40px 4px;
}

.memory-item {
  display: grid;
  gap: 12px;
}

.status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  justify-content: flex-end;
}

.prompt-editor {
  min-height: 50vh;
}

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

.mono {
  font-family: "IBM Plex Mono", monospace;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  min-width: 220px;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: rgba(7, 54, 66, 0.96);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

.toast-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(147, 213, 255, 0.22);
  border-top-color: #93d5ff;
  animation: spin 0.8s linear infinite;
}

.toast.success {
  border-color: rgba(133, 153, 0, 0.55);
}

.toast.error {
  border-color: rgba(220, 50, 47, 0.55);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 780px) {
  .topbar,
  .topbar-actions,
  .section-head-mobile,
  .detail-headline,
  .detail-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    flex-direction: row;
    align-items: stretch;
  }

  .service-list,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 25px;
  }

  .panel {
    padding: var(--space-2);
  }
}
