/* portal.css: the customer pages' layout (portal_base.html loads it after style.css). The owner, 2026-10-19: "make the
   customer UI better. make it horizontally better so that customer doesnt have to scroll". Phones (narrower than
   768px): one column, as before. Computers: the page uses the screen's width (up to 1320px), the home's stores and cards
   side by side with the time line under them (the owner, 2026-10-20: "your store should be on top and make it horizontal
   ... log should be on bottom"), the profile button top right with its menu, the "← Back" button (both portal_base.html),
   an application step's short boxes side by side (cols-2 / cols-3 / cols-4, and an
   address on one or two rows: address-row), the documents side by side with the phone's code beside them, the words
   to sign beside the signing, and a step's bar on top and its Save / Back buttons at the bottom always in view (sticky).
   Also the bar under a button that is working (portal.js busy-line). Colours only through style.css's tokens, so light
   and dark both work. */

@media (min-width: 1024px) {
  .portal-head, .portal-main, .portal-foot { max-width: 1320px; }
}
.portal-card p { max-width: 80ch; }  /* (a wide page, lines still easy to read) */
.portal-card.narrow { max-width: 40rem; }
.narrow-button { max-width: 24rem; }  /* "Add a new store": a button, not a bar across the whole page */

/* ----- the top bar: the brand, the language buttons and the profile button (portal_base.html). On a phone the
   profile button stays beside the brand and the language buttons get their own row under them. ----- */
.portal-head { flex-wrap: wrap; gap: .5rem 1rem; }
.portal-head .lang-switch { margin-left: auto; flex-wrap: wrap; }
@media (max-width: 767px) {
  .portal-head .profile-menu { margin-left: auto; }
  .portal-head:has(.profile-menu) .lang-switch { order: 3; flex-basis: 100%; }
}
/* the profile button: a circle with the first letter, the name (cut short with "..." when long; the whole name is in the
   menu's page) and "Menu"; at least 44px to tap. Pico's dropdown does the rest: its list floats under the button, and
   while it is open a see-through layer over the page closes it on a tap anywhere else (raised here over the rep's
   banner and an application step's bar too). */
details.dropdown.profile-menu { display: block; margin: 0; }
details.dropdown.profile-menu > summary:not([role]) { display: flex; align-items: center; gap: .55rem; height: auto; min-height: 44px;
  padding: .3rem .7rem .3rem .35rem; border: 1px solid var(--control-border); border-radius: 999px; background: var(--surface);
  color: var(--text); font-size: 1rem; line-height: 1.2; }
