/* ===== PORTAL TOKENS (LSM brand) ===== */
:root {
  --bg: #FAF8F5;
  --bg-alt: #F2EEE8;
  --fg: #1A2744;
  --fg-muted: #5A6B8A;
  --accent: #C9A84C;
  --accent-dark: #A8893A;
  --border: #E2DDD6;
  --white: #FFFFFF;
  --danger: #C0392B;
  --danger-bg: #FDF2F2;
  --success: #27AE60;
  --success-bg: #F2FBF6;
  --warning: #E67E22;
  --warning-bg: #FEF9F0;
}

/* ===== BASE RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ===== PORTAL LAYOUT ===== */
.portal-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.portal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,248,245,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
}
.portal-header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.portal-wordmark {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
}
.portal-wordmark span {
  color: var(--accent);
}
.portal-nav { display: flex; gap: 1.5rem; align-items: center; }
.portal-nav a {
  font-size: 0.875rem;
  color: var(--fg-muted);
  transition: color 0.15s;
}
.portal-nav a:hover { color: var(--fg); }
.portal-main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem;
}

/* ===== STATUS BADGE ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-received { background: var(--bg-alt); color: var(--fg-muted); }
.badge-review { background: #EEF3FF; color: #3B5BDB; }
.badge-awaiting { background: var(--warning-bg); color: var(--warning); }
.badge-filed { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--bg-alt); color: var(--fg-muted); }
.badge-received-item { background: var(--danger-bg); color: var(--danger); }
.badge-received-item.ok { background: var(--success-bg); color: var(--success); }

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.25rem;
}
.card-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.card-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 0.5rem;
}
.card-subtitle {
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* ===== CONSEQUENCE ALERT ===== */
.consequence-alert {
  background: #FFF8E6;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}
.consequence-alert strong {
  color: var(--accent-dark);
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
}
.consequence-alert p { color: var(--fg-muted); font-size: 0.875rem; }

/* ===== DOC LIST ===== */
.doc-list { list-style: none; }
.doc-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.doc-item:last-child { border-bottom: none; }
.doc-status-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.doc-status-icon.pending { background: var(--danger-bg); color: var(--danger); }
.doc-status-icon.received { background: var(--success-bg); color: var(--success); }
.doc-body { flex: 1; }
.doc-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.2rem; }
.doc-desc { color: var(--fg-muted); font-size: 0.85rem; margin-bottom: 0.3rem; }
.doc-due { font-size: 0.8rem; color: var(--fg-muted); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 0.4rem;
}
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--white);
  color: var(--fg);
  transition: border-color 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
}
.form-hint { font-size: 0.8rem; color: var(--fg-muted); margin-top: 0.35rem; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--fg); color: var(--fg); }
.btn-block { width: 100%; }

/* ===== OTP INPUT ===== */
.otp-inputs {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin: 1.5rem 0;
}
.otp-input {
  width: 56px;
  height: 64px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--fg);
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.15s;
}
.otp-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== GRID ===== */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.status-step {
  background: var(--bg-alt);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.status-step.active {
  background: #EEF3FF;
  border: 2px solid #3B5BDB;
}
.status-step.done {
  background: var(--success-bg);
  border: 2px solid var(--success);
}
.status-step-label {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}
.status-step-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 600;
}

/* ===== FLASH MESSAGES ===== */
.flash {
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.flash-error { background: var(--danger-bg); color: var(--danger); }
.flash-success { background: var(--success-bg); color: var(--success); }

/* ===== AUTH PAGE ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg);
}
.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}
.auth-logo {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--fg);
  text-align: center;
  margin-bottom: 0.35rem;
}
.auth-logo span { color: var(--accent); }
.auth-subtitle {
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

/* ===== DIVIDER ===== */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--fg-muted);
  font-size: 0.8rem;
  margin: 1.5rem 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== LOADING ===== */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn-primary.loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MOBILE ===== */
@media (max-width: 640px) {
  .portal-main { padding: 1.25rem 1rem; }
  .otp-inputs { gap: 0.5rem; }
  .otp-input { width: 48px; height: 56px; font-size: 1.25rem; }
  .status-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== TIMELINE ===== */
.return-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 2rem 0;
}
.tl-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}
.tl-step::before {
  content: '';
  position: absolute;
  top: 14px;
  left: calc(-50% + 14px);
  right: calc(50% + 14px);
  height: 2px;
  background: var(--border);
}
.tl-step:first-child::before { display: none; }
.tl-step.done::before { background: var(--success); }
.tl-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 1;
  background: var(--bg-alt);
  color: var(--fg-muted);
  border: 2px solid var(--border);
}
.tl-step.active .tl-dot { background: #EEF3FF; border-color: #3B5BDB; color: #3B5BDB; }
.tl-step.done .tl-dot { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.tl-label { font-size: 0.75rem; color: var(--fg-muted); text-align: center; }
.tl-step.active .tl-label { color: var(--fg); font-weight: 600; }