:root {
  color-scheme: light;
  --bg: #eef1f0;
  --panel: #ffffff;
  --ink: #111817;
  --muted: #66716f;
  --line: #d4dcda;
  --accent: #146b5c;
  --accent-2: #a84e32;
  --blue: #24547e;
  --yellow: #d4a72c;
  --shadow: 0 18px 50px rgba(26, 34, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: #9fb1a9;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid var(--line);
  background: #e2e8e5;
  padding: 18px;
  min-height: 100vh;
}

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

.brand-link {
  color: inherit;
  text-decoration: none;
}

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: #f8fbfa;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.chat-title span,
.status,
.attachment-list,
.metric-grid span {
  color: var(--muted);
  font-size: 12px;
}

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

.sidebar-section {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  min-height: 40px;
  padding: 0 12px;
  text-align: left;
  background: transparent;
}

.nav-btn.active {
  border-color: #9ab6ae;
  background: #f8fbfa;
  font-weight: 800;
}

.new-chat,
.send-btn {
  min-height: 42px;
  border-color: transparent;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.search input,
.chat-title input,
select,
textarea,
.settings-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--ink);
}

.search input,
select,
.settings-form input {
  min-height: 38px;
  padding: 0 12px;
}

.conversation-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.conversation {
  display: grid;
  gap: 3px;
  padding: 10px;
  text-align: left;
  background: transparent;
}

.conversation.active {
  border-color: #aabbb2;
  background: #fffaf0;
}

.conversation strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation span {
  color: var(--muted);
  font-size: 12px;
}

.main {
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 251, 250, 0.88);
  padding: 14px 20px;
  backdrop-filter: blur(14px);
}

.chat-title {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-width: 520px;
}

.chat-title input {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 22px;
  font-weight: 800;
}

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

.model-controls label {
  display: grid;
  gap: 4px;
  min-width: 150px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.model-controls select {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
}

.icon-btn {
  min-width: 64px;
  height: 40px;
  padding: 0 12px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.workspace.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  height: calc(100vh - 72px);
}

body[data-dashboard="customer"] .side-nav,
body[data-dashboard="customer"] .inspector,
body[data-dashboard="customer"] #settingsBtn,
body[data-dashboard="customer"] #exportBtn,
body:not([data-dashboard="customer"]) #customerBackBtn {
  display: none;
}

body[data-dashboard="customer"] .shell {
  grid-template-columns: 300px minmax(0, 1fr);
}

body[data-dashboard="customer"] .sidebar {
  background: #f8fbfa;
}

body[data-dashboard="customer"] .workspace.active {
  grid-template-columns: minmax(0, 1fr);
}

body[data-dashboard="customer"] .topbar {
  background: #ffffff;
}

body[data-dashboard="customer"] .chat-title input {
  font-size: 18px;
}

.home-view {
  position: relative;
  min-height: calc(100vh - 72px);
  overflow: hidden;
  background: #101817;
  color: #f8fbfa;
}

.home-view.active {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.hero-scene {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    radial-gradient(circle at 72% 18%, rgba(212, 167, 44, 0.28), transparent 24%),
    radial-gradient(circle at 24% 72%, rgba(20, 107, 92, 0.45), transparent 30%),
    #101817;
  background-size: 56px 56px, 56px 56px, auto, auto, auto;
}

.node,
.trace {
  position: absolute;
  display: block;
}

.node {
  width: 14px;
  height: 14px;
  border: 2px solid #f8fbfa;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 10px rgba(212, 167, 44, 0.12);
}

.n1 { left: 20%; top: 22%; }
.n2 { left: 62%; top: 18%; background: #55b39f; }
.n3 { left: 80%; top: 62%; background: #f8fbfa; }
.n4 { left: 34%; top: 76%; background: var(--accent-2); }

.trace {
  height: 2px;
  background: rgba(248, 251, 250, 0.28);
  transform-origin: left center;
}

.t1 {
  left: 21%;
  top: 24%;
  width: 45%;
  transform: rotate(-5deg);
}

.t2 {
  left: 35%;
  top: 76%;
  width: 48%;
  transform: rotate(-18deg);
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 18px;
  max-width: 820px;
  min-height: min(720px, calc(100vh - 188px));
  padding: clamp(38px, 7vw, 92px);
}

.eyebrow {
  margin: 0;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h1,
.page-head h1 {
  margin: 0;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy h1 {
  max-width: 760px;
  font-size: clamp(42px, 8vw, 92px);
}

.hero-copy p:not(.eyebrow) {
  max-width: 620px;
  margin: 0;
  color: #dce5e2;
  font-size: 18px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.primary-action,
.secondary-action {
  min-height: 46px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-action {
  border-color: transparent;
  background: var(--yellow);
  color: #101817;
}

.secondary-action {
  border-color: rgba(248, 251, 250, 0.4);
  background: rgba(248, 251, 250, 0.08);
  color: #f8fbfa;
}

.home-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid rgba(248, 251, 250, 0.16);
  background: rgba(16, 24, 23, 0.82);
}

.home-strip div {
  display: grid;
  gap: 8px;
  min-height: 116px;
  border-right: 1px solid rgba(248, 251, 250, 0.16);
  padding: 20px;
}

.home-strip span {
  color: #bfd0cb;
  line-height: 1.45;
}

.chat-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
}

.message-stream {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  padding: 26px;
}

.empty-state {
  display: grid;
  align-content: center;
  gap: 14px;
  min-height: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.empty-state h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(34px, 6vw, 76px);
  line-height: 0.96;
}

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

.quick-grid button {
  min-height: 72px;
  padding: 12px;
  text-align: left;
}

.message {
  display: grid;
  gap: 8px;
  max-width: 880px;
}

.message.user {
  align-self: end;
}

.bubble {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
  box-shadow: 0 8px 24px rgba(50, 45, 34, 0.07);
  line-height: 1.55;
  white-space: pre-wrap;
}

.message.user .bubble {
  border-color: #b9d0c6;
  background: #eaf5ef;
}

.message-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.composer {
  border-top: 1px solid var(--line);
  background: #f4f7f5;
  padding: 14px;
}

.composer-tools,
.send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.composer-tools {
  justify-content: flex-start;
  margin-bottom: 10px;
}

.composer-tools button,
.file-chip {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 12px;
  cursor: pointer;
}

.file-chip input,
.file-input {
  display: none;
}

textarea {
  display: block;
  min-height: 86px;
  resize: vertical;
  padding: 12px;
  line-height: 1.45;
}

.send-row {
  margin-top: 10px;
}

.send-btn {
  min-width: 92px;
}

.inspector {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: #eef3f1;
  min-width: 0;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px;
}

.tab {
  min-height: 36px;
  background: transparent;
}

.tab.active {
  border-color: #9fb1a9;
  background: #fffdf8;
  font-weight: 700;
}

.panel {
  display: none;
  gap: 16px;
  overflow: auto;
  padding: 14px;
}

.panel.active {
  display: grid;
  align-content: start;
}

.panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.attachment-list {
  display: grid;
  gap: 8px;
}

.attachment {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 10px;
}

.prompt-template {
  min-height: 52px;
  padding: 12px;
  text-align: left;
}

.tool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric-grid div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  padding: 14px;
}

.metric-grid strong {
  font-size: 26px;
}

dialog {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(29, 37, 34, 0.38);
}

.settings-form {
  display: grid;
  gap: 16px;
}

.settings-form header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-form header button {
  width: 34px;
  height: 34px;
}

.settings-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.settings-note {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f1;
  color: var(--muted);
  padding: 12px;
  line-height: 1.45;
  font-size: 13px;
}

.settings-form menu {
  display: flex;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
}

#saveSettingsBtn {
  min-height: 40px;
  min-width: 96px;
  background: var(--accent);
  color: white;
}

.usage-view,
.pricing-view {
  height: calc(100vh - 72px);
  overflow: auto;
  padding: clamp(22px, 4vw, 48px);
}

.usage-view.active,
.pricing-view.active {
  display: block;
}

.page-head {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin-bottom: 26px;
}

.page-head h1 {
  font-size: clamp(34px, 5vw, 64px);
}

.page-head p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.usage-grid,
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.usage-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.stat-card,
.price-card,
.rate-table,
.usage-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(26, 34, 32, 0.07);
}

.stat-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  font-size: clamp(28px, 4vw, 44px);
}

.usage-table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.price-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 22px;
}

