/* =============================================================================
   Smartrise customer portal frame on the design system (v1.309, wave 3).
   A calm white top bar: the logo, the main places, "More", EN | SW and the account menu.
   On a phone: logo, EN | SW and one Menu with every place, plus a bottom tab bar with the four
   places customers open most. Every tap target on a phone is at least 44 px.
   Pages already moved onto the kit (body.sr-portal--kit) follow the device's light / dark.
   No raw colours (design lint) — values come from assets/css/sr/tokens.css.
   ============================================================================= */
body.sr-portal { --sr-portal-bar-h: 64px; }
body.sr-portal--kit { background: var(--sr-bg); color: var(--sr-text); font-family: var(--sr-font-body); }

/* ---------- top bar ---------- */
.sr-portal-bar { position: sticky; top: 0; z-index: 900; background: var(--sr-nav-bg); border-bottom: 1px solid var(--sr-nav-line); font-family: var(--sr-font-body); }
.sr-portal-bar__in { max-width: 1120px; margin: 0 auto; height: var(--sr-portal-bar-h); padding: 0 var(--sr-space-6); box-sizing: border-box; display: flex; align-items: center; gap: var(--sr-space-6); }
.sr-portal-bar__logo { display: inline-flex; align-items: center; min-height: var(--sr-tap); flex: none; border-radius: var(--sr-radius-md); }
.sr-portal-bar__img { height: 28px; width: auto; display: block; }
/* v1.324: the bar is teal in light and dark, so it always shows the logo made for a dark background */
.sr-portal-bar__img--light { display: none; }
.sr-portal-bar__end { margin-left: auto; display: flex; align-items: center; gap: var(--sr-space-3); }

/* the main places (desktop) */
.sr-portal-nav { display: flex; align-items: center; gap: var(--sr-space-1); min-width: 0; }
.sr-portal-nav__link { display: inline-flex; align-items: center; gap: var(--sr-space-1); min-height: 40px; padding: 0 var(--sr-space-3); border-radius: var(--sr-radius-md); color: var(--sr-text-soft); font-size: var(--sr-size-md); font-weight: var(--sr-weight-medium); text-decoration: none; white-space: nowrap; cursor: pointer; list-style: none; }
.sr-portal-nav__link::-webkit-details-marker { display: none; }
.sr-portal-nav__link:hover { color: var(--sr-heading); background: var(--sr-surface-2); }
.sr-portal-nav__link.is-active { color: var(--sr-heading); font-weight: var(--sr-weight-semibold); box-shadow: inset 0 -2px 0 var(--sr-heading); border-radius: var(--sr-radius-md) var(--sr-radius-md) 0 0; }
.sr-portal-nav__link:focus-visible, .sr-portal-pop__link:focus-visible, .sr-portal-account__btn:focus-visible, .sr-portal-menu__btn:focus-visible, .sr-portal-bar__logo:focus-visible, .sr-portal-tabbar__item:focus-visible { outline: 2px solid var(--sr-focus); outline-offset: 2px; }