details.dropdown.profile-menu > summary:not([role]):hover { border-color: var(--accent); }
details.dropdown.profile-menu[open] > summary::before { z-index: 50; }
.profile-menu .avatar { display: grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; }
.profile-menu .profile-words { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.profile-menu .profile-words strong { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu .profile-words small { color: var(--muted); font-size: var(--text-s); }
@media (max-width: 420px) { .profile-menu .profile-words strong { max-width: 7.5rem; } }
details.dropdown.profile-menu > summary + ul { left: auto; right: 0; width: max-content; min-width: 15rem; max-width: calc(100vw - 2rem);
  white-space: normal; background: var(--surface); border-color: var(--border-strong); box-shadow: var(--shadow-raised); }
/* (selectors as strong as Pico's own dropdown and button rules, so these win) */
details.dropdown.profile-menu > summary + ul li { padding: 0; }
details.dropdown.profile-menu > summary + ul li a, .profile-menu ul li .menu-signout { display: flex; align-items: center; width: 100%;
  min-height: 44px; margin: 0; padding: .55rem 1rem; border: 0; border-radius: 0; background: none; box-shadow: none;
  font-size: 1.05rem; font-weight: 500; color: var(--text); text-align: left; text-decoration: none; }
.profile-menu ul li form { margin: 0; border-top: 1px solid var(--border); }
details.dropdown.profile-menu > summary + ul li a:hover, details.dropdown.profile-menu > summary + ul li a[aria-current=page],
.profile-menu ul li .menu-signout:hover { background: var(--row-hover); color: var(--text); }
details.dropdown.profile-menu > summary + ul li a[aria-current=page] { font-weight: 700; }
details.dropdown.profile-menu > summary + ul li a:focus-visible, .profile-menu ul li .menu-signout:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: -3px; }
/* the language buttons: big enough to tap too */
.portal-head .lang-switch button { min-height: 44px; }
/* "Cancel this update" (_portal_cancel_update.html) stays the card's whole width, level with the big Continue above it
   (style.css makes other fold buttons only as wide as their words) */
.cancel-update > summary[role=button] { display: block; width: 100%; }

/* "← Back" on top of a page (portal_base.html): the staff side's look (style.css .back), big enough to tap */
.portal .back { min-height: 44px; padding: .45rem 1rem; font-size: 1rem; }

/* ----- the home (portal_home.html), top to bottom: "Hello" with "Add a new store" on its right; the application while it
   is the next thing to do; "Your stores" side by side; "Shop wholesale" under them; the other cards; "What's happened"
   the whole width at the bottom. A grid's columns are never wider than the phone (min(100%, ...)). ----- */
.home-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-6); margin-bottom: var(--space-4); }
.home-top h1 { margin: 0; overflow-wrap: anywhere; }
.home-top [role=button] { width: auto; margin: 0; }
@media (max-width: 767px) { .home-top [role=button] { width: 100%; } }
.portal-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
/* the home's cards side by side are as tall as each other: each one's big button (Continue, Open, Start my application)
   sits at the card's foot, so the buttons of one row line up instead of being staggered (like a store card's buttons) */
.portal-cards > article { display: flex; flex-direction: column; }
.portal-cards > article > :is(p, form):last-child:has(.big-button), .portal-cards > article > .big-button:last-child,
.portal .panels > .portal-card > p:last-child:has(.big-button) { margin-top: auto; }
/* My account's cards side by side (portal_account.html, a .panels) the same way: as tall as each other, the last button
   at the foot ("Update my documents" level with "Change how I pay") */
.portal .panels { align-items: stretch; }
.portal .panels > .portal-card { display: flex; flex-direction: column; }
/* (in a column a paragraph's space under it and a heading's space over it add up instead of overlapping: a heading
   after a paragraph gets the rest of the gap it had before, 1rem + 1.25rem, not 1rem + 2.25rem) */
:is(.portal-cards > article, .portal .panels > .portal-card) > * + :is(h2, h3) { margin-top: 1.25rem; }
.first-cards { max-width: 48rem; }
.store-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: var(--space-4); margin-bottom: var(--space-4); }
.store-row > article { margin: 0; display: flex; flex-direction: column; }
.store-card { overflow-wrap: anywhere; }
.store-card h3 { margin-bottom: .4rem; }
.store-card p { margin-bottom: .4rem; }
.store-card .store-buttons { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: auto 0 0; padding-top: var(--space-2); }
.store-card .store-buttons [role=button] { flex: 1 1 auto; margin: 0; min-height: 44px; }
.shop-card { margin-bottom: 1rem; }
@media (min-width: 768px) {
  .shop-card { display: flex; align-items: center; gap: 1.5rem; }
  .shop-card > div { flex: 1; min-width: 0; }
  .shop-card > div > :last-child { margin-bottom: 0; }
  .shop-card .big-button { width: auto; flex: none; }
}
/* "What's happened": a card like every other part of the home (it was bare on the grey page under the cards) */
.portal-timeline { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); padding: var(--space-5); box-shadow: var(--shadow); }
.portal-timeline > :last-child { margin-bottom: 0; }
@media (min-width: 768px) { .portal-timeline { padding: var(--space-6); } }
@media (min-width: 1024px) {  /* the time line in two columns: half the scrolling (each entry has its date) */
  .portal-timeline ul.timeline { columns: 2; column-gap: 2rem; }
  .portal-timeline ul.timeline li { break-inside: avoid; }
}

