: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; }
}
