/*
 * TradingHub sign-in, registration, password recovery and invitation pages (November 2026).
 * Professional fintech look: navy brand panel, slate surfaces, one blue accent. Follows the platform's light / dark
 * choice through html[data-theme-resolved] (set by theme/boot). Everything is scoped to .tha so no other page changes.
 * Contrast: body text >= 7:1 and muted text >= 4.5:1 on its surface in both themes; focus ring is 3px.
 */
.tha {
    --tha-bg: #f3f6fb;
    --tha-surface: #ffffff;
    --tha-surface-2: #f5f8fc;
    --tha-border: #d5deea;
    --tha-border-strong: #9aabc2;
    --tha-text: #0f1b2d;
    --tha-muted: #4a5b73;
    --tha-accent: #1d4ed8;
    --tha-accent-hover: #1e40af;
    --tha-accent-soft: #e6eeff;
    --tha-link: #1d4ed8;
    --tha-on-accent: #ffffff;
    --tha-danger: #b42318;
    --tha-danger-soft: #fdecea;
    --tha-success: #116a3a;
    --tha-success-soft: #e5f5ec;
    --tha-info: #1e429f;
    --tha-info-soft: #e8efff;
    --tha-focus: #2563eb;
    --tha-input-bg: #ffffff;
    --tha-shadow: 0 18px 50px rgba(15, 27, 45, .08);
    --tha-radius: 14px;
    --tha-font: Inter, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --tha-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    margin: 0; min-height: 100vh; background: var(--tha-bg); color: var(--tha-text);
    font: 400 15px/1.55 var(--tha-font); -webkit-font-smoothing: antialiased;
}
html[data-theme-resolved="dark"] .tha {
    --tha-bg: #0a1120;
    --tha-surface: #111b2e;
    --tha-surface-2: #16223a;
    --tha-border: #26344f;
    --tha-border-strong: #4d607f;
    --tha-text: #e8eef8;
    --tha-muted: #a3b2c8;
    --tha-accent: #2563eb;
    --tha-accent-hover: #3b74f0;
    --tha-accent-soft: rgba(59, 130, 246, .16);
    --tha-link: #8bb8ff;
    --tha-danger: #ff9b8f;
    --tha-danger-soft: rgba(248, 113, 113, .13);
    --tha-success: #7ee2a8;
    --tha-success-soft: rgba(74, 222, 128, .12);
    --tha-info: #a8c6ff;
    --tha-info-soft: rgba(96, 165, 250, .13);
    --tha-focus: #93c5fd;
    --tha-input-bg: #0c1527;
    --tha-shadow: none;
    color-scheme: dark;
}
.tha *, .tha *::before, .tha *::after { box-sizing: border-box; }
.tha :is(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--tha-focus); outline-offset: 2px; }
.tha a { color: var(--tha-link); text-underline-offset: 2px; }
.tha .visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.tha-skip { position: absolute; left: 12px; top: -60px; z-index: 20; padding: 10px 14px; border-radius: 8px; background: var(--tha-accent); color: var(--tha-on-accent) !important; font-weight: 700; text-decoration: none; }
.tha-skip:focus { top: 12px; }

