/* Sub2API operations polish: warm, readable, and restrained. */
:root {
  --primary-50: 239 253 250;
  --primary-100: 204 251 241;
  --primary-200: 153 246 228;
  --primary-300: 94 234 212;
  --primary-400: 45 212 191;
  --primary-500: 20 184 166;
  --primary-600: 13 148 136;
  --primary-700: 15 118 110;
  --primary-800: 17 94 89;
  --primary-900: 19 78 74;
  --codex-bg: #f6faf7;
  --codex-panel: rgba(255, 255, 255, .92);
  --codex-line: rgba(72, 103, 93, .18);
  --codex-text: #1e332d;
  --codex-muted: #667872;
  --codex-teal: #0f9f8f;
  --codex-blue: #3b82b6;
  --codex-amber: #d99145;
}

html:not(.dark) body {
  background: linear-gradient(135deg, #f7fbf8 0%, #eef7f3 48%, #fbf7ef 100%) !important;
  color: var(--codex-text);
}

html:not(.dark) aside,
html:not(.dark) header,
html:not(.dark) .bg-white {
  background-color: var(--codex-panel) !important;
  border-color: var(--codex-line) !important;
}

html:not(.dark) .bg-gray-50,
html:not(.dark) .bg-gray-100 {
  background-color: rgba(246, 250, 247, .92) !important;
}

html:not(.dark) table,
html:not(.dark) [class*="rounded-xl"][class*="border"],
html:not(.dark) [class*="rounded-lg"][class*="border"] {
  border-color: var(--codex-line) !important;
}

html:not(.dark) thead,
html:not(.dark) th {
  background: rgba(243, 248, 245, .94) !important;
}

html:not(.dark) tbody tr:hover {
  background: rgba(229, 246, 239, .58) !important;
}

html:not(.dark) .btn-primary,
html:not(.dark) .bg-primary-600,
html:not(.dark) .bg-primary-500 {
  background: linear-gradient(135deg, #12a89a, #0e8d82) !important;
  box-shadow: 0 12px 28px -20px rgba(15, 143, 130, .75) !important;
}

html:not(.dark) .text-primary-600,
html:not(.dark) .text-primary-500 {
  color: var(--codex-teal) !important;
}

html:not(.dark) .border-primary-500,
html:not(.dark) .border-primary-600 {
  border-color: var(--codex-teal) !important;
}

html:not(.dark) input,
html:not(.dark) textarea,
html:not(.dark) select,
html:not(.dark) .input {
  background-color: rgba(255, 255, 255, .95) !important;
  border-color: rgba(72, 103, 93, .24) !important;
}

html:not(.dark) input:focus,
html:not(.dark) textarea:focus,
html:not(.dark) select:focus,
html:not(.dark) .input:focus {
  border-color: rgba(15, 159, 143, .54) !important;
  box-shadow: 0 0 0 3px rgba(15, 159, 143, .12) !important;
}

.codex-home,
.codex-channel-banner,
.codex-key-banner,
.codex-client-panel {
  box-sizing: border-box;
}

.codex-home {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto 24px;
  padding-top: 16px;
}

.codex-home__hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
  padding: 24px;
  border: 1px solid var(--codex-line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(241, 249, 246, .94));
  box-shadow: 0 20px 45px -36px rgba(21, 72, 62, .45);
}

.codex-eyebrow {
  margin: 0 0 8px;
  color: var(--codex-teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.codex-home h1,
.codex-channel-banner h2 {
  margin: 0;
  color: #18362f;
  font-weight: 850;
  letter-spacing: 0;
}

.codex-home h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
}

.codex-home p,
.codex-channel-banner p {
  margin: 12px 0 0;
  color: var(--codex-muted);
  line-height: 1.75;
}

.codex-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.codex-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(15, 159, 143, .24);
  background: #eef9f5;
  color: #0f766e;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.codex-actions a:first-child {
  background: #0f9f8f;
  color: #fff;
}

.codex-home__panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-height: 180px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid rgba(59, 130, 182, .22);
  background: #f3f8fb;
}

.codex-home__panel span {
  color: var(--codex-blue);
  font-size: 12px;
  font-weight: 800;
}

.codex-home__panel strong {
  color: #173f38;
  font-size: 22px;
  line-height: 1.25;
}

.codex-home__panel small {
  color: #667872;
  line-height: 1.6;
}

