/*
 * New design: shared structure, loaded after the original stylesheets when the new design is on (body.ui-theme).
 * Colors, fonts and shapes come from the custom properties hud.css sets on body.theme-hud.
 */

body.ui-theme {
    --header-h: 56px;
    --nav-w: 216px;

    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.45;
}

body.ui-theme ::selection {
    background: var(--accent-2);
    color: var(--accent-2-ink);
}

body.ui-theme a {
    color: var(--link);
}

body.ui-theme a:focus-visible,
body.ui-theme button:focus-visible,
body.ui-theme input:focus-visible,
body.ui-theme select:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* ---------- header ---------- */

body.ui-theme .site-header {
    height: var(--header-h);
    padding: 0 20px;
    background: var(--header-bg);
    color: var(--header-ink);
    border-bottom: 1px solid var(--header-line);
    box-shadow: var(--header-shadow);
    display: flex;
    align-items: center;
}

body.ui-theme .site-header-logo {
    margin: 0 0 0 36px;
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: var(--logo-tracking);
    text-transform: var(--logo-case);
    color: var(--header-ink);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

body.ui-theme .site-header-logo:before {
    content: '';
    width: 22px;
    height: 22px;
    flex: none;
    background: var(--logo-mark);
    clip-path: var(--logo-clip);
    border-radius: var(--logo-radius);
}

body.ui-theme .site-nav-left-btn {
    top: 50%;
    transform: translateY(-50%);
    left: 18px;
    color: var(--header-ink);
}

body.ui-theme .login-link {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--header-cta-ink);
    background: var(--header-cta-bg);
    border: 1px solid var(--header-cta-line);
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    clip-path: var(--cut-sm);
    transition: background .15s, color .15s, border-color .15s;
}

body.ui-theme .login-link:hover {
    background: var(--header-cta-bg-hover);
}

/* ---------- left nav ---------- */

body.ui-theme .site-nav-left {
    width: var(--nav-w);
    top: var(--header-h);
    height: calc(100% - var(--header-h));
    background: var(--nav-bg);
    border-right: 1px solid var(--line);
    padding: 14px 10px 24px;
}

body.ui-theme .site-nav-left-collapsed {
    left: calc(var(--nav-w) * -1);
}

body.ui-theme .site-nav-left li {
    padding: 0;
    font-size: 14px;
    line-height: 20px;
}

body.ui-theme .site-nav-left li > div > a,
body.ui-theme .site-nav-left li.child > a,
body.ui-theme .site-nav-left .expandcollapse {
    display: block;
    padding: 8px 12px;
    color: var(--nav-ink);
    border-radius: var(--radius-sm);
    font-weight: 500;
    position: relative;
    transition: background .12s, color .12s;
}

body.ui-theme .site-nav-left .expandcollapse {
    margin-top: 6px;
    font-family: var(--font-label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--nav-ink-muted);
}

body.ui-theme .site-nav-left li.child {
    padding: 0;
    font-size: 14px;
}

body.ui-theme .site-nav-left li.child > a {
    padding-left: 22px;
}

body.ui-theme .site-nav-left li > div > a:hover,
body.ui-theme .site-nav-left li.child > a:hover {
    background: var(--nav-hover);
    color: var(--ink);
}

body.ui-theme .site-nav-left a.active,
body.ui-theme .site-nav-left li > div > a.active,
body.ui-theme .site-nav-left li.child > a.active {
    color: var(--nav-active-ink);
    background: var(--nav-active-bg);
    font-weight: 600;
}

body.ui-theme .site-nav-left a.active:before {
    content: '';
    position: absolute;
    left: 0;
    top: 7px;
    bottom: 7px;
    width: 3px;
    background: var(--nav-active-bar);
    box-shadow: var(--glow-accent);
    border-radius: 2px;
}

