/*
 * Trade Wizards brand layer for the shared portal (dashboard, sign up, sign in).
 * Built from the Plumbing Wizards "Violet Spell" layer; every color is a variable so each trade
 * gets its own look from html[data-trade] (set by /trade.js):
 *   parent  (tradewizards.video)   violet #3A2377 · yellow #FFC400  (same as plumbing)
 *   plumbing (plumbingwizards.video) violet #3A2377 · yellow #FFC400 · cream #FFF6DD
 *   marine  (boatwizards.com)      navy #003366 · orange #FF6B35
 * Loaded LAST in portal.html so it wins over web-theme.css and the inline styles.
 */
:root {
  --pw-violet: #3A2377; --pw-violet-d: #2A1858; --pw-violet-dd: #1E1142;
  --pw-yellow: #FFC400; --pw-yellow-d: #E6B000;
  --pw-ink: #15151A; --pw-cream: #FFF6DD; --pw-copper: #CC6A2C;
  --pw-paper: #FBF7EC; --pw-line: #E8DFC8; --pw-tint: #F1ECFA; --pw-muted: #4A4560;
  --pw-cream-rgb: 255,246,221; --pw-violet-rgb: 58,35,119; --pw-violet-dd-rgb: 30,17,66; --pw-yellow-rgb: 255,196,0;
  --pw-display: 'Avenir Next Condensed', 'Barlow Condensed', 'DIN Condensed', 'Arial Narrow', Impact, sans-serif;
  --pw-body: 'Avenir Next', 'Barlow', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --portal-accent: #3A2377;
  --portal-accent-hover: #2A1858;
}
html[data-trade="marine"] {
  --pw-violet: #003366; --pw-violet-d: #002447; --pw-violet-dd: #00172E;
  --pw-yellow: #FF6B35; --pw-yellow-d: #E85A26;
  --pw-cream: #F3F6FA; --pw-paper: #F5F7FA; --pw-line: #DCE3EC; --pw-tint: #E8EEF6; --pw-muted: #44546A;
  --pw-cream-rgb: 243,246,250; --pw-violet-rgb: 0,51,102; --pw-violet-dd-rgb: 0,23,46; --pw-yellow-rgb: 255,107,53;
  --pw-display: 'Inter', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
  --pw-body: 'Inter', 'Avenir Next', 'Helvetica Neue', Arial, sans-serif;
  --portal-accent: #003366;
  --portal-accent-hover: #002447;
}

/* ---------- Type ---------- */
html body, html body * { font-family: var(--pw-body); }
html body .font-mono, html body code, html body pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pw-disp,
#signupCard h2, #loginCard h2, #verifyEmailCard h2, #portalLoading h2 {
  font-family: var(--pw-display) !important; font-weight: 800; text-transform: uppercase; letter-spacing: .01em; line-height: 1;
}
#signupCard h2, #loginCard h2, #verifyEmailCard h2 { font-size: 2.4rem !important; }

/* ---------- Page ---------- */
html[data-theme="light"] body, html[data-theme="light"] body.bg-black { background-color: var(--pw-paper) !important; color: var(--pw-ink) !important; }
html:not([data-theme="light"]) body, html:not([data-theme="light"]) body.bg-black { background-color: var(--pw-violet-dd) !important; color: var(--pw-cream) !important; }