.price-card.featured {
  border-color: #7aa99c;
  box-shadow: 0 18px 46px rgba(20, 107, 92, 0.16);
}

.price-card span {
  color: var(--muted);
  font-weight: 800;
}

.price-card strong {
  font-size: 44px;
}

.price-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.price-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.rate-table {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.rate-table h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

#pricingRows {
  display: grid;
}

.rate-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(150px, auto) minmax(150px, auto);
  gap: 14px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 13px 0;
}

.rate-row div {
  display: grid;
  gap: 3px;
}

.rate-row span {
  color: var(--muted);
  font-size: 13px;
}

.pricing-main {
  max-width: 1160px;
}

.pricing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.pricing-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(42px, 7vw, 82px);
  line-height: 0.96;
}

.pricing-hero p:not(.eyebrow),
.pricing-note p,
.pricing-detail p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.pricing-hero p:not(.eyebrow) {
  max-width: 700px;
  margin-top: 14px;
  font-size: 17px;
}

.pricing-note,
.pricing-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 16px;
}

.pricing-note span,
.pricing-detail span,
.plan-pill {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.pricing-note strong {
  display: block;
  margin: 8px 0;
  font-size: 20px;
}

.plan-grid {
  margin-bottom: 18px;
}

.plan-card {
  position: relative;
  gap: 16px;
  min-height: 100%;
}

.plan-card-head {
  display: grid;
  gap: 6px;
}

.plan-card-head span {
  color: var(--muted);
}

.plan-card-head strong {
  line-height: 1;
}

.plan-card-head sub {
  font-size: 16px;
  color: var(--muted);
}

.plan-pill {
  justify-self: start;
  border: 1px solid #9fc7ba;
  border-radius: 999px;
  background: #e8f5ef;
  padding: 5px 9px;
}

.plan-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.plan-metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 10px;
}

.plan-metrics dt {
  color: var(--muted);
  font-size: 12px;
}

.plan-metrics dd {
  margin: 4px 0 0;
  font-weight: 900;
}

.plan-btn {
  min-height: 42px;
  margin-top: auto;
  border-color: transparent;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.plan-btn:hover {
  background: #2a3a37;
}

.plan-btn:disabled {
  border-color: var(--line);
  background: #eef3f1;
  color: var(--muted);
  cursor: default;
}

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

.pricing-detail {
  display: grid;
  gap: 8px;
}

.pricing-rates {
  margin-top: 0;
}

.rate-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.light-action {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.auth-main {
  display: grid;
  place-items: center;
  flex: 1;
  width: 100%;
  padding: clamp(28px, 6vw, 72px) 18px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 28px;
  width: min(980px, 100%);
  align-items: center;
}

.auth-copy h1,
.developer-hero h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.98;
}

.auth-copy p:not(.eyebrow),
.developer-hero p {
  color: var(--muted);
  line-height: 1.55;
}

.auth-form,
.developer-card,
.developer-account {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  padding: 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.auth-form label,
.developer-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form input,
.developer-card input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
}

.auth-submit {
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.auth-status,
.developer-status {
  min-height: 20px;
  margin: 0;
  color: var(--accent-2);
  font-size: 13px;
}

.link-button {
  justify-self: center;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  text-decoration: underline;
}

.developer-main {
  max-width: 1160px;
}

.developer-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
}

.developer-account span,
.developer-account strong {
  display: block;
}

.developer-account span {
  color: var(--muted);
  font-size: 13px;
}

.developer-account strong {
  font-size: 24px;
  text-transform: capitalize;
}

.developer-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  margin-bottom: 18px;
}

