:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101413;
  color: #eef4ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(31, 48, 45, 0.7), rgba(16, 20, 19, 0.95)),
    #101413;
}

button,
input {
  font: inherit;
}

select {
  border: 1px solid #3d4b47;
  border-radius: 6px;
  background: #171d1b;
  color: #eef4ef;
  padding: 0.7rem;
}

button {
  border: 1px solid #89c2a5;
  border-radius: 6px;
  background: #89c2a5;
  color: #102018;
  cursor: pointer;
  font-weight: 700;
  padding: 0.7rem 1rem;
}

button:hover {
  background: #a3d9bc;
}

input {
  width: 100%;
  border: 1px solid #3d4b47;
  border-radius: 6px;
  background: #171d1b;
  color: #eef4ef;
  padding: 0.75rem;
}

textarea {
  width: 100%;
  border: 1px solid #3d4b47;
  border-radius: 6px;
  background: #171d1b;
  color: #eef4ef;
  padding: 0.75rem;
  font: inherit;
}

input[type="search"],
input[type="number"] {
  min-width: 0;
}

.shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.toggle-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid #2d3835;
  border-radius: 6px;
  background: #171d1b;
  color: #cfd8d3;
  padding: 0 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.toggle-control input {
  width: auto;
  accent-color: #89c2a5;
}

