:root {
  --portal-navy: #0d2948;
  --portal-blue: #0e5d86;
  --portal-teal: #0a9f9a;
  --portal-ink: #14253a;
  --portal-muted: #66788a;
  --portal-line: #dce5ec;
  --portal-soft: #eef7f8;
  --portal-sand: #f5f1e8;
}

.portal-page {
  background: #f4f7f9;
  color: var(--portal-ink);
  min-height: 100vh;
}

.portal-header {
  align-items: center;
  background: linear-gradient(135deg, var(--portal-navy), #123c63);
  color: #fff;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 58px);
  position: sticky;
  top: 0;
  z-index: 30;
}

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

.portal-brand img {
  background: #fff;
  border-radius: 50%;
  height: 52px;
  object-fit: contain;
  padding: 5px;
  width: 52px;
}

.portal-brand strong,
.portal-brand span {
  display: block;
}

.portal-brand strong {
  font-size: 1.12rem;
  letter-spacing: .06em;
}

.portal-brand span {
  color: #c9dde9;
  font-size: .86rem;
  margin-top: 3px;
}

.portal-header-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.portal-header .btn-secondary {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .25);
  color: #fff;
}

.portal-cart-button {
  background: var(--portal-teal);
  color: #fff;
}

.portal-cart-count {
  align-items: center;
  background: #fff;
  border-radius: 999px;
  color: var(--portal-navy);
  display: inline-flex;
  font-size: .78rem;
  height: 22px;
  justify-content: center;
  margin-left: 8px;
  min-width: 22px;
  padding: 0 6px;
}

.portal-main {
  margin: 0 auto;
  max-width: 1440px;
  padding: 30px clamp(16px, 4vw, 54px) 70px;
}

