:root {
  --aiotm-bg: #f5f7fb;
  --aiotm-card: #fff;
  --aiotm-text: #0f172a;
  --aiotm-muted: #64748b;
  --aiotm-primary: #4f46e5;
  --aiotm-border: #e2e8f0;
  --aiotm-danger: #b91c1c;
  --aiotm-warning: #a16207;
  --aiotm-success: #166534;
}

html[data-theme="dark"] {
  --aiotm-bg: #0b1120;
  --aiotm-card: #111827;
  --aiotm-text: #f8fafc;
  --aiotm-muted: #94a3b8;
  --aiotm-primary: #818cf8;
  --aiotm-border: #1f2937;
}

.aiotm-directory-wrap,
.aiotm-single-tool,
.aiotm-dashboard-grid,
.aiotm-pricing-grid {
  font-family: Inter, system-ui, sans-serif;
  color: var(--aiotm-text);
}

.aiotm-directory-filters,
.aiotm-search,
.aiotm-single-tool__hero,
.aiotm-tool-layout,
.aiotm-dashboard-grid,
.aiotm-pricing-grid,
.aiotm-tool-grid,
.aiotm-term-grid {
  display: grid;
  gap: 18px;
}

.aiotm-directory-filters {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 24px;
}

.aiotm-directory-filters input,
.aiotm-directory-filters select,
.aiotm-search input,
.aiotm-execution-form input,
.aiotm-execution-form select,
.aiotm-execution-form textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--aiotm-border);
  border-radius: 14px;
  background: var(--aiotm-card);
  color: var(--aiotm-text);
}

.aiotm-tool-grid,
.aiotm-pricing-grid,
.aiotm-dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.aiotm-tool-card,
.aiotm-pricing-card,
.aiotm-stat-card,
.aiotm-panel,
.aiotm-tool-sidecard {
  background: var(--aiotm-card);
  border: 1px solid var(--aiotm-border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.06);
}

.aiotm-tool-card__inner {
  display: block;
  color: inherit;
  text-decoration: none;
}

.aiotm-tool-card__top,
.aiotm-tool-card__meta,
.aiotm-results__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.aiotm-tool-card__icon,
.aiotm-tool-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: rgba(79, 70, 229, 0.12);
  color: var(--aiotm-primary);
  font-size: 28px;
}

.aiotm-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.14);
}

.aiotm-badge--premium {
  background: #fde68a;
  color: #92400e;
}

.aiotm-button,
button.aiotm-button,
.aiotm-directory-filters button,
.aiotm-search button,
.aiotm-copy-result,
.aiotm-share-result,
.aiotm-execution-form button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 12px 18px;
  border: none;
  border-radius: 14px;
  background: var(--aiotm-primary);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.aiotm-button--ghost {
  background: transparent;
  color: var(--aiotm-primary);
  border: 1px solid var(--aiotm-primary);
}

.aiotm-button[disabled],
.aiotm-execution-form button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.aiotm-tool-quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.aiotm-single-tool__hero {
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  align-items: start;
  margin: 22px 0;
}

.aiotm-tool-sidecard > div:not(.aiotm-tool-sidecard__actions) {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.aiotm-tool-sidecard > div:not(.aiotm-tool-sidecard__actions):last-of-type {
  margin-bottom: 0;
}

.aiotm-tool-sidecard strong {
  display: block;
  color: var(--aiotm-muted);
}

.aiotm-tool-sidecard span {
  display: block;
  text-align: right;
  font-weight: 700;
}

.aiotm-tool-sidecard__actions {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 12px;
}

.aiotm-tool-sidecard__actions .aiotm-button {
  width: 100%;
}

.aiotm-tool-layout {
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
}

.aiotm-api-stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.aiotm-stage-card strong {
  display: block;
  margin-bottom: 8px;
}

.aiotm-stage-card span {
  color: var(--aiotm-muted);
  display: block;
}

.aiotm-tool-workspace-intro h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.aiotm-tool-workspace-intro p {
  margin: 0;
  color: var(--aiotm-muted);
}

.aiotm-form-field {
  margin-bottom: 14px;
}

.aiotm-form-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.aiotm-input-with-actions {
  display: grid;
  gap: 10px;
}

.aiotm-input-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.aiotm-field-help {
  margin: 8px 0 0;
  color: var(--aiotm-muted);
  font-size: 14px;
}

.aiotm-form-prompt-bank {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--aiotm-border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.06), transparent);
}

.aiotm-form-prompt-bank__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-bottom: 12px;
}

