:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #14213d;
  --muted: #667085;
  --line: #e5eaf1;
  --primary: #1d4ed8;
  --primary-2: #2563eb;
  --soft: #eef4ff;
  --success: #157347;
  --warning: #9a6700;
  --radius: 22px;
  --shadow: 0 18px 50px rgba(32, 52, 89, .08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

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

button { cursor: pointer; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px max(18px, calc((100vw - 1320px) / 2));
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(229,234,241,.9);
}

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

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--primary), #0f3caa);
  color: white;
  font-weight: 900;
  letter-spacing: -.03em;
}

.brand h1 { margin: 0; font-size: 1.05rem; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }

.header-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

.badge, .usage-pill {
  border-radius: 999px;
  padding: 7px 10px;
  font-size: .75rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge { background: #fff4cc; color: #7a5700; }
.usage-pill { background: var(--soft); color: var(--primary); }

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

.view { display: none; }
.view.active { display: block; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: clamp(24px, 5vw, 54px);
  margin-bottom: 28px;
  background:
    radial-gradient(circle at top right, rgba(37,99,235,.13), transparent 34%),
    white;
}

.hero h2 {
  max-width: 850px;
  margin: 7px 0 10px;
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -.045em;
}

.hero p { max-width: 720px; margin: 0; color: var(--muted); font-size: 1.02rem; line-height: 1.7; }

.eyebrow {
  display: inline-block;
  color: var(--primary);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .09em;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 0 4px 14px;
}

.section-heading h3 { margin: 0; font-size: 1.2rem; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }

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

.tool-card {
  position: relative;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  padding: 20px;
  min-height: 180px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.tool-card:not(.disabled):hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: #c7d7ff;
}

.tool-card.disabled { cursor: default; opacity: .68; }

.tool-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: var(--soft);
  font-size: 1.5rem;
  margin-bottom: 18px;
}

.tool-card h4 { margin: 0 0 8px; font-size: 1rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }

.tool-state {
  position: absolute;
  top: 16px;
  right: 16px;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: .66rem;
  font-weight: 900;
  background: #edf7ef;
  color: var(--success);
}

.tool-state.soon { background: #f2f4f7; color: #667085; }

.ghost-btn, .secondary-btn, .action-row button {
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  border-radius: 12px;
  font-weight: 800;
}

.ghost-btn { padding: 10px 14px; margin-bottom: 14px; }
.secondary-btn { padding: 9px 14px; }

.generator-layout {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 18px;
  align-items: start;
}

.form-card, .result-card { padding: 24px; }

.module-heading { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.module-icon {
  width: 58px; height: 58px; flex: 0 0 58px;
  display: grid; place-items: center;
  background: var(--soft);
  border-radius: 18px;
  font-size: 1.7rem;
}
.module-heading h2 { margin: 3px 0 4px; font-size: 1.45rem; }
.module-heading p { margin: 0; color: var(--muted); font-size: .9rem; }

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

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #344054;
  font-size: .82rem;
  font-weight: 800;
}

.span-2 { grid-column: span 2; }

input, select, textarea {
  width: 100%;
  border: 1px solid #d9e0ea;
  border-radius: 13px;
  background: #fbfcfe;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea { resize: vertical; min-height: 84px; }

input:focus, select:focus, textarea:focus {
  border-color: #8eb0ff;
  box-shadow: 0 0 0 4px rgba(37,99,235,.09);
  background: white;
}

.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.primary-btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  background: linear-gradient(145deg, var(--primary-2), var(--primary));
  color: white;
  font-weight: 900;
  box-shadow: 0 9px 24px rgba(37,99,235,.22);
}

.primary-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.status-text { color: var(--muted); font-size: .82rem; }

.result-card { min-height: 650px; position: sticky; top: 100px; }

.result-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.result-header h3 { margin: 2px 0 0; }

.empty-state {
  min-height: 510px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  padding: 30px;
  border: 1.5px dashed #d8e0ee;
  border-radius: 18px;
  background: #fbfcfe;
}
.empty-state h4 { margin: 12px 0 6px; }
.empty-state p { max-width: 440px; color: var(--muted); line-height: 1.6; margin: 0; }
.empty-icon { font-size: 2rem; }

.result-editor {
  width: 100%;
  min-height: 510px;
  border-radius: 18px;
  background: #fbfcfe;
  line-height: 1.65;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9rem;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.action-row button { padding: 9px 11px; font-size: .78rem; }

.hidden { display: none !important; }

.toast {
  position: fixed;
  z-index: 99;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: #101828;
  color: white;
  padding: 11px 16px;
  border-radius: 999px;
  font-size: .82rem;
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1050px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
  .generator-layout { grid-template-columns: 1fr; }
  .result-card { position: static; }
}

@media (max-width: 700px) {
  .topbar { align-items: flex-start; padding: 13px 14px; }
  .brand p { display: none; }
  .brand-mark { width: 40px; height: 40px; flex-basis: 40px; border-radius: 12px; }
  .header-actions { gap: 5px; }
  .usage-pill { font-size: .67rem; }
  .app-shell { width: min(100% - 20px, 1320px); margin-top: 14px; }
  .hero { border-radius: 18px; }
  .hero h2 { font-size: 2rem; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tool-card { min-height: 164px; padding: 16px; border-radius: 17px; }
  .form-card, .result-card { padding: 17px; border-radius: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .result-card { min-height: auto; }
  .empty-state, .result-editor { min-height: 420px; }
}

@media (max-width: 420px) {
  .tool-grid { grid-template-columns: 1fr; }
  .badge { display: none; }
}
