/* ============================================================
   Allitas — private investor portal
   Theme: #181F38 navy / logo violet accent
   Shared styles + branded preloader (CSS-only, reduced-motion safe)
   ============================================================ */

:root {
    --allitas-navy: #181F38;
    --allitas-navy-deep: #0b0f1c;
    --allitas-violet: #9870a5;
    --allitas-paper: #f3f5f9;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--allitas-paper);
    color: #12182b;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: rgba(24, 31, 56, 0.9);
    color: #f5f6fa;
}

/* Serif display face used for headlines and lead figures. */
.font-display {
    font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* Logo rendered white for navy surfaces. */
.logo-on-dark {
    filter: brightness(0) invert(1);
}

/* Dark-mode form controls: fields flip to dark backgrounds (dark:bg-gray-800)
   but keep the light-mode text colour unless overridden. Make typed text and
   placeholders legible globally so every input/select/textarea is covered. */
.dark input:not([type="checkbox"]):not([type="radio"]),
.dark select,
.dark textarea {
    color: #eef1f7;
    caret-color: #ccb8dd;
}
.dark input::placeholder,
.dark select::placeholder,
.dark textarea::placeholder {
    color: #7d879e;
    opacity: 1;
}

/* Shared input/select/textarea style used across profile/settings/plans. */
.input-field {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid #e2e6ef;
    background-color: #fff;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    outline: none;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.dark .input-field {
    border-color: #2b3a53;
    background-color: #17203a;
    color: #eef1f7;
}
.input-field:focus {
    border-color: var(--allitas-navy);
    box-shadow: 0 0 0 3px rgba(24, 31, 56, 0.15);
}

/* ============================================================
   Auth — editorial split layout
   ============================================================ */
.auth-panel {
    position: relative;
    background:
        radial-gradient(900px 520px at 100% 0%, rgba(152, 112, 165, 0.34), transparent 62%),
        radial-gradient(760px 520px at 0% 100%, rgba(82, 102, 134, 0.34), transparent 58%),
        linear-gradient(158deg, #1f2b42 0%, #181F38 48%, #0b0f1c 100%);
}
.auth-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(120% 100% at 50% 0%, #000 25%, transparent 82%);
    mask-image: radial-gradient(120% 100% at 50% 0%, #000 25%, transparent 82%);
    pointer-events: none;
}
.auth-panel::after {
    content: "";
    position: absolute;
    right: -220px;
    bottom: -260px;
    width: 560px;
    height: 560px;
    border-radius: 50%;
    border: 1px solid rgba(204, 184, 221, 0.22);
    box-shadow: 0 0 0 70px rgba(204, 184, 221, 0.045), 0 0 0 150px rgba(204, 184, 221, 0.03);
    pointer-events: none;
}
.auth-eyebrow {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: #ccb8dd;
}
.auth-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6b7488;
}
.dark .auth-label { color: #9aa4bb; }
input.auth-field,
select.auth-field,
textarea.auth-field {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background-color: transparent;
    border: 0;
    border-bottom: 1px solid #d9dfeb;
    border-radius: 0;
    background: transparent;
    padding: 0.8rem 2.6rem 0.8rem 0;
    font-size: 0.925rem;
    color: #12182b;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
input.auth-field::placeholder,
select.auth-field::placeholder,
textarea.auth-field::placeholder { color: #9aa2b5; }
input.auth-field:focus,
select.auth-field:focus,
textarea.auth-field:focus {
    background-color: transparent;
    border: 0;
    border-bottom: 1px solid var(--allitas-navy);
    box-shadow: 0 1px 0 0 var(--allitas-navy);
}
.dark input.auth-field,
.dark select.auth-field,
.dark textarea.auth-field {
    background-color: transparent;
    color: #eef1f7;
    border-bottom-color: #33405c;
}
.dark input.auth-field::placeholder,
.dark select.auth-field::placeholder,
.dark textarea.auth-field::placeholder { color: #6f7a92; }
.dark input.auth-field:focus,
.dark select.auth-field:focus,
.dark textarea.auth-field:focus {
    border-bottom-color: #ccb8dd;
    box-shadow: 0 1px 0 0 #ccb8dd;
}
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.95rem 1.25rem;
    border-radius: 0.85rem;
    background: var(--allitas-navy);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 16px 28px -16px rgba(24, 31, 56, 0.65);
    transition: background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.auth-btn:hover {
    background: #2b3a53;
    transform: translateY(-1px);
    box-shadow: 0 20px 32px -18px rgba(24, 31, 56, 0.7);
}
.auth-btn:focus-visible {
    outline: 2px solid var(--allitas-violet);
    outline-offset: 3px;
}
.dark .auth-btn {
    background: #e3d7ed;
    color: var(--allitas-navy);
    box-shadow: 0 16px 28px -18px rgba(0, 0, 0, 0.6);
}
.dark .auth-btn:hover { background: #ccb8dd; }

/* ============================================================
   Legal pages — Terms & Privacy
   ============================================================ */
.legal-doc {
    color: #3a4256;
    font-size: 0.95rem;
    line-height: 1.75;
}
.dark .legal-doc { color: #b6bfd2; }

.legal-doc section { scroll-margin-top: 6.5rem; }
.legal-doc section + section {
    margin-top: 2.25rem;
    padding-top: 2.25rem;
    border-top: 1px solid #e8ebf2;
}
.dark .legal-doc section + section { border-top-color: rgba(255, 255, 255, 0.08); }

.legal-doc h2 {
    font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
    font-weight: 400;
    font-size: 1.55rem;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: #12182b;
}
.dark .legal-doc h2 { color: #ffffff; }

.legal-num {
    display: inline-block;
    margin-right: 0.6rem;
    vertical-align: 0.35em;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--allitas-violet);
}
.dark .legal-num { color: #ccb8dd; }

.legal-doc h3 {
    margin-top: 1.15rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #12182b;
}
.dark .legal-doc h3 { color: #e8ecf5; }

.legal-doc p { margin-top: 0.8rem; }
.legal-doc strong { font-weight: 700; color: #12182b; }
.dark .legal-doc strong { color: #f2f5fa; }

.legal-doc ul {
    margin-top: 0.8rem;
    padding-left: 0;
    list-style: none;
}
.legal-doc li {
    position: relative;
    margin-top: 0.45rem;
    padding-left: 1.15rem;
}
.legal-doc li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.66em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #c3cbdc;
}
.dark .legal-doc li::before { background: #4a5875; }

.legal-doc a {
    color: #6a4b75;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: rgba(152, 112, 165, 0.4);
}
.legal-doc a:hover { text-decoration-color: currentColor; }
.dark .legal-doc a { color: #ccb8dd; }

.legal-toc a {
    display: block;
    padding: 0.32rem 0 0.32rem 0.9rem;
    border-left: 1px solid #e2e6ef;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    color: #6b7488;
    transition: color .15s ease, border-color .15s ease;
}
.legal-toc a:hover {
    border-left-color: var(--allitas-violet);
    color: var(--allitas-navy);
}
.dark .legal-toc a {
    border-left-color: rgba(255, 255, 255, 0.14);
    color: #8e99ae;
}
.dark .legal-toc a:hover {
    border-left-color: #ccb8dd;
    color: #ffffff;
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #e7ebf2; }
::-webkit-scrollbar-thumb { background: #b4bdcf; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #7c8aa5; }
.dark ::-webkit-scrollbar-track { background: #0d1322; }
.dark ::-webkit-scrollbar-thumb { background: #2b3a53; }
.dark ::-webkit-scrollbar-thumb:hover { background: #3c4f6b; }

.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #c6cede; border-radius: 3px; }
.dark .custom-scrollbar::-webkit-scrollbar-thumb { background: #33405c; }

/* Shine hover */
.shine-effect-container { position: relative; overflow: hidden; }
.shine-effect {
    position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background-image: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
    transform: rotate(45deg); opacity: 0; transition: opacity .5s;
}
.shine-effect-container:hover .shine-effect { opacity: 1; animation: shine-once 1.5s ease-in-out; }

/* Scroll fade-in */
.fade-in-section { opacity: 0; transform: translateY(20px); transition: opacity .6s ease-out, transform .6s ease-out; }
.fade-in-section.is-visible { opacity: 1; transform: translateY(0); }

/* ============================================================
   Allitas preloader — quiet navy field, logo, single light line
   ============================================================ */
.page-loading {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;
    transition: opacity .25s ease, visibility .25s ease;
    background:
        radial-gradient(ellipse at 50% 42%, #22304c 0%, #181F38 48%, #0b0f1c 100%);
    opacity: 0;
    visibility: hidden;
    z-index: 9999;
    overflow: hidden;
}
.page-loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(60% 55% at 50% 50%, #000 10%, transparent 100%);
    mask-image: radial-gradient(60% 55% at 50% 50%, #000 10%, transparent 100%);
    pointer-events: none;
}
.page-loading.active { opacity: 1; visibility: visible; }
.page-loading-inner {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    display: flex; flex-direction: column; align-items: center;
    text-align: center; transition: opacity .2s ease; opacity: 0;
}
.page-loading.active > .page-loading-inner { opacity: 1; }

.loading-logo {
    width: 200px;
    max-width: 60vw;
    height: auto;
    filter: brightness(0) invert(1);
    opacity: 0.96;
    animation: logoReveal .8s cubic-bezier(.22,.61,.36,1) both;
}
.loading-tagline {
    margin-top: 1.15rem;
    padding-left: 0.42em;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: rgba(204, 184, 221, 0.75);
}

/* thin indeterminate shimmer line */
.loading-shimmer {
    width: 180px; height: 2px; border-radius: 999px; margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.12); overflow: hidden; position: relative;
}
.loading-shimmer span {
    position: absolute; top: 0; left: 0; height: 100%; width: 40%; border-radius: 999px;
    background: linear-gradient(90deg, transparent, #9870a5, #ccb8dd, transparent);
    animation: shimmerSlide 1.15s ease-in-out infinite;
}

@keyframes logoReveal { from { opacity: 0; transform: translateY(8px) scale(.975); } to { opacity: .96; transform: translateY(0) scale(1); } }
@keyframes shimmerSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

@media (prefers-reduced-motion: reduce) {
    .page-loading { transition: none; }
    .loading-logo,
    .loading-shimmer span { animation: none !important; }
}

/* ============================================================
   Live share chart widget
   ============================================================ */
[data-sw-price] { transition: color .3s ease; font-variant-numeric: tabular-nums; }
[data-sw-chart] polyline,
[data-sw-chart] path { transition: stroke .3s ease; }
[data-sw-change] { transition: background-color .3s ease; }

/* Table row hover for ledger-style lists */
.data-row { transition: background-color .15s ease; }
.data-row:hover { background-color: rgba(24, 31, 56, 0.035); }
.dark .data-row:hover { background-color: rgba(255, 255, 255, 0.04); }

/* ============================================================
   Flash toasts
   ============================================================ */
.toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 120;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: min(22.5rem, calc(100vw - 2rem));
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.8rem 0.85rem 0.8rem 1rem;
    border: 1px solid #e2e6ef;
    border-radius: 0.9rem;
    background: #ffffff;
    color: #12182b;
    box-shadow: 0 18px 45px -20px rgba(16, 23, 41, 0.45);
    font-size: 0.8125rem;
    line-height: 1.45;
    animation: toastIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.toast.is-leaving {
    animation: toastOut 0.22s ease-in forwards;
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    flex: none;
    border-radius: 0.5rem;
    font-size: 0.8rem;
}

.toast-message {
    flex: 1;
    margin: 0;
    padding-top: 0.15rem;
    font-weight: 500;
}

.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: inherit;
    opacity: 0.55;
    cursor: pointer;
    transition: opacity 0.15s ease, background-color 0.15s ease;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(24, 31, 56, 0.06);
}

.toast-success {
    border-color: #a7f3d0;
    background: #f0fdf7;
    color: #065f46;
}
.toast-success .toast-icon { background: #d1fae5; color: #059669; }

.toast-error {
    border-color: #fecaca;
    background: #fff5f5;
    color: #991b1b;
}
.toast-error .toast-icon { background: #fee2e2; color: #dc2626; }

.toast-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}
.toast-warning .toast-icon { background: #fef3c7; color: #d97706; }

.toast-info {
    border-color: #cdd4e2;
    background: #f5f6fa;
    color: #181f38;
}
.toast-info .toast-icon { background: #e9ecf3; color: #3c4f6b; }

.dark .toast {
    box-shadow: 0 18px 45px -18px rgba(0, 0, 0, 0.7);
}
.dark .toast-success {
    border-color: rgba(52, 211, 153, 0.35);
    background: rgba(16, 185, 129, 0.12);
    color: #a7f3d0;
}
.dark .toast-success .toast-icon { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }

.dark .toast-error {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
}
.dark .toast-error .toast-icon { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

.dark .toast-warning {
    border-color: rgba(251, 191, 36, 0.35);
    background: rgba(245, 158, 11, 0.12);
    color: #fde68a;
}
.dark .toast-warning .toast-icon { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }

.dark .toast-info {
    border-color: rgba(255, 255, 255, 0.12);
    background: #141c30;
    color: #e9ecf3;
}
.dark .toast-info .toast-icon { background: rgba(255, 255, 255, 0.08); color: #ccb8dd; }

.dark .toast-close:hover { background: rgba(255, 255, 255, 0.08); }

@keyframes toastIn {
    from { opacity: 0; transform: translate3d(0, -10px, 0) scale(0.97); }
    to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes toastOut {
    to { opacity: 0; transform: translate3d(0, -6px, 0) scale(0.98); }
}

@media (max-width: 640px) {
    .toast-stack {
        top: 0.75rem;
        left: 0.75rem;
        right: 0.75rem;
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast,
    .toast.is-leaving { animation: none; }
}
