:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #17211c;
  --muted: #667168;
  --line: #dfe5dc;
  --accent: #146c43;
  --accent-dark: #0f5132;
  --soft: #e8f3ec;
  --warning: #8a5a00;
}

* {
  box-sizing: border-box;
}

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

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}

.topbar h1,
.hero h2,
.pricing h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.pay-link,
button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.pay-link,
#generate {
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.pay-link {
  padding: 10px 16px;
}

.account-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 14px;
}

.link-button {
  padding: 0;
  color: var(--accent);
  background: transparent;
  font-weight: 800;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 26px auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-copy {
  padding: clamp(24px, 4vw, 42px);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #edf6ef 100%);
  border: 1px solid var(--line);
}

.hero-copy h2 {
  max-width: 780px;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.02;
}

.hero-copy p {
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.admin-hero {
  padding: clamp(22px, 4vw, 34px);
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #edf6ef 100%);
}

.admin-hero h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: 0;
}

.admin-hero p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.usage-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  border-radius: 8px;
  background: var(--accent-dark);
  color: white;
}

.usage-box span,
.usage-box small {
  opacity: 0.78;
}

.usage-box strong {
  display: block;
  margin: 10px 0;
  font-size: 28px;
  line-height: 1.1;
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
}

.auth-panel {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.auth-panel h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

#auth-form {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.auth-actions {
  display: flex;
  gap: 10px;
}

#register,
#login {
  min-height: 42px;
  padding: 0 14px;
  white-space: nowrap;
  font-weight: 800;
}

#register {
  background: var(--accent);
  color: white;
}

.tool-panel,
.editor,
.pricing {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.tool-panel {
  padding: 10px;
  align-self: start;
}

.tool {
  width: 100%;
  display: block;
  padding: 14px;
  margin-bottom: 8px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
}

.tool:hover,
.tool.active {
  background: var(--soft);
  border-color: #b8d9c4;
}

.tool span,
.tool small {
  display: block;
}

.tool span {
  font-weight: 800;
}

.tool small {
  color: var(--muted);
  margin-top: 4px;
}

.editor {
  padding: 18px;
}

.controls {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

label,
.input-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 210px;
  padding: 14px;
  resize: vertical;
  line-height: 1.5;
}

.actions {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}

.actions button {
  padding: 12px 16px;
}

.secondary {
  background: #edf0ec;
  color: var(--ink);
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.status {
  min-height: 22px;
  color: var(--warning);
  font-size: 14px;
  margin-bottom: 8px;
}

.output {
  min-height: 260px;
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.55;
  background: #101815;
  color: #e8f5ec;
}

.pricing {
  margin-top: 18px;
  padding: 22px;
}

.admin-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.stats-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stats-grid span,
.stats-grid strong {
  display: block;
}

.stats-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stats-grid strong {
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.15;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: end;
  margin-bottom: 12px;
}

.admin-toolbar h2 {
  margin: 0;
  letter-spacing: 0;
}

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

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

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

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

td {
  font-size: 14px;
}

.plan-select {
  min-width: 130px;
  margin-top: 0;
}

.small-button {
  min-height: 34px;
  margin: 2px;
  padding: 0 10px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.legal-page {
  max-width: 840px;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.legal-page h2 {
  margin: 0 0 16px;
  font-size: clamp(30px, 5vw, 52px);
  letter-spacing: 0;
}

.legal-page h3 {
  margin: 26px 0 8px;
}

.legal-page p {
  color: var(--muted);
  line-height: 1.65;
}

.plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.plans article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.plans h3,
.plans p {
  margin: 0;
}

.plans strong {
  display: block;
  margin: 10px 0;
  font-size: 24px;
}

.plans p,
footer {
  color: var(--muted);
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 30px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
}

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

.site-footer a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

@media (max-width: 850px) {
  .hero,
  .workspace,
  .controls,
  .plans,
  .auth-panel,
  #auth-form,
  .admin-toolbar,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-copy h2 {
    font-size: 34px;
  }

  .topbar,
  .account-strip,
  .auth-actions,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
