/* Portal shell: sidebar + topbar + main + the public footer. Tokens (--brand, --text, --border, ...) come from
   pages/css/landing.css; components, utilities and the new tokens (--danger, --live, --line2) from app.css (loaded after
   this file). Rules: weights <= 500, no hex colours, hairline borders, no shadows (portal_web/tests/test_design_rules.py). */
[x-cloak] { display: none !important; }

/* Base typography + links for everything inside the portal: no browser-default blue/purple underlined links. */
.pw-shell, .pw-login { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
.pw-shell a, .pw-login a { text-decoration: none; text-underline-offset: 3px; }
/* Plain links read as links on any surface: the surrounding text colour, underlined. Classed links are buttons, cards and
   tiles that set their own colours. */
.pw-shell a:not([class]), .pw-shell a:not([class]):visited, .pw-login a:not([class]), .pw-login a:not([class]):visited { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; }
.pw-shell a:focus-visible, .pw-shell button:focus-visible { outline: 2px solid var(--brand-deep); outline-offset: 2px; border-radius: 6px; }
/* Slim progress bar while htmx is fetching (boosted navigation, load-more, forms). */
.pw-progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--brand-deep); z-index: 400; opacity: 0; transition: width .4s ease, opacity .2s ease; }
.htmx-request .pw-progress, .pw-progress.htmx-request { opacity: 1; width: 70%; transition: width 2s cubic-bezier(.1,.7,.3,1); }

.pw-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
.pw-skip { position: absolute; left: -999px; top: 8px; z-index: 300; background: var(--surface); color: var(--text); padding: 8px 14px; border: 1px solid var(--border-strong); }
.pw-skip:focus { left: 8px; }

/* Sidebar */
.pw-sidebar { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; padding: 22px 14px 28px; background: var(--surface); border-right: 1px solid var(--border); }
.pw-sidebar-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 0 10px 22px; }
.pw-brand { display: flex; flex-direction: column; line-height: 1; }
.pw-brand img { height: 34px; width: auto; display: block; }
.pw-brand-tag { font-family: 'EB Garamond', Georgia, serif; font-style: italic; font-size: 10.5px; letter-spacing: 0.14em; color: var(--text-soft); margin-top: 4px; }
.pw-nav-group { margin-bottom: 18px; }
.pw-nav-heading { padding: 0 10px 6px; font-size: 10.5px; color: var(--text-soft); }
.pw-nav-heading::before { width: 12px; }
.pw-nav-group ul { list-style: none; }
.pw-nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--text-mid); text-decoration: none; font-size: 14.5px; font-weight: 400; line-height: 1.3; }
.pw-nav-link:hover { background: var(--bg); color: var(--text); }
.pw-nav-link.is-active { background: var(--brand-tint); color: var(--text); }
.pw-nav-link .pw-icon { font-size: 21px; color: var(--text-soft); }
.pw-nav-link.is-active .pw-icon { color: var(--brand-deep); }
.pw-scrim { display: none; }

/* Body, topbar, main */
.pw-body { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.pw-topbar { display: flex; align-items: center; gap: 14px; padding: 16px 32px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pw-topbar-titles { flex: 1; min-width: 0; }
.pw-topbar .eyebrow { margin-bottom: 4px; }
.pw-topbar h1 { font-family: 'EB Garamond', Georgia, serif; font-weight: 400; font-size: 28px; line-height: 1.15; color: var(--text); }
.pw-topbar p { font-size: 13.5px; color: var(--text-mid); }
.pw-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; background: none; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--text); cursor: pointer; }
.pw-icon-btn:hover { background: var(--brand-tint); }
.pw-drawer-close, .pw-menu-btn { display: none; }

/* Avatar dropdown */
.pw-user { position: relative; }
.pw-user-btn { display: inline-flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; font: inherit; font-size: 13.5px; color: var(--text-mid); background: none; border: 1px solid transparent; border-radius: 999px; cursor: pointer; }
.pw-user-btn:hover { background: var(--bg); border-color: var(--border); }
.pw-user-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 190px; padding: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; }
.pw-user-menu form { margin: 0; }
.pw-user-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; font: inherit; font-size: 14px; color: var(--text); text-align: left; text-decoration: none; background: none; border: 0; border-radius: 6px; cursor: pointer; }
.pw-user-item:hover { background: var(--brand-tint); }
.pw-user-item .pw-icon { color: var(--text-soft); }

