.portal-header {
  padding-inline: max(16px, calc((100% - 1160px) / 2));
}
.portal-catalog-link,
.portal-text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 4px;
}
.portal-catalog-link:hover,
.portal-text-link:hover {
  text-decoration-color: currentColor;
}
.portal-main {
  max-width: 1200px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 56px) 20px max(48px, env(safe-area-inset-bottom));
}
.portal-card {
  min-width: 0;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}
.portal-auth {
  display: grid;
  justify-items: start;
  gap: 16px;
  width: min(100%, 460px);
  margin: clamp(0px, 3vw, 40px) auto 0;
}
.portal-auth .portal-form {
  width: 100%;
  padding-top: 4px;
}
.portal-auth .portal-form .primary {
  width: 100%;
}
.portal-auth .portal-text-link {
  margin-bottom: -6px;
}
.portal-skeleton {
  display: grid;
  gap: 12px;
  width: 100%;
  padding-top: 12px;
}
.portal-skeleton > span {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 10px;
  background: var(--surface-soft);
}
.portal-skeleton > span::after {
  position: absolute;
  inset: 0;
  content: '';
  background: linear-gradient(100deg, transparent 20%, rgb(145 154 174 / .14) 48%, transparent 75%);
  transform: translateX(-100%);
  animation: portal-skeleton-sweep 1.8s ease-in-out infinite;
}
.portal-skeleton-line {
  width: 28%;
  height: 12px;
}
.portal-skeleton-field,
.portal-skeleton-button {
  height: 48px;
  margin-bottom: 8px;
}
.portal-skeleton-button {
  margin-top: 4px;
}
@keyframes portal-skeleton-sweep {
  to { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .portal-skeleton > span::after { animation: none; }
}
.portal-auth p,
.portal-section > p,
.portal-account-name {
  color: var(--muted);
}
.portal-dashboard {
  display: grid;
  gap: 24px;
}
.portal-heading,
.portal-section-heading,
.portal-row-heading,
.portal-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  column-gap: 16px;
  row-gap: 8px;
}
.portal-heading {
  align-items: center;
}
.portal-heading h1 {
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -.035em;
}
.portal-section-heading {
  align-items: center;
}
.portal-account-name {
  margin-top: 6px;
}
.portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}
.portal-admin-grid {
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.35fr);
}
.portal-section,
.portal-form {
  display: grid;
  justify-items: start;
  gap: 16px;
}
.portal-section > *,
.portal-form > *,
.portal-section-heading {
  min-width: 0;
  max-width: 100%;
}
.portal-section > :not(button):not(a),
.portal-form > :not(button),
.portal-fields {
  width: 100%;
}
.portal-section h2,
.portal-section h3,
.portal-section p,
.portal-section dd,
.portal-form p,
.portal-auth p,
.portal-heading p {
  overflow-wrap: anywhere;
}
.portal-form label,
.portal-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.portal-form small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.portal-field :is(input, select, textarea),
.portal-form :is(input, select, textarea):not([type="hidden"], [type="checkbox"]) {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
}
.portal-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.portal-fields .portal-field-wide {
  grid-column: 1 / -1;
}
.portal-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.portal-row {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.portal-row > * + * {
  margin-top: 8px;
}
.portal-row-heading > :first-child {
  min-width: 0;
  flex: 1 1 130px;
  overflow-wrap: anywhere;
}
.portal-row-actions {
  justify-content: flex-start;
}
.portal-row-actions .secondary,
.portal-section-nav a,
.portal-customer-link {
  min-height: 44px;
}
.portal-row-actions .secondary {
  background: var(--surface);
}
.portal-status-label {
  align-self: start;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  max-width: 100%;
}
.portal-status-label[data-state="requested"],
.portal-status-label[data-state="confirmed"],
.portal-status-label[data-state="pending"] {
  color: var(--ink);
}
.portal-muted {
  color: var(--muted);
}
.portal-error,
.portal-status[data-error] {
  color: var(--danger) !important;
}
.portal-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.portal-section-nav a {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 650;
}
.portal-section-nav a[aria-current] {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}
.portal-customer-link {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  overflow-wrap: anywhere;
}
.portal-customer-link[aria-current],
.portal-customer-link:hover {
  background: var(--surface-soft);
}
.portal-disclosure {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.portal-disclosure summary {
  padding: 12px 0;
  font-weight: 650;
  cursor: pointer;
}
.portal-disclosure .portal-form {
  padding: 4px 0 16px;
}
.portal-facts {
  display: grid;
  grid-template-columns: minmax(75px, max-content) minmax(0, 1fr);
  margin: 0;
  gap: 6px 14px;
}
.portal-facts dt {
  color: var(--muted);
}
.portal-facts dd {
  margin: 0;
}
.portal-order-details summary {
  min-height: 44px;
  padding-block: 11px;
  cursor: pointer;
}
.portal-order-notes {
  white-space: pre-wrap;
}
.portal-order-items {
  display: grid;
  gap: 4px;
  padding-left: 18px;
}
.portal-copy {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.portal-permissions {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 6px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.portal-permissions legend {
  padding-inline: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.portal-permissions label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-inline: 4px;
  cursor: pointer;
}
.portal-permissions input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--lime);
}
.portal-dialog {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  color: var(--ink);
}
.portal-dialog::backdrop {
  background: #080a0a99;
}
@media (max-width: 780px) {
  .portal-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 415px) {
  .portal-main {
    padding-inline: 14px;
  }
  .portal-card {
    padding-inline: 14px;
  }
  .portal-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

.portal-order-status-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
@media (max-width: 415px) {
  .portal-order-status-form {
    grid-template-columns: minmax(0, 1fr);
  }
}