body.ui-theme li.help-support {
    margin: 18px 4px 0;
    padding: 14px 8px 6px;
    border-top: 1px solid var(--line);
    color: var(--ink-2);
    font-family: var(--font-label);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

body.ui-theme .site-nav-left .premium {
    padding: 0 8px;
    height: auto;
}

body.ui-theme .site-nav-left .premium .btn-raised {
    width: 100%;
}

body.ui-theme .site-nav-left .suggestions,
body.ui-theme .site-nav-left .legal-links {
    padding: 14px 8px 0;
    color: var(--ink-2);
    line-height: 1.6;
}

body.ui-theme .suggestions a {
    color: var(--link) !important;
}

/* ---------- content area ---------- */

body.ui-theme .site-content {
    padding-top: var(--header-h);
    margin-left: calc(var(--nav-w) + 28px);
    margin-right: 28px;
}

body.ui-theme h1,
body.ui-theme h2,
body.ui-theme h3 {
    font-family: var(--font-display);
}

body.ui-theme .col-header {
    color: var(--ink);
}

body.ui-theme h1 {
    border-bottom-color: var(--line);
}

body.ui-theme .row {
    padding-top: 28px;
}

body.ui-theme .header-sentence {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
}

body.ui-theme .row h2.col-header,
body.ui-theme .header-sentence h2.col-header {
    font-size: 30px;
    font-weight: var(--display-weight);
    letter-spacing: var(--display-tracking);
    line-height: 1.1;
    padding: 0;
}

body.ui-theme .row h3.col-header,
body.ui-theme .header-sentence h3.col-header {
    font-family: var(--font-label);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--chip-ink);
    background: var(--chip-bg);
    border: 1px solid var(--chip-line);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    clip-path: var(--cut-sm);
}

body.ui-theme .row h3.col-header:empty {
    display: none;
}

body.ui-theme .col-info,
body.ui-theme .row > div > p {
    color: var(--ink-2);
    font-size: 14.5px;
    max-width: 78ch;
}

/* ---------- forms ---------- */

body.ui-theme .formgroup label,
body.ui-theme .searchcrit .formgroup label {
    font-family: var(--font-label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-2);
    margin-bottom: 6px;
}

body.ui-theme label.tooltip,
body.ui-theme .underline.tooltip {
    text-decoration: underline dotted var(--ink-3);
    text-underline-offset: 3px;
}

body.ui-theme input[type="text"],
body.ui-theme input[type="email"],
body.ui-theme input[type="number"],
body.ui-theme input[type="password"],
body.ui-theme input[type="date"],
body.ui-theme textarea {
    font-family: var(--font-num);
    font-size: 14px;
    color: var(--ink);
    background-color: var(--field-bg);
    background-image: linear-gradient(var(--accent-2), var(--accent-2));
    background-size: 0 2px;
    background-repeat: no-repeat;
    background-position: center bottom;
    border: 1px solid var(--field-line);
    border-radius: var(--radius-sm);
    padding: 9px 10px;
    height: 40px;
}

body.ui-theme textarea {
    height: auto;
}

/* autocomplete fields (Strategy, Symbol) keep room for their search icon */
body.ui-theme .textbox_wrap input[type="text"] {
    padding-left: 30px;
}

body.ui-theme .sentence .vueautoc input[type="text"] {
    padding-left: 10px;
}

body.ui-theme input[type="text"]:hover,
body.ui-theme input[type="email"]:hover,
body.ui-theme input[type="number"]:hover,
body.ui-theme textarea:hover {
    border-color: var(--field-line-hover);
}

body.ui-theme input[type="text"]:focus,
body.ui-theme input[type="email"]:focus,
body.ui-theme input[type="number"]:focus,
body.ui-theme input[type="password"]:focus,
body.ui-theme textarea:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: var(--focus-ring);
    background-size: 100% 2px;
}

body.ui-theme .formgroup > select {
    height: 40px;
    padding: 0 10px;
    min-width: 220px;
    color: var(--ink);
    font-family: var(--font-ui);
    background-color: var(--field-bg);
    border: 1px solid var(--field-line);
    border-radius: var(--radius-sm);
}

body.ui-theme .formgroup > select:hover {
    border-color: var(--field-line-hover);
}

body.ui-theme .select {
    border: 1px solid var(--field-line);
    border-radius: var(--radius-sm);
    background: var(--field-bg);
    overflow: hidden;
}

body.ui-theme .select:hover {
    border-color: var(--field-line-hover);
}

body.ui-theme .select select {
    background: var(--field-bg);
    color: var(--ink);
    font-family: var(--font-ui);
    height: 38px;
}

body.ui-theme .select:before {
    color: var(--accent-2);
}

body.ui-theme .input-icon-wrap .percent-symbol {
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-3);
    font-family: var(--font-num);
}