/* ---------- Header: violet bar like the card front ---------- */
html body header.pw-header { background: var(--pw-violet) !important; border-bottom: 4px solid var(--pw-yellow) !important; backdrop-filter: none; }
.pw-header .pw-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.pw-header .pw-brand img { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.pw-header .pw-wordmark { font-family: var(--pw-display) !important; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; color: var(--pw-yellow) !important; font-size: 1.35rem; line-height: 1; }
html body .pw-header #portalWelcome { -webkit-text-fill-color: var(--pw-cream); color: var(--pw-cream) !important; background: none; font-family: var(--pw-display) !important; font-weight: 800; text-transform: uppercase; font-size: 1.6rem; line-height: 1.05; margin-top: 2px; }
html body .pw-header #portalUsername { color: rgba(var(--pw-cream-rgb),.75) !important; }
html body .pw-header .portal-btn-secondary { background: transparent !important; color: var(--pw-cream) !important; border: 2px solid var(--pw-cream) !important; border-radius: 999px; }
html body .pw-header .portal-btn-secondary:hover { background: rgba(var(--pw-cream-rgb),.12) !important; }
html body .pw-header #headerAvatarBtn { background: var(--pw-yellow) !important; color: var(--pw-ink) !important; }
html body .pw-header #headerUnreadBadge { background: var(--pw-ink) !important; color: var(--pw-yellow) !important; }
@media (max-width: 480px) {
  .pw-header .pw-wordmark { font-size: 1.1rem; }
  html body .pw-header #portalWelcome { font-size: 1.3rem; }
  .pw-header .pw-brand img { width: 38px; height: 38px; }
}

/* ---------- Cards ---------- */
html[data-theme="light"] .card { background: #fff !important; border: 1px solid var(--pw-line) !important; border-radius: 1.25rem; box-shadow: 0 2px 0 var(--pw-line); }
html:not([data-theme="light"]) .card { background: var(--pw-violet-d) !important; border: 1px solid rgba(var(--pw-yellow-rgb),.18) !important; }
html[data-theme="light"] .card h2, html[data-theme="light"] .card h3 { color: var(--pw-violet) !important; }
html:not([data-theme="light"]) .card h2, html:not([data-theme="light"]) .card h3 { color: var(--pw-cream) !important; }
html[data-theme="light"] .gradient-text { background: none; -webkit-text-fill-color: var(--pw-violet); color: var(--pw-violet); }
html:not([data-theme="light"]) .gradient-text { background: none; -webkit-text-fill-color: var(--pw-cream); color: var(--pw-cream); }

/* Dark theme: remap Tailwind grays to the violet family */
html:not([data-theme="light"]) .bg-black { background-color: var(--pw-violet-dd) !important; }
html:not([data-theme="light"]) .bg-gray-950, html:not([data-theme="light"]) .bg-gray-900 { background-color: var(--pw-violet-dd) !important; }
html:not([data-theme="light"]) .bg-gray-800 { background-color: #3B2A73 !important; }
html:not([data-theme="light"]) .bg-gray-900\/60 { background-color: rgba(var(--pw-violet-dd-rgb),.6) !important; }
html:not([data-theme="light"]) .border-gray-700, html:not([data-theme="light"]) .border-gray-800, html:not([data-theme="light"]) .border-gray-600 { border-color: rgba(var(--pw-cream-rgb),.18) !important; }
html:not([data-theme="light"]) .text-gray-300, html:not([data-theme="light"]) .text-gray-400 { color: rgba(var(--pw-cream-rgb),.82) !important; }
html:not([data-theme="light"]) .text-gray-500 { color: rgba(var(--pw-cream-rgb),.62) !important; }

/* ---------- Buttons ---------- */
html body .portal-btn { border-radius: 999px; font-weight: 700; }
html body .portal-btn-primary,
html body .portal-btn.portal-btn-primary,
html[data-theme="light"] body .portal-btn-primary,
html[data-theme="light"] body .portal-btn-primary:hover,
html body .bw-accent-btn,
html body .portal-chip-active,
html body a.bg-red-600, html body button.bg-red-600:not(#incomingCallDeclineBtn) {
  background: var(--pw-yellow) !important; color: var(--pw-ink) !important;
  border: 2px solid var(--pw-ink) !important; box-shadow: 0 3px 0 var(--pw-ink);
  font-family: var(--pw-display) !important; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; font-size: 1rem;
}
html body .portal-btn-primary:hover, html body .bw-accent-btn:hover,
html body a.bg-red-600:hover, html body button.bg-red-600:not(#incomingCallDeclineBtn):hover { background: var(--pw-yellow-d) !important; }
html body .portal-btn-primary:active, html body .bw-accent-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--pw-ink); }
html:not([data-theme="light"]) .portal-btn-primary { border-color: var(--pw-yellow) !important; box-shadow: none; }
html[data-theme="light"] .portal-btn-secondary, html[data-theme="light"] .portal-chip { border: 2px solid var(--pw-violet) !important; color: var(--pw-violet) !important; background: #fff !important; }
html[data-theme="light"] .portal-btn-secondary:hover, html[data-theme="light"] .portal-chip:hover { background: var(--pw-tint) !important; }
html:not([data-theme="light"]) .portal-btn-secondary, html:not([data-theme="light"]) .portal-chip { border: 2px solid rgba(var(--pw-cream-rgb),.6) !important; color: var(--pw-cream) !important; background: transparent !important; }
html body .portal-btn-success, html body button.bg-green-600, html body a.bg-green-600, html body .portal-topup-btn { border-radius: 999px; }
/* Big buttons on the sign-up / sign-in cards */
#signupSubmitBtn, #loginSubmitBtn, #verifyEmailCheckBtn { min-height: 60px; font-size: 1.5rem !important; }

/* ---------- Tabs ---------- */
html body .portal-tabbar { background: transparent !important; border-bottom: 0 !important; backdrop-filter: none; }
html body .portal-tab-btn { border-radius: 999px !important; font-weight: 700; }
html[data-theme="light"] .portal-tab-btn { color: var(--pw-violet) !important; }
html[data-theme="light"] .portal-tab-btn:hover { background: var(--pw-tint) !important; color: var(--pw-violet) !important; }
html:not([data-theme="light"]) .portal-tab-btn { color: rgba(var(--pw-cream-rgb),.8) !important; }
html:not([data-theme="light"]) .portal-tab-btn:hover { background: rgba(var(--pw-cream-rgb),.08) !important; color: var(--pw-cream) !important; }
html body .portal-tab-btn.active { background: var(--pw-violet) !important; color: var(--pw-yellow) !important; border-color: var(--pw-violet) !important; }
html:not([data-theme="light"]) .portal-tab-btn.active { background: var(--pw-yellow) !important; color: var(--pw-ink) !important; border-color: var(--pw-yellow) !important; }

/* ---------- Links + accents (old red) ---------- */
html[data-theme="light"] .text-red-400, html[data-theme="light"] .text-red-300,
html[data-theme="light"] .hover\:text-red-300:hover, html[data-theme="light"] .bw-text-link { color: var(--pw-violet) !important; }
html:not([data-theme="light"]) .text-red-400, html:not([data-theme="light"]) .text-red-300,
html:not([data-theme="light"]) .hover\:text-red-300:hover, html:not([data-theme="light"]) .bw-text-link { color: var(--pw-yellow) !important; }
html[data-theme="light"] .text-orange-300 { color: var(--pw-copper) !important; }
html:not([data-theme="light"]) .text-orange-300 { color: var(--pw-yellow) !important; }
html body .border-orange-700\/40 { border-color: var(--pw-yellow) !important; border-width: 2px !important; }
/* Error text (signup/login) must stay readable red */
#signupError, #loginError { color: #B3261E !important; font-weight: 700; }
html:not([data-theme="light"]) #signupError, html:not([data-theme="light"]) #loginError { color: #FFB4A8 !important; }

/* ---------- Forms ---------- */
html body input:focus, html body select:focus, html body textarea:focus { border-color: var(--pw-violet) !important; box-shadow: 0 0 0 3px rgba(var(--pw-violet-rgb),.18); outline: none; }
html:not([data-theme="light"]) input:focus { border-color: var(--pw-yellow) !important; box-shadow: 0 0 0 3px rgba(var(--pw-yellow-rgb),.25); }
#signupCard input[type="text"], #signupCard input[type="email"], #signupCard input[type="password"],
#loginCard input[type="email"], #loginCard input[type="password"] { font-size: 1.15rem; min-height: 54px; border-radius: 12px; }
#signupCard label.text-sm, #loginCard label.text-sm { font-size: 1.05rem; font-weight: 700; }
html[data-theme="light"] #signupCard label.text-sm, html[data-theme="light"] #loginCard label.text-sm { color: var(--pw-ink) !important; }
input[type="checkbox"] { accent-color: var(--pw-violet); width: 20px; height: 20px; }
html[data-theme="light"] #togglePasswordBtn, html[data-theme="light"] #toggleSignupPasswordBtn { border-radius: 999px; color: var(--pw-violet) !important; border-color: var(--pw-violet) !important; font-weight: 700; }

/* "I want to..." selector (non-pro sign up only) */
#accountTypeClient:checked + .account-type-card,
#accountTypeConsultant:checked + .account-type-card { border-color: var(--pw-violet) !important; background: var(--pw-tint) !important; box-shadow: 0 0 0 2px var(--pw-violet) !important; }
#accountTypeClient:checked + .account-type-card .account-type-title,
#accountTypeConsultant:checked + .account-type-card .account-type-title { color: var(--pw-violet) !important; }
#accountTypeClient:checked + .account-type-card .account-type-desc,
#accountTypeConsultant:checked + .account-type-card .account-type-desc { color: var(--pw-ink) !important; }

/* ---------- Sign-up card extras ---------- */
.pw-eyebrow { display: inline-block; background: var(--pw-yellow); color: var(--pw-ink); font-family: var(--pw-display); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: .95rem; padding: 5px 12px; border-radius: 6px; margin-bottom: 14px; }
.pw-sub { font-size: 1.1rem; font-weight: 600; }
html[data-theme="light"] .pw-sub { color: var(--pw-muted); }
.pw-link-preview { display: flex; align-items: center; flex-wrap: wrap; gap: 0; font-weight: 700; }
.pw-link-preview .pw-link-host { color: #6b6680; white-space: nowrap; }
.pw-langbar { display: flex; justify-content: flex-end; margin: -8px 0 8px; }
.pw-lang { border: 2px solid var(--pw-violet); color: var(--pw-violet); background: transparent; border-radius: 999px; padding: 2px 12px; font-family: var(--pw-display); font-weight: 800; letter-spacing: .06em; cursor: pointer; }
html:not([data-theme="light"]) .pw-lang { border-color: var(--pw-cream); color: var(--pw-cream); }
.pw-trust { margin-top: 14px; text-align: center; font-size: .95rem; font-weight: 600; }
html[data-theme="light"] .pw-trust { color: var(--pw-muted); }

/* Availability card + stat strip */
html[data-theme="light"] #availabilityToggleCard { border-color: var(--pw-violet) !important; }
html[data-theme="light"] #consultantActionStrip .bg-gray-900\/60 { background: var(--pw-paper) !important; }
html[data-theme="light"] #consultantActionStrip p.text-2xl { font-family: var(--pw-display); font-weight: 800; color: var(--pw-violet) !important; }
html[data-theme="light"] #stripPayout, html[data-theme="light"] #stripUpcoming { color: #1f7a4d !important; }
body.pw-pro #consultantFieldsBlock { display: none !important; }
#togglePasswordBtn, #toggleSignupPasswordBtn { top: 50% !important; transform: translateY(-50%) !important; }
/* Specificity bumps: beat web-theme.css + inline light-theme tab rules */
html body .portal-tabbar.portal-tabbar.portal-tabbar { background: transparent !important; border-bottom: 0 !important; backdrop-filter: none; }
html body .portal-tab-btn.portal-tab-btn.active { background: var(--pw-violet) !important; color: var(--pw-yellow) !important; border-color: var(--pw-violet) !important; }
html:not([data-theme="light"]) body .portal-tab-btn.portal-tab-btn.active { background: var(--pw-yellow) !important; color: var(--pw-ink) !important; border-color: var(--pw-yellow) !important; }
/* Phone header: brand on one line, buttons on the next */
.pw-header .pw-wordmark { white-space: nowrap; }
@media (max-width: 560px) {
  .pw-header > div { flex-wrap: wrap; row-gap: 10px; }
  .pw-header > div > a.pw-brand { flex: 1 1 100%; }
  .pw-header > div > div { width: 100%; justify-content: flex-start !important; }
  .pw-header > div > div:not(:has(:not(.hidden))) { display: none; }
}

/* Big, obvious role chooser at the top of sign up */
.pw-iam-label { font-family: var(--pw-display); font-weight: 900; font-size: 1.35rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 10px; }
html[data-theme="light"] .pw-iam-label { color: var(--pw-ink); }
.pw-role-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.pw-role-opt { cursor: pointer; display: block; }
.pw-role-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px !important; border-width: 2px !important; border-radius: 14px !important; text-align: left !important; min-height: 76px; }
.pw-role-icon { font-size: 2rem; line-height: 1; }
.pw-role-text { display: flex; flex-direction: column; flex: 1; }
.pw-role-title { font-family: var(--pw-display); font-size: 1.5rem; font-weight: 900; line-height: 1.1; }
.pw-role-desc { font-size: 1rem; margin-top: 2px; }
.pw-role-check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #9a94ad; color: transparent; display: flex; align-items: center; justify-content: center; font-weight: 900; flex: none; }
.sr-only:checked + .pw-role-card .pw-role-check { background: var(--pw-violet); border-color: var(--pw-violet); color: var(--pw-yellow); }
.sr-only:focus-visible + .pw-role-card { outline: 3px solid var(--pw-yellow); outline-offset: 2px; }
.pw-role-opt { position: relative; }
.pw-role-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

/* ---------- Trade picker (tradewizards.video sign up) ---------- */
.tw-trade-picker { margin: 0 0 18px; }
.tw-trade-picker-label { font-weight: 700; margin: 0 0 8px; }
.tw-trade-picker-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tw-trade-btn { padding: 16px 12px; border-radius: 14px; border: 2px solid var(--pw-violet); background: #fff; color: var(--pw-violet);
  font-family: var(--pw-display); font-weight: 800; text-transform: uppercase; font-size: 1.05rem; cursor: pointer; }
.tw-trade-btn.is-on { background: var(--pw-violet); color: var(--pw-yellow); box-shadow: 0 0 0 3px rgba(var(--pw-yellow-rgb), .45); }
html:not([data-theme="light"]) .tw-trade-btn { background: transparent; color: var(--pw-cream); border-color: var(--pw-cream); }
html:not([data-theme="light"]) .tw-trade-btn.is-on { background: var(--pw-yellow); color: var(--pw-ink); border-color: var(--pw-yellow); }
