:root {
  --codex-bg: #0f1115;
  --codex-panel: #171a21;
  --codex-panel-strong: #1f2430;
  --codex-text: #f3f5f7;
  --codex-muted: #a7afbd;
  --codex-border: #2b313d;
  --codex-accent: #58c4dd;
  --codex-accent-strong: #9fd66f;
}

* {
  box-sizing: border-box;
}

.codex-cloud-page {
  min-height: 100vh;
  margin: 0;
  background: var(--codex-bg);
  color: var(--codex-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.codex-shell {
  display: grid;
  grid-template-rows: auto auto minmax(360px, 1fr);
  gap: 12px;
  min-height: 100vh;
  padding: 16px;
}

.codex-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--codex-border);
  background: var(--codex-panel);
  border-radius: 8px;
  padding: 16px;
}

.back-link {
  display: inline-flex;
  color: var(--codex-accent);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 8px;
}

.codex-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.codex-header p {
  margin: 8px 0 0;
  color: var(--codex-muted);
}

.codex-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--codex-border);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--codex-text);
  background: var(--codex-panel-strong);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.button--primary {
  border-color: rgba(88, 196, 221, 0.55);
  background: #17313a;
}

.button--ghost {
  background: transparent;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.status-strip > div {
  border: 1px solid var(--codex-border);
  background: var(--codex-panel);
  border-radius: 8px;
  padding: 12px;
  min-width: 0;
}

.status-label {
  display: block;
  color: var(--codex-muted);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.status-strip strong {
  display: block;
  overflow-wrap: anywhere;
}

.terminal-panel {
  min-height: 0;
  border: 1px solid var(--codex-border);
  background: #050607;
  border-radius: 8px;
  overflow: hidden;
}

.terminal-panel iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 190px);
  border: 0;
  background: #050607;
}

@media (max-width: 720px) {
  .codex-shell {
    padding: 10px;
  }

  .codex-header {
    align-items: stretch;
    flex-direction: column;
  }

  .codex-actions {
    justify-content: stretch;
  }

  .button {
    flex: 1 1 150px;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .terminal-panel iframe {
    min-height: calc(100vh - 285px);
  }
}
