*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-primary: #0f766e;
  --color-primary-hover: #0d5c56;
  --color-primary-light: #e6f7f6;
  --color-border: #e2e8f0;
  --color-success: #059669;
  --color-error: #dc2626;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.5;
}

/* Top banner */
.top-banner {
  background: linear-gradient(90deg, #1e40af 0%, #3b82f6 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.top-banner p {
  margin: 0;
}

.top-banner-link {
  color: white;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.2);
  transition: background 0.2s;
}

.top-banner-link:hover {
  background: rgba(255, 255, 255, 0.3);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 50%, #3b82f6 100%);
  margin: 0 -1.5rem;
  padding: 1.5rem 1.5rem 1.75rem;
  border-radius: 0 0 20px 20px;
  margin-bottom: 2rem;
  box-shadow: 0 4px 20px rgba(30, 64, 175, 0.25);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.header {
  position: relative;
}

.logo-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  letter-spacing: -0.03em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: white;
  width: 0%;
  transition: width 0.4s ease;
}

.step-indicator {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.9);
}

/* Wizard */
.wizard {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.wizard-inner {
  flex: 1;
  position: relative;
}

/* Steps */
.step {
  display: none;
  animation: fadeIn 0.35s ease;
}

.step.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step h2 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 1.5rem;
  line-height: 1.3;
}

.step .subtext {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
}

.step .subtext strong {
  color: var(--color-text);
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="number"] {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  margin-bottom: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input::placeholder {
  color: var(--color-text-muted);
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.demo-code {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(37, 99, 235, 0.08);
  border-radius: var(--radius-sm);
}

.resend-hint {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.btn-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  color: #2563eb;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: #1e3a8a;
}

/* Back button */
.btn-back {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 0.75rem 0;
  font-size: 0.875rem;
  font-family: inherit;
  background: none;
  color: var(--color-text-muted);
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-back:hover {
  color: #2563eb;
}

.btn-back.hidden {
  display: none;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.upload-zone p {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.uploaded-files {
  margin-bottom: 0.5rem;
}

.upload-status {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.uploaded-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.uploaded-file::before {
  content: '📄';
}

.uploaded-file .remove {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 1rem;
}

.uploaded-file .remove:hover {
  color: var(--color-error);
}

/* Success step */
.success-icon {
  width: 64px;
  height: 64px;
  font-size: 2rem;
  background: rgba(37, 99, 235, 0.12);
  color: var(--color-success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.step[data-step="7"] .subtext {
  margin-bottom: 0;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 1.5rem 1.5rem 2rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.site-footer p {
  margin: 0;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* Error state */
.error {
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: -1rem;
  margin-bottom: 1rem;
}

input.error {
  border-color: var(--color-error);
}

/* Finance Knowledge page */
.app--wide {
  max-width: 680px;
}

.header--simple {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  margin-bottom: 1.5rem;
  margin-left: 0;
  margin-right: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
}

.header--simple .logo-wrap {
  margin-bottom: 0;
  text-decoration: none;
  color: inherit;
}

.header--simple .logo-wrap:hover {
  opacity: 0.9;
}

.header--simple .logo-text {
  color: var(--color-text);
}

.header-nav .nav-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #2563eb;
  text-decoration: none;
}

.header-nav .nav-link:hover {
  text-decoration: underline;
}

.content-page {
  padding-bottom: 2rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.page-intro {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.article-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) {
  .article-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.article-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.article-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.article-card.is-open {
  border-color: #2563eb;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
}

.article-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 0;
  padding-bottom: 1.25rem;
}

.article-card.is-open .article-card-header {
  padding-bottom: 1rem;
}

.article-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.article-card-header h2 {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
  margin: 0;
}

.article-chevron {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.article-card.is-open .article-chevron {
  transform: rotate(180deg);
}

.article-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.article-card.is-open .article-card-body {
  max-height: 800px;
}

.article-card-body {
  padding: 0 1.25rem 1.25rem;
  padding-top: 0;
}

.article-card.is-open .article-card-body {
  padding: 1rem 1.25rem 1.5rem;
  border-top: 1px solid var(--color-border);
  margin-top: 0;
}

.article-card-body p {
  font-size: 0.9375rem;
  color: var(--color-text);
  line-height: 1.65;
  margin-bottom: 1rem;
}

.article-card-body p:last-child {
  margin-bottom: 0;
}

.article-card-body strong {
  color: var(--color-text);
}