.portal-hero {
  align-items: end;
  background: linear-gradient(120deg, #e9f7f6, #eef3f8 66%, #f8f2e6);
  border: 1px solid #d5e5e8;
  border-radius: 22px;
  display: flex;
  gap: 28px;
  justify-content: space-between;
  margin-bottom: 24px;
  overflow: hidden;
  padding: clamp(24px, 4vw, 44px);
}

.portal-eyebrow {
  color: var(--portal-teal);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .13em;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.portal-hero h1 {
  color: var(--portal-navy);
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1.04;
  margin: 0 0 12px;
  max-width: 720px;
}

.portal-hero p:last-child {
  color: var(--portal-muted);
  line-height: 1.55;
  margin: 0;
  max-width: 760px;
}

.portal-cutoff-card {
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(15, 74, 105, .12);
  border-radius: 16px;
  flex: 0 0 250px;
  padding: 18px;
}

.portal-cutoff-card span,
.portal-cutoff-card strong {
  display: block;
}

.portal-cutoff-card span {
  color: var(--portal-muted);
  font-size: .84rem;
}

.portal-cutoff-card strong {
  color: var(--portal-navy);
  font-size: 1.22rem;
  margin: 6px 0;
}

.portal-toolbar {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.portal-search {
  max-width: 520px;
  position: relative;
  width: 100%;
}

.portal-search input {
  background: #fff;
  border: 1px solid var(--portal-line);
  border-radius: 12px;
  font: inherit;
  min-height: 48px;
  padding: 12px 16px;
  width: 100%;
}

.portal-category-filters {
  display: flex;
  gap: 9px;
  margin-bottom: 22px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
}

.portal-category-filter {
  align-items: center;
  background: #fff;
  border: 1px solid var(--portal-line);
  border-radius: 999px;
  color: var(--portal-ink);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font: inherit;
  font-size: .9rem;
  font-weight: 750;
  gap: 8px;
  min-height: 42px;
  padding: 8px 13px 8px 16px;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.portal-category-filter strong {
  align-items: center;
  background: #eef3f6;
  border-radius: 999px;
  color: var(--portal-blue);
  display: inline-flex;
  font-size: .76rem;
  height: 24px;
  justify-content: center;
  min-width: 24px;
  padding: 0 7px;
}

.portal-category-filter:hover,
.portal-category-filter.active {
  background: var(--portal-navy);
  border-color: var(--portal-navy);
  color: #fff;
}

.portal-category-filter.active strong,
.portal-category-filter:hover strong {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

.portal-category-filter:focus-visible {
  outline: 3px solid rgba(10, 159, 154, .3);
  outline-offset: 2px;
}

.portal-catalog-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-product-card {
  background: #fff;
  border: 1px solid var(--portal-line);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(13, 41, 72, .06);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.portal-product-image {
  background: linear-gradient(145deg, #dbecef, #f6f2e9);
  height: 230px;
  object-fit: cover;
  width: 100%;
}

.portal-product-placeholder {
  align-items: center;
  display: flex;
  justify-content: center;
}

.portal-product-placeholder img {
  height: 98px;
  object-fit: contain;
  opacity: .86;
  width: 160px;
}

.portal-product-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 20px;
}

.portal-family {
  color: var(--portal-teal);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .1em;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.portal-product-copy h2 {
  color: var(--portal-navy);
  font-size: 1.3rem;
  margin: 0 0 8px;
}

.portal-product-copy > p {
  color: var(--portal-muted);
  line-height: 1.48;
  margin: 0 0 16px;
}

.portal-product-details {
  border-top: 1px solid #edf1f4;
  color: var(--portal-muted);
  font-size: .9rem;
  margin-bottom: 12px;
  padding-top: 12px;
}

.portal-product-details summary {
  color: var(--portal-blue);
  cursor: pointer;
  font-weight: 800;
}

.portal-variants {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.portal-variant {
  background: #f8fafb;
  border: 1px solid #e3eaef;
  border-radius: 12px;
  padding: 12px;
}

.portal-variant-head,
.portal-variant-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.portal-variant-head strong {
  font-size: .93rem;
}

.portal-price {
  color: var(--portal-navy);
  font-size: 1.02rem;
  font-weight: 900;
  white-space: nowrap;
}

.portal-availability {
  color: #08766f;
  display: block;
  font-size: .78rem;
  font-weight: 800;
  margin: 5px 0 10px;
}

.portal-variant-actions input {
  border: 1px solid #cfd9e1;
  border-radius: 9px;
  font: inherit;
  min-height: 40px;
  padding: 8px 10px;
  width: 100px;
}

.portal-cart-panel {
  background: #fff;
  border-left: 1px solid var(--portal-line);
  bottom: 0;
  box-shadow: -18px 0 50px rgba(13, 41, 72, .16);
  display: flex;
  flex-direction: column;
  max-width: 460px;
  padding: 24px;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(105%);
  transition: transform .22s ease;
  width: min(100%, 460px);
  z-index: 60;
}

.portal-cart-panel.open {
  transform: translateX(0);
}

.portal-cart-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.portal-cart-head h2 {
  color: var(--portal-navy);
  margin: 0;
}

.portal-cart-lines {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  max-height: 36vh;
  overflow: auto;
}

.portal-cart-line {
  border: 1px solid var(--portal-line);
  border-radius: 12px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.portal-cart-line-head,
.portal-cart-line-controls,
.portal-cart-total-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.portal-cart-line-controls input {
  border: 1px solid #cfd9e1;
  border-radius: 8px;
  padding: 8px;
  width: 92px;
}

.portal-cart-checkout {
  border-top: 1px solid var(--portal-line);
  display: grid;
  gap: 14px;
  margin-top: auto;
  overflow: auto;
  padding-top: 16px;
}

.portal-delivery-options {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-delivery-option {
  border: 1px solid var(--portal-line);
  border-radius: 10px;
  cursor: pointer;
  padding: 10px 6px;
  text-align: center;
}

.portal-delivery-option:has(input:checked) {
  background: var(--portal-soft);
  border-color: var(--portal-teal);
}

.portal-delivery-option input {
  margin: 0 0 5px;
}

.portal-cart-checkout textarea {
  border: 1px solid var(--portal-line);
  border-radius: 10px;
  font: inherit;
  min-height: 72px;
  padding: 10px;
  resize: vertical;
  width: 100%;
}

.portal-overlay {
  background: rgba(7, 25, 43, .45);
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity .2s ease;
  z-index: 50;
}

.portal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.portal-empty,
.portal-feedback,
.portal-history {
  background: #fff;
  border: 1px solid var(--portal-line);
  border-radius: 14px;
  padding: 18px;
}

.portal-feedback.success {
  background: #eaf9f4;
  border-color: #a9dfcf;
  color: #07634d;
}

.portal-feedback.error {
  background: #fff0ef;
  border-color: #efbeb9;
  color: #9c2b23;
}

.portal-history {
  margin-top: 28px;
}

.portal-history h2 {
  color: var(--portal-navy);
  margin-top: 0;
}

.portal-auth-shell {
  align-items: center;
  background: radial-gradient(circle at top left, #e2f5f3, transparent 36%), linear-gradient(145deg, #f7fafb, #eef3f7);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.portal-auth-card {
  background: #fff;
  border: 1px solid var(--portal-line);
  border-radius: 22px;
  box-shadow: 0 24px 65px rgba(13, 41, 72, .14);
  max-width: 480px;
  padding: 34px;
  width: 100%;
}

.portal-auth-logo {
  display: block;
  margin: 0 auto 20px;
  max-height: 100px;
  max-width: 210px;
}

.portal-auth-card h1 {
  color: var(--portal-navy);
  margin: 0 0 8px;
  text-align: center;
}

.portal-auth-card > p {
  color: var(--portal-muted);
  line-height: 1.5;
  margin: 0 0 24px;
  text-align: center;
}

.portal-auth-card form {
  display: grid;
  gap: 16px;
}

.portal-auth-footer {
  color: var(--portal-muted);
  font-size: .83rem;
  margin-top: 20px;
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (max-width: 1080px) {
  .portal-catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .portal-header { align-items: flex-start; position: static; }
  .portal-header-actions { align-items: stretch; flex-direction: column; }
  .portal-user-name { display: none; }
  .portal-hero { align-items: stretch; flex-direction: column; }
  .portal-cutoff-card { flex-basis: auto; }
  .portal-catalog-grid { grid-template-columns: 1fr; }
  .portal-toolbar { align-items: stretch; flex-direction: column; }
  .portal-product-image { height: 210px; }
  .portal-delivery-options { grid-template-columns: 1fr; }
  .portal-cart-panel { padding: 18px; }
}
