/* Primoura (my.primoura.com): the hub's own pieces on top of the shared Primoura look (app.css, same as Center / CRM).
   Tokens only; no literal colours. Phone first: thumb-sized cards, bottom tab bar, bottom sheets, safe areas. */

html, body { background: var(--bg); }
body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }

/* ---------- sign-in additions ---------- */
.passkey-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 52px !important;
  background: var(--text); color: var(--bg); border: 1px solid var(--text); border-radius: 14px; font-size: 15.5px; font-weight: 500; }
.passkey-btn:hover { background: var(--text); opacity: .92; }
.passkey-btn .icon { stroke: currentColor; }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin: 6px 0 2px; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- shell ---------- */
.hub { min-height: 100dvh; display: flex; flex-direction: column; }
.hub-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: calc(10px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 10px max(20px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.hub-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.hub-brand .on-dark { display: none; }
:root[data-theme="dark"] .hub-brand .on-light { display: none; }
:root[data-theme="dark"] .hub-brand .on-dark { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hub-brand .on-light { display: none; } :root:not([data-theme="light"]) .hub-brand .on-dark { display: block; } }
.hub-nav { display: flex; gap: 2px; margin-inline: auto; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.hub-nav-link { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 9px; color: var(--text-2); text-decoration: none; font-size: 14px; transition: background .2s var(--ease-out), color .2s; }
.hub-nav-link .icon { width: 17px; height: 17px; }
.hub-nav-link:hover { color: var(--text); }
.hub-nav-link.active { background: var(--surface); color: var(--text); box-shadow: var(--pill-shadow); }
.hub-tools { display: flex; align-items: center; gap: 4px; }
.hub-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; margin-inline-start: 6px; text-decoration: none;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; border: 1px solid var(--line); }
.hub-main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 28px max(20px, env(safe-area-inset-right)) 48px max(20px, env(safe-area-inset-left)); }
.hub-tabbar { display: none; }

.view { animation: view-in .38s var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1, .hub-hello h1 { font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; margin: 0; }
.page-head h1 { font-size: 30px; }
.page-head p { margin: 4px 0 0; }
.section-title { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: .02em; margin: 30px 0 12px; }

/* ---------- home ---------- */
.hub-hello .eyebrow { color: var(--accent-ink); font-size: 14px; margin: 0 0 2px; }
.hub-hello h1 { font-size: clamp(34px, 5vw, 46px); line-height: 1.1; }
.hub-ws { margin: 8px 0 0; color: var(--text-2); font-size: 15px; }
.hub-ws.pick { display: inline-flex; align-items: center; gap: 4px; position: relative; }
.hub-ws.pick select { appearance: none; border: 0; background: transparent; color: var(--text-2); font: inherit; padding-inline-end: 18px; cursor: pointer; }
.hub-ws.pick .icon { position: absolute; inset-inline-end: 0; pointer-events: none; transform: rotate(-90deg); }

.p-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.p-card { position: relative; display: flex; flex-direction: column; gap: 14px; min-height: 236px; padding: 22px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; overflow: hidden; isolation: isolate;
  transition: transform .35s var(--ease-spring), border-color .25s, box-shadow .35s var(--ease-out); }
.p-card::before { /* champagne sheen, only on active cards */
  content: ''; position: absolute; inset: -40% -20% auto auto; width: 70%; aspect-ratio: 1; border-radius: 50%; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 16%, transparent), transparent); opacity: 0; transition: opacity .4s; }
