:root {
  color-scheme: light;
  --ink: #18201d;
  --muted: #66716c;
  --line: #dce3de;
  --paper: #f5f7f4;
  --card: #ffffff;
  --green: #176b4d;
  --green-dark: #0e5038;
  --green-soft: #e3f2ea;
  --amber: #f5b94c;
  --shadow: 0 20px 60px rgba(35, 52, 44, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 5%, rgba(245, 185, 76, 0.16), transparent 25rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  height: 76px;
  margin: auto;
  padding: 0 28px;
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-weight: 760;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: white;
  background: var(--green);
  font-family: Georgia, serif;
  font-size: 21px;
}

.local-badge,
.step,
.eyebrow {
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.local-badge {
  padding: 7px 10px;
  border: 1px solid #bbd6c9;
  border-radius: 999px;
  background: var(--green-soft);
  letter-spacing: 0.04em;
  text-transform: none;
}

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

.compact-button {
  height: 36px;
  padding: 0 12px;
  font-size: 0.78rem;
}

main {
  max-width: 1200px;
  margin: auto;
  padding: 70px 28px 100px;
}

.auth-gate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr);
  gap: 70px;
  align-items: center;
  min-height: 650px;
}

.auth-card {
  display: grid;
  min-height: 420px;
  place-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  color: var(--muted);
}

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.75fr);
  gap: 80px;
  align-items: center;
  min-height: 650px;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 24px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.1rem, 7vw, 6.25rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.96;
}

h2 {
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.lede {
  max-width: 650px;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.7;
}

.lede.compact {
  margin-bottom: 0;
}

.start-card {
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.start-card p,
.modal-card p,
.section-heading p {
  color: var(--muted);
  line-height: 1.55;
}

form {
  display: grid;
  gap: 9px;
}

label {
  font-size: 0.83rem;
  font-weight: 750;
}

input,
textarea {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #cbd4ce;
  border-radius: 10px;
  outline: none;
  background: white;
}

input {
  height: 48px;
  padding-top: 0;
  padding-bottom: 0;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.13);
}

.primary,
.secondary,
.ghost {
  height: 46px;
  padding: 0 18px;
  border-radius: 10px;
  font-weight: 750;
}

.primary {
  border: 0;
  color: white;
  background: var(--green);
}

.primary:hover {
  background: var(--green-dark);
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary {
  border: 1px solid var(--line);
  background: white;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
}

.input-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0;
  color: #909993;
  font-size: 0.75rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.dashboard-heading,
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.dashboard-heading h1 {
  margin-bottom: 12px;
  font-size: clamp(3rem, 6vw, 5.4rem);
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.6fr 1.2fr;
  gap: 14px;
  margin: 48px 0 70px;
}

.summary-card {
  position: relative;
  min-height: 148px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.summary-card.accent {
  color: white;
  border-color: var(--green);
  background: var(--green);
}

.summary-card strong {
  display: block;
  margin: 14px 0 4px;
  font-family: Georgia, serif;
  font-size: 2.5rem;
  font-weight: 500;
}

.summary-label {
  display: block;
  margin-bottom: 24px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.summary-card code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
}

.copy-button {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 750;
}

.summary-card .copy-button {
  position: absolute;
  right: 16px;
  bottom: 16px;
}

.search input {
  width: min(310px, 100%);
}

.section-heading {
  margin-bottom: 22px;
}

.provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.provider-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--card);
  transition: border-color 160ms ease, transform 160ms ease;
}

.provider-card:hover {
  border-color: #aebbb3;
  transform: translateY(-2px);
}

.provider-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  color: var(--green);
  background: var(--green-soft);
  font-family: Georgia, serif;
  font-size: 1.4rem;
}

.provider-card h3 {
  margin: 1px 0 7px;
  font-size: 1rem;
}

.provider-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.provider-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 0.7rem;
}

.provider-meta span {
  padding: 5px 7px;
  border-radius: 6px;
  background: #f1f4f2;
}