.pw-main { padding: 28px 32px 56px; max-width: 1100px; width: 100%; margin: 0 auto; outline: none; }
.pw-coming-soon h2 { font-family: 'EB Garamond', Georgia, serif; font-weight: 400; font-size: 24px; margin-bottom: 6px; }

/* Primitives older module templates still use (the .card/.eyebrow/.empty/.btn components in app.css are the new names). */
.pw-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 20px 22px; }
.pw-eyebrow { font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-mid); }
.pw-empty { text-align: center; padding: 40px 16px; color: var(--text-mid); }
.pw-empty h2 { font-family: 'EB Garamond', Georgia, serif; font-weight: 400; color: var(--text); font-size: 22px; }
.pw-form-error { color: var(--danger); background: var(--danger-tint); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; }
.pw-btn-quiet { font: inherit; font-size: 13px; background: none; border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 14px; color: var(--text); cursor: pointer; }
.pw-btn-quiet:hover { background: var(--brand-tint); }
.pw-btn-primary { margin-top: 20px; width: 100%; font: inherit; font-weight: 500; background: var(--cta); color: var(--cta-label); border: 1px solid var(--brand); border-radius: 8px; padding: 11px 16px; cursor: pointer; }
.pw-btn-primary:hover { background: var(--cta-deep); }

/* Login and account screens: a centred card (auth templates use the .field/.btn components). */
.pw-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.pw-login-card { width: 100%; max-width: 420px; padding: 32px 30px; }
.pw-login-brand { display: flex; flex-direction: column; line-height: 1; margin-bottom: 22px; }
.pw-login-brand img { height: 38px; width: auto; display: block; }
.pw-login h1 { font-family: 'EB Garamond', Georgia, serif; font-weight: 400; font-size: 30px; line-height: 1.15; margin-bottom: 14px; }

/* Mobile: the sidebar becomes an off-canvas drawer behind the topbar's menu button. */
@media (max-width: 900px) {
  .pw-shell { grid-template-columns: minmax(0, 1fr); }
  .pw-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 210; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .25s ease; }
  .pw-sidebar.is-open { transform: none; }
  .pw-scrim { display: block; position: fixed; inset: 0; z-index: 200; background: var(--text); opacity: 0.4; }
  .pw-drawer-close, .pw-menu-btn { display: inline-flex; }
  .pw-topbar, .pw-main { padding-left: 18px; padding-right: 18px; }
  .pw-topbar h1 { font-size: 24px; }
  .pw-user-name { display: none; }
}

/* Icons: Material Symbols Outlined (= Flutter's Icons.*), via {% icon %}. Self-hosted and trimmed to the one optical
   size/weight we use (opsz 24, wght 400, GRAD 0) with the FILL axis kept for active items: ~470 KB instead of Google's
   ~2.2 MB variable font, and no third-party request in the critical path. Apache-2.0 (Google Material Symbols). */
@font-face { font-family: 'Material Symbols Outlined'; font-style: normal; font-weight: 400; font-display: block;
  src: url("../fonts/material-symbols-outlined-24-400.f71a909ec1e2.woff2") format('woff2'); }
.material-symbols-outlined { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; line-height: 1;
  letter-spacing: normal; text-transform: none; white-space: nowrap; word-wrap: normal; direction: ltr;
  -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga'; }
.pw-icon { font-size: 20px; line-height: 1; width: 1em; height: 1em; display: inline-flex; align-items: center; justify-content: center;
  flex: none; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; user-select: none; overflow: hidden; }

/* Slim portal footer (portal_web/_footer.html). */
.pw-footer { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; padding: 18px 32px 22px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-soft); }
.pw-footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pw-footer-link { color: var(--text-soft); }
.pw-footer-link:hover { color: var(--text); text-decoration: underline; }
