:root {
  --portal-bg: #f6efe7;
  --portal-bg-soft: #f3e8dc;
  --portal-card: #ffffff;
  --portal-border: rgba(113, 86, 60, 0.18);
  --portal-text: #3e2f22;
  --portal-muted: #7a6551;
  --portal-accent: #8b5d3b;
  --portal-accent-dark: #6f472d;
  --portal-shadow: 0 18px 50px rgba(70, 44, 24, 0.18);
  --portal-radius: 22px;
  --portal-font-title: "Cormorant Garamond", serif;
  --portal-font-body: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

body.portal-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--portal-font-body);
  color: var(--portal-text);
  background: var(--portal-bg);
}

.portal-backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60% 40% at 20% 10%, rgba(235, 218, 202, 0.9), transparent 60%),
    radial-gradient(50% 30% at 90% 20%, rgba(210, 185, 163, 0.4), transparent 70%),
    linear-gradient(180deg, #f8f3ee 0%, #efe2d4 100%);
  z-index: -1;
}

.portal-header,
.portal-auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
  position: sticky;
  top: 0;
  background: rgba(246, 239, 231, 0.86);
  backdrop-filter: blur(10px);
  z-index: 5;
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.portal-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 8px 20px rgba(60, 40, 24, 0.2);
}

.portal-brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--portal-accent);
  color: #fff;
  font-weight: 700;
}

.portal-brand-name {
  font-family: var(--portal-font-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.portal-unit-pill {
  margin-left: 8px;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid var(--portal-border);
  color: var(--portal-muted);
  background: rgba(255, 255, 255, 0.7);
}

.portal-header-actions {
  display: flex;
  gap: 8px;
}

.portal-logout-link {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--portal-border);
  background: #fff;
  color: var(--portal-text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(60, 40, 24, 0.12);
}

.portal-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--portal-border);
  background: #fff;
  color: var(--portal-text);
  display: grid;
  place-items: center;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(60, 40, 24, 0.15);
}

.portal-icon-btn--menu {
  position: relative;
}

.portal-icon-bars {
  width: 16px;
  height: 12px;
  display: inline-block;
  position: relative;
}

.portal-icon-bars::before,
.portal-icon-bars::after,
.portal-icon-bars {
  background: var(--portal-text);
}

.portal-icon-bars::before,
.portal-icon-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
}

.portal-icon-bars::before {
  top: 0;
}

.portal-icon-bars::after {
  bottom: 0;
}

.portal-icon-bars {
  height: 2px;
  top: 5px;
  border-radius: 2px;
}

.portal-main {
  padding: 16px 18px 96px;
}

.portal-main--full {
  padding-bottom: 32px;
}

.portal-screen {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.portal-page-header h1 {
  font-family: var(--portal-font-title);
  font-size: 26px;
  margin: 0 0 4px;
}

.portal-page-header p {
  margin: 0;
  color: var(--portal-muted);
}

.portal-page-header--compact h1 {
  font-size: 24px;
}

.portal-card {
  background: var(--portal-card);
  border-radius: var(--portal-radius);
  padding: 16px 18px;
  box-shadow: var(--portal-shadow);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.portal-card--points {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portal-card-kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--portal-muted);
}

.portal-card-sub {
  margin: 6px 0 0;
  color: var(--portal-muted);
  font-size: 14px;
}

.portal-card-note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--portal-muted);
}

.portal-progress {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: rgba(120, 72, 44, 0.12);
  overflow: hidden;
}

.portal-progress-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a46c3d 0%, #d8a66b 100%);
}

.portal-points-value {
  text-align: right;
}

.portal-points-value strong {
  font-size: 26px;
  display: block;
  color: var(--portal-accent);
}

.portal-btn {
  font-family: var(--portal-font-body);
  border: none;
  border-radius: 16px;
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.portal-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.portal-btn--primary {
  background: linear-gradient(135deg, var(--portal-accent) 0%, var(--portal-accent-dark) 100%);
  color: #fff;
  box-shadow: 0 12px 24px rgba(118, 76, 46, 0.35);
}

.portal-btn--ghost {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--portal-border);
  color: var(--portal-text);
}

.portal-btn--block {
  width: 100%;
}

.portal-section h2 {
  font-family: var(--portal-font-title);
  font-size: 20px;
  margin: 0 0 10px;
}

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

.portal-list-item {
  background: var(--portal-card);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 24px rgba(60, 40, 24, 0.12);
}

.portal-list-item span {
  display: block;
  color: var(--portal-muted);
  font-size: 13px;
  margin-top: 4px;
}

.portal-chevron {
  font-size: 22px;
  color: var(--portal-muted);
}

.portal-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 78%;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
}