.provider-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.status {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 750;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: #aeb8b2;
}

.status.connected {
  color: var(--green);
}

.status.connected::before {
  background: #34a874;
  box-shadow: 0 0 0 3px var(--green-soft);
}

.provider-actions button {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-size: 0.75rem;
  font-weight: 750;
}

.provider-actions .remove {
  color: #9b3d35;
}

.tester {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 30px 44px;
  margin-top: 80px;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 14px 40px rgba(35, 52, 44, 0.06);
}

.tester-copy p {
  color: var(--muted);
  line-height: 1.6;
}

.tester-form {
  align-content: start;
}

.tester-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 6px;
}

.tester-actions span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.test-result {
  grid-column: 1 / -1;
  padding: 20px;
  border: 1px solid #b9d9ca;
  border-radius: 12px;
  background: var(--green-soft);
}

.test-result.error {
  border-color: #e6c4bf;
  background: #fff0ee;
}

.test-result-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.test-result-heading span {
  color: var(--muted);
  font-size: 0.78rem;
}

.test-result pre {
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  line-height: 1.6;
}

.prompt-builder {
  margin-top: 80px;
}

.prompt-form {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid label,
.prompt-form>label {
  display: grid;
  gap: 9px;
}

.prompt-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 8px;
}

.prompt-form-footer span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.prompt-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.prompt-card {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 24px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.prompt-card h3 {
  margin: 0 0 8px;
}

.prompt-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.prompt-link {
  display: grid;
  align-content: center;
  gap: 12px;
  min-width: 0;
}

.prompt-link code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.prompt-link>div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-button {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.secondary.danger {
  color: #9b3d35;
}

.empty-state {
  padding: 22px;
  border: 1px dashed #bbc6bf;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.prompt-page {
  max-width: 820px;
  padding-top: 50px;
}

.public-prompt-card {
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.public-prompt-card h1 {
  margin-bottom: 18px;
  font-size: clamp(2.8rem, 8vw, 5rem);
}

.public-prompt-card form {
  margin-top: 34px;
  gap: 12px;
}

.field-help {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.public-inputs {
  display: grid;
  gap: 16px;
  margin: 10px 0 16px;
}

.public-inputs label {
  display: grid;
  gap: 8px;
}

.optional-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.public-result {
  margin-top: 28px;
  padding: 22px;
  border: 1px solid #b9d9ca;
  border-radius: 14px;
  background: var(--green-soft);
}

.public-result.error {
  border-color: #e6c4bf;
  background: #fff0ee;
}

.public-result pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.7;
}

.error-card {
  border-color: #e6c4bf;
}

.usage {
  position: relative;
  display: grid;
  grid-template-columns: 0.8fr 1.5fr;
  gap: 44px;
  align-items: center;
  margin-top: 80px;
  padding: 40px;
  border-radius: 20px;
  color: white;
  background: #17231f;
}

.usage .eyebrow {
  color: #75caa9;
}

.usage pre {
  overflow: auto;
  margin: 0;
  padding: 20px;
  border: 1px solid #36443e;
  border-radius: 12px;
  background: #101714;
  color: #d7e7df;
  font-size: 0.78rem;
  line-height: 1.6;
}

.code-copy {
  position: absolute;
  right: 52px;
  bottom: 50px;
}

.modal[hidden],
[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 19, 16, 0.58);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  padding: 32px;
  border-radius: 20px;
  background: white;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  background: transparent;
  font-size: 1.7rem;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.modal-actions a {
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 750;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 360px;
  padding: 13px 16px;
  border-radius: 10px;
  color: white;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 180ms ease;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 850px) {
  main {
    padding-top: 34px;
  }

  .auth-gate,
  .welcome {
    grid-template-columns: 1fr;
    gap: 36px;
    min-height: auto;
  }

  .summary-grid,
  .provider-grid,
  .tester,
  .prompt-card,
  .usage {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    margin: 38px 0 58px;
  }

  .usage {
    gap: 20px;
  }

  .code-copy {
    position: static;
    justify-self: start;
  }
}

@media (max-width: 560px) {

  .topbar,
  main {
    padding-left: 18px;
    padding-right: 18px;
  }

  main {
    padding-bottom: 60px;
  }

  .local-badge {
    display: none;
  }

  h1 {
    font-size: 3.25rem;
  }

  .start-card {
    padding: 22px;
  }

  .dashboard-heading,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .search input {
    width: 100%;
  }

  .provider-card {
    grid-template-columns: 42px 1fr;
  }

  .provider-icon {
    width: 42px;
    height: 42px;
  }

  .provider-actions {
    grid-column: 2;
    grid-template-columns: auto auto;
    justify-items: start;
  }

  .tester {
    padding: 26px 20px;
  }

  .tester-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .usage {
    padding: 26px 20px;
  }
}

/* =========================================================
   Analysis tab styles — original Free LLM Router theme
   ========================================================= */
.dashboard-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  margin: 28px 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(35, 52, 44, 0.06);
}

.tab-button {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.tab-button.active {
  color: white;
  background: var(--green);
}

.tab-panel[hidden] {
  display: none !important;
}

.analytics-panel {
  display: grid;
  gap: 22px;
}

.analysis-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.secondary.danger {
  color: #9b3d35;
}

.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0 10px;
}

.analysis-card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 14px 40px rgba(35, 52, 44, 0.06);
}

.compact-heading {
  margin-bottom: 18px;
}

.compact-heading h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.compact-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.frequency-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(34px, 1fr));
  gap: 12px;
  min-height: 172px;
  align-items: end;
}