/* pop-over menus: More, the account menu, the phone's Menu (native <details>) */
.sr-portal-pop { position: relative; }
.sr-portal-pop > summary { list-style: none; }
.sr-portal-pop > summary::-webkit-details-marker { display: none; }
.sr-portal-pop__chev { width: 16px; height: 16px; transition: transform var(--sr-dur-fast) var(--sr-ease); }
.sr-portal-pop[open] .sr-portal-pop__chev { transform: rotate(180deg); }
.sr-portal-pop__panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 950; min-width: 232px; padding: var(--sr-space-2); box-sizing: border-box; background: var(--sr-surface); border: 1px solid var(--sr-line); border-radius: var(--sr-radius-lg); box-shadow: var(--sr-shadow-2); display: flex; flex-direction: column; gap: 2px; }
.sr-portal-pop--end .sr-portal-pop__panel { left: auto; right: 0; }
.sr-portal-pop[open] .sr-portal-pop__panel { animation: sr-portal-pop-in var(--sr-dur-base) var(--sr-ease-out); }
@keyframes sr-portal-pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sr-portal-pop__link { display: flex; align-items: center; min-height: var(--sr-tap); padding: 0 var(--sr-space-3); border-radius: var(--sr-radius-md); color: var(--sr-text); font-size: var(--sr-size-md); text-decoration: none; }
.sr-portal-pop__link:hover { background: var(--sr-surface-2); color: var(--sr-heading); }
.sr-portal-pop__link.is-active { background: var(--sr-surface-2); color: var(--sr-heading); font-weight: var(--sr-weight-semibold); }
.sr-portal-pop__link--out { color: var(--sr-danger-ink); }
.sr-portal-pop__who { margin: 0 0 var(--sr-space-1); padding: var(--sr-space-2) var(--sr-space-3) var(--sr-space-3); border-bottom: 1px solid var(--sr-line); font-size: var(--sr-size-sm); color: var(--sr-text-soft); overflow-wrap: anywhere; }

/* account (desktop) */
.sr-portal-account__btn { display: inline-flex; align-items: center; justify-content: center; width: var(--sr-tap); height: var(--sr-tap); border-radius: 50%; cursor: pointer; }
.sr-portal-account__btn:hover .sr-avatar { box-shadow: 0 0 0 3px var(--sr-surface-2); }
.sr-portal-account__btn .sr-avatar { width: 36px; height: 36px; }

/* phone: the Menu button and its sheet */
.sr-portal-menu { display: none; }
.sr-portal-menu__btn { display: inline-flex; align-items: center; gap: var(--sr-space-2); min-height: var(--sr-tap); padding: 0 var(--sr-space-3); border: 1px solid var(--sr-line); border-radius: var(--sr-radius-pill); color: var(--sr-heading); font-weight: var(--sr-weight-semibold); font-size: var(--sr-size-md); cursor: pointer; background: var(--sr-surface); }
.sr-portal-menu__btn svg { width: 20px; height: 20px; }
.sr-portal-menu[open] .sr-portal-menu__btn { background: var(--sr-surface-2); }
.sr-portal-menu__group { margin: var(--sr-space-3) var(--sr-space-3) var(--sr-space-1); font-size: var(--sr-size-xs); font-weight: var(--sr-weight-bold); letter-spacing: .06em; text-transform: uppercase; color: var(--sr-text-faint); }

/* EN | SW in the bar */
.sr-portal-bar .lang-switch { background: transparent; border-color: var(--sr-nav-line); font-family: var(--sr-font-body); }
.sr-portal-bar .lang-switch a, .sr-portal-bar .lang-switch span { min-height: 36px; }
.sr-portal-bar .lang-switch a { color: var(--sr-nav-ink-soft); }
.sr-portal-bar .lang-switch a:hover { color: var(--sr-nav-strong); background: var(--sr-nav-hover); }
.sr-portal-bar .lang-switch span[aria-current] { background: var(--sr-nav-strong); color: var(--sr-nav-bg); }

/* ---------- page column on moved pages ---------- */
.sr-portal-main { max-width: 1120px; margin: 0 auto; padding: var(--sr-space-7) var(--sr-space-6) var(--sr-space-9); box-sizing: border-box; }
.sr-portal-main > .sr-page-head { margin-bottom: var(--sr-space-5); }
.sr-portal-main > .sr-page-head > .sr-live { order: 2; } /* the live note sits after the title, not above it */
.sr-portal-notice { max-width: 820px; margin: var(--sr-space-4) auto 0; display: flex; flex-wrap: wrap; gap: var(--sr-space-2); align-items: baseline; }
.sr-portal-main > .sr-portal-notice { max-width: none; margin: 0 0 var(--sr-space-4); }
.sr-portal-notice a { font-weight: var(--sr-weight-semibold); }
.sr-portal-foot { text-align: center; font-size: var(--sr-size-xs); color: var(--sr-text-faint); padding: var(--sr-space-4) 0 var(--sr-space-6); margin: 0; }

