:root {
  --ink: #1d1b16;
  --muted: #6f675e;
  --accent: #f06449;
  --accent-dark: #c54a2b;
  --accent-alt: #1c7c7d;
  --panel: #fff7ed;
  --panel-edge: #efe1cf;
  --shadow: 0 24px 48px rgba(28, 24, 16, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 20%, rgba(240, 100, 73, 0.18), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(28, 124, 125, 0.18), transparent 35%),
    linear-gradient(135deg, #f8efe5 0%, #f2f6f1 55%, #fbf4ea 100%);
}

.ambient {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 30% 80%, rgba(0, 0, 0, 0.05), transparent 45%),
    radial-gradient(circle at 75% 60%, rgba(255, 255, 255, 0.55), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-alt));
  box-shadow: var(--shadow);
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.panel-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.panel-head p {
  margin: 0 0 18px;
  color: var(--muted);
}

.text-link {
  color: var(--accent-alt);
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.form-grid {
  display: grid;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.field input {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #d8c9b5;
  background: #fffdf9;
  font-size: 15px;
  color: var(--ink);
}

.field textarea {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #d8c9b5;
  background: #fffdf9;
  font-size: 15px;
  color: var(--ink);
  font-family: "Courier Prime", "Courier New", monospace;
  line-height: 1.5;
}

.field select {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #d8c9b5;
  background: #fffdf9;
  font-size: 15px;
  color: var(--ink);
}

.field input:focus {
  outline: 2px solid rgba(240, 100, 73, 0.35);
  border-color: var(--accent);
}

.field textarea:focus {
  outline: 2px solid rgba(240, 100, 73, 0.35);
  border-color: var(--accent);
}

.field.grow {
  flex: 1;
  min-width: 240px;
}

.field.narrow {
  width: 140px;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-row input {
  flex: 1;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 14px;
  border: 1px solid #e4d6c4;
  background: #fffaf2;
}

.toggle input {
  accent-color: var(--accent);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn.small {
  padding: 8px 12px;
  font-size: 12px;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 14px 24px rgba(240, 100, 73, 0.25);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(240, 100, 73, 0.3);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid #d8c9b5;
}

.btn.ghost.danger {
  border-color: #e1b2b2;
  color: #a54848;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

.loading {
  display: none;
  font-size: 13px;
  color: var(--accent-alt);
}

.loading.show {
  display: inline-flex;
}

.alert {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(240, 100, 73, 0.15);
  color: var(--accent-dark);
  font-size: 13px;
}

.meta {
  font-size: 13px;
  color: var(--muted);
}

.results-grid {
  display: grid;
  gap: 18px;
}

.result-card {
  background: #fffdf9;
  border: 1px solid #eadcc8;
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: 0 12px 24px rgba(20, 16, 12, 0.08);
}

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

.result-title {
  font-weight: 700;
  font-size: 16px;
}

.result-sub {
  font-size: 12px;
  color: var(--muted);
}

.result-text {
  margin: 14px 0 0;
  color: #3b352d;
  line-height: 1.5;
}

.nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.nav-row form {
  margin: 0;
}

.ai-output {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #d8c9b5;
  background: #fffdf9;
  font-family: "Courier Prime", "Courier New", monospace;
  line-height: 1.5;
  color: #3b352d;
  font-size: 22px;
  font-weight: 600;
}

.ai-summary {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid #d8c9b5;
  background: #fff7ec;
  line-height: 1.6;
  color: #3b352d;
  font-size: 16px;
}

.doc-editor {
  width: 100%;
  min-height: 180px;
  resize: vertical;
}

.corrections-list {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.correction-item {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #eadcc8;
  background: #fffdf9;
  display: grid;
  gap: 8px;
}

.correction-text {
  font-weight: 600;
  color: #3b352d;
}

.correction-meta {
  font-size: 12px;
  color: var(--muted);
}

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

.answer-editor {
  min-height: 240px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid #eadcc8;
  background: #fffdf9;
  line-height: 1.6;
  font-family: "Courier Prime", "Courier New", monospace;
}

.answer-editor:focus {
  outline: 2px solid rgba(240, 100, 73, 0.35);
  border-color: var(--accent);
}

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

.tag {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #eadcc8;
  background: #fff3e4;
  font-size: 12px;
  color: #5a5248;
}

mark {
  background: rgba(240, 100, 73, 0.25);
  padding: 0 2px;
  border-radius: 4px;
}

.doc-text {
  white-space: pre-wrap;
  background: #fffdf9;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #eadcc8;
  line-height: 1.6;
  font-family: "Courier Prime", "Courier New", monospace;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer {
    flex-direction: column;
  }

  .field.narrow {
    width: 100%;
  }
}