.developer-card h2 {
  margin: 0;
  font-size: 20px;
}

.developer-card pre,
.secret-box {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111817;
  color: #f8fbfa;
  padding: 14px;
  line-height: 1.5;
}

.secret-box {
  white-space: pre-wrap;
  word-break: break-all;
}

@media (max-width: 1040px) {
  .shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .workspace.active {
    grid-template-columns: minmax(0, 1fr);
  }

  .inspector {
    display: none;
  }

  .usage-grid,
  .pricing-grid,
  .home-strip {
    grid-template-columns: 1fr;
  }

  .rate-row {
    grid-template-columns: 1fr;
  }

  .model-controls {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .pricing-hero,
  .pricing-details,
  .auth-panel,
  .developer-hero,
  .developer-grid {
    grid-template-columns: 1fr;
  }

  .rate-table-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .conversation-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    overflow-x: auto;
  }

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

  .top-actions,
  .model-controls label,
  .settings-button {
    width: 100%;
  }

  .model-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .workspace.active {
    height: auto;
    min-height: calc(100vh - 260px);
  }

  .home-view {
    min-height: calc(100vh - 260px);
  }

  .hero-copy {
    min-height: 520px;
    padding: 28px;
  }

  .chat-pane {
    min-height: calc(100vh - 260px);
  }

  .message-stream {
    padding: 18px;
  }

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

  .plan-metrics {
    grid-template-columns: 1fr;
  }
}

/* ── Settings dialog (API keys) ───────────────────────────── */
#settingsDialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  max-width: 480px;
  width: 95vw;
  background: var(--panel);
  box-shadow: var(--shadow);
}

#settingsDialog::backdrop {
  background: rgba(10, 16, 14, 0.45);
  backdrop-filter: blur(3px);
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-form > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.settings-form > header strong {
  font-size: 1rem;
}

.settings-form > header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.settings-form > header button {
  border: none;
  background: none;
  font-size: 1.1rem;
  padding: 2px 8px;
  color: var(--muted);
  border-radius: 6px;
}

.settings-form > p.settings-note {
  margin: 0;
  padding: 10px 20px 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.key-fieldset {
  border: none;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 14px 20px 16px;
}

.key-fieldset legend {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 4px;
}

.key-fieldset label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--ink);
  margin-top: 10px;
}

.readonly-field {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 10px;
  margin-top: 10px;
}

.readonly-field span {
  color: var(--muted);
  font-size: 0.82rem;
}

.readonly-field strong {
  font-size: 1.35rem;
}

.key-fieldset input[type="password"],
.key-fieldset input[type="url"],
.key-fieldset input[type="number"],
.key-fieldset input[type="text"],
.key-fieldset input:not([type]) {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--ink);
  font-size: 0.85rem;
  width: 100%;
}

.key-fieldset input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.key-fieldset .settings-note {
  margin: 8px 0 0;
  font-size: 0.77rem;
  color: var(--muted);
}

.key-fieldset .settings-warn {
  color: #b45309;
}

.key-status {
  margin: 0;
  padding: 8px 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  min-height: 24px;
}

.settings-form menu {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px;
  margin: 0;
  border-top: 1px solid var(--line);
}

.settings-form menu button {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
}

.settings-form menu button#saveSettingsBtn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.settings-form menu button#saveSettingsBtn:hover {
  background: #115f51;
}

/* ═══════════════════════════════════════════════════════════
   Multi-page layout (index.html, usage.html, pricing.html)
═══════════════════════════════════════════════════════════ */

/* ── Shared page body ──────────────────────────────────────── */
.page-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Site header / top nav ─────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.site-brand strong {
  font-weight: 700;
  font-size: 0.95rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--bg);
}

.site-nav-cta {
  background: var(--ink) !important;
  color: #f8fbfa !important;
  font-weight: 600;
  margin-left: 8px;
}

.site-nav-cta:hover {
  background: #2a3a37 !important;
}