.codex-home__cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.codex-home__cards article,
.codex-home__steps span {
  border: 1px solid var(--codex-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
}

.codex-home__cards article {
  padding: 14px;
}

.codex-home__cards strong {
  display: block;
  color: #173f38;
  font-weight: 850;
}

.codex-home__cards span {
  display: block;
  margin-top: 6px;
  color: var(--codex-muted);
  font-size: 13px;
  line-height: 1.6;
}

.codex-home__steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.codex-home__steps span {
  padding: 10px 12px;
  color: #31524a;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}

.codex-channel-banner,
.codex-key-banner {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto 16px;
  border: 1px solid var(--codex-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 18px 38px -34px rgba(21, 72, 62, .36);
}

.codex-channel-banner {
  padding: 18px 20px;
}

.codex-channel-banner h2 {
  font-size: 22px;
}

.codex-key-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 12px 14px;
}

.codex-key-banner strong {
  color: #173f38;
}

.codex-key-banner span {
  color: var(--codex-muted);
  font-size: 13px;
}

.codex-inline-group {
  border: 1px solid rgba(15, 159, 143, .24) !important;
  border-radius: 8px !important;
  background: rgba(232, 247, 241, .82) !important;
  box-shadow: 0 10px 24px -22px rgba(15, 118, 110, .7);
}

.codex-client-panel {
  margin-top: 16px;
  border: 1px solid rgba(15, 159, 143, .2);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(248, 253, 250, .99), rgba(255, 252, 247, .99));
  overflow: hidden;
}

.codex-client-panel__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 159, 143, .14);
}

.codex-client-panel__title {
  color: #173f38;
  font-weight: 850;
}

.codex-client-panel__hint {
  margin-top: 2px;
  color: var(--codex-muted);
  font-size: 12px;
}

.codex-client-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  padding: 12px;
}

.codex-client-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid rgba(72, 103, 93, .16);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  color: #173f38;
  text-align: left;
  cursor: pointer;
}

.codex-client-card span {
  color: var(--codex-muted);
  font-size: 12px;
  line-height: 1.45;
}

.codex-client-card:hover,
.codex-client-card.is-active {
  border-color: rgba(15, 159, 143, .42);
  box-shadow: 0 16px 32px -28px rgba(15, 118, 110, .58);
}

.codex-config-output {
  margin: 0 12px 12px;
  border-radius: 8px;
  background: #17231f;
  overflow: hidden;
}

.codex-config-output__bar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  background: #22322e;
  color: #dbece6;
  font-size: 12px;
}

.codex-config-output pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  color: #e8f6f0;
  font-size: 12px;
  line-height: 1.55;
}

.codex-small-btn {
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, .08);
  color: #e8f6f0;
  font-size: 12px;
  font-weight: 750;
}

.codex-small-btn:hover {
  background: rgba(255, 255, 255, .16);
}

.codex-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483647;
  max-width: min(360px, calc(100vw - 32px));
  border-radius: 8px;
  background: #173f38;
  color: #fff;
  padding: 12px 14px;
  box-shadow: 0 18px 42px -24px rgba(0, 0, 0, .5);
  font-size: 14px;
}

html.dark .codex-home__hero,
html.dark .codex-home__cards article,
html.dark .codex-home__steps span,
html.dark .codex-channel-banner,
html.dark .codex-key-banner,
html.dark .codex-client-panel {
  border-color: rgba(45, 212, 191, .22);
  background: rgba(20, 65, 58, .24);
}

html.dark .codex-home h1,
html.dark .codex-channel-banner h2,
html.dark .codex-home__cards strong,
html.dark .codex-key-banner strong,
html.dark .codex-client-panel__title {
  color: #d8fff5;
}

html.dark .codex-home p,
html.dark .codex-channel-banner p,
html.dark .codex-home__cards span,
html.dark .codex-key-banner span,
html.dark .codex-client-panel__hint {
  color: #a7c9c0;
}

@media (max-width: 760px) {
  .codex-home {
    width: min(100vw - 20px, 1120px);
    padding-top: 10px;
  }

  .codex-home__hero,
  .codex-home__cards,
  .codex-home__steps {
    grid-template-columns: 1fr;
  }

  .codex-home__hero {
    padding: 18px;
  }

  .codex-channel-banner,
  .codex-key-banner {
    width: min(100vw - 20px, 1120px);
  }

  .codex-client-panel__head,
  .codex-config-output__bar {
    align-items: stretch;
    flex-direction: column;
  }
}