.frequency-bucket {
  display: grid;
  gap: 7px;
  justify-items: center;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.frequency-track {
  position: relative;
  width: 100%;
  height: 124px;
  overflow: hidden;
  border: 1px solid #d7dfda;
  border-radius: 999px;
  background: #f1f4f2;
}

.frequency-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #75caa9, var(--green));
}

.request-log-list {
  display: grid;
  gap: 12px;
}

.request-log-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

.request-log-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  cursor: pointer;
}

.request-log-card summary::-webkit-details-marker {
  display: none;
}

.request-log-card small,
.request-log-meta {
  color: var(--muted);
}

.request-log-card strong {
  color: var(--ink);
}

.request-log-meta {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 0.74rem;
}

.request-log-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f1f4f2;
}

.request-log-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
  border-top: 1px solid var(--line);
  background: #fbfcfb;
}

.request-log-body h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.request-log-body pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f5f7f4;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  line-height: 1.55;
}

.empty-state {
  padding: 22px;
  border: 1px dashed #bbc6bf;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 850px) {

  .analytics-summary-grid,
  .request-log-body {
    grid-template-columns: 1fr;
  }

  .frequency-chart {
    grid-template-columns: repeat(6, minmax(34px, 1fr));
  }

  .request-log-card summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .request-log-meta {
    justify-content: flex-start;
  }
}

/* =========================================================
   Product dashboard upgrade: sidebar, provider wizard,
   request drawer, filters, snippets, empty states, settings
   ========================================================= */

[hidden] {
  display: none !important;
}

.dashboard {
  animation: pageIn 260ms ease both;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 34px;
}