/* ----- short boxes side by side ----- */
@media (min-width: 768px) {
  .cols-2, .cols-3, .cols-4 { display: grid; gap: 0 1rem; align-items: start; }
  .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cols-2 > fieldset, .cols-2 > details { margin-bottom: 0; }
  /* an address: the street on its own row, then city / state / ZIP */
  .address-row { display: grid; gap: 0 1rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
  .address-row .street { grid-column: 1 / -1; }
  /* the documents step: the documents side by side, the phone's code on the right */
  .docs-layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.25rem; align-items: start; }
  .phone-box { width: 19rem; }
  .doc-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0 1rem; }
  /* signing: the words on the left, the tick boxes, the name and the pad on the right */
  .sign-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
  .sign-side .agreement-text { max-height: 30rem; }
}
@media (min-width: 1100px) {  /* a wide screen: the whole address on one row */
  .address-row { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .9fr); }
  .address-row .street { grid-column: auto; }
}

/* ----- always in view: the step's bar on top (computers), its buttons at the bottom ----- */
.step-buttons { position: sticky; bottom: 0; z-index: 5; flex-wrap: wrap; background: var(--surface); padding: .75rem 0;
  border-top: 1px solid var(--border); }
@media (min-width: 768px) {
  .step-progress { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: .5rem 0 .6rem; }
  body:has(.assist-banner) .step-progress { top: 3rem; }  /* (below a rep's "filling this in with" banner) */
}

/* ----- a button at work: its bar (portal.js), the phone's "Send all" ----- */
.busy-line { display: flex; flex-basis: 100%; align-items: center; gap: .6rem; margin: .25rem 0 0; }
.busy-line progress { flex: 1; margin: 0; }
.busy-line small { color: var(--muted); }
.send-all { margin-top: 1rem; }
form[data-send-all] .sending { margin-top: 1rem; }
form[data-send-all] .sending progress { margin-bottom: .25rem; }

/* ----- a store's page (portal_store.html): one document a row, its date, status and action on the same line ----- */
.store-papers { list-style: none; padding: 0; margin: 0; }
.store-papers li { list-style: none; display: flex; flex-direction: column; gap: .15rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.store-papers li:last-child { border-bottom: 0; }
.paper-line { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; }
/* a document's state: the coloured pill of the staff pages (style.css .status, logic/tones.py 'doc': accepted green,
   received amber, sent back red), a little bigger for customers (the owner, 2026-10-21: "changed accepted to green") */
.paper-line .status, .doc-row .status { font-size: var(--text-s); }
/* a sent-back document's "Send a new one" / "Send it": the one tap they must make, as big to tap as the portal's other buttons */
.paper-line [role=button].small { min-height: 44px; padding-inline: var(--space-4); font-size: var(--text-m); display: inline-flex; align-items: center; }

/* ----- "From your Dodo rep" (portal_picks.html, portal_card_picks.html; app/picks.py): a pick's products side by side,
   each a small card with its photo, name, SKU, price and links; the home card's little pictures in a row ----- */
.pick-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.pick-product { display: flex; flex-direction: column; gap: .25rem; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius); }
.pick-product img { width: 100%; height: 11rem; object-fit: cover; border-radius: var(--radius-s); }
.pick-thumbs { display: inline-flex; gap: .25rem; vertical-align: middle; }
.pick-thumbs img { width: 2rem; height: 2rem; object-fit: cover; border-radius: var(--radius-s); }

/* ----- the new look (2026-10-27, docs/build/redesign_2026-10-27.md): the staff pages' levels, in Dodo's own blue ----- */
/* the top bar: white across the whole screen with a line under it (level 1 over the grey page), like the staff pages' */
.portal-top { background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: var(--space-5); }
.portal-top .portal-head { padding-top: var(--space-3); padding-bottom: var(--space-3); }
/* the application to do now (the home's first cards): raised (level 2), Dodo's blue line on top */
.first-cards > article { box-shadow: var(--shadow-raised); border-top: 3px solid var(--accent); }
/* a step's buttons at the bottom: lifted over the page that scrolls under them */
.step-buttons { box-shadow: var(--shadow-raised); }
