/* Members Portal 2.0 (row #4316): the Apple-style shell. Approved boards live in
   docs/mockup/portal-2/. Colours are rgb triplets so the Tailwind tokens in
   base.html (bg, panel, fg, muted ...) keep working on every older page.
   Dark is the default; html[data-theme="light"] is set by the head script from
   the saved choice, else the device setting. */
:root {
  --bg: 0 0 0; --bg2: 18 18 20; --panel: 28 28 30; --panelhi: 44 44 46; --border: 58 58 60;
  --text: 245 245 247; --muted: 161 161 166; --dim: 128 128 133;
  --primary: 10 132 255; --primaryhi: 64 156 255; --onprimary: 255 255 255;
  --success: 48 209 88; --warn: 255 159 10; --danger: 255 105 97;
  --gold: 214 188 122; --goldhi: 240 222 170;
  --seg: rgba(118,118,128,.24); --line: rgba(255,255,255,.08); --line2: rgba(255,255,255,.18);
  --nav: rgba(22,22,24,.72); --track: #3a3a3c; --shadow: none; --wordgold: #D6BC7A;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: 245 245 247; --bg2: 236 236 240; --panel: 255 255 255; --panelhi: 242 242 247; --border: 210 210 215;
  --text: 29 29 31; --muted: 110 110 115; --dim: 134 134 139;
  --primary: 0 113 227; --primaryhi: 0 102 204;
  --success: 36 138 61; --warn: 201 104 0; --danger: 215 0 21;
  --gold: 138 109 37; --goldhi: 176 140 60;
  --seg: rgba(118,118,128,.12); --line: rgba(0,0,0,.08); --line2: rgba(0,0,0,.18);
  --nav: rgba(255,255,255,.72); --track: #e5e5ea; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06); --wordgold: #8A6D25;
  color-scheme: light;
}
html, body { background: rgb(var(--bg)); }
body.portal { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; color: rgb(var(--text)); transition: background .3s ease; }