.portal-carousel-card {
  scroll-snap-align: start;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 10px 26px rgba(70, 45, 24, 0.16);
}

.portal-carousel-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.portal-carousel-content {
  padding: 12px;
}

.portal-card--split {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.portal-reward-grid {
  display: grid;
  gap: 16px;
}

.portal-reward-card {
  border-radius: 20px;
  background: var(--portal-card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--portal-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.portal-reward-card.is-eligible {
  border-color: rgba(138, 92, 60, 0.4);
}

.portal-reward-media img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.portal-reward-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-reward-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.portal-reward-header span {
  display: block;
  color: var(--portal-muted);
  font-size: 13px;
  margin-top: 4px;
}

.portal-reward-points {
  text-align: right;
}

.portal-reward-points strong {
  font-size: 20px;
  color: var(--portal-accent);
  display: block;
}

.portal-reward-meta {
  font-size: 12px;
  color: var(--portal-muted);
}

.portal-reward-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-reward-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--portal-muted);
}

.portal-voucher-card h2 {
  margin: 8px 0 6px;
  font-size: 22px;
  font-family: var(--portal-font-title);
}

.portal-voucher-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.portal-voucher-code {
  text-align: right;
  background: rgba(120, 72, 44, 0.08);
  padding: 10px 14px;
  border-radius: 12px;
}

.portal-voucher-code span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--portal-muted);
  letter-spacing: 1px;
}

.portal-voucher-code strong {
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--portal-accent);
}

.portal-voucher-meta {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--portal-muted);
}

.portal-voucher-meta strong {
  color: var(--portal-text);
}

.portal-voucher-note {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(120, 72, 44, 0.2);
  font-size: 13px;
  color: var(--portal-muted);
}

.portal-points-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(65, 102, 87, 0.12);
  color: #2f5a47;
}

.portal-points-pill.is-negative {
  background: rgba(180, 72, 54, 0.12);
  color: #7d2c22;
}

.portal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed var(--portal-border);
  color: var(--portal-muted);
  background: rgba(255, 255, 255, 0.6);
}

.portal-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px calc(env(safe-area-inset-bottom) + 8px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  background: rgba(252, 248, 244, 0.92);
  border-top: 1px solid var(--portal-border);
  backdrop-filter: blur(12px);
}

.portal-nav-item {
  text-decoration: none;
  color: var(--portal-muted);
  font-size: 11px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 8px 6px;
  border-radius: 16px;
}

.portal-nav-item.is-active {
  color: var(--portal-accent);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(70, 45, 24, 0.12);
}

.portal-nav-icon svg {
  width: 20px;
  height: 20px;
}

.portal-auth-body {
  display: flex;
  flex-direction: column;
}

.portal-auth-main {
  padding: 20px 18px 60px;
}

.portal-auth-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  padding: 22px;
  box-shadow: var(--portal-shadow);
}

.portal-auth-card--narrow {
  max-width: 520px;
  margin: 0 auto;
}

.portal-auth-hero h1 {
  font-family: var(--portal-font-title);
  font-size: 28px;
  margin: 6px 0;
}

.portal-auth-hero p {
  color: var(--portal-muted);
  margin: 0 0 14px;
}

.portal-auth-kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--portal-muted);
}

.portal-login-options {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.portal-login-option {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--portal-border);
  text-decoration: none;
  color: inherit;
  background: rgba(255, 255, 255, 0.75);
}

.portal-login-option.is-primary {
  background: rgba(139, 93, 59, 0.1);
  border-color: rgba(139, 93, 59, 0.4);
}

.portal-login-title {
  font-weight: 700;
  font-size: 16px;
}

.portal-login-subtitle {
  color: var(--portal-muted);
  font-size: 13px;
}

.portal-form {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.portal-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--portal-muted);
}

.portal-field input,
.portal-field textarea,
.portal-field select {
  border-radius: 14px;
  border: 1px solid var(--portal-border);
  padding: 12px 14px;
  font-family: var(--portal-font-body);
  font-size: 14px;
}

.portal-auth-footnote {
  margin-top: 16px;
  font-size: 13px;
  color: var(--portal-muted);
}

.portal-back-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--portal-muted);
  text-decoration: none;
}

.portal-alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  border: 1px solid rgba(180, 72, 54, 0.3);
  background: rgba(180, 72, 54, 0.08);
  color: #7d2c22;
}

.portal-unit-list {
  display: grid;
  gap: 12px;
}

.portal-unit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--portal-border);
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.portal-unit-card input {
  accent-color: var(--portal-accent);
}

.portal-unit-info {
  display: grid;
  gap: 4px;
}

.portal-unit-name {
  font-weight: 700;
}