.compact-select {
  min-height: 44px;
  padding: 0 0.75rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-button {
  border: 1px solid #2d3835;
  background: #171d1b;
  color: #cfd8d3;
}

.tab-button.active {
  border-color: #89c2a5;
  background: #89c2a5;
  color: #102018;
}

.eyebrow {
  margin: 0 0 6px;
  color: #89c2a5;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
  margin-bottom: 16px;
  font-size: 1rem;
}

.panel,
.metric {
  border: 1px solid #2d3835;
  border-radius: 8px;
  background: rgba(20, 27, 25, 0.9);
}

.panel {
  margin-bottom: 12px;
  padding: 20px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric {
  min-height: 118px;
  padding: 18px;
}

.metric span,
dt,
.muted {
  color: #9ca8a3;
}

.metric span {
  display: block;
  margin-bottom: 16px;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.45rem;
  white-space: pre-line;
}

.token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.usage-meter {
  display: grid;
  gap: 12px;
}

.usage-row {
  display: grid;
  gap: 6px;
}

.usage-row-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.usage-row-header span {
  margin: 0;
  color: #cfd8d3;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.usage-row-header strong {
  font-size: 0.95rem;
}

.usage-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #26302d;
}

.usage-fill {
  height: 100%;
  border-radius: inherit;
  background: #89c2a5;
}

.usage-fill.warn {
  background: #d9b45f;
}

.usage-fill.danger {
  background: #e06d5f;
}

.usage-fill.unknown {
  background: #56625e;
}

.usage-row small,
.usage-credit {
  color: #9ca8a3;
  font-size: 0.75rem;
  line-height: 1.35;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #cfd8d3;
  font-weight: 700;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dt {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.hidden {
  display: none;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
}

.log-controls {
  display: flex;
  gap: 8px;
}

.logs {
  display: grid;
  gap: 8px;
}

.marketplace-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.marketplace-status {
  margin: 0 0 12px;
  font-size: 0.92rem;
}

.marketplace-results {
  display: grid;
  gap: 10px;
}

.task-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 8px;
  margin: 14px 0;
}

.task-form textarea {
  grid-column: 1 / -1;
  min-height: 170px;
}

.task-form button {
  width: fit-content;
}

.task-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  gap: 8px;
  margin-bottom: 16px;
}

.task-results {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  gap: 10px;
  border: 1px solid #26302d;
  border-radius: 6px;
  background: #111715;
  padding: 12px;
}

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

.task-status {
  border-radius: 999px;
  background: #26302d;
  color: #cfd8d3;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.task-waiting_for_approval .task-status,
.task-waiting_for_input .task-status {
  background: #7a6730;
  color: #fff4cd;
}

.task-running .task-status {
  background: #2b5c7a;
  color: #e5f4ff;
}

.task-completed .task-status {
  background: #397258;
  color: #e6fff1;
}

.task-failed .task-status,
.task-denied .task-status {
  background: #7d3b35;
  color: #ffe6e2;
}

.task-meta,
.task-events {
  color: #9ca8a3;
  font-size: 0.84rem;
}

.task-prompt,
.task-output {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 6px;
  background: #0d1211;
  color: #d7e1dc;
  padding: 10px;
  font-size: 0.86rem;
}

.task-output {
  border: 1px solid #26302d;
}

.task-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
  gap: 8px;
}

.task-actions textarea {
  grid-column: 1 / -1;
  min-height: 92px;
}

.task-events {
  margin: 0;
  padding-left: 20px;
}

.calendar-actions,
.calendar-form-actions,
.calendar-event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.calendar-form textarea {
  grid-column: 1 / -1;
}

.calendar-form-actions {
  grid-column: 1 / -1;
}

.calendar-controls {
  margin: 0 0 14px;
}

.calendar-controls input {
  width: min(100%, 360px);
}

.calendar-results {
  display: grid;
  gap: 10px;
}

.calendar-event {
  display: grid;
  gap: 8px;
  border: 1px solid #26302d;
  border-radius: 6px;
  background: #111715;
  padding: 12px;
}

.calendar-event strong {
  color: #eef4ef;
}

.calendar-event p {
  margin: 0;
  color: #d7e1dc;
}

.calendar-event-meta {
  color: #9ca8a3;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.api-docs {
  display: grid;
  gap: 18px;
}

.command-docs {
  display: grid;
  gap: 18px;
}

.api-doc-group {
  display: grid;
  gap: 10px;
}

.command-doc-group {
  display: grid;
  gap: 10px;
}

.api-doc-group h3 {
  margin: 0;
  color: #eef4ef;
  font-size: 0.95rem;
}

.command-doc-group h3 {
  margin: 0;
  color: #eef4ef;
  font-size: 0.95rem;
}

.command-doc-group > p {
  margin: 0;
  color: #9ca8a3;
}

.api-endpoints {
  display: grid;
  gap: 10px;
}

.command-variants {
  display: grid;
  gap: 10px;
}

.api-endpoint {
  display: grid;
  gap: 8px;
  border: 1px solid #26302d;
  border-radius: 6px;
  background: #111715;
  padding: 12px;
}

.command-doc {
  display: grid;
  gap: 8px;
  border: 1px solid #26302d;
  border-radius: 6px;
  background: #111715;
  padding: 12px;
}

.command-usage {
  color: #89c2a5;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.command-doc p {
  margin: 0;
  color: #cfd8d3;
}

.command-options {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.command-options.nested {
  margin-top: 6px;
}

.command-options li,
.command-options small {
  color: #9ca8a3;
  font-size: 0.86rem;
}

.command-options code {
  color: #d7e1dc;
}

.api-route {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.api-method {
  min-width: 64px;
  border-radius: 999px;
  background: #26302d;
  color: #eef4ef;
  padding: 4px 10px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 900;
}

.api-method.get {
  background: #2b5c7a;
}

.api-method.post {
  background: #397258;
}

.api-method.put {
  background: #7a6730;
}

.api-method.delete {
  background: #7d3b35;
}

.api-route code {
  color: #d7e1dc;
  overflow-wrap: anywhere;
}

.api-endpoint p,
.api-endpoint small {
  margin: 0;
  color: #cfd8d3;
}

.api-endpoint small,
.api-endpoint li {
  color: #9ca8a3;
  font-size: 0.86rem;
}

.api-endpoint ul {
  margin: 0;
  padding-left: 20px;
}

.api-endpoint pre {
  margin: 0;
  overflow-x: auto;
  border-radius: 6px;
  background: #0d1211;
  color: #d7e1dc;
  padding: 10px;
  font-size: 0.84rem;
}

.settings-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.setting-field {
  display: grid;
  gap: 8px;
  border: 1px solid #26302d;
  border-radius: 6px;
  background: #111715;
  padding: 12px;
}

.setting-field span {
  color: #eef4ef;
  font-weight: 800;
}

.setting-field small {
  color: #9ca8a3;
  overflow-wrap: anywhere;
}

.listing-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid #26302d;
  border-radius: 6px;
  background: #111715;
  padding: 12px;
}

.listing-image {
  display: grid;
  place-items: center;
  width: 112px;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: #1b2421;
  color: #89c2a5;
  font-weight: 800;
}

.listing-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listing-body {
  min-width: 0;
}

.listing-title {
  display: block;
  color: #eef4ef;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.listing-title:hover {
  color: #a3d9bc;
}

.listing-price {
  display: block;
  margin: 6px 0;
  color: #89c2a5;
}

.listing-body p {
  margin-bottom: 8px;
  color: #d7e1dc;
}

.listing-meta,
.listing-match,
.listing-body span {
  color: #9ca8a3;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.listing-match {
  margin: 6px 0;
  color: #cfd8d3;
}

.log-entry {
  border: 1px solid #26302d;
  border-radius: 6px;
  background: #111715;
  padding: 12px;
}

.log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  color: #9ca8a3;
  font-size: 0.82rem;
}

.log-event {
  color: #89c2a5;
  font-weight: 800;
}

.log-entry pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #d7e1dc;
  font-size: 0.85rem;
}

.readme-content {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #d7e1dc;
  font-size: 0.86rem;
  line-height: 1.55;
}

.markdown {
  display: grid;
  gap: 12px;
}

.markdown h2,
.markdown h3,
.markdown h4 {
  margin: 0;
  color: #eef4ef;
}

.markdown p {
  margin: 0;
}

.markdown ul {
  margin: 0;
  padding-left: 20px;
}

.markdown li + li {
  margin-top: 6px;
}

.markdown pre {
  margin: 0;
  padding: 12px;
  border: 1px solid #26302d;
  border-radius: 6px;
  background: #0f1412;
  overflow-x: auto;
}

.markdown code {
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  background: #0f1412;
  color: #a3d9bc;
}

.markdown pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

@media (max-width: 640px) {
  .topbar,
  .token-row,
  .section-heading,
  .log-controls,
  .task-form,
  .task-controls {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-heading,
  .log-controls,
  .task-form,
  .task-controls,
  .listing-card {
    display: grid;
  }

  .listing-card {
    grid-template-columns: 1fr;
  }

  .listing-image {
    width: 100%;
    max-height: 220px;
  }
}
