/* ============================================================
   Rise Local — Client Portal v2
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

:root {
  --bg: #f4f1e8;
  --bg-soft: #e2dcc6;
  --bg-card: #ffffff;
  --ink: #1c2e1f;
  --ink-soft: #3a4d3d;
  --muted: #6a7a6c;
  --accent: #6b8e23;
  --accent-dark: #4a6618;
  --accent-soft: rgba(107, 142, 35, 0.12);
  --line: #d4ceb8;
  --line-soft: #ddd6c0;
  --shadow-sm: 0 1px 2px rgba(28, 46, 31, 0.05), 0 2px 6px rgba(28, 46, 31, 0.05);
  --shadow-md: 0 4px 12px rgba(28, 46, 31, 0.07), 0 12px 32px rgba(28, 46, 31, 0.07);
  --radius: 14px;
  --radius-sm: 10px;
  --max: 860px;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.portal-header {
  position: sticky;
  top: 0;
  background: rgba(244, 241, 232, 0.9);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.logo-mark {
  color: var(--accent);
  width: 24px;
  height: 24px;
}
.header-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  border: 0;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--ink); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-pay {
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}
.btn-pay:hover { background: var(--accent-dark); transform: translateY(-1px); }

/* ---------- Access gate ---------- */
.gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.gate.hidden {
  display: none;
}
.gate-card {
  text-align: center;
  max-width: 380px;
  width: 100%;
}
.gate-logo {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  color: var(--accent);
  margin: 0 auto 24px;
}
.gate-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--ink);
}
.gate-sub {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 32px;
}
.code-input-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}
.code-digit {
  width: 56px;
  height: 64px;
  text-align: center;
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--ink);
  caret-color: var(--accent);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.code-digit:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.code-digit.error {
  border-color: #c0392b;
  animation: shake 0.4s ease;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.gate-error {
  font-size: 14px;
  color: #c0392b;
  min-height: 20px;
  margin: 0 0 16px;
}
.gate-help {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.gate-help a {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------- Loading ---------- */
.loading {
  text-align: center;
  padding: 120px 0;
  color: var(--muted);
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Landing ---------- */
.landing-state {
  text-align: center;
  padding: 100px 0;
}
.landing-state h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 12px;
}
.landing-state p {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0 0 8px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.landing-state .landing-contact {
  font-size: 14px;
  color: var(--muted);
  margin-top: 24px;
}
.landing-state a { color: var(--accent); text-decoration: underline; }
.landing-admin {
  display: inline-block;
  margin-top: 32px;
  font-size: 13px;
  color: var(--muted) !important;
  text-decoration: none !important;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.landing-admin:hover { opacity: 1; }

/* ---------- Error ---------- */
.error-state {
  text-align: center;
  padding: 120px 0;
}
.error-state h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px;
  margin: 0 0 12px;
}
.error-state p {
  color: var(--ink-soft);
  font-size: 16px;
}
.error-state a { color: var(--accent); text-decoration: underline; }

/* ---------- Main ---------- */
.portal-main {
  padding: 48px 0 64px;
  min-height: 60vh;
}

/* ---------- Welcome ---------- */
.welcome {
  margin-bottom: 40px;
}
.welcome-eyebrow {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 8px;
}
.welcome-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(28px, 5vw, 38px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.welcome-note {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0;
  padding: 12px 16px;
  background: #fef9e7;
  border-left: 3px solid #e8a308;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.welcome-note:empty { display: none; }

/* ---------- Status cards ---------- */
.status-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}
.status-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.status-card-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 6px;
}
.status-card-value {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

/* ---------- Sections ---------- */
.portal-section {
  margin-bottom: 40px;
}
.portal-section h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--ink);
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 32px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--line);
}
.timeline-step {
  position: relative;
  padding: 0 0 28px;
}
.timeline-step:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -32px;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.timeline-step.done .timeline-dot {
  background: var(--accent);
  border-color: var(--accent);
}
.timeline-step.done .timeline-dot::after {
  content: '';
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
  margin-top: -1px;
}
.timeline-step.active .timeline-dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.timeline-step.active .timeline-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 2px;
}
.timeline-step.future .timeline-name { color: var(--muted); }
.timeline-date {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

/* ---------- Payments ---------- */
.payment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.payment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  gap: 16px;
}
.payment-info {
  display: flex;
  flex-direction: column;
}
.payment-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.payment-meta {
  font-size: 13px;
  color: var(--muted);
}
.payment-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.payment-amount {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}
.payment-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.payment-badge.paid { background: #d4edda; color: #155724; }
.payment-badge.due { background: #fef3cd; color: #856404; }
.payment-badge.pending { background: var(--bg-soft); color: var(--muted); }

/* ---------- Scope ---------- */
.scope-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.scope-text {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0 0 16px;
  line-height: 1.6;
}
.scope-meta {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: var(--ink-soft);
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- Retainer ---------- */
.retainer-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.retainer-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
  color: var(--ink-soft);
}
.retainer-row:last-child { border-bottom: none; }

/* ---------- Files ---------- */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.file-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.file-download {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.file-download:hover { text-decoration: underline; }

/* ---------- Contact ---------- */
.contact-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.contact-person {
  display: flex;
  flex-direction: column;
}
.contact-person strong {
  font-size: 16px;
  color: var(--ink);
}
.contact-person span {
  font-size: 13px;
  color: var(--muted);
}
.contact-links {
  display: flex;
  gap: 8px;
}

/* ---------- Footer ---------- */
.portal-footer {
  padding: 24px 0;
  border-top: 1px solid var(--line);
  text-align: center;
}
.portal-footer p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.portal-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .status-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .payment-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .payment-right {
    width: 100%;
    justify-content: space-between;
  }
  .contact-card {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  .contact-links {
    flex-direction: column;
    width: 100%;
  }
}
