/* Finantria site-specific CSS overrides */

/* Preline's HSOverlay returns keyboard focus to the button that opened a modal
   when it closes (e.g. via Escape). That's a real .focus() call, so Chrome's
   :focus-visible heuristic treats it like keyboard navigation and shows its
   default outline on the trigger button. Every modal trigger in the app shares
   the data-hs-overlay attribute, so suppress it once, globally, instead of
   overriding each of the 11 modals' buttons. */
[data-hs-overlay]:focus-visible {
    outline: none;
}

/* Shared shape for ticker/company logo avatars (search dropdowns, holdings, watchlist, alerts). Size classes stay per-instance via Tailwind; only shape lives here. */
.ticker-avatar {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background-color: #f1f5f9;
}

.holdings-tab.active {
    border-color: rgb(37 99 235);
    color: rgb(37 99 235);
    font-weight: 600;
}

.holdings-tab-icon {
    display: inline-flex;
    justify-content: center;
    width: 1.15rem;
    font-size: 1.15rem;
    color: rgb(100 116 139);
    -webkit-text-stroke: 0.4px currentColor;
}

.holdings-symbol-cell {
    vertical-align: middle;
}

.holdings-symbol-wrap {
    position: relative;
    display: block;
    height: 1.72rem;
    overflow: hidden;
}

.holdings-symbol-link {
    display: block;
    line-height: 0.98rem;
}

.holdings-symbol-company {
    position: absolute;
    left: 0;
    right: 0;
    top: 0.94rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 9px;
    line-height: 0.72rem;
    font-weight: 400;
    color: rgb(100 116 139);
    pointer-events: none;
}

.holdings-tabs-nav {
    -webkit-overflow-scrolling: touch;
}

/* Announcement ticker: continuous horizontal marquee of index/stock quotes below the header. */
.announcement-ticker {
    position: relative;
    overflow: hidden;
}

.announcement-ticker::before,
.announcement-ticker::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2.5rem;
    z-index: 2;
    pointer-events: none;
}

.announcement-ticker::before {
    left: 0;
    background: linear-gradient(to right, rgb(255 255 255), rgb(255 255 255 / 0));
}

.announcement-ticker::after {
    right: 0;
    background: linear-gradient(to left, rgb(255 255 255), rgb(255 255 255 / 0));
}

.announcement-ticker-track {
    animation: announcement-ticker-scroll 110s linear infinite;
}

.announcement-ticker:hover .announcement-ticker-track {
    animation-play-state: paused;
}

@keyframes announcement-ticker-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(calc(-50% - 1rem));
    }
}

@media (prefers-reduced-motion: reduce) {
    .announcement-ticker-track {
        animation-duration: 1ms;
        animation-iteration-count: 1;
    }
}

a,
a:hover,
a:focus,
a:active,
a:visited {
    color: #021A3D !important;
    text-decoration: none !important;
}

.auth-muted-link,
.auth-muted-link:hover,
.auth-muted-link:focus,
.auth-muted-link:active,
.auth-muted-link:visited {
    color: rgb(148 163 184) !important;
}

.auth-muted-link:hover,
.auth-muted-link:focus {
    color: rgb(100 116 139) !important;
}

.by-asset-price-input {
    width: 100%;
}

.by-asset-alert-fields {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) minmax(7rem, 0.5fr) minmax(7rem, 0.5fr) max-content;
    gap: 0.75rem;
    align-items: end;
}

@media (max-width: 639px) {
    .by-asset-alert-fields {
        grid-template-columns: 1fr;
    }
}

/* The bank list can run to hundreds of items (e.g. DE); let its dropdown
   overflow the modal card's own scroll box instead of being clipped by it. */
#banks-add-modal .pointer-events-auto {
    overflow-y: visible;
}

.btn-accent {
    background-color: #0EC89C;
    border-color: #0EC89C;
}

.btn-accent:hover,
.btn-accent:focus {
    background-color: #0BB58D;
    border-color: #0BB58D;
}

form button[type="submit"],
form button:not([type]),
form input[type="submit"] {
    background-color: #0EC89C !important;
    border-color: #0EC89C !important;
    color: #ffffff !important;
}

form button[type="submit"]:hover,
form button[type="submit"]:focus,
form button:not([type]):hover,
form button:not([type]):focus,
form input[type="submit"]:hover,
form input[type="submit"]:focus {
    background-color: #0BB58D !important;
    border-color: #0BB58D !important;
}

