/* ==========================================================================
   Customer ordering portal (/p/:token): employee list and manager review.
   Loaded after style.css and scoped to html.portal (set in app.js), so the
   management area keeps its own look.
   Identity follows the website: Archivo, the logo's red and ink, square
   corners, and the red block of the logo as the graphic motif.
   Employees arrive from a QR code, so small screens come first.
   ========================================================================== */

html.portal {
  --red: #AB2430;
  --red-deep: #8E1B26;
  --ink: #050E14;
  --ink-2: #101B23;
  --paper: #F5F0E7;
  --paper-2: #EAE2D3;
  --white: #fff;
  --muted: #535A61;
  --muted-ink: #AEB5BA;
  --line: rgba(5, 14, 20, .14);
  --soft: var(--paper-2);

  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  /* Side padding that keeps header and content on the same centred column */
  --side: max(var(--gutter), calc((100% - var(--wrap)) / 2));
  --hdr: 58px;          /* header height */
  --stick: var(--hdr);  /* where sticky parts stop: under the header while it is sticky */
  --filters: 62px;      /* height of the sticky category bar */
  --arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='square'%3E%3Cpath d='M7 17 17 7M8.5 7H17v8.5'/%3E%3C/svg%3E");

  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

.portal ::selection { background: var(--red); color: #fff; }
.portal :focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.portal .public-hero :focus-visible,
.portal .dock:focus-visible { outline-color: var(--paper); }
.portal .icon { width: 22px; height: 22px; flex: none; }

/* ---------- Type ---------- */
.portal h1,
.portal dialog h2,
.portal .totals .grand,
.portal .cart-total {
  font-weight: 900;
  font-stretch: 62%;
  letter-spacing: -.012em;
  word-spacing: .1em;
  line-height: .95;
  text-transform: uppercase;
}
.portal h1 { font-size: clamp(28px, 3.2vw, 44px); margin: 0 0 8px; }
.portal h2 {
  font-size: 19px; font-weight: 800; font-stretch: 78%; letter-spacing: .035em;
  line-height: 1.1; text-transform: uppercase;
}
.portal h3 { font-size: 16px; font-weight: 700; }
.portal p { line-height: 1.5; }

/* The logo's block: a word in white on red */
.portal .hl {
  display: inline-block; background: var(--red); color: #fff;
  padding: .11em .13em .08em; margin-top: .035em;
}

.portal .eyebrow {
  display: flex; align-items: center; gap: 10px; margin: 0 0 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .16em; color: var(--red);
}
.portal .eyebrow::before { content: ""; width: 10px; height: 10px; background: currentColor; flex: none; }

.portal .sub { font-size: 16px; color: var(--muted); }
.portal .fine { font-size: 13px; line-height: 1.5; color: var(--muted); }

.portal .link {
  color: var(--ink); font-size: 14px; font-weight: 700;
  text-decoration-color: var(--red); text-decoration-thickness: 2px;
}
.portal .link:hover { color: var(--red); }

/* ---------- Buttons ---------- */
.portal .btn {
  min-height: 46px; padding: 0 18px; gap: 10px;
  border: 0; border-radius: 0; background: var(--red); color: #fff;
  font-size: 14.5px; font-weight: 800; font-stretch: 78%; letter-spacing: .05em;
  line-height: 1; text-transform: uppercase;
  transition: background .2s, color .2s;
}
.portal .btn:hover { filter: none; background: var(--red-deep); }
.portal .btn.dark { background: var(--ink); }
.portal .btn.dark:hover { background: var(--ink-2); }
.portal .btn.secondary { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.portal .btn.secondary:hover { background: var(--ink); color: #fff; }
.portal .btn.danger { background: none; color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red); }
.portal .btn.danger:hover { background: var(--red); color: #fff; }
.portal .btn.small { min-height: 40px; padding: 0 14px; font-size: 13.5px; }
.portal .btn.block { display: flex; width: 100%; }

/* Two pieces, like the logo: label plus a contrasting block with the arrow */
.portal .btn.arrow { justify-content: space-between; padding-right: 0; gap: 18px; }
.portal .btn.arrow::after {
  content: ""; flex: none; align-self: stretch; width: 46px;
  background: var(--ink) var(--arrow) center / 18px no-repeat;
}
.portal .btn.dark.arrow::after { background-color: var(--red); }

/* ---------- Fields ---------- */
.portal input,
.portal select,
.portal textarea {
  padding: 11px 12px; border: 1.5px solid var(--ink); border-radius: 0;
  background: #fff; font-size: 16px; /* 16px stops iOS from zooming on focus */
}
.portal input:focus-visible,
.portal select:focus-visible,
.portal textarea:focus-visible { outline: 0; border-color: var(--red); box-shadow: 4px 4px 0 var(--red); }
.portal ::placeholder { color: #8b9095; }
.portal .field { gap: 7px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.portal .field small { font-size: 12px; font-weight: 500; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.portal .pin-input { margin: 4px 0 16px; font-size: 30px; font-weight: 800; letter-spacing: .3em; text-indent: .3em; }

/* Quantity: minus, number, plus */
.portal .stepper { display: inline-flex; flex: none; height: 46px; border: 1.5px solid var(--ink); background: #fff; }
.portal .stepper:focus-within { border-color: var(--red); }
.portal .stepper button {
  width: 42px; border: 0; background: none; color: var(--ink);
  font-size: 22px; font-weight: 600; line-height: 1;
}
.portal .stepper button:hover { background: var(--paper-2); }
.portal .stepper button:focus-visible { outline-offset: -3px; }
.portal .stepper input {
  width: 46px; padding: 0; border: 0; box-shadow: none; text-align: center;
  font-weight: 700; appearance: textfield; -moz-appearance: textfield;
}
.portal .stepper input::-webkit-inner-spin-button,
.portal .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Small parts ---------- */
.portal .badge {
  padding: 6px 9px 5px; border-radius: 0; background: var(--paper-2); color: var(--ink);
  font-size: 11px; font-weight: 700; letter-spacing: .1em; line-height: 1.2; text-transform: uppercase;
}
.portal .badge.confirmed { background: #F3DFB1; color: #5C4310; }
.portal .badge.preparing { background: #DDE8EF; color: #2F556C; }
.portal .badge.cancelled { background: #F3DCDA; color: var(--red-deep); }

.portal .note {
  padding: 12px 16px; border: 0; border-left: 4px solid var(--ink); border-radius: 0;
  background: var(--paper-2); font-size: 14px; line-height: 1.5;
}
.portal .note.warning { background: #FBEFD3; border-left-color: #C98F52; }
.portal .note.success { background: #E9F4EC; border-left-color: #1F6A34; color: #164825; margin-bottom: 18px; }
.portal .note.error { background: #F8E3E1; border-left-color: var(--red); color: var(--red-deep); }

.portal .empty { padding: 40px 20px; }
.portal .empty .symbol { display: none; }
.portal .empty h3 { color: var(--ink); }
.portal .empty p { font-size: 14px; }

.portal #toast {
  bottom: 24px; z-index: 30; padding: 14px 20px;
  border-left: 6px solid var(--red); border-radius: 0; box-shadow: none;
  font-size: 15px; font-weight: 600;
}
.portal #toast.error { background: var(--red); border-left-color: var(--ink); }

/* ---------- Header ---------- */
.portal .public-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--hdr); padding: 0 var(--side); gap: 12px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.portal .public-header .brand { width: 168px; flex-shrink: 1; min-width: 0; }
.portal .public-header .btn { min-height: 38px; padding: 0 14px; font-size: 13px; }
.portal .public-header .btn.arrow { padding-right: 0; gap: 14px; }
.portal .public-header .btn.arrow::after { width: 38px; background-size: 16px; }
.portal .public-header .tools { flex: none; flex-wrap: nowrap; gap: 14px; }

/* ---------- Page ---------- */
.portal .public-main { max-width: none; margin: 0; padding: clamp(16px, 2vw, 24px) var(--side) 64px; }
.portal .public-main > .brand { width: 168px; margin-bottom: 18px; }
.portal .page-head { margin: 0 0 18px; }
.portal .page-head h1 { margin-bottom: 6px; }
.portal .page-head .sub { font-size: 14px; }
.portal .note-action { margin-top: 8px; }
.portal .note-action .link { font-size: 13px; padding: 2px 0; }
.portal .panel-body .section-gap { margin-top: 14px; }

.portal .panel { margin-bottom: 24px; border: 0; border-top: 3px solid var(--ink); border-radius: 0; overflow: visible; }
.portal .panel-head { padding: 16px 20px; }
.portal .panel-body { padding: 20px; }
.portal .panel-body > .btn { margin-top: 4px; }

/* ---------- Employee view: one grid ----------
   Wide:  hero | daily card      Narrow: hero
          catalogue | team list          daily card
                                         catalogue
                                         team list (also one tap away, in the bottom bar) */
.portal .shop {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: start;
  gap: clamp(18px, 2vw, 24px) clamp(24px, 3.5vw, 48px);
  padding-top: 0;
}
/* Full-width ink band behind the first row */
.portal .shop::before {
  content: ""; grid-area: 1 / 1 / 2 / -1; align-self: stretch;
  background: var(--ink); box-shadow: 0 0 0 100vmax var(--ink); clip-path: inset(0 -100vmax);
}
/* clip-path makes the band a stacking context, so the content on it is lifted above */
.portal .public-hero,
.portal .coffee-break { position: relative; z-index: 1; }
.portal .public-hero {
  grid-area: 1 / 1; display: block; margin: 0; padding: clamp(14px, 1.8vw, 22px) 0;
  border-radius: 0; background: none; color: var(--paper);
}
.portal .public-hero h1 { font-size: clamp(28px, 3.2vw, 44px); margin: 0; }
.portal .public-hero .eyebrow { margin-bottom: 6px; font-size: 11.5px; color: var(--paper); }
.portal .public-hero .eyebrow::before { background: var(--red); }
/* The filter bar opens the catalogue; pulled up by its own top padding so it lines up with the team list */
.portal .catalog { grid-area: 2 / 1; min-width: 0; margin-top: -10px; }
.portal .cart { grid-area: 2 / 2; }

/* Daily fact or joke: centred in the height of the band */
.portal .coffee-break {
  grid-area: 1 / 2; align-self: center; margin: 10px 0; padding: 12px 16px;
  border-left: 4px solid var(--red); border-radius: 0; background: var(--ink-2); color: var(--paper);
}
.portal .coffee-break h2 { font-size: 11.5px; font-weight: 700; font-stretch: 100%; letter-spacing: .16em; color: var(--muted-ink); }
.portal .coffee-break p { margin: 5px 0; font-size: 13.5px; line-height: 1.4; }
.portal .coffee-break summary,
.portal .coffee-break a { display: inline-block; padding: 2px 0; color: inherit; font-size: 12px; text-underline-offset: 3px; }
.portal .coffee-break summary { display: list-item; }

/* ---------- Catalogue ---------- */

/* Filters stay in reach while the list scrolls */
.portal .category-buttons {
  position: sticky; top: var(--stick); z-index: 5;
  margin: 0; padding: 10px 0; gap: 8px;
  background: var(--paper); border-bottom: 3px solid var(--ink);
}
.portal .category-button {
  flex: none; height: 46px; padding: 0 14px; gap: 8px;
  border: 1.5px solid var(--ink); border-radius: 0; background: none; color: var(--ink);
  font-size: 14px; font-weight: 800; font-stretch: 78%; letter-spacing: .05em;
  line-height: 1; text-transform: uppercase; white-space: nowrap;
}
.portal .category-button:hover { background: var(--paper-2); }
.portal .category-button.selected { background: var(--ink); color: #fff; }
.portal .category-button span { font-size: 12.5px; font-stretch: 100%; letter-spacing: 0; opacity: .65; }

.portal .product-list { gap: 0; background: #fff; scroll-margin-top: calc(var(--stick) + var(--filters)); }
.portal .product-list .empty { border: 0; border-radius: 0; background: none; }
.portal .product-line {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 10px 16px;
  padding: 14px 18px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none;
}
.portal .product-line:last-child { border-bottom: 0; }
.portal .product-photo { width: 64px; height: 64px; border-radius: 0; }
.portal .product-info h3 { margin: 0 0 3px; font-size: 17px; line-height: 1.25; }
.portal .product-info small { font-size: 13.5px; color: var(--muted); }
.portal .product-add { align-items: center; gap: 10px; margin: 0; }
.portal .quantity-label {
  flex-direction: row; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.portal .product-add .cart-btn { width: 54px; padding: 0; }

/* ---------- Team list ---------- */
.portal .cart { position: sticky; top: calc(var(--hdr) + 20px); }
.portal .cart .panel { border-top: 0; box-shadow: 8px 8px 0 var(--red); }
.portal .cart .panel-head { border: 0; background: var(--ink); color: var(--paper); }
.portal .cart .panel-head .badge { background: var(--red); color: #fff; }
.portal .cart .panel-body { max-height: calc(100vh - var(--hdr) - 190px); overflow-y: auto; }
.portal .cart .panel-body .fine { margin-bottom: 0; }
/* What adding to the list means: said plainly, at reading size */
.portal .list-note { margin: 4px 8px 0 0; padding-left: 1.25em; font-size: 16px; line-height: 1.45; font-weight: 500; }
.portal .list-note li + li { margin-top: 6px; }
.portal dialog .list-note { margin: 22px 0 0; }

.portal .cart-line { align-items: center; padding: 12px 0; font-size: 15px; }
.portal .cart-line:first-child { padding-top: 0; }
.portal .cart-line small { margin-top: 3px; font-size: 13px; }
.portal .cart-line strong { font-weight: 700; }
.portal .cart-qty { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.portal .remove-own {
  width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 17px; line-height: 1; display: inline-grid; place-items: center; transition: color .15s, border-color .15s, background .15s;
}
.portal .remove-own:hover { border-color: var(--red); color: var(--red); background: #fdf4f4; }
.portal .cart-total {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-top: -1px; padding-top: 14px; border-top: 2px solid var(--ink); font-size: 26px;
}

/* Bottom bar on small screens: opens the team list without leaving the catalogue */
.portal .dock { display: none; }

/* ---------- Manager view ---------- */
.portal .columns {
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0 clamp(24px, 3.5vw, 48px); align-items: start;
}
.portal .aside-meta .meta-block + .meta-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.portal .aside-meta h3 { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.portal .aside-meta p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink); }
.portal .aside-meta .fine { margin-top: 4px; font-size: 13px; color: var(--muted); }
.portal .aside-meta .fine strong { color: var(--ink); }
.portal .support-card > .fine { margin: 0 0 14px; }
.portal .support-links { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.portal .support-links .link { font-size: 13.5px; word-break: break-word; }
.portal .cart-line .price-row { flex: none; gap: 10px; }
.portal .cart-line .badge { margin-left: 8px; }
.portal form.cart-line strong { font-size: 16px; }

.portal .totals { padding: 14px 0 18px; }
.portal .totals div { margin: 8px 0; font-size: 15px; }
.portal .totals .grand { align-items: baseline; margin: 14px 0 0; padding-top: 16px; border-top: 2px solid var(--ink); font-size: 32px; }

.portal .pending {
  margin-bottom: 18px; padding: 22px 24px; border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: 0;
  background: #fff; box-shadow: none;
}
.portal .pin-confirm-form { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-top: 20px; max-width: none; }
.portal .pin-confirm-form .field { flex: 0 0 auto; }
.portal .pin-confirm-form .tools { gap: 10px; }
.portal .pin-input {
  width: 220px; max-width: 100%; margin: 4px 0 0; padding: 11px 14px;
  font-size: 24px; font-weight: 800; letter-spacing: 8px; text-indent: 8px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.portal dialog .pin-input {
  width: 100%; max-width: none; margin: 4px 0 14px; padding: 12px 14px;
  font-size: 28px; font-weight: 800; letter-spacing: .34em; text-indent: .34em;
  background: var(--paper); border-color: rgba(5, 14, 20, .24);
}
.portal dialog input:focus-visible,
.portal dialog select:focus-visible,
.portal dialog textarea:focus-visible {
  background: #fff; border-color: var(--red); box-shadow: 0 0 0 3px rgba(171, 36, 48, .16);
}
.portal .pending .row-between { flex-wrap: nowrap; align-items: flex-start; margin-bottom: 12px; }
.portal .pending p { font-size: 15px; }
.portal .pending .pin-input { background: var(--paper); border-color: rgba(5, 14, 20, .24); }
.portal .pending .pin-input:focus-visible { background: #fff; border-color: var(--red); box-shadow: 0 0 0 3px rgba(171, 36, 48, .16); }

.portal th { padding: 12px 20px; background: none; font-size: 11px; font-weight: 700; letter-spacing: .12em; white-space: nowrap; }
.portal td .link { white-space: nowrap; }
.portal td { padding: 16px 20px; border-bottom-color: var(--line); font-size: 14.5px; }
.portal td strong { font-size: 15px; margin-bottom: 3px; }
.portal td small { font-size: 13px; }

.portal .activity { padding: 14px 0; border-bottom-color: var(--line); font-size: 14.5px; }
.portal .activity:first-child { padding-top: 0; }
.portal .activity:last-child { padding-bottom: 0; }
.portal .activity small { margin-top: 3px; font-size: 12.5px; }

/* ---------- Dialogs ---------- */
.portal dialog {
  position: relative; max-width: 440px; width: calc(100% - 32px); padding: 26px 26px 24px;
  border: 0; border-top: 4px solid var(--red); border-radius: 0;
  background: #fff; box-shadow: 0 24px 60px rgba(5, 14, 20, .34);
}
.portal dialog::backdrop { background: rgba(5, 14, 20, .62); backdrop-filter: blur(4px); }
.portal dialog h2 { margin: 0 0 8px; padding-right: 36px; font-size: 26px; line-height: 1.05; }
.portal dialog .sub { font-size: 14.5px; line-height: 1.5; margin: 0 0 18px; }
.portal dialog .section-gap { margin-top: 16px; }
.portal dialog .btn[type="submit"] { width: 100%; min-height: 48px; }
.portal dialog .dialog-foot { margin-top: 14px; text-align: center; }
.portal dialog .dialog-foot .link { font-size: 13px; color: var(--muted); text-decoration-color: var(--line); }
.portal dialog .dialog-foot .link:hover { color: var(--red); text-decoration-color: var(--red); }
.portal .dialog-close {
  position: absolute; top: 12px; right: 12px; float: none; margin: 0;
  width: 36px; height: 36px; display: grid; place-items: center;
  color: var(--muted); font-size: 24px; line-height: 1; transition: color .15s, background .15s;
}
.portal .dialog-close:hover { color: var(--ink); background: var(--paper); }
.portal .order-addresses { border-radius: 0; background: #fff; }
.portal .order-addresses h3 { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.portal .order-addresses p { font-size: 14.5px; }
.portal .order-addresses small { font-size: 12px; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1000px) {
  .portal .columns { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .portal .shop { grid-template-columns: minmax(0, 1fr); row-gap: 18px; padding-bottom: 96px; }
  /* The band covers the hero and the daily card under it */
  .portal .shop::before { grid-area: 1 / 1 / 3 / 2; }
  .portal .public-hero { padding: 14px 0 0; }
  /* Under the title, compact padding */
  .portal .coffee-break { grid-area: 2 / 1; align-self: start; margin: -6px 0 14px; padding: 11px 14px; }
  .portal .coffee-break p { font-size: 13.5px; }
  /* Filters sit close under the band */
  .portal .catalog { grid-area: 3 / 1; margin-top: -18px; }
  .portal .cart { grid-area: 4 / 1; position: static; }
  .portal .cart .panel { margin-right: 6px; box-shadow: 6px 6px 0 var(--red); }
  .portal .cart .panel-body { max-height: none; }

  .portal .dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
    border: 0; border-top: 3px solid var(--red); background: var(--ink); color: var(--paper);
    font-size: 15px; font-weight: 800; font-stretch: 78%; letter-spacing: .05em;
    line-height: 1; text-transform: uppercase;
  }
  .portal .dock:disabled { opacity: 1; }
  .portal .dock span { display: flex; align-items: center; gap: 10px; }
  .portal .dock strong { padding: 10px 12px 9px; background: var(--red); color: #fff; }
  .portal #toast { left: var(--gutter); right: var(--gutter); bottom: 80px; max-width: none; transform: none; }
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  /* The header scrolls away: the screen is for the catalogue, and the filters stick to the top */
  html.portal { --hdr: 60px; --stick: 0px; }
  .portal .public-header { position: static; }
  .portal .public-header .brand { width: 150px; }
  .portal .public-header .btn { min-height: 44px; padding: 0 12px; font-size: 13px; }
  .portal .public-header .btn.arrow { padding-right: 0; gap: 12px; }
  .portal .public-header .btn.arrow::after { width: 40px; background-size: 16px; }
  .portal .public-header .link,
  .portal .panel-head .link { padding: 12px 0; }
  .portal .page-head { margin-bottom: 24px; }

  /* One swipeable row of filters instead of two wrapped ones */
  .portal .category-buttons {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); padding: 10px var(--gutter);
  }
  .portal .category-buttons::-webkit-scrollbar { display: none; }
  .portal .product-list { margin-top: 14px; }

  .portal .stepper button { width: 46px; }
  .portal form.cart-line { flex-wrap: wrap; }
  .portal form.cart-line > span { flex-basis: 100%; }
  .portal .totals .grand { font-size: 28px; }
  .portal .pending { padding: 18px; }
  .portal .panel-head { flex-wrap: nowrap; }
  /* Order history as stacked cards instead of a table that scrolls sideways:
     number and status on top, date and total below, then the link */
  .portal .table-wrap table,
  .portal .table-wrap tbody { display: block; }
  .portal .table-wrap thead { display: none; }
  .portal .table-wrap tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px 14px;
    padding: 16px 20px; border-bottom: 1px solid var(--line);
  }
  .portal .table-wrap tr:last-child { border-bottom: 0; }
  .portal .table-wrap td { padding: 0; border: 0; }
  .portal .table-wrap td:nth-child(4) { grid-area: 1 / 2; justify-self: end; }
  .portal .table-wrap td:nth-child(2) { grid-area: 2 / 1; color: var(--muted); }
  .portal .table-wrap td:nth-child(3) { grid-area: 2 / 2; justify-self: end; font-weight: 700; }
  .portal .table-wrap td:nth-child(5) { grid-column: 1 / -1; }
  .portal .table-wrap td .link { padding: 8px 0; }
  .portal dialog { padding: 22px 20px 20px; }
  .portal dialog h2 { font-size: 23px; }
}

@media (max-width: 600px) {
  .portal .product-line { grid-template-columns: 56px minmax(0, 1fr); align-items: start; padding: 14px; }
  .portal .product-photo { width: 56px; height: 56px; }
  .portal .product-info { flex-basis: auto; }
  /* Quantity and cart button share the whole row, half each: wide targets for the thumb */
  .portal .product-add { grid-column: 1 / -1; margin: 0; }
  .portal .product-add .quantity-label,
  .portal .product-add .cart-btn { flex: 1 1 0; width: auto; min-width: 0; }
  .portal .product-add .stepper { display: flex; flex: 1; }
  .portal .product-add .stepper input { flex: 1; width: auto; min-width: 0; }
  /* The unit is already in each product line ("Caixa de 30 cápsulas") and in the field's label for screen readers */
  .portal .quantity-label > span { display: none; }
}

@media (max-width: 374px) {
  .portal .public-header .brand { width: 128px; }
  .portal .public-header .btn { padding: 0 10px; font-size: 12.5px; letter-spacing: .03em; }
  .portal .public-header .btn.arrow { padding-right: 0; gap: 10px; }
  .portal .public-header .btn.arrow::after { width: 36px; }
  .portal .public-header .tools { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html.portal { scroll-behavior: auto; }
  .portal .btn { transition: none; }
}