.aiotm-form-prompt-bank__head span {
  color: var(--aiotm-muted);
}

.aiotm-suggestion-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.aiotm-suggestion-chip {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--aiotm-border);
  background: var(--aiotm-card);
  color: var(--aiotm-text);
  cursor: pointer;
}

.aiotm-form-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.aiotm-form-footer__meta {
  display: grid;
  gap: 4px;
}

.aiotm-form-footer__meta span {
  color: var(--aiotm-muted);
  font-size: 14px;
}

.aiotm-results {
  margin-top: 16px;
  padding: 18px;
  border: 1px dashed var(--aiotm-border);
  border-radius: 18px;
  background: var(--aiotm-card);
}

.aiotm-results__content pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--aiotm-bg);
  padding: 14px;
  border-radius: 14px;
}

.aiotm-results__content img,
.aiotm-results__content video,
.aiotm-results__content audio {
  max-width: 100%;
}

.aiotm-alert {
  margin: 18px 0;
  padding: 14px 18px;
  border-radius: 14px;
}

.aiotm-alert--warning {
  background: #fef3c7;
  color: var(--aiotm-warning);
}

.aiotm-alert--danger {
  background: #fee2e2;
  color: var(--aiotm-danger);
}

.aiotm-alert--success {
  background: #dcfce7;
  color: var(--aiotm-success);
}

.aiotm-table {
  width: 100%;
  border-collapse: collapse;
}

.aiotm-table th,
.aiotm-table td {
  padding: 12px;
  border-bottom: 1px solid var(--aiotm-border);
  text-align: left;
}

.aiotm-term-card {
  background: var(--aiotm-card);
  border: 1px solid var(--aiotm-border);
  padding: 16px 18px;
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
}

.aiotm-term-card small {
  display: block;
  margin-top: 6px;
  color: var(--aiotm-muted);
}

.aiotm-empty-state,
.aiotm-auth-required {
  padding: 28px;
  border: 1px dashed var(--aiotm-border);
  border-radius: 18px;
  background: var(--aiotm-card);
}

.aiotm-tool-frame {
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
}

.aiotm-browser-status {
  margin-top: 12px;
  color: var(--aiotm-muted);
  font-size: 14px;
}

.aiotm-credit-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.aiotm-credit-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.7);
}

.aiotm-credit-modal__dialog {
  position: relative;
  width: min(92vw, 420px);
  margin: 12vh auto 0;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid var(--aiotm-border);
  background: var(--aiotm-card);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
}

.aiotm-credit-modal__dialog h3 {
  margin-top: 0;
}

.aiotm-credit-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.aiotm-free-credit-notice {
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
  border: 1px solid #c7d2fe;
  color: #312e81;
}

.aiotm-free-credit-notice--active {
  background: linear-gradient(135deg, #dcfce7, #f0fdf4);
  border-color: #bbf7d0;
  color: #166534;
}

.aiotm-pricing-card--free {
  border: 2px solid #c7d2fe;
}

.aiotm-plan-badge {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  color: var(--aiotm-primary);
  font-size: 12px;
  font-weight: 700;
}

.aiotm-pricing-card--free .aiotm-price {
  color: var(--aiotm-primary);
  font-weight: 800;
  font-size: 2rem;
}

@media (max-width: 900px) {
  .aiotm-single-tool__hero,
  .aiotm-tool-layout {
    grid-template-columns: 1fr;
  }

  .aiotm-api-stage-grid {
    grid-template-columns: 1fr;
  }

  .aiotm-directory-filters,
  .aiotm-tool-grid,
  .aiotm-pricing-grid,
  .aiotm-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .aiotm-form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .aiotm-tool-card__top,
  .aiotm-tool-card__meta,
  .aiotm-results__actions,
  .aiotm-tool-sidecard > div:not(.aiotm-tool-sidecard__actions) {
    flex-direction: column;
    align-items: flex-start;
  }

  .aiotm-tool-sidecard span {
    text-align: left;
  }

  .aiotm-tool-frame {
    min-height: 420px !important;
  }
}

@media (max-width: 640px) {
  .aiotm-tool-card,
  .aiotm-pricing-card,
  .aiotm-stat-card,
  .aiotm-panel,
  .aiotm-tool-sidecard {
    padding: 16px;
    border-radius: 16px;
  }

  .aiotm-button,
  .aiotm-directory-filters button,
  .aiotm-search button,
  .aiotm-copy-result,
  .aiotm-share-result,
  .aiotm-execution-form button {
    width: 100%;
  }
}