/* Destructive confirm buttons (e.g. "Delete" in remove-position/remove-transaction
   modals) opt out of the default teal accent above via this extra class. */
form button[type="submit"].btn-danger {
    background-color: #e11d48 !important;
    border-color: #e11d48 !important;
}

form button[type="submit"].btn-danger:hover,
form button[type="submit"].btn-danger:focus {
    background-color: #be123c !important;
    border-color: #be123c !important;
}

/* Icon-only submit buttons (e.g. "Refresh balance") opt out of the default
   teal accent above so they match the other grey icon buttons in the row. */
form button[type="submit"].holdings-icon-btn {
    background-color: transparent !important;
    border-color: rgb(203 213 225) !important;
    color: rgb(71 85 105) !important;
}

form button[type="submit"].holdings-icon-btn:hover,
form button[type="submit"].holdings-icon-btn:focus {
    background-color: rgb(241 245 249) !important;
    border-color: rgb(203 213 225) !important;
    color: rgb(71 85 105) !important;
}

.watchlist-add-asset-btn {
    background-color: #0EC89C !important;
    border-color: #0EC89C !important;
    color: #ffffff !important;
}

.watchlist-add-asset-btn:hover,
.watchlist-add-asset-btn:focus {
    background-color: #0BB58D !important;
    border-color: #0BB58D !important;
}

.btn-disabled-muted,
.btn-disabled-muted:disabled {
    background-color: rgb(241 245 249) !important;
    border-color: rgb(226 232 240) !important;
    color: rgb(148 163 184) !important;
}

.watchlist-add-asset-btn.btn-disabled-muted:hover,
.watchlist-add-asset-btn.btn-disabled-muted:focus,
.watchlist-add-asset-btn:disabled:hover,
.watchlist-add-asset-btn:disabled:focus {
    background-color: rgb(241 245 249) !important;
    border-color: rgb(226 232 240) !important;
    color: rgb(148 163 184) !important;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="url"],
textarea,
select {
    min-height: 2rem;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    line-height: 1.125rem;
}

/* Native <select> chrome (padding, min-height) isn't fully controllable via
   height/padding alone in every browser - Firefox in particular keeps its own
   internal minimum regardless, so a select can end up visibly taller than an
   input with identical CSS. appearance:none hands full control of the box
   back to us, so select and input compute to the exact same height. */
select {
    height: 2rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.55rem center;
    background-size: 0.85rem;
    padding-right: 1.75rem;
}

.holdings-lot-table {
    width: 100%;
    table-layout: auto;
    text-align: right;
    min-width: 980px;
}

.holdings-main-table {
    width: 100%;
    table-layout: auto;
    min-width: 1080px;
}

.holdings-main-table > thead > tr > th,
.holdings-main-table > tbody > tr:not([id^="lots-"]) > td {
    white-space: nowrap;
}