/* ── Shared page main ──────────────────────────────────────── */
.page-main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 60px 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.page-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.page-actions .primary-action,
.page-actions .secondary-action {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.page-actions .primary-action {
  background: var(--ink);
  color: #f8fbfa;
}

.page-actions .primary-action:hover {
  background: #2a3a37;
}

.page-actions .secondary-action {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.page-actions .secondary-action:hover {
  background: var(--line);
}

/* ── Landing page hero ─────────────────────────────────────── */
.lp-hero {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #101d1a 0%, #183029 60%, #0f2820 100%);
  border-radius: 20px;
  overflow: hidden;
  margin: 28px 32px 0;
}

.lp-hero .hero-copy {
  position: relative;
  z-index: 2;
  padding: 60px 56px;
  max-width: 680px;
}

.lp-hero .hero-copy h1 {
  color: #f8fbfa;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 1.0;
  margin: 12px 0 20px;
}

.lp-hero .hero-copy p {
  color: #9fbfb6;
  line-height: 1.6;
  font-size: 1.05rem;
  margin: 0 0 32px;
}

.lp-hero .hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.lp-hero .primary-action,
.lp-hero .secondary-action {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: opacity 0.15s, transform 0.15s;
}

.lp-hero .primary-action {
  background: var(--yellow);
  color: #101817;
}

.lp-hero .secondary-action {
  background: rgba(248, 251, 250, 0.08);
  border-color: rgba(248, 251, 250, 0.25);
  color: #f8fbfa;
}

.lp-hero .primary-action:hover,
.lp-hero .secondary-action:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

/* ── Feature strip ─────────────────────────────────────────── */
.lp-strip {
  padding: 0 32px;
}

.lp-strip-inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.lp-feature {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.lp-feature-icon {
  font-size: 1.5rem;
}

.lp-feature strong {
  font-size: 0.95rem;
}

.lp-feature span {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Provider cards ────────────────────────────────────────── */
.lp-providers {
  padding: 0 32px;
}

.lp-providers h2 {
  font-size: 1.4rem;
  margin: 0 0 20px;
}

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

.lp-provider-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.lp-provider-card strong {
  font-size: 1rem;
}

.lp-provider-card > span {
  font-size: 0.82rem;
  color: var(--muted);
}

.lp-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}

.lp-badge-green {
  background: #d1f5ea;
  color: #0a5940;
}

.lp-badge-yellow {
  background: #fef3c7;
  color: #92400e;
}

/* ── CTA section ───────────────────────────────────────────── */
.lp-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  padding: 60px 32px 80px;
  background: var(--ink);
  border-radius: 20px;
  margin: 0 32px 28px;
}

.lp-cta h2 {
  color: #f8fbfa;
  font-size: 2rem;
  margin: 0;
}

.lp-cta p {
  color: #9fbfb6;
  margin: 0;
}

.lp-cta .primary-action {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  border-radius: 10px;
  background: var(--yellow);
  color: #101817;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  transition: opacity 0.15s;
}

.lp-cta .primary-action:hover {
  opacity: 0.88;
}

/* ── Site footer ───────────────────────────────────────────── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}

.site-footer nav {
  display: flex;
  gap: 16px;
}

.site-footer nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer nav a:hover {
  color: var(--ink);
}

/* ── Usage / pricing page shared ──────────────────────────── */
.rate-note {
  color: var(--muted);
  font-size: 0.85rem;
  margin: -8px 0 16px;
}

.rate-group {
  margin-bottom: 28px;
}

.rate-group-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 10px;
}

/* sidebar nav-btn as anchor tag */
.side-nav a.nav-btn {
  display: block;
  text-decoration: none;
  text-align: left;
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  border: 1px solid transparent;
  background: none;
  transition: background 0.12s;
}

.side-nav a.nav-btn:hover {
  background: rgba(0,0,0,0.06);
}

.side-nav a.nav-btn.active {
  background: var(--panel);
  border-color: var(--line);
  font-weight: 600;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .lp-strip-inner,
  .lp-provider-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 0 16px;
  }

  .lp-hero {
    margin: 12px 16px 0;
    min-height: 420px;
  }

  .lp-hero .hero-copy {
    padding: 36px 28px;
  }

  .lp-strip,
  .lp-providers,
  .lp-cta {
    padding-left: 16px;
    padding-right: 16px;
    margin-left: 16px;
    margin-right: 16px;
  }

  .lp-strip-inner,
  .lp-provider-grid {
    grid-template-columns: 1fr;
  }

  .page-main {
    padding: 36px 16px 60px;
  }

  .site-footer {
    padding: 16px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .site-nav-cta {
    display: none;
  }
}

/* ── Checkout modal dialog styles ────────────────────────── */
#checkoutDialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  max-width: 440px;
  width: 95vw;
  background: var(--panel);
  box-shadow: var(--shadow);
}

#checkoutDialog::backdrop {
  background: rgba(10, 16, 14, 0.45);
  backdrop-filter: blur(3px);
}

.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.checkout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.checkout-sub {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.checkout-header h3 {
  margin: 4px 0 0;
  font-size: 1.1rem;
}

.checkout-close {
  border: none;
  background: none;
  font-size: 1.1rem;
  padding: 4px 8px;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
}

.checkout-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.checkout-summary {
  background: var(--bg);
  padding: 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px dashed var(--line);
}

.checkout-summary span {
  font-size: 0.85rem;
  color: var(--muted);
}

.checkout-summary strong {
  font-size: 1.2rem;
  color: var(--ink);
}

.checkout-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checkout-fields label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink);
}

.checkout-fields input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  background: #fbfdfc;
  color: var(--ink);
  width: 100%;
}

.checkout-fields input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.card-input-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fbfdfc;
}

.card-input-group input {
  border: none;
  border-radius: 0;
  padding: 10px 12px;
}

.card-input-group input:not(:last-child) {
  border-bottom: 1px solid var(--line);
}

.card-sub-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.card-sub-fields input:first-child {
  border-right: 1px solid var(--line);
}

.checkout-hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
}

.checkout-footer {
  padding: 16px 24px 24px;
  border-top: 1px solid var(--line);
}

.checkout-submit-btn {
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 100%;
  padding: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.checkout-submit-btn:hover {
  background: #2a3a37;
}

.checkout-submit-btn:disabled {
  background: var(--muted);
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* plan buttons active states */
.plan-btn {
  width: 100%;
  padding: 10px;
  margin-top: auto;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.15s;
}

.plan-btn:not(:disabled) {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.plan-btn:not(:disabled):hover {
  background: #2a3a37;
  border-color: #2a3a37;
}

.plan-btn.current-active {
  background: var(--bg) !important;
  color: var(--muted) !important;
  border-color: var(--line) !important;
  cursor: default;
}

/* Remade pages */
.nd-page {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(238, 241, 240, 0.2) 34%),
    #eef1f0;
}

.nd-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  border-bottom: 1px solid rgba(17, 24, 23, 0.1);
  background: rgba(248, 251, 250, 0.92);
  padding: 0 clamp(18px, 4vw, 44px);
  backdrop-filter: blur(16px);
}

.nd-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.nd-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

.nd-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 0 12px;
  text-decoration: none;
}

.nd-nav a:hover,
.nd-nav a[aria-current="page"] {
  background: #fff;
  color: var(--ink);
}