/* ---------- Two-column shell ---------- */
.tha-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tha-brand {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
    padding: 44px clamp(32px, 5vw, 72px); color: #e9f0fb;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(37, 99, 235, .32), transparent 60%),
        radial-gradient(90% 70% at 100% 100%, rgba(14, 116, 144, .22), transparent 65%),
        linear-gradient(160deg, #0a1730 0%, #0b1a36 45%, #081226 100%);
}
/* Decorative grid; no data is drawn. */
.tha-brand::before {
    content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
    background-image: linear-gradient(rgba(148, 178, 230, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 178, 230, .07) 1px, transparent 1px);
    background-size: 44px 44px; mask-image: linear-gradient(180deg, transparent, #000 25%, #000 75%, transparent);
}
.tha-brand > * { position: relative; }
.tha-logo { display: inline-flex; align-items: center; gap: 12px; color: #fff !important; text-decoration: none; font-weight: 800; letter-spacing: -.01em; font-size: 17px; }
.tha-logo img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: rgba(255, 255, 255, .06); padding: 4px; }
.tha-logo small { display: block; font-weight: 600; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: #a9bddb; }
.tha-headline { margin: 0 0 18px; max-width: 15ch; font-size: clamp(32px, 3.6vw, 50px); line-height: 1.06; letter-spacing: -.035em; font-weight: 800; color: #fff; }
.tha-headline span { color: #8fb7ff; }
.tha-lead { margin: 0 0 30px; max-width: 46ch; color: #c2d1e6; font-size: 16.5px; line-height: 1.6; }
.tha-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 460px; }
.tha-points li { display: grid; grid-template-columns: 38px 1fr; gap: 14px; align-items: start; }
.tha-points svg { width: 38px; height: 38px; padding: 9px; border-radius: 10px; background: rgba(96, 145, 255, .14); border: 1px solid rgba(143, 183, 255, .22); stroke: #a9c7ff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tha-points strong { display: block; color: #fff; font-size: 14.5px; }
.tha-points span { color: #b6c6dd; font-size: 13.5px; }
.tha-brand-foot { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; color: #9fb3d1; font-size: 12.5px; }
.tha-brand-foot svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; vertical-align: -2px; margin-right: 5px; }

.tha-panel { display: flex; flex-direction: column; min-width: 0; padding: 20px clamp(18px, 4vw, 56px) 32px; }
.tha-topbar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; min-height: 44px; }
.tha-topbar .hc-theme-trigger { background: var(--tha-surface); color: var(--tha-text); border: 1px solid var(--tha-border); }
.tha-topbar .hc-theme-trigger:hover { background: var(--tha-surface-2); }
.tha-main { flex: 1; display: grid; place-items: center; padding: 18px 0; }
.tha-card { width: 100%; max-width: 440px; }
.tha-card.is-wide { max-width: 560px; }
.tha-eyebrow { margin: 0 0 6px; color: var(--tha-accent); font-weight: 800; font-size: 12px; letter-spacing: .09em; text-transform: uppercase; }
html[data-theme-resolved="dark"] .tha-eyebrow { color: var(--tha-link); }
.tha-title { margin: 0 0 8px; font-size: 28px; line-height: 1.15; letter-spacing: -.03em; font-weight: 800; color: var(--tha-text); }
.tha-subtitle { margin: 0 0 24px; color: var(--tha-muted); }

/* ---------- Messages ---------- */
.tha-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin: 0 0 18px; border-radius: 10px; border: 1px solid transparent; font-size: 14px; }
.tha-alert svg { flex: none; width: 18px; height: 18px; margin-top: 2px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tha-alert.is-danger { background: var(--tha-danger-soft); color: var(--tha-danger); border-color: color-mix(in srgb, var(--tha-danger) 30%, transparent); }
.tha-alert.is-success { background: var(--tha-success-soft); color: var(--tha-success); border-color: color-mix(in srgb, var(--tha-success) 30%, transparent); }
.tha-alert.is-info { background: var(--tha-info-soft); color: var(--tha-info); border-color: color-mix(in srgb, var(--tha-info) 30%, transparent); }
.tha-alert ul { margin: 4px 0 0; padding-left: 18px; }
.tha-alert a { color: inherit; font-weight: 700; }

/* ---------- Fields ---------- */
.tha-form { display: grid; gap: 16px; }
.tha-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tha-field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.tha-label { font-weight: 700; font-size: 13.5px; color: var(--tha-text); }
.tha-label .tha-optional { font-weight: 500; color: var(--tha-muted); }
.tha-input {
    width: 100%; min-height: 46px; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--tha-border-strong);
    background: var(--tha-input-bg); color: var(--tha-text); font: inherit; font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.tha-input::placeholder { color: var(--tha-muted); opacity: 1; }
.tha-input:hover { border-color: var(--tha-muted); }
.tha-input:focus { outline: none; border-color: var(--tha-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tha-focus) 30%, transparent); }
.tha-input[aria-invalid="true"] { border-color: var(--tha-danger); }
.tha-input[readonly] { background: var(--tha-surface-2); color: var(--tha-text); }
.tha-hint { font-size: 12.5px; color: var(--tha-muted); }
.tha-error { font-size: 12.5px; color: var(--tha-danger); font-weight: 600; }
.tha-error:empty { display: none; }
.tha-password { position: relative; }
.tha-password .tha-input { padding-right: 52px; }
.tha-reveal {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 40px; height: 36px; display: grid; place-items: center;
    border: 0; border-radius: 8px; background: transparent; color: var(--tha-muted); cursor: pointer;
}
.tha-reveal:hover { background: var(--tha-surface-2); color: var(--tha-text); }
.tha-reveal svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tha-reveal .is-hide { display: none; }
.tha-reveal[aria-pressed="true"] .is-show { display: none; }
.tha-reveal[aria-pressed="true"] .is-hide { display: block; }
.tha-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tha-check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: var(--tha-text); cursor: pointer; }
.tha-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--tha-accent); }

/* ---------- Buttons ---------- */
.tha-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 48px; padding: 12px 18px;
    border-radius: 10px; border: 1px solid var(--tha-accent); background: var(--tha-accent); color: var(--tha-on-accent);
    font: 700 15px/1.2 var(--tha-font); cursor: pointer; text-decoration: none; transition: background-color .15s;
}
.tha-btn:hover { background: var(--tha-accent-hover); border-color: var(--tha-accent-hover); color: var(--tha-on-accent); }
.tha-btn[disabled] { opacity: .75; cursor: progress; }
.tha-btn.is-secondary { background: transparent; color: var(--tha-text); border-color: var(--tha-border-strong); }
.tha-btn.is-secondary:hover { background: var(--tha-surface-2); }
.tha-spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: tha-spin .8s linear infinite; }
.tha-btn[aria-busy="true"] .tha-spinner { display: inline-block; }
@keyframes tha-spin { to { transform: rotate(360deg); } }
.tha-divider { display: flex; align-items: center; gap: 12px; color: var(--tha-muted); font-size: 12.5px; margin: 8px 0 0; }
.tha-divider::before, .tha-divider::after { content: ''; flex: 1; height: 1px; background: var(--tha-border); }
.tha-switch { margin: 18px 0 0; text-align: center; color: var(--tha-muted); font-size: 14px; }
.tha-switch a { font-weight: 700; }