body.ui-theme .search-crit-shell {
    /* no clip-path here: the symbol autocomplete drops down out of this box */
    background: var(--panel-deco, none), var(--panel-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 16px 14px;
    margin-top: 10px;
    box-shadow: var(--shadow-sm);
}

body.ui-theme .search-crit-shell .search-crit-button {
    margin-top: 18px;
}

body.ui-theme .search-type-options {
    display: flex;
    gap: 4px;
    margin-top: 18px;
}

body.ui-theme .search-type-options li {
    padding: 0;
}

body.ui-theme .search-type-options a {
    display: inline-block;
    padding: 8px 14px;
    font-weight: 600;
    font-size: 13px;
    color: var(--ink-2);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

body.ui-theme .search-type-options a:hover {
    color: var(--ink);
    background: var(--nav-hover);
}

body.ui-theme .search-type-active a,
body.ui-theme .search-type-active a:hover {
    color: var(--tab-active-ink);
    background: var(--tab-active-bg);
    border-color: var(--tab-active-line);
    box-shadow: var(--glow-soft);
    padding-bottom: 8px;
}

/* ---------- buttons ---------- */

body.ui-theme .btn-raised {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 9px 16px;
    min-height: 38px;
    border-radius: var(--radius-sm);
    clip-path: var(--cut-sm);
    background: var(--btn-bg);
    color: var(--btn-ink);
    border: 1px solid var(--btn-line);
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}

body.ui-theme .btn-raised:hover {
    border-color: var(--btn-line-hover);
    background: var(--btn-bg-hover);
}

body.ui-theme .btn-raised:active {
    transform: translateY(1px);
}

body.ui-theme .btn-green {
    background: var(--primary);
    color: var(--primary-ink);
    border-color: var(--primary-line);
    box-shadow: var(--primary-shadow);
}

body.ui-theme .btn-green:hover,
body.ui-theme .btn-green[disabled]:hover {
    background: var(--primary-hover);
    border-color: var(--primary-line);
}

body.ui-theme .btn-blue {
    background: var(--secondary);
    color: var(--secondary-ink);
    border-color: var(--secondary-line);
}

body.ui-theme .btn-blue:hover,
body.ui-theme .btn-blue[disabled]:hover {
    background: var(--secondary-hover);
    border-color: var(--secondary-line);
}

body.ui-theme .btn-red {
    background: var(--neg);
    border-color: var(--neg);
    color: #fff;
}

body.ui-theme .btn-noborder {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--ink-2);
}

body.ui-theme .btn-noborder:hover {
    background: var(--nav-hover);
    color: var(--ink);
}

body.ui-theme .btn-raised[disabled] {
    color: inherit !important;
}

body.ui-theme .btn-green[disabled],
body.ui-theme .btn-blue[disabled] {
    color: var(--primary-ink) !important;
}

body.ui-theme .question-mark {
    width: 18px;
    height: 18px;
    line-height: 16px;
    font-size: 11px;
    font-weight: 700;
    background: transparent;
    border: 1px solid var(--accent-2);
}

body.ui-theme .question-mark a {
    color: var(--accent-2);
}

/* ---------- data grids ---------- */

body.ui-theme .grid-wrap,
body.ui-theme .grid-container {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

body.ui-theme .grid-container {
    margin-top: 16px;
    padding: 0;
}

body.ui-theme .grid-wrap .grid-container,
body.ui-theme .grid-container .grid-wrap {
    border: 0;
    box-shadow: none;
    margin-top: 0;
}

body.ui-theme .grid {
    border-color: var(--line);
}

body.ui-theme .grid td,
body.ui-theme .grid th {
    background: transparent;
    border-color: var(--line-soft);
}

body.ui-theme .grid.grid-open th,
body.ui-theme .grid thead th {
    font-family: var(--font-label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-2);
    padding: 12px 10px 10px;
    background: var(--th-bg);
    border-bottom: 1px solid var(--line);
    vertical-align: bottom;
}

body.ui-theme .grid.grid-open td {
    padding: 9px 10px;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

body.ui-theme .grid.grid-open td:not(.col-Symbol) {
    font-family: var(--font-num);
    font-size: var(--num-size);
}

body.ui-theme .grid.grid-open tr {
    border-bottom-color: var(--line-soft);
}

body.ui-theme .grid.grid-open tbody tr {
    transition: background .1s;
}

body.ui-theme .grid.grid-open tbody tr:hover {
    background: var(--row-hover);
    box-shadow: inset 3px 0 0 var(--accent-2);
}

body.ui-theme .grid.grid-sortable thead th[data-sort].sorting-desc,
body.ui-theme .grid.grid-sortable thead th[data-sort].sorting-asc {
    color: var(--accent-2-strong);
}

body.ui-theme .grid.grid-sortable thead th[data-sort]:after {
    color: var(--ink-3);
    font-size: 13px;
}

body.ui-theme .grid.grid-sortable thead th[data-sort].sorting-desc:after,
body.ui-theme .grid.grid-sortable thead th[data-sort].sorting-asc:after {
    color: var(--accent-2-strong);
}

body.ui-theme .grid td.col-Symbol a,
body.ui-theme .grid td.col-Symbol {
    font-family: var(--font-num);
    font-weight: 700;
    letter-spacing: 0.02em;
}

body.ui-theme .grid.grid-open td.col-OptionPremium {
    color: var(--link);
    font-weight: 600;
}

body.ui-theme .grid.grid-open td.col-ROINotAssigned,
body.ui-theme .grid.grid-open td.col-ROIPerDayNotAssigned,
body.ui-theme .grid.grid-open td.col-ROIAnnualized {
    color: var(--pos);
    font-weight: 600;
}

body.ui-theme .grid.grid-open td.col-ROINotAssigned {
    background: var(--roi-cell);
}

body.ui-theme .premium-info li.bidask {
    color: var(--ink-3);
    font-size: 11.5px;
}

body.ui-theme .green {
    color: var(--pos) !important;
}

body.ui-theme .red {
    color: var(--neg) !important;
}

body.ui-theme .icon-star-full {
    color: var(--line);
}

body.ui-theme .icon-star-full-on {
    color: var(--star);
}

body.ui-theme .icon-star-full-on-green {
    color: var(--pos);
}

/* ---------- modals, toasts ---------- */

body.ui-theme .modal-overlay {
    background: var(--overlay);
    opacity: 1;
    backdrop-filter: blur(3px);
}

body.ui-theme .modal {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

body.ui-theme .modal-header,
body.ui-theme .modal-footer {
    background: var(--surface);
}

body.ui-theme .modal-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--line-soft);
    box-shadow: inset 0 2px 0 var(--accent-2);
}

body.ui-theme .modal-header h1 {
    font-family: var(--font-display);
    font-weight: var(--display-weight);
    font-size: 18px;
}

body.ui-theme .modal .close-button {
    top: 18px;
}

body.ui-theme .modal-footer {
    border-top-color: var(--line-soft);
}

/* the footer is one 50px line; the taller buttons sit on its baseline and spill out unless centered */
body.ui-theme .modal-footer button,
body.ui-theme .modal-footer a {
    vertical-align: middle;
}

body.ui-theme .toast {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-left: 4px solid;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

body.ui-theme .toast-active {
    top: calc(var(--header-h) + 16px);
}

body.ui-theme .toast-success {
    border-left-color: var(--pos);
}

body.ui-theme .toast-error {
    border-left-color: var(--neg);
}

body.ui-theme .feature-info-box {
    background: var(--panel-bg);
    border-color: var(--line);
    border-radius: var(--radius);
}

/* ---------- responsive (mirrors the 1000px breakpoint in layout.scss) ---------- */

@media (max-width: 1000px) {
    body.ui-theme .site-header-logo {
        display: inline-flex;
        font-size: 16px;
    }

    body.ui-theme .site-content {
        padding-top: var(--header-h);
        margin-left: 12px;
        margin-right: 12px;
    }

    body.ui-theme .site-nav-left {
        top: var(--header-h);
        background: var(--nav-bg);
    }

    body.ui-theme .site-nav-left:not(.site-nav-left-collapsed) {
        box-shadow: var(--shadow-lg);
    }

    body.ui-theme .row h2.col-header,
    body.ui-theme .header-sentence h2.col-header {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    body.ui-theme .site-header-logo {
        font-size: 14px;
        letter-spacing: 0.02em;
        max-width: calc(100% - 160px);
    }

    body.ui-theme .site-header-logo span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.ui-theme .login-link {
        padding: 6px 12px;
        font-size: 12px;
    }

    body.ui-theme .search-crit-shell {
        padding: 12px 10px;
    }
}
