:root {
  --ink: #1b1f29;
  --muted: #6a7384;
  --paper: #f4f1ea;
  --card: #ffffff;
  --accent: #ff6b4a;
  --accent-2: #2a7f92;
  --accent-3: #f4b740;
  --border: #e6dfd3;
  --shadow: 0 25px 60px rgba(21, 26, 35, 0.16);
  --radius: 22px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 107, 74, 0.18), transparent 48%),
    radial-gradient(circle at 86% 12%, rgba(42, 127, 146, 0.22), transparent 42%),
    radial-gradient(circle at 50% 90%, rgba(244, 183, 64, 0.18), transparent 45%),
    linear-gradient(180deg, #fbf7f0 0%, #f2ede3 100%);
  min-height: 100vh;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 20px 70px;
}

.brand {
  font-family: "Fraunces", serif;
  letter-spacing: 0.3px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

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

.card-ui + .card-ui {
  margin-top: 24px;
}

.section-title {
  font-weight: 600;
  letter-spacing: -0.3px;
}

.text-muted-ui {
  color: var(--muted);
}

.btn-ui {
  border-radius: 999px;
  padding: 11px 20px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary-ui {
  background: linear-gradient(135deg, #ff6b4a 0%, #ff865e 55%, #ffb284 100%);
  color: #fff;
  box-shadow: 0 14px 26px rgba(255, 107, 74, 0.3);
}

.btn-primary-ui:hover {
  transform: translateY(-1px);
}

.btn-secondary-ui {
  background: #fff;
  border-color: var(--border);
  color: var(--ink);
}

.btn-ghost-ui {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f3f4f7;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--muted);
}

.table-ui {
  border-collapse: separate;
  border-spacing: 0 12px;
}

.table-ui thead th {
  color: var(--muted);
  font-weight: 600;
  border-bottom: none;
}

.table-ui tbody tr {
  background: #fff;
  box-shadow: 0 12px 26px rgba(21, 26, 35, 0.08);
  border-radius: 16px;
}

.table-ui tbody tr td {
  border-top: none;
  border-bottom: none;
  padding: 16px;
}

.table-ui tbody tr td:first-child {
  border-radius: 14px 0 0 14px;
}

.table-ui tbody tr td:last-child {
  border-radius: 0 14px 14px 0;
}

.message-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 8px;
}

.message-list.tall {
  max-height: 560px;
}

.message-list {
  scroll-behavior: smooth;
}

.message {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
}

.message.user {
  border-left: 4px solid var(--accent);
  background: #fff3ee;
}

.message.assistant {
  border-left: 4px solid var(--accent-2);
  background: #eef8fa;
}

.form-card {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px 36px;
}

.auth-card {
  width: min(1180px, 100%);
  padding: 0;
  overflow: hidden;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(380px, 0.9fr);
  min-height: 620px;
}

.auth-visual {
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.25), transparent 55%),
    linear-gradient(160deg, #ff6b4a 0%, #ff865e 45%, #f4b740 100%);
  color: #fff;
  padding: 54px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-visual .badge {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.auth-visual h2 {
  font-family: "Fraunces", serif;
  font-weight: 600;
}

.auth-visual p {
  opacity: 0.9;
}

.auth-kicker {
  color: rgba(255, 255, 255, 0.82);
}

.auth-highlight {
  margin: 28px 0 4px;
  padding: 18px 20px;
  border-radius: 20px;
  background: rgba(27, 31, 41, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.auth-highlight h5 {
  margin-bottom: 8px;
  font-size: 1.08rem;
}

.auth-highlight p:last-child {
  margin-bottom: 0;
}

.auth-proof {
  display: grid;
  gap: 14px;
  margin: 32px 0;
}

.auth-proof-card {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  padding: 16px 18px;
  backdrop-filter: blur(4px);
}

.auth-proof-card h6 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.auth-proof-card p:last-child {
  margin-bottom: 0;
}

.auth-visual .steps {
  display: grid;
  gap: 10px;
  font-size: 0.95rem;
}

.auth-panel {
  padding: 54px 48px;
  background: #fff;
}

.auth-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.auth-panel h3 {
  margin-bottom: 8px;
}

.auth-panel .helper {
  color: var(--muted);
  margin-bottom: 24px;
}

.auth-map {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-map-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #efe5d8;
  background: #fffcf8;
}

.auth-map-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6b4a 0%, #ff9d77 100%);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-form-card {
  padding: 24px;
  border-radius: 20px;
  background: linear-gradient(180deg, #fffdfa 0%, #fff8ef 100%);
  border: 1px solid #efe2d2;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.helper-tight {
  margin-bottom: 18px;
}

.auth-submit-copy {
  margin-top: 14px;
  margin-bottom: 0;
}

.auth-submit {
  padding-top: 13px;
  padding-bottom: 13px;
}

.auth-bottom {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #efe5d8;
}

.auth-links {
  line-height: 1.8;
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.field-link {
  color: var(--accent-2);
  font-size: 0.92rem;
  text-decoration: none;
}

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

.form-control {
  border-radius: 12px;
  border-color: #e3d9cc;
  padding: 12px 14px;
}

.form-control:focus {
  border-color: #ff6b4a;
  box-shadow: 0 0 0 0.2rem rgba(255, 107, 74, 0.18);
}

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

.summary-item {
  background: #fff7f2;
  border: 1px solid #f2dfd4;
  border-radius: 14px;
  padding: 14px 16px;
}

.summary-item h6 {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary-item p {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.insight-grid,
.comparison-grid,
.progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

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

.insight-panel,
.comparison-card,
.progress-card {
  background: #fffcf7;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  position: relative;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffefe7 0%, #fff7f1 100%);
  border: 1px solid #f2ddd1;
  color: #b45539;
  font-weight: 700;
  margin-bottom: 14px;
}

.topic-card,
.topic-row {
  background: #fff;
  border: 1px solid #efe5d8;
  border-radius: 16px;
  padding: 14px 16px;
}

.topic-card + .topic-card,
.topic-row + .topic-row {
  margin-top: 12px;
}

.topic-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.topic-state {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.state-weak {
  background: #ffe8e2;
  color: #b43b21;
}

.state-improved {
  background: #e8f5f1;
  color: #166653;
}

.state-passed {
  background: #e9f1ff;
  color: #28569e;
}

.state-unseen {
  background: #f0eee8;
  color: #6b675d;
}

.inline-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action-stack {
  display: grid;
  gap: 16px;
}

.action-block {
  border: 1px solid #efe5d8;
  border-radius: 16px;
  padding: 16px 18px;
  background: #fff;
}

.action-block-positive {
  background: linear-gradient(180deg, #ffffff 0%, #fbfffd 100%);
  border-color: #dcefe8;
}

.action-block-alert {
  background: linear-gradient(180deg, #ffffff 0%, #fffaf8 100%);
  border-color: #f3ddd3;
}

.action-block-neutral {
  background: linear-gradient(180deg, #ffffff 0%, #fbfeff 100%);
  border-color: #dbecef;
}

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

.reading-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fffdfa;
  border: 1px solid #efe5d8;
  border-radius: 18px;
  padding: 16px 18px;
}

.reading-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  flex: 0 0 32px;
  background: linear-gradient(135deg, #ff6b4a 0%, #ff9d77 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(255, 107, 74, 0.18);
}

.reading-step .mini-label {
  margin-bottom: 4px;
}

.soft-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: #f3efe6;
  color: var(--ink);
  font-size: 0.9rem;
}

.soft-tag-alert {
  background: #ffe8e2;
  color: #b43b21;
}

.soft-tag-neutral {
  background: #eef8fa;
  color: #1f5d6b;
}

.soft-tag-positive {
  background: #e8f5f1;
  color: #166653;
}

.topic-state-list {
  display: grid;
  gap: 12px;
}

.topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.progress-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 18px;
}

.progress-stack {
  display: grid;
  gap: 18px;
}

.first-run-hero {
  display: grid;
  gap: 22px;
  background:
    radial-gradient(circle at top left, rgba(255, 107, 74, 0.12), transparent 40%),
    linear-gradient(180deg, #fffdf9 0%, #fffbf5 100%);
}

.first-run-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.first-run-copy {
  max-width: 720px;
}

.first-run-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.first-run-pills {
  gap: 12px;
}

.first-run-map .reading-step {
  background: rgba(255, 255, 255, 0.86);
}

.first-run-benefits .summary-item {
  background: rgba(255, 255, 255, 0.9);
}

.progress-card-clean {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  background: #fffcf7;
}

.progress-card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.progress-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.progress-body {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 20px;
  align-items: start;
}

.progress-copy {
  display: grid;
  gap: 12px;
}

.progress-line {
  margin: 0;
}

.progress-actions {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.historical-grid {
  display: grid;
  gap: 12px;
}

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

.history-pill-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #efe5d8;
  border-radius: 16px;
  padding: 14px 16px;
  background: #fff;
}

.mini-label {
  margin-bottom: 8px;
  color: #7a6658;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #8a94a3;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.password-field {
  position: relative;
}

.password-toggle i {
  font-size: 1.15rem;
  line-height: 1;
}

.fade-in {
  animation: fadeIn 0.5s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .auth-shell {
    padding: 24px;
  }
  .form-card {
    grid-template-columns: 1fr;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .auth-grid {
    grid-template-columns: 1fr;
  }
  .auth-visual {
    min-height: 240px;
    padding: 40px 30px;
  }
  .auth-panel {
    padding: 34px 28px;
  }
  .auth-panel-head,
  .field-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
  .reading-map {
    grid-template-columns: 1fr;
  }
  .first-run-hero-head {
    flex-direction: column;
  }
  .first-run-actions {
    justify-content: flex-start;
  }
  .insight-grid,
  .comparison-grid,
  .progress-grid,
  .progress-metrics,
  .progress-body {
    grid-template-columns: 1fr;
  }
  .progress-card-head {
    flex-direction: column;
  }
  .history-pill-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .topic-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