.sidebar {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.nav-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 15px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.nav-item span {
  font-weight: 800;
}

.nav-item small {
  color: var(--muted);
  font-size: 0.73rem;
}

.nav-item:hover {
  transform: translateX(2px);
  background: #f1f6f2;
  border-color: var(--line);
}

.nav-item.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.nav-item.active small {
  color: rgba(255, 255, 255, 0.74);
}

.workspace {
  min-width: 0;
}

.page-panel {
  animation: panelIn 220ms ease both;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-actions,
.analysis-actions,
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.two-column-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

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

.mini-panel,
.settings-card,
.settings-actions-card,
.filter-card,
.empty-state-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 14px 38px rgba(35, 52, 44, 0.06);
}

.empty-state-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin: -38px 0 42px;
  background: linear-gradient(135deg, #ffffff, #f1faf5);
}

.compact-empty {
  display: grid;
  justify-content: start;
  margin: 0;
  color: var(--muted);
}

.compact-empty strong,
.inline-empty strong {
  color: var(--ink);
}

.inline-empty {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px dashed #c8d4cd;
  border-radius: 14px;
  color: var(--muted);
  background: #fafcf9;
}

.health-list {
  display: grid;
  gap: 10px;
}

.health-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdfb;
}

.health-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.health-row small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.health-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.compact-code {
  max-height: 220px;
  margin: 8px 0 12px;
}

.provider-card {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.provider-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 52px rgba(35, 52, 44, 0.13);
}

.provider-card.configured {
  border-color: #bddccf;
  background: linear-gradient(180deg, #ffffff, #f7fcf9);
}

.provider-content {
  min-width: 0;
}

.provider-wizard {
  max-width: 560px;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0;
  margin: 16px 0 18px;
  list-style: none;
}

.wizard-steps li {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fafcf9;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.wizard-steps li.active {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

select {
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #cbd4ce;
  border-radius: 10px;
  outline: none;
  background: white;
  color: var(--ink);
  font: inherit;
}

select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.13);
}

.form-grid,
.filter-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

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

.filter-card {
  margin: 22px 0;
}

.filter-card label,
.form-grid label {
  display: grid;
  gap: 7px;
}

.analytics-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.request-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  margin-bottom: 10px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  text-align: left;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.request-log-row:hover {
  transform: translateY(-2px);
  border-color: #b7d4c8;
  background: #fbfdfb;
}

.request-log-row>span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.request-log-row small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.status.failed {
  color: #9d2b2b;
  border-color: #efcaca;
  background: #fff0f0;
}

.snippet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 12px;
}

.snippet-tab {
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  font-weight: 800;
}

.snippet-tab.active {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.settings-card h3 {
  margin: 12px 0 8px;
}

.settings-actions-card {
  margin-top: 16px;
}

.settings-actions-card h3 {
  margin-top: 0;
}

.request-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 26, 0.32);
  backdrop-filter: blur(3px);
}

.drawer-card {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  width: min(720px, calc(100vw - 24px));
  height: 100%;
  padding: 34px;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #fbfdfb;
  box-shadow: -28px 0 80px rgba(35, 52, 44, 0.18);
  animation: drawerIn 220ms ease both;
}