.holdings-main-table > tbody > tr:not([id^="lots-"]) > td {
    vertical-align: middle;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

.watchlist-main-table > tbody > tr > td {
    vertical-align: middle;
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
}

.watchlist-main-table .holdings-symbol-cell > .flex {
    min-width: 0;
}

.watchlist-main-table .holdings-symbol-wrap {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
}

.holdings-mobile-table .holdings-symbol-cell > .flex {
    min-width: 0;
}

.holdings-mobile-table .holdings-symbol-wrap {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
}

.holdings-main-table .holdings-symbol-wrap {
    height: 1.9rem;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    max-width: none !important;
}

.holdings-main-table .holdings-symbol-cell > .flex {
    min-width: 0;
}

.holdings-main-table .holdings-symbol-link {
    padding-top: 0.4rem;
}

.holdings-main-table .holdings-symbol-company {
    top: 1.24rem;
    font-size: 9px;
}

.holdings-main-table > thead > tr > th {
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

.holdings-icon-btn {
    vertical-align: middle;
    line-height: 1;
}

.holdings-icon-btn svg {
    display: block;
}

.holdings-lot-scroll {
    width: 100%;
    overflow-x: auto;
}

.holdings-lot-col-type {
    width: 1%;
    min-width: 0;
}

.holdings-lot-col-date {
    width: auto;
    min-width: 8rem;
}

.holdings-lot-col-number {
    width: 3.5rem;
    min-width: 3.5rem;
}

.holdings-lot-col-shares {
    width: auto;
    min-width: 3.6rem;
}

.holdings-lot-col-cost {
    width: auto;
    min-width: 4.8rem;
}

.holdings-lot-col-total {
    width: auto;
    min-width: 5.5rem;
}

.holdings-lot-col-realized {
    width: auto;
    min-width: 5.75rem;
}

.holdings-lot-col-note {
    width: 12rem;
    min-width: 12rem;
}

.holdings-lot-col-action {
    width: auto;
    min-width: 2.25rem;
}

.ticker-desc-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    text-align: justify;
}

.ticker-desc-text.is-clamped {
    -webkit-line-clamp: 3;
}

.holdings-lot-cell,
.holdings-lot-head-cell {
    padding: 0.35rem 0.75rem;
    vertical-align: top;
    white-space: nowrap;
}

.holdings-lot-total-cell {
    vertical-align: middle;
}

.holdings-lot-action-cell {
    vertical-align: middle;
    padding-left: 0.35rem;
    padding-right: 0.5rem;
}

.holdings-lot-total-value {
    margin-top: 0.1rem;
    min-height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: inherit;
    line-height: inherit;
    font-weight: inherit;
    color: inherit;
}

.holdings-lot-toggle-arrow {
    transform: translateY(0);
    transition: transform 140ms ease;
}

.holdings-lot-toggle-arrow.is-open {
    transform: translateY(-1px) rotate(180deg);
}

.holdings-lot-realized-lines {
    margin-top: 0.25rem;
}

.holdings-lot-realized-line {
    line-height: 1.2;
}

.holdings-lot-head-cell {
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: rgb(51 65 85);
}

.holdings-lot-title {
    display: block;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: rgb(51 65 85);
}

.holdings-lot-title-muted {
    color: transparent;
}

.holdings-lot-field {
    margin-top: 0.25rem;
    height: 1.875rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border-radius: 0.5rem;
    border: 1px solid rgb(203 213 225);
    padding: 0 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    text-align: right;
    outline: none;
}

.holdings-lot-field:focus {
    border-color: rgb(59 130 246);
    box-shadow: 0 0 0 2px rgb(219 234 254);
}

.holdings-lot-field-date {
    width: 8rem;
    max-width: 8rem;
    padding-right: 1.5rem;
}

.holdings-lot-field-shares {
    width: 4.25rem;
    max-width: 4.25rem;
}

.holdings-lot-field-cost {
    width: 5.5rem;
    max-width: 5.5rem;
}

.holdings-lot-field-commission {
    width: 4.5rem;
    max-width: 4.5rem;
}

.holdings-lot-field-note {
    min-width: 12rem;
    width: 100%;
    max-width: 14rem;
}

.holdings-lot-field-type {
    width: 7rem;
    min-width: 7rem;
    max-width: 7rem;
    text-align: left;
    padding-right: 1.75rem;
}

.holdings-field-standard {
    height: 1.875rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(203 213 225);
    padding: 0 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    outline: none;
}

.holdings-field-standard:focus {
    border-color: rgb(59 130 246);
    box-shadow: 0 0 0 2px rgb(219 234 254);
}

select.holdings-field-standard {
    padding-right: 1.75rem;
}

.holdings-import-type-field {
    min-width: 7.75rem;
    padding-right: 1.6rem;
}

.holdings-lot-btn {
    margin-top: 0.25rem;
    width: 100%;
    white-space: nowrap;
    border-radius: 0.5rem;
    background: rgb(15 23 42);
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: rgb(255 255 255);
}

.holdings-lot-btn:hover {
    background: rgb(30 41 59);
}

.js-no-spinner {
    -moz-appearance: textfield;
}

.js-no-spinner::-webkit-outer-spin-button,
.js-no-spinner::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#site-header-search-wrap {
    flex: 1 1 28rem;
    max-width: 28rem;
    min-width: 10rem;
}

#site-header-search-wrap > .relative.w-full.max-w-md {
    width: 100%;
    max-width: none;
}

#site-header-row {
    position: relative;
}

@media (min-width: 641px) {
    #site-header-search-wrap {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: min(28rem, calc(100% - 20rem));
        max-width: 28rem;
        min-width: 16rem;
        flex: 0 1 auto;
        z-index: 5;
    }
}