.nd-home-main,
.nd-main-wide {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.nd-home-main {
  display: grid;
  gap: 18px;
  padding: 22px 0 42px;
}

.nd-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  gap: clamp(18px, 4vw, 44px);
  align-items: end;
  min-height: min(680px, calc(100vh - 120px));
  border: 1px solid rgba(248, 251, 250, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(248, 251, 250, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(248, 251, 250, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, #101817 0%, #17352f 58%, #543626 100%);
  background-size: 58px 58px, 58px 58px, auto;
  color: #f8fbfa;
  overflow: hidden;
  padding: clamp(28px, 6vw, 72px);
}

.nd-hero-copy {
  display: grid;
  gap: 18px;
  max-width: 760px;
}

.nd-hero-copy h1,
.nd-page-head h1 {
  margin: 0;
  letter-spacing: 0;
  line-height: 0.98;
}

.nd-hero-copy h1 {
  font-size: clamp(48px, 9vw, 108px);
}

.nd-hero-copy p:not(.eyebrow),
.nd-split-section p,
.nd-page-head p,
.nd-info-panel p {
  margin: 0;
  line-height: 1.55;
}

.nd-hero-copy p:not(.eyebrow) {
  max-width: 650px;
  color: #dce5e2;
  font-size: 18px;
}

.nd-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.nd-actions a,
.nd-page-head > a,
.nd-split-section > a,
.rate-table-head a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.nd-command-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(248, 251, 250, 0.18);
  border-radius: 8px;
  background: rgba(248, 251, 250, 0.09);
  padding: 12px;
}

.nd-command-panel div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  border: 1px solid rgba(248, 251, 250, 0.14);
  border-radius: 8px;
  background: rgba(16, 24, 23, 0.38);
  padding: 12px 14px;
}

.nd-command-panel span {
  color: #b7c9c4;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.nd-command-panel strong {
  text-align: right;
}

.nd-hero-preview {
  display: grid;
  gap: 14px;
  align-self: center;
  border: 1px solid rgba(248, 251, 250, 0.18);
  border-radius: 8px;
  background: rgba(248, 251, 250, 0.1);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  padding: 16px;
}

.nd-preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #dce5e2;
  font-size: 13px;
  font-weight: 800;
}

.nd-preview-top strong {
  border: 1px solid rgba(248, 251, 250, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
}

.nd-preview-message {
  width: fit-content;
  max-width: 100%;
  border-radius: 18px;
  background: rgba(248, 251, 250, 0.12);
  color: #f8fbfa;
  padding: 12px 14px;
  line-height: 1.45;
}

.nd-preview-message.user {
  justify-self: end;
  background: #e8f3ee;
  color: #111817;
}

.nd-preview-message.assistant {
  justify-self: start;
}

.nd-preview-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(248, 251, 250, 0.18);
}

.nd-preview-meter span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: #d4a72c;
}

.nd-feature-row,
.pricing-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.nd-feature-row article,
.pricing-detail,
.nd-info-panel,
.stat-card,
.price-card,
.developer-card,
.auth-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 38px rgba(26, 34, 32, 0.08);
}

.nd-feature-row article {
  display: grid;
  gap: 8px;
  padding: 20px;
}

.nd-feature-row span,
.pricing-detail span,
.nd-info-panel span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.nd-feature-row p,
.pricing-detail p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.nd-split-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111817;
  color: #f8fbfa;
  padding: clamp(22px, 4vw, 34px);
}

.nd-split-section h2 {
  max-width: 620px;
  margin: 6px 0 10px;
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1;
}

.nd-split-section p:not(.eyebrow) {
  max-width: 650px;
  color: #cbd8d4;
}

.page-main.nd-main-wide {
  max-width: none;
  padding: clamp(24px, 5vw, 54px) 0 clamp(42px, 7vw, 80px);
}

.nd-page-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, auto);
  gap: 22px;
  align-items: end;
}

.nd-page-head h1 {
  max-width: 820px;
  font-size: clamp(38px, 6vw, 76px);
}

.nd-page-head p:not(.eyebrow) {
  max-width: 720px;
  color: var(--muted);
  font-size: 17px;
}

.nd-info-panel {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.nd-info-panel strong {
  font-size: 22px;
}

.nd-stat-grid {
  gap: 14px;
}

.nd-stat-grid .stat-card strong {
  overflow-wrap: anywhere;
}

.nd-table-panel {
  border-radius: 8px;
  background: #fff;
}

.auth-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(20, 107, 92, 0.1), transparent 42%),
    linear-gradient(315deg, rgba(168, 78, 50, 0.12), transparent 38%),
    #eef1f0;
}

.nd-auth-main {
  min-height: calc(100vh - 68px);
}

.nd-auth-panel {
  width: min(1060px, 100%);
}

.auth-form .tab {
  min-height: 40px;
}

.developer-account button,
.developer-card .primary-action,
.auth-submit {
  min-height: 42px;
  border-color: transparent;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.developer-card pre {
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}

.developer-page .developer-grid {
  align-items: stretch;
}

.pricing-page .plan-grid {
  align-items: stretch;
}

.pricing-page .plan-card {
  min-width: 0;
}

.pricing-page .plan-card-head strong {
  overflow-wrap: anywhere;
}

.pricing-account-banner {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  padding: 14px 16px;
  line-height: 1.45;
}

.pricing-account-banner[data-tone="ok"] {
  border-color: #9fc7ba;
  background: #e8f5ef;
  color: #174a3f;
}

.pricing-account-banner[data-tone="warn"] {
  border-color: #e6c47c;
  background: #fff8e8;
  color: #68460c;
}

.pricing-account-banner a {
  color: inherit;
  font-weight: 900;
}

.nd-chat-page {
  min-height: 100vh;
  background: #eef1f0;
}

.nd-chat-shell {
  grid-template-columns: 292px minmax(0, 1fr);
}

.nd-chat-sidebar {
  background: #f8fbfa;
}

.nd-chat-sidebar .brand {
  padding-bottom: 4px;
}

.nd-chat-sidebar .side-nav {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.nd-chat-topbar {
  min-height: 76px;
  background: rgba(255, 255, 255, 0.9);
}

.chat-workspace.active {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  height: calc(100vh - 76px);
}

.chat-pane {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(238, 241, 240, 0.5)),
    #eef1f0;
}

.chat-composer {
  background: rgba(248, 251, 250, 0.96);
}

.chat-composer textarea {
  max-height: 38vh;
  background: #fff;
}

.chat-inspector {
  background: #f8fbfa;
}

#apiBudgetInput {
  display: block;
}