/* the install-the-app card (cust-lang.css, shared with pages not on the kit) wears the kit's colours here, light and dark */
body.sr-portal--kit .app-install { background: var(--sr-surface); border-color: var(--sr-line); border-left-color: var(--sr-accent); }
body.sr-portal--kit .app-install__body h3 { color: var(--sr-heading); }
body.sr-portal--kit .app-install__body p { color: var(--sr-text-soft); }
body.sr-portal--kit .app-install__how { color: var(--sr-text) !important; }
body.sr-portal--kit .app-install__icon { background: var(--sr-surface); border-color: var(--sr-line); }
body.sr-portal--kit .app-install__btn { background: var(--sr-accent); color: var(--sr-accent-ink); }
body.sr-portal--kit .app-install__later { background: var(--sr-surface); border-color: var(--sr-line-strong); color: var(--sr-text-soft); }

/* a small form that is only a button (Send me a copy) sits in the line */
.sr-inline-form { display: inline; margin: 0; }

/* ---------- one pop-up stack (flash notices and the kit's pop-ups) ---------- */
body.sr-portal .sr-toasts > .toast-stack { position: static; inset: auto; transform: none; width: auto; max-width: none; margin: 0; display: flex; flex-direction: column; gap: var(--sr-space-2); pointer-events: none; }
body.sr-portal .sr-toasts .toast { pointer-events: auto; margin: 0; background: var(--sr-surface); color: var(--sr-text); border: 1px solid var(--sr-line); border-left: 4px solid var(--sr-info-ink); border-radius: var(--sr-radius-md); box-shadow: var(--sr-shadow-2); font-family: var(--sr-font-body); font-size: var(--sr-size-md); }
body.sr-portal .sr-toasts .toast--success { border-left-color: var(--sr-success-ink); }
body.sr-portal .sr-toasts .toast--error { border-left-color: var(--sr-danger-ink); }

/* ---------- phone tab bar ---------- */
.sr-portal-tabbar { display: none; }