@media (max-width: 1024px) {
    .holdings-lot-table {
        min-width: 920px;
    }

    .holdings-lot-col-date {
        width: auto;
        min-width: 8rem;
    }

    .holdings-lot-col-shares,
    .holdings-lot-col-cost,
    .holdings-lot-col-number {
        width: auto;
        min-width: 3.9rem;
    }

    .holdings-lot-col-total,
    .holdings-lot-col-realized {
        width: auto;
        min-width: 5.25rem;
    }

    .holdings-lot-col-note {
        width: auto;
        min-width: 15.75rem;
    }

    .holdings-lot-col-action {
        width: auto;
        min-width: 2.25rem;
    }

    .holdings-lot-field-shares {
        width: 3.75rem;
        max-width: 3.75rem;
    }

    .holdings-lot-field-cost {
        width: 4.9rem;
        max-width: 4.9rem;
    }

    .holdings-lot-field-note {
        min-width: 16.5rem;
    }

    .holdings-lot-field-type {
        width: 7rem;
        min-width: 7rem;
        max-width: 7rem;
    }

    .holdings-lot-field-date {
        width: 8rem;
        max-width: 8rem;
    }
}

@media (max-width: 640px) {
    .holdings-add-asset-row.mt-2 {
        display: none;
    }

    .holdings-top-allocations.flex {
        display: none;
    }

    .holdings-tabs-nav {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 0.375rem;
        padding-bottom: 0.2rem;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .holdings-tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .holdings-tabs-nav .holdings-tab {
        flex: 0 0 auto;
        white-space: nowrap;
        scroll-snap-align: start;
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    #site-header-row {
        gap: 0.5rem;
    }

    img[src="/assets/images/logo.png"] {
        height: 4rem !important;
        width: auto;
    }

    #site-header-mobile-menu {
        display: block;
        margin-left: auto;
    }

    #site-header-auth-desktop,
    #site-header-row > div.flex.items-center.gap-4:empty {
        display: none;
    }

    #site-header-search-wrap {
        order: 3;
        flex: 0 0 100%;
        width: 100%;
        margin-bottom: 0.4rem;
    }

    #site-header-search-wrap > .relative.w-full.max-w-md {
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    #site-header-mobile-menu > summary::-webkit-details-marker {
        display: none;
    }

    #ticker-search-input {
        min-height: 2rem;
        padding: 0.28rem 0.6rem;
        font-size: 0.8125rem;
        line-height: 1.15rem;
    }

    #ticker-search-input::placeholder {
        font-size: 0.75rem;
    }

    #ticker-search-results {
        font-size: 0.8125rem;
    }

    .holdings-symbol-wrap {
        height: 1.9rem;
    }

    .holdings-symbol-link {
        padding-top: 0.4rem;
    }

    .holdings-symbol-company {
        top: 1.24rem;
    }
}

/* Site-wide: hide placeholder hint text when a field is focused/clicked. */
input:focus::placeholder,
textarea:focus::placeholder {
    color: transparent;
    opacity: 0;
}

/* Site-wide tooltip primitives for custom hover/focus tooltips. */
.site-tooltip-wrap {
    position: relative;
    display: inline-flex;
}

.site-tooltip {
    pointer-events: none;
    position: absolute;
    left: 100%;
    top: 50%;
    z-index: 50;
    margin-left: 0.5rem;
    width: max-content;
    max-width: 13.75rem;
    transform: translateY(-50%);
    border-radius: 0.375rem;
    background: rgb(30 41 59);
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 500;
    color: rgb(255 255 255);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    opacity: 0;
    visibility: hidden;
    transition: opacity 150ms ease, visibility 150ms ease;
}

.site-tooltip-wrap:hover .site-tooltip,
.site-tooltip-wrap:focus-within .site-tooltip {
    opacity: 1;
    visibility: visible;
}

.site-tooltip-arrow {
    position: absolute;
    right: 100%;
    top: 50%;
    height: 0.5rem;
    width: 0.5rem;
    transform: translateY(-50%) translateX(0.25rem) rotate(45deg);
    background: inherit;
}

.site-flash-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
    pointer-events: none;
    opacity: 1;
    transition: opacity 360ms ease;
}

.site-flash-modal.is-fading-out {
    opacity: 0;
}

.site-flash-modal-card {
    max-width: min(92vw, 28rem);
    border-width: 1px;
    border-radius: 0.625rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    line-height: 1.2rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