@media (max-width: 980px) {
  .nd-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .nd-nav {
    justify-content: flex-start;
  }

  .nd-hero,
  .nd-page-head,
  .nd-feature-row,
  .pricing-details,
  .nd-split-section,
  .chat-workspace.active,
  .nd-auth-panel,
  .developer-grid {
    grid-template-columns: 1fr;
  }

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

  .chat-inspector {
    display: none;
  }
}

@media (max-width: 720px) {
  .nd-main-wide,
  .nd-home-main {
    width: min(100% - 24px, 1180px);
  }

  .nd-hero {
    min-height: auto;
    padding: 24px;
  }

  .nd-hero-copy h1,
  .nd-page-head h1 {
    line-height: 1.02;
  }

  .nd-nav a {
    min-height: 34px;
    padding: 0 9px;
  }

  .nd-chat-shell {
    grid-template-columns: 1fr;
  }

  .nd-chat-sidebar {
    min-height: auto;
  }

  .chat-workspace.active {
    height: auto;
    min-height: calc(100vh - 280px);
  }

  .message-stream {
    min-height: 48vh;
  }
}

/* Chat layout fix */
body.nd-chat-page {
  height: 100vh;
  overflow: hidden;
}

.nd-chat-page .nd-chat-shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.nd-chat-page .chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  height: 100vh;
  overflow: hidden;
}

.nd-chat-page .chat-workspace.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  min-height: 0;
  height: auto;
  overflow: hidden;
}

.nd-chat-page .chat-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
}

.nd-chat-page .message-stream {
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 18px;
}

.nd-chat-page .chat-composer {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
  border-top: 1px solid var(--line);
}

.nd-chat-page .chat-composer textarea {
  min-height: 74px;
  max-height: 150px;
  resize: vertical;
}

.nd-chat-page .chat-inspector {
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 980px) {
  .nd-chat-page .chat-workspace.active {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body.nd-chat-page {
    height: auto;
    overflow: auto;
  }

  .nd-chat-page .nd-chat-shell,
  .nd-chat-page .chat-main {
    height: auto;
    min-height: 100vh;
  }

  .nd-chat-page .chat-workspace.active {
    min-height: calc(100vh - 260px);
  }
}

/* ChatGPT-style chat surface */
.nd-chat-page {
  --chat-bg: #f7f7f5;
  --chat-sidebar: #f0f0ee;
  --chat-text: #1f1f1f;
  --chat-muted: #6b6f6d;
  --chat-border: #deded8;
  --chat-user: #e8f3ee;
}

.nd-chat-page,
.nd-chat-page .chat-pane {
  background: var(--chat-bg);
  color: var(--chat-text);
}

.nd-chat-page .nd-chat-shell {
  grid-template-columns: 260px minmax(0, 1fr);
}

.nd-chat-page .nd-chat-sidebar {
  border-right: 1px solid var(--chat-border);
  background: var(--chat-sidebar);
  padding: 12px;
}

.nd-chat-page .brand {
  min-height: 44px;
  padding: 4px 6px;
}

.nd-chat-page .mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 12px;
}

.nd-chat-page .side-nav {
  gap: 2px;
  border-bottom: 0;
  padding-bottom: 4px;
}

.nd-chat-page .side-nav a.nav-btn,
.nd-chat-page .nav-btn,
.nd-chat-page .conversation,
.nd-chat-page .new-chat {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #343735;
  padding: 8px 10px;
  font-size: 14px;
}

.nd-chat-page .side-nav a.nav-btn:hover,
.nd-chat-page .nav-btn:hover,
.nd-chat-page .conversation:hover {
  background: rgba(0, 0, 0, 0.06);
}

.nd-chat-page .nav-btn.active,
.nd-chat-page .conversation.active {
  background: rgba(0, 0, 0, 0.08);
  font-weight: 650;
}

.nd-chat-page .new-chat {
  justify-content: flex-start;
  background: #ffffff;
  color: var(--chat-text);
  font-weight: 650;
}

.nd-chat-page .search span,
.nd-chat-page .section-head {
  display: none;
}

.nd-chat-page .search input {
  min-height: 36px;
  border: 0;
  background: rgba(255, 255, 255, 0.75);
}

.nd-chat-page .conversation-list {
  gap: 2px;
}

.nd-chat-page .conversation strong {
  font-weight: 550;
}

.nd-chat-page .conversation span {
  color: var(--chat-muted);
}

.nd-chat-page .usage-meter {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

.nd-chat-page .usage-meter-head,
.nd-chat-page .usage-meter-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nd-chat-page .usage-meter-head span,
.nd-chat-page .usage-meter-meta {
  color: var(--chat-muted);
  font-size: 12px;
}

.nd-chat-page .usage-meter-head strong {
  color: var(--chat-text);
  font-size: 12px;
}

.nd-chat-page .usage-meter-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #deded8;
}

.nd-chat-page .usage-meter-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #111817;
  transition: width 180ms ease, background 180ms ease;
}

.nd-chat-page .usage-meter-track[data-level="warn"] span {
  background: #d4a72c;
}

.nd-chat-page .usage-meter-track[data-level="danger"] span {
  background: #a84e32;
}

.nd-chat-page .usage-meter-meta {
  align-items: flex-start;
  flex-direction: column;
  gap: 3px;
  line-height: 1.25;
}

