:root {
  --bg: #fff9ef;
  --panel: #fffcf7;
  --ink: #222222;
  --ink-soft: #5b574f;
  --accent: #d14d2a;
  --accent-2: #0a7a7a;
  --line: #e8dccd;
  --ok: #1c8f4e;
  --warn: #b56a00;
  --err: #b43232;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at top right, #ffe2ce 0%, var(--bg) 45%),
    linear-gradient(140deg, #fff9ef 0%, #f7f1e8 100%);
  color: var(--ink);
  min-height: 100vh;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(80px);
  opacity: 0.32;
  z-index: -1;
}

.bg-shape-a {
  width: 320px;
  height: 320px;
  background: #ff8f66;
  top: -120px;
  left: -80px;
}

.bg-shape-b {
  width: 300px;
  height: 300px;
  background: #82d8d8;
  right: -100px;
  bottom: -80px;
}

.hero {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 0 16px;
  animation: fade-up 0.45s ease-out;
}

.hero h1 {
  margin: 0;
  font-size: 2rem;
}

.hero p {
  margin: 8px 0 0;
  color: var(--ink-soft);
}

.user-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff8ef;
}

.user-strip-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.secondary-btn {
  width: auto;
  margin: 0;
  padding: 8px 14px;
  background: #e7dfd2;
  color: #3b342b;
  border: 1px solid #d4c8b4;
}

.secondary-btn:hover {
  filter: brightness(0.98);
}

.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.layout {
  max-width: 1100px;
  margin: 14px auto 24px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.single-column {
  grid-template-columns: 1fr;
  max-width: 560px;
  margin-top: 48px;
}

.login-panel {
  animation: fade-up 0.4s ease-out;
}

.login-panel h1 {
  margin: 0;
}

.login-actions {
  margin-top: 8px;
}

.login-quick-links {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.login-quick-links a {
  color: var(--accent-2);
  text-decoration: underline;
}

.login-quick-links a:hover {
  color: #066d6d;
}

.auth-extra-panel {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.auth-panel-actions {
  margin-top: 6px;
}

.auth-back-link {
  color: var(--accent-2);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  text-decoration: underline;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 24px rgba(52, 42, 25, 0.07);
}

h2 {
  margin-top: 0;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0 0 12px;
  padding: 10px;
}

legend {
  color: var(--accent-2);
  font-weight: 700;
}

h3 {
  margin: 10px 0 8px;
  font-size: 1rem;
  color: #6f4f2b;
}

label {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 8px;
}

input,
select,
textarea,
button {
  width: 100%;
  margin-top: 4px;
  border: 1px solid #d8cfbf;
  border-radius: 8px;
  padding: 9px 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88rem;
  background: #fffdfa;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #7ccfcf;
  border-color: #7ccfcf;
}

.grid {
  display: grid;
  gap: 8px;
}

.grid.two {
  grid-template-columns: 1fr 1fr;
}

.checks {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checks label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
}

.checks input {
  width: auto;
  margin: 0;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

button {
  cursor: pointer;
  background: linear-gradient(90deg, var(--accent) 0%, #de774f 100%);
  color: #fff;
  border: none;
  font-weight: 700;
  transition: transform 0.2s ease, filter 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

#formStatus {
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.muted {
  color: var(--ink-soft);
}

.result-card {
  animation: fade-up 0.4s ease-out;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}

.label {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.score {
  margin: 0;
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 700;
}

.agent-response {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: #fff8ef;
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.hidden {
  display: none;
}

.status-success {
  color: var(--ok);
  font-weight: 700;
}

.status-warning {
  color: var(--warn);
  font-weight: 700;
}

.status-error,
.status-erro {
  color: var(--err);
  font-weight: 700;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mode Toggle */
.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.simple-header {
  margin-bottom: 12px;
}

.form-header h2 {
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.mode-toggle {
  display: flex;
  gap: 4px;
  background: #f0e8dd;
  padding: 4px;
  border-radius: 8px;
}

.toggle-btn {
  padding: 8px 12px;
  font-size: 0.85rem;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: auto;
  margin: 0;
}

.toggle-btn.active {
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-weight: 700;
}

/* Import Section */
.import-section {
  background: #faf6f0;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}

.import-intro {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff3e6;
  border: 1px solid #f0d5b4;
  color: #7a4e17;
  font-size: 0.88rem;
  line-height: 1.45;
}

.always-visible {
  display: block;
}

.import-section.hidden {
  display: none;
}

.import-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--line);
}

.import-tab {
  padding: 8px 12px;
  font-size: 0.85rem;
  background: transparent;
  color: var(--ink-soft);
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  width: auto;
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
}

.import-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.import-tab-content {
  display: none;
}

.import-tab-content.active {
  display: block;
  animation: fade-up 0.2s ease-out;
}

.import-tab-content > label {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.import-tab-content > textarea {
  font-size: 0.8rem;
  line-height: 1.4;
  background: #fffcf7;
  border: 1px solid var(--line);
}

.btn-import {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  background: linear-gradient(90deg, var(--accent-2) 0%, #0b8f8f 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.btn-import:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.import-status {
  margin-top: 10px;
  font-size: 0.85rem;
  padding: 8px;
  border-radius: 6px;
  display: none;
}

.import-status.active {
  display: block;
}

.import-status.success {
  background: #e8f5e9;
  color: var(--ok);
  border: 1px solid var(--ok);
}

.import-status.error {
  background: #ffebee;
  color: var(--err);
  border: 1px solid var(--err);
}

.progress-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff8ef;
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #efdfcb;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, #f2a65d 100%);
  transition: width 0.35s ease;
}

.progress-panel.is-success .progress-fill {
  background: linear-gradient(90deg, var(--ok) 0%, #4fc17b 100%);
}

.progress-panel.is-error .progress-fill {
  background: linear-gradient(90deg, var(--err) 0%, #d96a6a 100%);
}

.manual-form.hidden {
  display: none;
}

.full-width {
  grid-column: 1 / -1;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.hub-card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fffdfa;
  color: var(--ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hub-card h3 {
  margin-top: 0;
}

.hub-card span {
  display: inline-block;
  margin-top: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--accent-2);
}

.hub-card-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 18px rgba(52, 42, 25, 0.12);
}

.hub-card-disabled {
  opacity: 0.78;
}

.hub-footer-note {
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.profile-layout {
  grid-template-columns: 1fr 1fr;
}

.profile-summary {
  display: grid;
  gap: 12px;
}

.profile-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-data-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff8ef;
}

.profile-data-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.profile-side-stack {
  display: grid;
  gap: 16px;
}

.inline-status {
  margin-top: 8px;
  min-height: 20px;
  font-size: 0.86rem;
}

.back-link {
  color: var(--accent-2);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.86rem;
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .hub-grid {
    grid-template-columns: 1fr;
  }

  .profile-data-grid {
    grid-template-columns: 1fr;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .checks {
    grid-template-columns: 1fr;
  }

  .form-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .mode-toggle {
    width: 100%;
  }

  .toggle-btn {
    flex: 1;
  }

  .user-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-strip-actions {
    width: 100%;
  }

  .user-strip-actions .secondary-btn {
    flex: 1;
    width: 100%;
  }

  .progress-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .login-quick-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