html[dir=rtl] .p-card::before { inset: -40% auto auto -20%; }
.p-card.is-active::before { opacity: 1; }
.p-card.is-active { cursor: pointer; }
.p-card.is-active:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.p-card.is-active:active, .p-card.pressed { transform: scale(.975); transition-duration: .12s; }
.p-head { position: relative; width: 72px; height: 72px; }
.p-ico img { display: block; width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .18)); transition: transform .45s var(--ease-spring); }
.p-card.is-active:hover .p-ico img { transform: scale(1.06) rotate(-2deg); }
.p-card.is-locked .p-ico img { filter: grayscale(1) opacity(.42); }
.p-card.is-available .p-ico img { filter: grayscale(.35) opacity(.85); }
.p-lock { position: absolute; inset-block-end: -2px; inset-inline-end: -4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--text-2); }
.p-text h3 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 500; font-size: 22px; letter-spacing: -.005em; }
.p-text p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.p-card.is-locked .p-text h3, .p-card.is-locked .p-text p { color: var(--muted); }
.p-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 32px; }
.p-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.p-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.is-active .p-state { color: var(--ok-ink); }
.is-active .p-state .dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.is-available .p-state { color: var(--accent-ink); }
.is-available .p-state .dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.is-available { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.p-go { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text); }
html[dir=ltr] .p-go .icon { transform: scaleX(-1); }
.p-card.is-active:hover .p-go .icon { transform: translateX(-3px); }
html[dir=ltr] .p-card.is-active:hover .p-go .icon { transform: scaleX(-1) translateX(-3px); }
.p-go .icon { transition: transform .3s var(--ease-spring); }
.p-requested { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--accent-ink); }
.p-card.just-on { animation: just-on 1.1s var(--ease-out); }
@keyframes just-on { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }

.empty-card { text-align: center; padding: 48px 20px; border: 1px dashed var(--line-strong); border-radius: 24px; color: var(--text-2); margin-top: 24px; }
.empty-card h3 { margin: 10px 0 4px; font-weight: 500; }

/* the "opening" moment */
.launch-veil { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: color-mix(in srgb, var(--bg) 0%, transparent); backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0);
  transition: background .36s var(--ease-out), backdrop-filter .36s; pointer-events: none; }
.launch-veil.in { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.launch-ico { transform: translate(var(--from-x, 0), var(--from-y, 0)) scale(.64); opacity: .6; transition: transform .42s var(--ease-spring), opacity .3s; }
.launch-veil.in .launch-ico { transform: none; opacity: 1; }
.launch-ico img { width: 112px; height: 112px; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .25)); }
.launch-name { margin: 0; font-family: var(--font-display); font-size: 22px; opacity: 0; transform: translateY(6px); transition: opacity .3s .12s, transform .3s .12s var(--ease-out); }
.launch-veil.in .launch-name { opacity: 1; transform: none; }