@media (max-width: 959px) {
  body.sr-portal { --sr-portal-bar-h: 60px; }
  .sr-portal-bar__in { padding: 0 var(--sr-space-4); gap: var(--sr-space-3); }
  .sr-portal-nav, .sr-portal-account { display: none; }
  .sr-portal-menu { display: block; }
  .sr-portal-bar__end { gap: var(--sr-space-2); }
  .sr-portal-pop--end .sr-portal-menu__panel { position: fixed; top: var(--sr-portal-bar-h); left: var(--sr-space-2); right: var(--sr-space-2); max-height: calc(100dvh - var(--sr-portal-bar-h) - 88px - env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
  .sr-portal-main { padding: var(--sr-space-5) var(--sr-space-4) var(--sr-space-8); }
  /* customers tap: buttons and boxes are thumb-sized on a phone */
  body.sr-portal--kit { --sr-control-h: 44px; }
  body.sr-portal--kit .sr-btn--sm { min-height: 40px; }

  body.sr-portal--tabs { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .sr-portal-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 800; display: flex; justify-content: space-around; background: var(--sr-surface); border-top: 1px solid var(--sr-line); padding: var(--sr-space-1) var(--sr-space-1) calc(var(--sr-space-1) + env(safe-area-inset-bottom)); box-shadow: var(--sr-shadow-2); font-family: var(--sr-font-body); }
  .sr-portal-tabbar__item { flex: 1; max-width: 120px; min-height: 56px; min-width: var(--sr-tap); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: var(--sr-radius-md); color: var(--sr-text-soft); text-decoration: none; font-size: var(--sr-size-xs); font-weight: var(--sr-weight-medium); text-align: center; line-height: 1.2; }
  .sr-portal-tabbar__item svg { width: 22px; height: 22px; }
  .sr-portal-tabbar__item:hover { color: var(--sr-text); background: var(--sr-surface-2); }
  .sr-portal-tabbar__item.is-active { color: var(--sr-heading); font-weight: var(--sr-weight-bold); }
  .sr-portal-tabbar__item.is-active { background: var(--sr-surface-2); }
  .sr-portal-tabbar__item.is-active svg { color: var(--sr-heading); } /* v1.324: orange is kept for the main action only */

  /* floating things ride above the tab bar */
  body.sr-portal--tabs .sr-toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.sr-portal--tabs .sr-live--float { bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.sr-portal--tabs .pwa-banner { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .sr-portal-menu__btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .sr-portal-menu__btn { width: var(--sr-tap); justify-content: center; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { .sr-portal-pop[open] .sr-portal-pop__panel { animation: none; } .sr-portal-pop__chev { transition: none; } }
@media print { .sr-portal-bar, .sr-portal-tabbar { display: none !important; } body.sr-portal--tabs { padding-bottom: 0; } }

/* ---------- v1.310: the business portals (partners, suppliers, building agents) wear the same frame ---------- */
.sr-biz-label { font-size: var(--sr-size-sm); font-weight: var(--sr-weight-semibold); color: var(--sr-text-soft); padding-left: var(--sr-space-3); border-left: 1px solid var(--sr-line); white-space: nowrap; margin-left: calc(var(--sr-space-3) * -1); }
.sr-biz-who { display: flex; flex-direction: column; gap: 2px; }
.sr-biz-who__main { font-weight: var(--sr-weight-semibold); color: var(--sr-heading); font-size: var(--sr-size-md); }
.sr-biz-who__sub { font-size: var(--sr-size-sm); color: var(--sr-text-soft); }
.sr-portal-nav__link .sr-badge, .sr-portal-pop__link .sr-badge { margin-left: var(--sr-space-1); }
@media (max-width: 959px) { .sr-biz-label { display: none; } }
.sr-portal-tabbar__item { position: relative; }
.sr-portal-tabbar__badge { position: absolute; top: 4px; left: calc(50% + 6px); }

/* ---------- v1.324: the teal frame — the bar wears the staff menu's tokens (--sr-nav-*); pop-over panels stay white ---------- */
.sr-portal-bar .sr-portal-nav__link { color: var(--sr-nav-ink-soft); }
.sr-portal-bar .sr-portal-nav__link:hover { color: var(--sr-nav-strong); background: var(--sr-nav-hover); }
.sr-portal-bar .sr-portal-nav__link.is-active { color: var(--sr-nav-strong); background: var(--sr-nav-active-bg); box-shadow: inset 0 -3px 0 var(--sr-nav-active); }
.sr-portal-bar .sr-portal-nav .sr-badge { background: var(--sr-nav-badge-bg); color: var(--sr-nav-badge-ink); }
.sr-portal-bar .sr-biz-label { color: var(--sr-nav-ink-soft); border-left-color: var(--sr-nav-line); }
.sr-portal-bar .sr-portal-account__btn .sr-avatar { background: var(--sr-nav-active-bg); color: var(--sr-nav-strong); }
.sr-portal-bar .sr-portal-account__btn:hover .sr-avatar { box-shadow: 0 0 0 3px var(--sr-nav-hover); }
.sr-portal-bar .sr-portal-menu__btn { background: transparent; border-color: var(--sr-nav-line); color: var(--sr-nav-strong); }
.sr-portal-bar .sr-portal-menu[open] .sr-portal-menu__btn { background: var(--sr-nav-hover); }
.sr-portal-bar .sr-portal-nav__link:focus-visible, .sr-portal-bar .sr-portal-account__btn:focus-visible, .sr-portal-bar .sr-portal-menu__btn:focus-visible, .sr-portal-bar .sr-portal-bar__logo:focus-visible { outline-color: var(--sr-nav-strong); }

/* v1.326 PREMIUM: on the teal portal bar the focus line is the bar's strong ink (the teal focus token would not show) */
.sr-portal-bar :focus-visible { outline-color: var(--sr-nav-strong); }