@keyframes drawerIn {
  from {
    transform: translateX(26px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.drawer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}

.drawer-meta span,
.request-log-meta span:not(.status) {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf7;
}

.drawer-section {
  display: grid;
  gap: 10px;
}

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

.drawer-section-heading h3 {
  margin: 0;
}

.drawer-section pre {
  max-height: none;
}

.toast {
  z-index: 80;
}

button,
.provider-card,
.summary-card,
.mini-panel,
.settings-card,
.analysis-card,
.usage,
.tester {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:active {
  transform: scale(0.985);
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-summary-grid,
  .settings-grid,
  .filter-card {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .sidebar {
    grid-template-columns: 1fr 1fr;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
  }

  .section-actions,
  .analysis-actions {
    justify-content: start;
    width: 100%;
  }

  .search,
  .search input {
    width: 100%;
  }

  .analytics-summary-grid,
  .settings-grid,
  .filter-card,
  .tester .form-grid {
    grid-template-columns: 1fr;
  }

  .request-log-row {
    align-items: start;
    flex-direction: column;
  }

  .request-log-meta {
    justify-content: start;
  }

  .empty-state-card {
    align-items: start;
    flex-direction: column;
  }
}


/* =========================================================
   Code / terminal window for snippets
   ========================================================= */

.code-window {
  margin-top: 18px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #0f172a;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.code-window-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #111827;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
}

.code-dot.red {
  background: #ff5f57;
}

.code-dot.yellow {
  background: #ffbd2e;
}

.code-dot.green {
  background: #28c840;
}

.code-window-title {
  margin-left: 8px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
}

.code-window pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  max-width: 100%;
  background: #0f172a;
}

.code-window code {
  display: block;
  min-width: max-content;
  color: #e5e7eb;
  font-family:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    Menlo,
    monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

/* Optional: nicer scrollbar for code window */
.code-window pre::-webkit-scrollbar {
  height: 10px;
}

.code-window pre::-webkit-scrollbar-track {
  background: #111827;
}

.code-window pre::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 999px;
}

.code-window pre::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* =========================================================
   Terminal-style code windows
   ========================================================= */

.code-window {
  margin-top: 18px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #0f172a;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  max-width: 100%;
}

.code-window-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #111827;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 auto;
}

.code-dot.red {
  background: #ff5f57;
}

.code-dot.yellow {
  background: #ffbd2e;
}

.code-dot.green {
  background: #28c840;
}

.code-window-title {
  margin-left: 8px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
}

.code-window pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  max-width: 100%;
  background: #0f172a;
}

.code-window code {
  display: block;
  min-width: max-content;
  color: #e5e7eb;
  font-family:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    Menlo,
    monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

.code-window pre::-webkit-scrollbar {
  height: 10px;
}

.code-window pre::-webkit-scrollbar-track {
  background: #111827;
}

.code-window pre::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 999px;
}

.code-window pre::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Prevent old compact-code styling from forcing overflow */
.compact-code {
  max-width: 100%;
  overflow-x: auto;
}

/* =========================================================
   Fix Docs / Integration snippet code window layout
   ========================================================= */

.usage {
  display: block;
  padding: 24px;
  background: #102019;
  border-radius: 24px;
  max-width: 100%;
}

.usage .code-window {
  width: 100%;
  max-width: 100%;
  margin-top: 0;
}

.usage .code-window pre {
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
}

.usage .code-window code {
  min-width: max-content;
  font-size: 13px;
  line-height: 1.7;
}

.usage .code-copy {
  margin-top: 16px;
  float: none;
  display: inline-flex;
}

/* =========================================================
   Provider company logos
   ========================================================= */

.provider-card-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.provider-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.provider-title-block {
  min-width: 0;
}

.provider-title-block h3 {
  margin: 0;
}

.provider-title-block span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-logo-wrap {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  flex: 0 0 auto;
  overflow: hidden;
}

.provider-logo-wrap.small {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.provider-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
}

.provider-logo-wrap.small .provider-logo {
  width: 22px;
  height: 22px;
}

.provider-logo-wrap.logo-fallback {
  background: #0f7a5f;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.95rem;
}

.provider-icon {
  display: none;
}

.health-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.request-provider-info,
.drawer-provider-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.request-provider-info>span {
  display: grid;
  min-width: 0;
}

.request-provider-info small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   Fix provider cards after adding company logos
   ========================================================= */

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.provider-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
  padding: 22px;
  min-height: 210px;
}

.provider-card-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.provider-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.provider-logo-wrap {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.provider-logo {
  width: 31px;
  height: 31px;
  object-fit: contain;
  display: block;
}

.provider-logo-wrap.logo-fallback {
  background: #0f7a5f;
  color: #ffffff;
  font-weight: 800;
}

.provider-title-block {
  min-width: 0;
}

.provider-title-block h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.provider-title-block span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-content {
  min-width: 0;
}

.provider-content p {
  margin: 0;
  max-width: 42rem;
  line-height: 1.55;
  color: var(--muted);
}

.provider-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.provider-meta span {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(15, 122, 95, 0.08);
  color: #4b5f58;
  font-size: 0.78rem;
  line-height: 1.2;
}

.provider-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  min-width: 112px;
}