/* ---------- bottom sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 90; display: grid; align-items: center; justify-items: center; padding: 16px;
  background: transparent; transition: background .26s var(--ease-out); }
.sheet-wrap.in { background: var(--overlay); }
.sheet { position: relative; width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 26px 24px 24px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 26px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .26s var(--ease-out), transform .32s var(--ease-spring); }
.sheet-wrap.in .sheet { opacity: 1; transform: none; }
.sheet-grab { display: none; }
.sheet h2 { font-family: var(--font-display); font-weight: 500; font-size: 24px; margin: 0 0 6px; }
.sheet .btn.block + .btn.block { margin-top: 8px; }
.pk-offer, .activate-sheet { text-align: center; display: grid; gap: 10px; }
.pk-offer p, .activate-sheet p { margin: 0 0 8px; }
.pk-offer-ico { width: 76px; height: 76px; margin: 0 auto 6px; border-radius: 22px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.pk-offer-ico .icon { stroke-width: 1.5; }
.activate-ico img { width: 88px; height: 88px; margin: 0 auto; display: block; }
.temp-box { margin: 12px 0; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-family: ui-monospace, Menlo, monospace; font-size: 14px; display: grid; gap: 4px; }
.temp-box b { font-size: 17px; letter-spacing: .04em; color: var(--accent-ink); }

/* ---------- seller ---------- */
.ws-search { width: 100%; max-width: 360px; margin-bottom: 16px; }
.ws-list { display: grid; gap: 14px; }
.ws-card { padding: 20px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); }
.ws-card.paused { opacity: .6; }
.ws-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ws-head h3 { margin: 0; font-weight: 500; font-size: 18px; display: flex; gap: 8px; align-items: center; }
.ws-head p { margin: 2px 0 0; }
.ws-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.ws-req { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; }
.ws-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; margin-top: 16px; }
.wp-row, .np-row { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.wp-row img, .np-row img { flex: none; object-fit: contain; }
.wp-name { flex: 1; min-width: 0; display: grid; }
.wp-name b { font-weight: 500; font-size: 14px; }
.np-row span { flex: 1; font-size: 14px; }
.new-products { display: grid; gap: 4px; padding: 6px 0; }
.seg3 { display: inline-flex; flex: none; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.seg3-btn { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; transition: background .2s, color .2s; }
.seg3-btn:hover { color: var(--text); }
.seg3-btn.on { background: var(--surface); color: var(--text); box-shadow: var(--pill-shadow); }
.seg3-btn.on.s-active { color: var(--ok-ink); }
.seg3-btn.on.s-available { color: var(--accent-ink); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--accent); }

/* ---------- team / account ---------- */
.team-list { display: grid; gap: 8px; }
.team-row, .pk-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.team-info, .pk-info { flex: 1; min-width: 0; display: grid; }
.team-info b, .pk-info b { font-weight: 500; display: flex; gap: 8px; align-items: center; }
.pk-list { display: grid; gap: 8px; margin: 10px 0 14px; }
.pk-row { background: var(--surface-2); }
.pk-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--accent-ink); border: 1px solid var(--line); flex: none; }
.acc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.acc-card { margin: 0; display: grid; gap: 12px; border-radius: 22px; }
.acc-card h3 { margin: 0; font-weight: 500; }
.acc-card p { margin: 0; }
.acc-id { display: flex; gap: 14px; align-items: center; }
.acc-id > div:last-child { display: grid; }
.avatar.big { width: 52px; height: 52px; font-size: 20px; }
.skeleton { height: 120px; border-radius: 22px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- app lock ---------- */
.lock-screen { position: fixed; inset: 0; z-index: 200; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center;
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); animation: view-in .3s var(--ease-out); }
.lock-screen h1 { font-family: var(--font-display); font-weight: 500; font-size: 28px; margin: 8px 0 0; }
.lock-screen p { margin: 0; }
.lock-screen .passkey-btn { margin-top: 14px; padding: 0 28px; min-width: 220px; }
.lock-msg { color: var(--danger); font-size: 13px; min-height: 18px; }
html.is-locked .hub { filter: blur(8px); }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .hub-top { padding-inline: 16px; }
  .hub-nav, .hub-tools .lang-btn { display: none; }
  .hub-tools { margin-inline-start: auto; }
  .hub-main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .hub-tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 84%, transparent); backdrop-filter: saturate(1.4) blur(20px); -webkit-backdrop-filter: saturate(1.4) blur(20px);
    border-top: 1px solid var(--line); }
  .hub-tab { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: 11px; border-radius: 12px; }
  .hub-tab .icon { width: 24px; height: 24px; }
  .hub-tab.active { color: var(--accent-ink); }
  .hub-tab:active { background: var(--hover-fill); }

  .p-grid { gap: 12px; }
  .p-card { min-height: 214px; padding: 16px; border-radius: 22px; gap: 10px; }
  .p-head, .p-ico img { width: 58px; height: 58px; }
  .p-text h3 { font-size: 17px; }
  .p-text p { font-size: 12.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .p-foot { flex-direction: column; align-items: stretch; gap: 8px; }
  .p-foot .btn { width: 100%; height: 36px; }
  .p-go { justify-content: space-between; }

  .sheet-wrap { align-items: end; padding: 0; }
  .sheet { width: 100%; max-height: 92dvh; border-radius: 26px 26px 0 0; border-bottom: 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); transform: translateY(100%); opacity: 1; }
  .sheet-wrap.in .sheet { transform: none; }
  .sheet-grab { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 14px; }

  .ws-products { grid-template-columns: 1fr; }
  .ws-head { flex-direction: column; }
  .acc-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 26px; }
  .page-head .btn { width: 100%; }
}
@media (max-width: 340px) { .p-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .view, .p-card, .launch-ico, .sheet { animation: none !important; transition: none !important; } }
@media (max-width: 760px) { #toasts { bottom: calc(84px + env(safe-area-inset-bottom)) !important; } }