.portal-unit-distance {
  font-size: 12px;
  color: var(--portal-muted);
}

.portal-unit-check {
  margin-left: auto;
  width: 16px;
  height: 16px;
  border-radius: 6px;
  border: 1px solid var(--portal-border);
  background: #fff;
}

.portal-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.portal-tab {
  text-align: center;
  font-size: 12px;
  padding: 8px 6px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid var(--portal-border);
  color: var(--portal-muted);
  background: rgba(255, 255, 255, 0.6);
}

.portal-tab.is-active {
  color: var(--portal-accent);
  border-color: rgba(139, 93, 59, 0.5);
  background: #fff;
}

.portal-timeline {
  display: grid;
  gap: 14px;
}

.portal-timeline-date {
  font-size: 13px;
  color: var(--portal-muted);
  margin-top: 6px;
}

.portal-timeline-card {
  background: #fff;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 10px 22px rgba(65, 40, 20, 0.12);
}

.portal-timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.portal-timeline-header span {
  display: block;
  color: var(--portal-muted);
  font-size: 12px;
  margin-top: 4px;
}

.portal-timeline-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--portal-muted);
}

.portal-badge {
  background: rgba(139, 93, 59, 0.12);
  color: var(--portal-accent);
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.portal-timeline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.portal-contact-card {
  background: #fff;
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 10px 22px rgba(60, 40, 24, 0.12);
  text-decoration: none;
  color: inherit;
}

.portal-contact-card span {
  display: block;
  color: var(--portal-muted);
  font-size: 12px;
  margin-top: 4px;
}

.portal-list--cards {
  display: grid;
  gap: 12px;
}

.portal-faq {
  display: grid;
  gap: 10px;
}

.portal-faq-item {
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid var(--portal-border);
}

.portal-faq-item summary {
  cursor: pointer;
  font-weight: 600;
}

.portal-profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  padding: 16px;
  border-radius: 20px;
  box-shadow: var(--portal-shadow);
}

.portal-profile-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.portal-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d6b79a 0%, #b28a64 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
}

.portal-profile-avatar.has-photo {
  background: #e5e7eb;
}

.portal-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portal-avatar-edit-btn {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--portal-primary, #b28a64);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: transform 0.15s ease, background 0.15s ease;
  padding: 0;
}

.portal-avatar-edit-btn:hover {
  transform: scale(1.1);
  background: #9a7556;
}

.portal-avatar-edit-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.portal-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.portal-photo-actions {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  margin-top: 12px;
  box-shadow: var(--portal-shadow);
  text-align: center;
}

.portal-photo-preview {
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
  border-radius: 50%;
  overflow: hidden;
  background: #f5f5f5;
}

.portal-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portal-photo-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.portal-photo-remove-wrap {
  text-align: center;
  margin-top: 12px;
}

.portal-btn--sm {
  font-size: 13px;
  padding: 6px 12px;
}

.portal-btn--danger {
  color: #c53030;
}

.portal-btn--danger:hover {
  background: #fff5f5;
}

.portal-profile-card > div:last-child {
  min-width: 0;
  flex: 1;
}

.portal-profile-card span {
  display: block;
  color: var(--portal-muted);
  font-size: 13px;
  margin-top: 4px;
  word-break: break-word;
}

@media (min-width: 768px) {
  .portal-main {
    max-width: 520px;
    margin: 0 auto;
  }
  .portal-carousel {
    grid-auto-columns: 60%;
  }
  .portal-reward-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .portal-voucher-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .portal-main {
    max-width: 960px;
    padding: 24px 24px 80px;
  }

  .portal-header {
    padding: 18px 32px 12px;
  }

  .portal-home {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
  }

  .portal-home .portal-page-header,
  .portal-home .portal-home-points,
  .portal-home .portal-home-cta {
    grid-column: 1 / -1;
  }

  .portal-home-next {
    grid-column: 1 / 2;
  }

  .portal-home-news {
    grid-column: 2 / 3;
  }

  .portal-home-directions {
    grid-column: 2 / 3;
    align-self: start;
  }

  .portal-history .portal-timeline,
  .portal-profile .portal-section {
    max-width: 720px;
  }

  .portal-nav {
    max-width: 960px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
  }
}

.portal-list-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.portal-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
  z-index: 300;
}

.portal-modal[aria-hidden="false"] {
  display: flex;
}

.portal-modal-card {
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  width: min(420px, 100%);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.portal-modal-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.portal-modal-card p {
  margin: 0 0 16px;
  color: #475569;
  line-height: 1.4;
}

.portal-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.portal-modal-backdrop {
  position: absolute;
  inset: 0;
}

.portal-body.portal-modal-open {
  overflow: hidden;
}