/* ---------- Company information panel (registration) ---------- */
.tha-company { border: 1px solid var(--tha-border); background: var(--tha-surface-2); border-radius: 12px; padding: 14px 16px; }
.tha-company-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px; margin-bottom: 10px; }
.tha-company-head h2 { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: .01em; color: var(--tha-text); }
.tha-tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; white-space: nowrap; border-radius: 999px; font-size: 11.5px; font-weight: 800; background: var(--tha-accent-soft); color: var(--tha-link); }
.tha-tag svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.2; }
html:not([data-theme-resolved="dark"]) .tha-tag { color: var(--tha-accent); }
.tha-company dl { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 10px 16px; margin: 0; }
.tha-company dt { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--tha-muted); }
.tha-company dd { margin: 2px 0 0; font-weight: 700; color: var(--tha-text); overflow-wrap: anywhere; }
.tha-company dd.is-code { font-family: var(--tha-mono); letter-spacing: .03em; }
.tha-company p { margin: 10px 0 0; font-size: 12.5px; color: var(--tha-muted); }

/* ---------- Other module sign-ins (existing partial) ---------- */
.tha .module-signins { margin-top: 26px; border-top: 1px solid var(--tha-border); padding-top: 18px; }
.tha .module-signins h2 { margin: 0 0 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--tha-muted); font-weight: 800; }
.tha .module-signins ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tha .module-signins a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--tha-border); border-radius: 10px; color: var(--tha-text); text-decoration: none; background: var(--tha-surface); }
.tha .module-signins a:hover { border-color: var(--tha-border-strong); background: var(--tha-surface-2); }
.tha .module-signins-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--tha-accent-soft); color: var(--tha-link); font-weight: 800; font-size: 12px; }
html:not([data-theme-resolved="dark"]) .tha .module-signins-icon { color: var(--tha-accent); }
.tha .module-signins-label { flex: 1; display: grid; }
.tha .module-signins-label strong { font-size: 14px; }
.tha .module-signins-label small { color: var(--tha-muted); font-size: 12px; }

.tha-footer { margin-top: 18px; text-align: center; color: var(--tha-muted); font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1023.98px) {
    .tha-shell { grid-template-columns: 1fr; }
    .tha-brand { padding: 26px clamp(18px, 5vw, 40px) 28px; gap: 18px; }
    .tha-headline { font-size: clamp(26px, 5vw, 34px); max-width: 22ch; margin-bottom: 8px; }
    .tha-lead { margin-bottom: 0; font-size: 15px; }
    .tha-points, .tha-brand-foot { display: none; }
    .tha-panel { padding-top: 12px; }
    .tha-topbar { position: absolute; top: 18px; right: 18px; }
    .tha-topbar .hc-theme-trigger { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .22); }
}
@media (max-width: 559.98px) {
    .tha { font-size: 15px; }
    .tha-grid-2 { grid-template-columns: 1fr; }
    .tha-title { font-size: 24px; }
    .tha-company dl { grid-template-columns: 1fr; }
    .tha-lead { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .tha * { transition: none !important; animation-duration: 0s !important; }
    .tha-spinner { animation: none; border-top-color: rgba(255, 255, 255, .45); }
}
@media (forced-colors: active) {
    .tha-btn, .tha-input { border: 1px solid CanvasText; }
}

/* Links styled as buttons (invitation pages): .tha a would otherwise give them the link colour. */
.tha a.tha-btn { color: var(--tha-on-accent); text-decoration: none; }
.tha a.tha-btn.is-secondary { color: var(--tha-text); }
.tha .tha-form > a.tha-btn + a.tha-btn { margin-top: 10px; }