.nd-chat-page .nd-chat-topbar {
  min-height: 58px;
  border-bottom: 0;
  background: rgba(247, 247, 245, 0.86);
  padding: 8px 24px;
}

.nd-chat-page .chat-title input {
  font-size: 18px;
  font-weight: 650;
}

.nd-chat-page .chat-title span {
  display: none;
}

.nd-chat-page .model-controls {
  gap: 8px;
}

.nd-chat-page .model-controls label {
  min-width: 118px;
}

.nd-chat-page .model-controls label span {
  display: none;
}

.nd-chat-page .model-controls select,
.nd-chat-page .settings-button {
  min-height: 36px;
  border: 1px solid transparent;
  background: transparent;
}

.nd-chat-page .model-controls select:hover,
.nd-chat-page .settings-button:hover {
  background: rgba(0, 0, 0, 0.06);
}

.nd-chat-page .chat-workspace.active {
  grid-template-columns: minmax(0, 1fr);
}

.nd-chat-page .chat-inspector[hidden] {
  display: none;
}

.nd-chat-page .message-stream {
  display: block;
  width: 100%;
  padding: 28px 24px 32px;
}

.nd-chat-page .empty-state {
  max-width: 760px;
  min-height: 100%;
  margin: 0 auto;
  place-content: center;
  text-align: center;
}

.nd-chat-page .empty-state h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 650;
  line-height: 1.08;
}

.nd-chat-page .quick-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 620px;
  margin: 10px auto 0;
}

.nd-chat-page .quick-grid button {
  min-height: 54px;
  border: 1px solid var(--chat-border);
  background: #fff;
  color: var(--chat-text);
}

.nd-chat-page .message {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 14px;
  width: min(100%, 820px);
  max-width: 820px;
  margin: 0 auto 28px;
}

.nd-chat-page .message.user {
  display: flex;
  justify-content: flex-end;
  max-width: 820px;
}

.nd-chat-page .message.user .message-avatar,
.nd-chat-page .message.user .message-label {
  display: none;
}

.nd-chat-page .message-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #111817;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.nd-chat-page .message-body {
  min-width: 0;
}

.nd-chat-page .message-label {
  margin-bottom: 8px;
  color: var(--chat-text);
  font-size: 14px;
  font-weight: 700;
}

.nd-chat-page .message.pending .bubble {
  color: var(--chat-muted);
  font-style: italic;
}

.nd-chat-page .message.pending .bubble::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  animation: thinkingDots 1.2s steps(4, end) infinite;
}

.nd-chat-page .message.typing .bubble::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.12em;
  background: currentColor;
  animation: typingCursor 0.8s steps(2, end) infinite;
}

@keyframes typingCursor {
  50% { opacity: 0; }
}

@keyframes thinkingDots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

.nd-chat-page .bubble {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  color: var(--chat-text);
  font-size: 16px;
  line-height: 1.68;
  white-space: pre-wrap;
}

.nd-chat-page .message.user .bubble {
  max-width: min(640px, 78vw);
  border: 1px solid rgba(20, 107, 92, 0.14);
  border-radius: 20px;
  background: var(--chat-user);
  padding: 10px 16px;
  line-height: 1.5;
}

.nd-chat-page .artifact-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  background: #f8faf9;
  padding: 10px;
}

.nd-chat-page .artifact-list > strong {
  flex-basis: 100%;
  color: var(--chat-muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.nd-chat-page .message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.nd-chat-page .message-attachment {
  display: grid;
  gap: 2px;
  max-width: 240px;
  border: 1px solid var(--chat-border);
  border-radius: 10px;
  background: #f8f9f8;
  padding: 8px 10px;
}

.nd-chat-page .message-attachment strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.nd-chat-page .message-attachment span {
  color: var(--chat-muted);
  font-size: 12px;
}

.nd-chat-page .message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.nd-chat-page .retry-btn {
  min-height: 34px;
  border: 1px solid var(--chat-border);
  border-radius: 999px;
  background: #fff;
  color: var(--chat-text);
  font-size: 13px;
  font-weight: 750;
  padding: 0 14px;
}

.nd-chat-page .retry-btn:hover {
  background: #f0f0ee;
}

.nd-chat-page .artifact-download {
  min-height: 34px;
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  background: #fff;
  color: var(--chat-text);
  font-size: 13px;
  font-weight: 650;
  padding: 0 12px;
}

.nd-chat-page .artifact-download:hover {
  background: #f0f0ee;
}

.nd-chat-page .artifact-project {
  border-color: #a4c7bd;
  background: #e8f3ee;
  order: -1;
}

.nd-chat-page .chat-composer {
  width: min(100% - 32px, 820px);
  margin: 0 auto 18px;
  border: 1px solid var(--chat-border);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
  padding: 10px;
}

.nd-chat-page .composer-tools {
  order: 2;
  margin: 0;
}

.nd-chat-page .composer-tools button,
.nd-chat-page .file-chip {
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--chat-muted);
  padding: 0 10px;
}

.nd-chat-page .composer-tools button:hover,
.nd-chat-page .file-chip:hover {
  background: rgba(0, 0, 0, 0.06);
}

.nd-chat-page #deleteChatBtn {
  color: #9b3b2f;
}

.nd-chat-page #deleteChatBtn:hover {
  background: #f5e7e3;
}

.nd-chat-page .composer-attachments {
  order: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.nd-chat-page .composer-attachments:empty {
  display: none;
}

.nd-chat-page .composer-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  min-height: 32px;
  border: 1px solid var(--chat-border);
  border-radius: 999px;
  background: #f7f7f5;
  color: var(--chat-text);
  padding: 0 10px;
}

.nd-chat-page .composer-attachment span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nd-chat-page .composer-attachment strong {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e0e2dc;
  color: #4d5551;
  font-size: 12px;
  line-height: 1;
}