/* top bar */
.p-top { position: sticky; top: 0; z-index: 40; background: var(--nav); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.p-top-in { max-width: 1280px; margin: 0 auto; padding: 8px 32px; min-height: 60px; box-sizing: border-box; display: flex; align-items: center; gap: 16px; }
.p-brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 600; letter-spacing: -.01em; color: var(--wordgold); text-decoration: none; white-space: nowrap; }
.p-seg { display: flex; gap: 4px; padding: 3px; border-radius: 10px; background: var(--seg); }
.p-seg a { padding: 7px 14px; border-radius: 8px; font-size: 14px; font-weight: 500; color: rgb(var(--muted)); text-decoration: none; white-space: nowrap; }
.p-seg a:hover { color: rgb(var(--text)); }
.p-seg a.on { background: rgb(var(--panel)); color: rgb(var(--text)); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.p-getapp { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 18px; background: rgb(var(--primary));
  color: #fff; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.p-getapp:hover { background: rgb(var(--primaryhi)); }
.p-icon { width: 44px; height: 44px; border: 0; border-radius: 22px; background: transparent; color: rgb(var(--muted)); cursor: pointer;
  display: flex; align-items: center; justify-content: center; }
.p-icon:hover { color: rgb(var(--text)); background: var(--seg); }
.p-avatar { width: 34px; height: 34px; border-radius: 17px; background: linear-gradient(135deg, #8E8E93, #48484A); color: #fff; font-size: 14px;
  font-weight: 600; display: flex; align-items: center; justify-content: center; }
.p-theme .sun { display: none; } html[data-theme="dark"] .p-theme .sun, html:not([data-theme]) .p-theme .sun { display: block; }
html[data-theme="dark"] .p-theme .moon, html:not([data-theme]) .p-theme .moon { display: none; }

/* menus (details/summary, no JS needed) */
.p-menu { position: relative; }
.p-menu > summary { list-style: none; cursor: pointer; }
.p-menu > summary::-webkit-details-marker { display: none; }
.p-menu-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; max-width: calc(100vw - 24px); padding: 8px; border-radius: 16px;
  background: rgb(var(--panel)); border: 1px solid var(--line); box-shadow: 0 18px 48px rgba(0,0,0,.35); z-index: 60; }
.p-menu-pop a, .p-menu-pop button.item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; font-size: 15px;
  color: rgb(var(--text)); text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; font-family: inherit; }
.p-menu-pop a:hover, .p-menu-pop button.item:hover { background: var(--seg); }
.p-menu-pop .navhead { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgb(var(--dim)); padding: 10px 12px 4px; }
.p-menu-pop .who { padding: 8px 12px 10px; font-size: 13px; color: rgb(var(--dim)); border-bottom: 1px solid var(--line); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-admin-btn { height: 32px; padding: 0 12px; border-radius: 16px; background: var(--seg); color: rgb(var(--muted)); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* page */
.p-main { max-width: 1280px; margin: 0 auto; padding: 48px 32px 96px; box-sizing: border-box; }
.p-stack { display: flex; flex-direction: column; gap: 56px; }
.p-h1 { margin: 0; font-size: 52px; line-height: 1.05; font-weight: 700; letter-spacing: -.025em; }
.p-h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.015em; }
.p-sub { color: rgb(var(--muted)); }
.p-card { border-radius: 24px; background: rgb(var(--panel)); box-shadow: var(--shadow); }
.p-chip { font-size: 13px; padding: 5px 10px; border-radius: 9px; background: var(--seg); color: rgb(var(--muted)); white-space: nowrap; }
.p-btn { height: 44px; padding: 0 16px; border-radius: 12px; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; text-decoration: none; border: 0; cursor: pointer; font-family: inherit; box-sizing: border-box; }
.p-btn svg { flex: none; }
.p-app .p-btn { white-space: nowrap; padding: 0 10px; font-size: 14.5px; }
.p-btn-fill { background: rgb(var(--primary)); color: #fff; } .p-btn-fill:hover { background: rgb(var(--primaryhi)); }
.p-btn-seg { background: var(--seg); color: rgb(var(--text)); } .p-btn-seg:hover { opacity: .85; }
.p-pill { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: 15px; font-size: 12px; font-weight: 800; letter-spacing: .22em;
  border: 1px solid rgb(var(--tier) / .4); background: rgb(var(--tier) / .08); color: rgb(var(--tierink)); }
.p-pill[data-tier="ai"], .p-tierink[data-tier="ai"] { --tier: 230 235 243; --tierink: 230 235 243; }
.p-pill[data-tier="wealth"], .p-tierink[data-tier="wealth"] { --tier: 52 211 153; --tierink: 52 211 153; }
.p-pill[data-tier="retention"], .p-tierink[data-tier="retention"] { --tier: 127 180 255; --tierink: 127 180 255; }
.p-pill[data-tier="free"], .p-pill[data-tier="unknown"] { --tier: 161 161 166; --tierink: 161 161 166; }
html[data-theme="light"] .p-pill[data-tier="ai"], html[data-theme="light"] .p-tierink[data-tier="ai"] { --tierink: 58 63 71; --tier: 58 63 71; }
html[data-theme="light"] .p-pill[data-tier="wealth"], html[data-theme="light"] .p-tierink[data-tier="wealth"] { --tierink: 11 122 82; --tier: 11 122 82; }
html[data-theme="light"] .p-pill[data-tier="retention"], html[data-theme="light"] .p-tierink[data-tier="retention"] { --tierink: 29 95 194; --tier: 29 95 194; }

.p-tierink { color: rgb(var(--tierink)); }

/* app cards */
.p-apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.p-app { position: relative; overflow: hidden; border-radius: 26px; background: rgb(var(--panel)); box-shadow: var(--shadow); padding: 24px;
  display: flex; flex-direction: column; gap: 16px; }
.p-app .halo { position: absolute; top: -90px; right: -90px; width: 240px; height: 240px; border-radius: 120px; opacity: .12; pointer-events: none; }
.p-appicon { position: relative; width: 72px; height: 72px; flex: none; border-radius: 17px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.3); }
.p-app[data-state="locked"] .p-appicon, .p-app[data-state="soon"] .p-appicon { opacity: .45; }

/* the wallet-style membership card */
.p-wallet { position: relative; box-sizing: border-box; min-height: 170px; padding: 20px 22px; border-radius: 20px; overflow: hidden; display: flex;
  flex-direction: column; justify-content: space-between; box-shadow: 0 10px 30px rgba(0,0,0,.25); text-decoration: none; }
.p-wallet[data-tier="ai"] { background: linear-gradient(135deg, #F4F6FA 0%, #C9CFD8 45%, #EEF1F5 70%, #AEB5C0 100%); color: #1D1D1F; }
.p-wallet[data-tier="wealth"] { background: linear-gradient(135deg, #0F5C43 0%, #1F9D6B 50%, #0B4433 100%); color: #fff; }
.p-wallet[data-tier="retention"] { background: linear-gradient(135deg, #123A7A 0%, #2F6FD1 50%, #0E2C5E 100%); color: #fff; }
.p-wallet[data-tier="free"], .p-wallet[data-tier="unknown"] { background: linear-gradient(135deg, #3A3A3C, #1C1C1E); color: #fff; }

/* set-up checklist */
.p-step { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); }
.p-tick { width: 26px; height: 26px; flex: none; border-radius: 13px; border: 2px solid var(--line2); background: transparent; display: flex; align-items: center;
  justify-content: center; box-sizing: border-box; cursor: pointer; padding: 0; color: transparent; }
.p-step.done .p-tick { background: rgb(var(--primary)); border-color: rgb(var(--primary)); color: #fff; }
.p-step.done .lbl { color: rgb(var(--muted)); }
.p-step .go { display: none; }
.p-step.next .go { display: inline-flex; }
.p-stepchip { width: 30px; height: 30px; flex: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; }

/* phone: bottom tab bar, compact top bar */
.p-tabs { display: none; }
@media (max-width: 860px) {
  .p-top-in { padding: 6px 16px; min-height: 52px; gap: 8px; }
  .p-seg, .p-getapp .txt, .p-hide-sm { display: none !important; }
  .p-getapp { width: 36px; padding: 0; justify-content: center; }
  .p-main { padding: 24px 16px calc(96px + env(safe-area-inset-bottom)); }
  .p-stack { gap: 36px; }
  .p-h1 { font-size: 34px; }
  .p-h2 { font-size: 22px; }
  .p-apps { grid-template-columns: 1fr; }
  .p-tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--nav); backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .p-tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; font-size: 10.5px; font-weight: 500;
    color: #8E8E93; text-decoration: none; min-height: 44px; justify-content: center; }
  .p-tabs a.on { color: var(--wordgold); }
}

/* Older pages inside the new shell: softer cards, Apple radius. */
.p-main .rounded-lg { border-radius: 20px; }
.p-main .border-border\/70 { border-color: var(--line); }
.p-main section.bg-panel, .p-main div.bg-panel { box-shadow: var(--shadow); }
.p-main .btn { border-radius: 12px; min-height: 44px; }
.p-main .input { border-radius: 12px; }
.p-main .display { font-family: inherit; font-weight: 700; letter-spacing: -.015em; }
.p-main .wordmark { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
[hidden] { display: none !important; }

/* Live calls (row #4317) */
.p-calls { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.p-call { overflow: hidden; display: flex; flex-direction: column; }
.p-call img { width: 100%; height: auto; aspect-ratio: 5 / 2; object-fit: cover; display: block; }
.p-call.locked img { opacity: .45; }
.p-call .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.p-sq { width: 44px; height: 44px; padding: 0; flex: none; justify-content: center; }
.p-bell[aria-pressed="true"] { background: rgba(48,209,88,.16); color: #30D158; }
.p-alertline { color: rgb(var(--muted)); }
.p-call[data-alert="on"] .p-alertline { color: #30D158; }
.p-switchbtn { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px; border: 0; border-radius: 22px; color: rgb(var(--text)); font-size: 15px; font-weight: 500; cursor: pointer; }
.p-switchbtn[disabled] { opacity: .6; cursor: default; }
.p-switch { width: 44px; height: 26px; border-radius: 13px; background: var(--seg); position: relative; display: inline-block; transition: background .2s; }
.p-switch span { position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 11px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .2s; }
[aria-pressed="true"] > .p-switch { background: #30D158; }
[aria-pressed="true"] > .p-switch span { left: 20px; }
.p-alertstrip { display: flex; align-items: center; gap: 14px; padding: 14px 16px; flex-wrap: wrap; }

/* Today tiles (row #4381, board Main.dc.html) */
.p-tile { flex: 1 1 250px; min-height: 196px; box-sizing: border-box; padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.p-tile-wide { flex: 2 1 520px; gap: 14px; }
.p-tile-dash { border: 1px dashed var(--line2); box-shadow: none; }
.p-mode { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--seg); }
.p-mode button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; background: transparent; color: rgb(var(--muted)); }
.p-mode button[aria-pressed="true"] { background: rgb(var(--panel)); color: rgb(var(--text)); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.p-strats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.p-strats[hidden] { display: none; }
.p-tile .p-chip { white-space: normal; }
.p-strat { padding: 14px 16px; border-radius: 16px; background: rgb(var(--panelhi)); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
@media (max-width: 560px) { .p-tile-wide { flex-basis: 100%; } .p-mode button { padding: 0 9px; } }