.provider-actions .status {
  white-space: nowrap;
}

.provider-actions button {
  white-space: nowrap;
}

/* Hide old letter icon if any older markup still exists */
.provider-icon {
  display: none !important;
}

/* Mobile-friendly card layout */
@media (max-width: 720px) {
  .provider-card {
    grid-template-columns: 1fr;
  }

  .provider-actions {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* =========================================================
   Dedicated selected-provider modal card
   ========================================================= */

.selected-provider-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  margin: 18px 0;
  border: 1px solid rgba(15, 122, 95, 0.14);
  border-radius: 18px;
  background: rgba(15, 122, 95, 0.045);
}

.selected-provider-card strong {
  display: block;
  margin-top: 3px;
  font-size: 1rem;
  color: var(--text);
}

.selected-provider-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#modal-provider-logo {
  flex: 0 0 auto;
}

/* =========================================================
   Settings account details
   ========================================================= */

.account-details-card {
  grid-column: span 2;
}

.account-settings-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.settings-avatar {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0f7a5f;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.15rem;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15, 122, 95, 0.16);
}

.settings-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-settings-header h3 {
  margin: 0;
}

.account-settings-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.settings-detail-list {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.settings-detail-list div {
  display: grid;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.settings-detail-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.settings-detail-list dd {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .account-details-card {
    grid-column: span 1;
  }
}

/* =========================================================
   Better Settings Actions card
   ========================================================= */

.settings-actions-card {
  padding: 24px;
}

.settings-action-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.settings-action-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
}

.settings-action-item strong {
  display: block;
  color: var(--text);
  font-size: 0.98rem;
}

.settings-action-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.settings-action-item button {
  white-space: nowrap;
}

.settings-action-item.danger-zone {
  background: rgba(179, 38, 30, 0.035);
  border-color: rgba(179, 38, 30, 0.12);
}

@media (max-width: 720px) {
  .settings-action-item {
    grid-template-columns: 1fr;
  }

  .settings-action-item button {
    justify-self: start;
  }
}

.logo-brand-mark {
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.logo-brand-mark img {
  width: 32px;
  height: 32px;
  display: block;
  object-fit: contain;
}

/* =========================================================
   Rate limit awareness
   ========================================================= */

.provider-card.rate-limited {
  border-color: rgba(180, 83, 9, 0.26);
  background:
    linear-gradient(180deg, rgba(255, 247, 237, 0.86), rgba(255, 255, 255, 0.92));
}

.provider-card.failing {
  border-color: rgba(179, 38, 30, 0.22);
  background:
    linear-gradient(180deg, rgba(254, 242, 242, 0.9), rgba(255, 255, 255, 0.92));
}

.provider-awareness {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.035);
}

.provider-awareness strong {
  display: block;
  color: var(--text);
  font-size: 0.88rem;
}

.provider-awareness small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.35;
}

.awareness-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 999px;
  background: #94a3b8;
  flex: 0 0 auto;
}

.awareness-dot.healthy,
.awareness-dot.connected {
  background: #0f7a5f;
}

.awareness-dot.available {
  background: #94a3b8;
}

.awareness-dot.rate-limited {
  background: #d97706;
}

.awareness-dot.failing {
  background: #b3261e;
}

.status.healthy,
.status.connected {
  color: #0f7a5f;
  background: rgba(15, 122, 95, 0.08);
}

.status.available {
  color: #64748b;
  background: rgba(100, 116, 139, 0.09);
}

.status.rate-limited {
  color: #b45309;
  background: rgba(217, 119, 6, 0.10);
}

.status.failing,
.status.failed {
  color: #b3261e;
  background: rgba(179, 38, 30, 0.10);
}

.health-row.rate-limited {
  border-color: rgba(217, 119, 6, 0.16);
}

.health-row.failing {
  border-color: rgba(179, 38, 30, 0.16);
}