.nd-chat-page .chat-composer textarea {
  order: 2;
  min-height: 48px;
  max-height: 180px;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  resize: none;
  outline: none;
}

.nd-chat-page .send-row {
  order: 4;
  margin-top: -42px;
  justify-content: flex-end;
  pointer-events: none;
}

.nd-chat-page .status {
  margin-right: auto;
  padding-left: 10px;
}

.nd-chat-page .send-btn {
  display: grid;
  place-items: center;
  min-width: 42px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #111817;
  color: transparent;
  pointer-events: auto;
  position: relative;
}

.nd-chat-page .send-btn::after {
  content: "↑";
  position: absolute;
  color: #fff;
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 720px) {
  .nd-chat-page .nd-chat-shell {
    grid-template-columns: 1fr;
  }

  .nd-chat-page .nd-chat-sidebar {
    display: none;
  }

  .nd-chat-page .nd-chat-topbar {
    padding: 10px 14px;
  }

  .nd-chat-page .message-stream {
    padding: 20px 14px 28px;
  }

  .nd-chat-page .message {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    margin-bottom: 24px;
  }

  .nd-chat-page .message-avatar {
    width: 28px;
    height: 28px;
  }

  .nd-chat-page .quick-grid {
    grid-template-columns: 1fr;
  }

  .nd-chat-page .chat-composer {
    width: calc(100% - 20px);
    margin-bottom: 10px;
  }
}

/* Remade product pages */
.nd-page:not(.nd-chat-page) {
  background: #f6f7f5;
}

.nd-page:not(.nd-chat-page) .nd-header {
  border-bottom: 1px solid #e2e3de;
  background: rgba(246, 247, 245, 0.9);
}

.nd-page:not(.nd-chat-page) .nd-brand .mark {
  border-radius: 8px;
  background: #111817;
}

.nd-remake-home {
  width: min(1180px, calc(100% - 32px));
  padding: 28px 0 56px;
}

.nd-remake-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  min-height: min(680px, calc(100vh - 128px));
  border: 1px solid #e0e2dc;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.48)),
    #eef1ed;
  padding: clamp(28px, 7vw, 76px);
}

.nd-remake-hero-copy {
  display: grid;
  gap: 18px;
}

.nd-remake-hero h1 {
  max-width: 780px;
  margin: 0;
  color: #111817;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.96;
}

.nd-remake-hero p:not(.eyebrow) {
  max-width: 660px;
  margin: 0;
  color: #59615e;
  font-size: 18px;
  line-height: 1.6;
}

.nd-remake-console {
  display: grid;
  gap: 14px;
  border: 1px solid #d7ddd8;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(17, 24, 23, 0.12);
  padding: 16px;
}

.nd-remake-console-bar {
  display: flex;
  gap: 7px;
}

.nd-remake-console-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d9ddd7;
}

.nd-remake-console-row {
  width: fit-content;
  max-width: 100%;
  border-radius: 18px;
  padding: 12px 14px;
  line-height: 1.45;
}

.nd-remake-console-row.user {
  justify-self: end;
  background: #e8f3ee;
}

.nd-remake-console-row.assistant {
  justify-self: start;
  background: #f1f2ef;
}

.nd-remake-console-usage {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e4df;
}

.nd-remake-console-usage span {
  display: block;
  width: 46%;
  height: 100%;
  border-radius: inherit;
  background: #111817;
}

.nd-remake-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.nd-remake-strip a {
  display: grid;
  gap: 8px;
  min-height: 132px;
  border: 1px solid #e0e2dc;
  border-radius: 12px;
  background: #fff;
  color: #111817;
  padding: 20px;
  text-decoration: none;
}

.nd-remake-strip a:hover {
  border-color: #bfc8c2;
}

.nd-remake-strip span {
  color: #626b67;
  line-height: 1.5;
}

.nd-page:not(.nd-chat-page) .nd-main-wide,
.nd-page:not(.nd-chat-page) .pricing-main,
.nd-page:not(.nd-chat-page) .developer-main {
  width: min(1180px, calc(100% - 32px));
}

.nd-page:not(.nd-chat-page) .nd-page-head {
  border: 1px solid #e0e2dc;
  border-radius: 12px;
  background: #fff;
  padding: clamp(22px, 4vw, 34px);
}

.nd-page:not(.nd-chat-page) .nd-page-head h1 {
  color: #111817;
}

.nd-page:not(.nd-chat-page) .stat-card,
.nd-page:not(.nd-chat-page) .price-card,
.nd-page:not(.nd-chat-page) .pricing-detail,
.nd-page:not(.nd-chat-page) .developer-card,
.nd-page:not(.nd-chat-page) .developer-account,
.nd-page:not(.nd-chat-page) .usage-table-wrap,
.nd-page:not(.nd-chat-page) .rate-table {
  border-color: #e0e2dc;
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}

.nd-page:not(.nd-chat-page) .stat-card strong {
  font-size: clamp(30px, 4vw, 46px);
}

.nd-page:not(.nd-chat-page) .plan-card.featured {
  border-color: #111817;
  box-shadow: 0 18px 42px rgba(17, 24, 23, 0.12);
}

.nd-page:not(.nd-chat-page) .primary-action,
.nd-page:not(.nd-chat-page) .plan-btn:not(:disabled),
.nd-page:not(.nd-chat-page) .developer-card .primary-action {
  border-color: transparent;
  background: #111817;
  color: #fff;
}

@media (max-width: 900px) {
  .nd-remake-hero,
  .nd-remake-strip,
  .nd-page:not(.nd-chat-page) .nd-page-head {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nd-remake-home,
  .nd-page:not(.nd-chat-page) .nd-main-wide,
  .nd-page:not(.nd-chat-page) .pricing-main,
  .nd-page:not(.nd-chat-page) .developer-main {
    width: min(100% - 20px, 1180px);
  }

  .nd-remake-hero {
    padding: 24px;
  }
}
