/* ===============================================================
   myDiviMax — styles.css
   =============================================================== */

[data-theme="original"] {
    --page-bg:               #f4f4f4;
    --header-bg:             #005284;
    --header-border:         #dddddd;
    --user-btn-color:        #ffffff;
    --dropdown-bg:           #ffffff;
    --dropdown-border:       #dddddd;
    --dropdown-hover-bg:     #e5e5e5;
    --set-header-bg:         #555555;
    --set-header-color:      #ffffff;
    --toggle-icon-color:     #555555;
    --tooltip-bg:            #334155;
    --tooltip-color:         #ffffff;
    --panel-bg:              #fafafa;
    --panel-border:          #d1d9e0;
    --panel-title-color:     #333333;
    --panel-label-color:     #000000;
    --panel-label-strong:    #005284;
    --list-bg:               #ffffff;
    --list-border:           #d1d9e0;
    --list-item-border:      #f0f0f0;
    --list-hover-bg:         #f0f4ff;
    --list-loaded-bg:        #b4d4f4;
    --list-loaded-accent:    #005284;
    --list-loaded-color:     #ffffff;
    --btn-blue-bg:           #005284;
    --btn-blue-color:        #ffffff;
    --btn-green-bg:          #28a745;
    --btn-green-color:       #ffffff;
    --btn-red-bg:            #dc3545;
    --btn-red-color:         #ffffff;
    --btn-gray-bg:           #e5e5e5;
    --btn-gray-color:        #000000;
    --controls-bg:           #ffffff;
    --table-bg:              #ffffff;
    --table-th-bg:           #005284;
    --table-th-color:        #ffffff;
    --table-border:          #d1d9e0;
    --table-delete-color:    #dc3545;
    --modal-overlay:         rgba(0, 0, 0, 0.45);
    --modal-bg:              #ffffff;
    --modal-shadow:          rgba(0, 0, 0, 0.2);
    --border:                #d1d9e0;
    --autocomplete-bg:       #ffffff;
    --autocomplete-hover:    #f1f1f1;
    --autocomplete-border:   #eeeeee;
    --status-color:          #666666;
}


/* ===============================================================
   BASE
   =============================================================== */

body {
    font-family: Segoe UI, sans-serif;
    background: var(--header-bg);
    padding: 0;
    font-size: 1em;
}

/* Footer — single footer, adapts to login vs app state */
.app-footer {
    background: var(--page-bg);
    border-top: 1px solid var(--border);
    padding: 0.625em 1em;
    margin: 0 1em;
}

/* On login screen, footer adapts to blue background */
body.login-state .app-footer {
    background: transparent;
    border-top: 1px solid var(--header-bg);
    margin: 1.5em auto 0 auto;
    max-width: 30em;
}

body.login-state .footer-top {
    display: none;
}

body.login-state .footer-bottom {
    border-top: none;
    padding-top: 0;
}

body.login-state .footer-copyright,
body.login-state .footer-disclaimer {
    color: rgba(255,255,255,0.75) !important;
}


    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 0.4em;
    padding: 0.75em 1em;
    margin-bottom: 1em;
    font-size: 0.88em;
    line-height: 1.5;
    text-align: left;
}

.folder-notice p {
    margin: 0 0 0.5em 0;
    text-align: left;
}

.folder-notice p:last-child {
    margin-bottom: 0;
}

.help-modal-body {
    font-size: 0.9em;
    line-height: 1.6;
    color: #333;
    max-height: 24em;
    overflow-y: auto;
    padding-right: 0.5em;
    text-align: left;
}

.help-modal-body p {
    margin: 0 0 0.75em 0;
    text-align: left;
}

.help-modal-body p:last-child {
    margin-bottom: 0;
}

.panel {
    background: var(--modal-bg);
    padding: 1.25em;
    max-width: 25em;
    margin: 0 auto;
    border-radius: 0.5em;
    box-shadow: 0 0 0.625em rgba(0,0,0,0.1);
}

/* -------------------------------------------------------
   Login & Panel buttons — unified via design system
   .btn-full   = layout modifier (full width)
   .btn-green  = primary action (register, validate)
   .btn-blue   = login action
   .btn-gray   = secondary/cancel
   .btn-register removed — replaced by .btn.btn-green.btn-full
------------------------------------------------------- */

.btn-full {
    width: 100%;
    margin-top: 0.4em;
    padding: 0.55em 1em;
    border-radius: 0.5em;
}

/* Ensure all panel buttons have consistent radius */
#login-form .btn,
#create-profile-form .btn,
#license-container .btn {
    border-radius: 0.5em;
}

.login-divider {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 0.6em 0;
}

.login-home-link {
    text-align: center;
    margin-bottom: 0.6em;
    font-size: 0.82em;
}

.login-home-link a {
    color: #005284;
    text-decoration: none;
}

.login-home-link a:hover {
    text-decoration: underline;
}

/* Two-column login layout for profiles mode */
.login-two-col {
    display: flex;
    gap: 1em;
    align-items: flex-start;
}

.login-col-left {
    flex: 1;
    min-width: 0;
}

.login-col-left label {
    display: block;
    margin-bottom: 0.15em;
    font-size: 0.9em;
}

.login-col-left select,
.login-col-left input[type="password"] {
    width: 100%;
    box-sizing: border-box;
}

.login-col-right {
    flex: 0 0 auto;
    width: 11em;
    display: flex;
    flex-direction: column;
    padding-top: 0.2em;
}

.login-col-right .btn {
    font-size: 0.82em;
    padding: 0.5em 0.6em;
    white-space: nowrap;
}

    width: 100%;
    height: 1.5em;
    background: var(--header-bg);
    display: block;
    max-width: 25em;
    margin: 0 auto;
}

#login-container {
    border-radius: 0.5em;
    margin-bottom: 0;
}

#login-bottom {
    margin-top: 0;
    border-radius: 0.5em;
}

.login-message {
    font-size: 0.85em;
    color: #c00;
    margin: 0;
    padding: 0;
    min-height: 0;
}

.login-message:not(:empty) {
    margin: 0.3em 0;
}

.panel-title {
    font-size: 1em;
    font-weight: 600;
    color: #005284;
    margin: 0 0 0.25em 0;
}

.panel-subtitle {
    font-size: 0.85em;
    color: #666;
    margin: 0 0 0.75em 0;
}

.license-btn-row {
    display: flex;
    gap: 0.5em;
    margin-top: 0.75em;
}

.license-btn-row .btn {
    flex: 1;
}

.test-mode-notice {
    background: #fff8e1;
    border: 1px solid #f0c040;
    border-radius: 0.3em;
    padding: 0.5em 0.65em;
    font-size: 0.82em;
    color: #555;
    margin-bottom: 0.5em;
    line-height: 1.4;
}

/* Login form label and field spacing */
#login-form label {
    display: block;
    margin-top: 0.5em;
    margin-bottom: 0.15em;
    font-size: 0.9em;
}

#login-form select,
#login-form input[type="password"] {
    width: 100%;
    margin-bottom: 0.1em;
}

/* Create profile form — wider panel and full-width inputs */
#create-profile-container.panel {
    max-width: 30em;
}

#create-profile-form label {
    display: block;
    margin-top: 0.6em;
    margin-bottom: 0.15em;
    font-size: 0.9em;
}

#create-profile-form input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.45em 0.6em;
    font-size: 0.95em;
    border: 1px solid #ccc;
    border-radius: 0.3em;
}

/* Section labels — green, no bold, wider tracking */
.login-section-label {
    font-size: 0.72em;
    font-weight: 600;
    color: var(--btn-green-bg);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.35em 0;
}

.test-timer-badge {
    position: fixed;
    top: 0.3em;
    left: 50%;
    transform: translateX(-50%);
    background: #005284;
    color: #ffffff;
    padding: 0.35em 1em;
    border-radius: 2em;
    font-size: 0.82em;
    font-weight: 600;
    z-index: 9000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: background 0.5s;
    white-space: nowrap;
}

.test-timer-badge.urgent {
    background: #c00;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}


.hidden {
    display: none !important;
}

label {
    display: block;
}

input, select, button {
    box-sizing: border-box;
}

button {
    cursor: pointer;
}

/* ===============================================================
   HEADER
   =============================================================== */

.app-header {
    position: sticky;
    top: 0;
    background: var(--header-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75em 1.25em;
    z-index: 1000;
}

.header-left {
    display: flex;
    flex-direction: column;
}

.app-logo {
    display: block;
    height: auto;
}

.app-title {
    font-size: 1.25em;
    font-weight: bold;
    color: var(--header-title-color);
}

.app-subtitle {
    font-size: 0.75em;
    color: var(--header-subtitle-color);
}

.header-right {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1em;
}

.user-icon {
    width: 16px;
    height: 16px;
    margin-right: 0.35em;
    vertical-align: middle;
    flex-shrink: 0;
}

.header-login-links {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.header-login-link {
    font-size: 0.85em;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.header-login-link:hover {
    opacity: 1;
    text-decoration: underline;
    color: #ffffff;
}

.header-login-sep {
    font-size: 0.85em;
    color: rgba(255,255,255,0.5);
}



.header-nav {
    display: flex;
    align-items: center;
    gap: 1.25em;
}

.header-menu-wrap {
    position: relative;
}

/* Unified style for all header nav buttons — matches help-link but no font-weight:600 */
.header-nav-btn {
    background: none;
    border: none;
    color: var(--user-btn-color);
    font-size: 0.875em;
    font-weight: normal;
    cursor: pointer;
    padding: 0.25em 0em;
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.header-nav-btn:hover {
    opacity: 1;
    text-decoration: underline;
}

.header-dropdown {
    position: absolute;
    top: 2em;
    left: 0;
    background: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    box-shadow: 0 0.25em 0.5em rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    min-width: 11em;
    z-index: 2000;
    border-radius: 0.25em;
}

.header-dropdown button {
    background: none;
    border: none;
    padding: 0.55em 0.9em;
    text-align: left;
    cursor: pointer;
    width: 100%;
    font-size: 0.875em;
    color: #333;
}

.header-dropdown button:hover {
    background-color: var(--dropdown-hover-bg);
}

.header-dropdown.show {
    display: flex;
}

.dropdown-divider {
    margin: 0.2em 0;
    border: none;
    border-top: 1px solid #e0e0e0;
}

.header-username-display {
    font-size: 0.875em;
    color: var(--user-btn-color);
    opacity: 0.9;
}

/* Settings modal */
.settings-body {
    margin-bottom: 1em;
}

.settings-section-title {
    font-size: 0.72em;
    font-weight: 700;
    color: var(--btn-green-bg);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 0.75em 0 0.4em 0;
}

.settings-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3em 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.88em;
}

.settings-info-label {
    color: #888;
    min-width: 6em;
}

.settings-info-value {
    color: #333;
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

.settings-password-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.4em 0.6em;
    border: 1px solid #ccc;
    border-radius: 0.3em;
    font-size: 0.9em;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6em 0;
    border-bottom: 1px solid #f0f0f0;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label {
    font-size: 0.9em;
    color: #333;
}

.settings-checkbox {
    width: 1.1em;
    height: 1.1em;
    cursor: pointer;
}

/* Login folder row */
.login-folder-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-wrap: wrap;
}

.login-folder-name {
    font-size: 0.85em;
    color: #444;
    font-weight: 500;
    word-break: break-all;
}

/* Footer */
.app-footer {
    background: var(--page-bg);
    border-top: 1px solid var(--border);
    padding: 0.625em 1em;
    margin: 0 1em;
}

.login-footer {
    background: transparent;
    border-top: 1px solid rgba(255,255,255,0.25);
    margin: 1.5em auto 0 auto;
    max-width: 30em;
}

.login-footer .footer-link,
.login-footer .footer-sep,
.login-footer .footer-copyright,
.login-footer .footer-disclaimer {
    color: rgba(255,255,255,0.75) !important;
}

.login-footer .footer-link:hover {
    color: #ffffff !important;
}

.footer-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5em;
}

.footer-logo {
    opacity: 0.75;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.footer-link {
    font-size: 0.85em;
    color: #005284;
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

.footer-sep {
    font-size: 0.85em;
    color: #aaa;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 0.4em;
}

.footer-copyright {
    font-size: 0.72em;
    color: #444;
}

.footer-disclaimer {
    font-size: 0.72em;
    color: #444;
    font-style: italic;
}


/* ===============================================================
   COLLAPSIBLE SET HEADER
   =============================================================== */

.set-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--set-header-bg);
    color: var(--set-header-color);
    cursor: pointer;
    padding: 0.5em 0.75em;
    margin: 0;
}

.set-header-controls {
    display: flex;
    align-items: center;
    gap: 1.5em;
}

.auto-hide-toggle {
    display: flex;
    align-items: center;
    gap: 0.35em;
    font-size: 0.8em;
    color: var(--set-header-color);
    cursor: pointer;
    opacity: 0.85;
    white-space: nowrap;
    user-select: none;
}

.auto-hide-toggle:hover {
    opacity: 1;
}

.auto-hide-toggle input[type="checkbox"] {
    cursor: pointer;
    accent-color: #ffffff;
    width: 0.9em;
    height: 0.9em;
}

.btn-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 1.1em;
    height: 1.1em;
    position: relative;
    flex-shrink: 0;
    padding: 0;
}

.toggle-icon {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
}

.toggle-icon::before,
.toggle-icon::after {
    content: "";
    position: absolute;
    background: #ffffff;
    border-radius: 2px;
    transition: transform 0.3s ease;
}

/* Horizontal bar — always visible */
.toggle-icon::before {
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

/* Vertical bar — rotates away when open (− state) */
.toggle-icon::after {
    width: 2px;
    height: 100%;
    top: 0;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
}

/* Closed state: vertical bar is visible (+ state) */
.btn-toggle:not(.open) .toggle-icon::after {
    transform: translateX(-50%) rotate(0deg);
}

/* Hover tooltip — handled by parent .set-header, suppressed here */
.btn-toggle::after {
    display: none;
}

.btn-toggle:not(.open)::after {
    display: none;
}

.btn-toggle:hover::after {
    display: none;
}

/* Cursor-following tooltip — shared utility, used anywhere in the app */
.cursor-tooltip {
    position: fixed;
    background: var(--tooltip-bg);
    color: var(--tooltip-color);
    font-size: 0.75em;
    padding: 0.2em 0.5em;
    border-radius: 0.25em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
}

/* ===============================================================
   COLLAPSIBLE WRAPPER
   =============================================================== */

.set-manager-wrapper {
    overflow: hidden;
    height: auto;
    opacity: 1;
    transition: height 0.4s ease, opacity 0.4s ease;
}

.set-manager-wrapper.collapsed {
    height: 0;
    opacity: 0;
}

/* ===============================================================
   TWO-PANEL MANAGER ROW
   =============================================================== */

.set-manager-panel {
    padding: 0;
    background-color: #dddddd;
}

.manager-row {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    padding: 0.625em;
}

.manager-panel {
    flex: 1 1 17.5em;
    min-width: 16em;
    border: 1px solid var(--panel-border);
    border-radius: 0.375em;
    padding: 0.625em;
    margin: 0.625em;
    background: var(--panel-bg);
}

.manager-row .manager-panel:first-child {
    margin-right: 0.625em;
}

.manager-row .manager-panel:last-child {
    margin-left: 0.625em;
}

.manager-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5em;
    flex-wrap: wrap;
    gap: 0.25em;
}

.manager-panel-title {
    font-size: 0.85em;
    font-weight: 700;
    color: var(--panel-title-color);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.manager-active-label {
    font-size: 0.8em;
    color: var(--panel-label-color);
}

.manager-active-label strong {
    color: var(--panel-label-strong);
}

.manager-panel-body {
    display: flex;
    flex-direction: row;
    gap: 0.5em;
    align-items: flex-start;
}

.manager-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    max-height: 11.8em;
    overflow-y: auto;
    border: 1px solid var(--list-border);
    border-radius: 0.25em;
    background: var(--list-bg);
    font-size: 0.85em;
}

.manager-list li {
    padding: 0.3em 0.5em;
    cursor: pointer;
    border-bottom: 1px solid var(--list-item-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.manager-list li:last-child {
    border-bottom: none;
}

.manager-list li:hover {
    background: var(--list-hover-bg);
}

.manager-list li.loaded:hover {
    background: var(--list-loaded-bg);
}

.manager-list li.loaded {
    background: var(--list-loaded-bg);
    font-weight: 600;
    border-left: 0.5em solid #005284;
}

.manager-list li.loaded.selected {
    background: var(--list-loaded-bg);
    color: var(--list-loaded-color);
}

.list-item-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Hamburger button on each list item */
.item-menu-btn {
    background: none;
    /* background-color: #cccccc; */
    border: none;
    cursor: pointer;
    font-size: 0.95em;
    padding: 0 0.3em;
    color: var(--panel-label-color);
    /* opacity: 0.5; */
    flex-shrink: 0;
    line-height: 1;
    border-radius: 0.2em;
}

.item-menu-btn:hover {
    opacity: 1;
    background: rgba(0,0,0,0.08);
}

.manager-list li.loaded .item-menu-btn {
    /*color: var(--list-loaded-color);*/
    /*opacity: 0.7;*/
}

.manager-list li.loaded .item-menu-btn:hover {
    opacity: 1;
}

/* Per-item dropdown menu */
.item-dropdown {
    position: fixed;
    z-index: 9000;
    background: var(--dropdown-bg);
    border: 1px solid var(--dropdown-border);
    border-radius: 0.35em;
    box-shadow: 0 0.25em 0.75em rgba(0,0,0,0.15);
    min-width: 10em;
    padding: 0.25em 0;
}

.item-dropdown.hidden {
    display: none !important;
}

.item-dropdown-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0.5em 1em;
    text-align: left;
    cursor: pointer;
    font-size: 0.875em;
    color: var(--panel-label-color);
}

.item-dropdown-btn:hover {
    background: var(--dropdown-hover-bg);
}

.item-dropdown-danger {
    color: #c0392b;
}

.item-dropdown-danger:hover {
    background: #fdf0f0;
}

.item-dropdown-divider {
    border: none;
    border-top: 1px solid var(--list-item-border);
    margin: 0.25em 0;
}

/* Button row below list */
.manager-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35em;
    align-items: center;
}

.manager-btn-row .btn {
    flex-shrink: 0;
}

/* Button column to the right of list */
.manager-btn-col {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    min-width: 5.5em;
    flex-shrink: 0;
}

.manager-btn-col .btn {
    width: 100%;
    text-align: center;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    font-size: 0.8em;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 0.25em;
}

/* ===============================================================
   ESTIMATED DIVIDEND INCOME PANEL
   =============================================================== */

.income-wrapper {
    overflow: hidden;
    transition: height 0.3s ease;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.income-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    margin: 0.625em;
    border-radius: 0.375em;
    padding: 0.75em 1em;
}

/* Empty state — three cards horizontal */
.income-empty-state {
    display: flex;
    gap: 1em;
    justify-content: center;
    padding: 0.5em 0;
}

/* Populated state — chart left, cards right */
.income-populated-state {
    display: flex;
    gap: 1em;
    align-items: flex-end;
}

/* Stat card base */
.income-stat-card {
    background: #f0f0f0;
    border-radius: 0.4em;
    padding: 0 1.25em;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* Vertical cards (populated state) */
.income-stat-card-vertical {
    flex: none;
    align-items: center;
    justify-content: center;
}

/* Portfolio Market Value card */
.income-stat-card-market {
    background: #e0e0e0;
}

.income-stat-label {
    font-size: 0.8em;
    color: #555555;
    white-space: nowrap;
    text-align: center;
}

.income-stat-value {
    font-size: 1.25em;
    font-weight: 700;
    color: #005284;
    text-align: center;
}

/* Cards column in populated state */
.income-cards-col {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    flex-shrink: 0;
}

/* Hide/Show label in income header */
.income-hide-label {
    font-size: 0.8em;
    color: var(--set-header-color);
    opacity: 0.85;
    margin-right: 0.5em;
}

/* Chart area — 3/4 width */
.income-chart-area {
    flex: 1;
    min-width: 0;
    max-width: 75%;
}

.income-chart-title {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 0.8em;
    font-weight: 600;
}

.income-chart-placeholder {
    display: flex;
    align-items: flex-end;
    height: 8em;
    border-bottom: 1px solid #ccc;
    padding: 0.25em 0 0 0;
    position: relative;
}

.income-chart-bars-wrap {
    flex: 1;
    height: 100%;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.income-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 0.25em;
    width: 100%;
    height: 100%;
    padding: 0 0.1em 0 0.25em;
    box-sizing: border-box;
}

.income-chart-bar {
    flex: 1;
    min-width: 0;
    background: #005284;
    border-radius: 0.15em 0.15em 0 0;
    min-height: 2px;
    transition: height 0.4s ease;
}

/* Older 12 months — same color, lighter */
.income-chart-bar-older {
    background: rgba(0, 82, 132, 0.5);
}

.income-chart-xlabel-older {
    opacity: 0.55;
}

/* Avg monthly line — positioned absolutely within bars-wrap */
.income-chart-avgline-wrap {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.income-chart-avgline {
    flex: 1;
    border-top: 1px dotted #005284;
}

.income-chart-avglabel {
    font-size: 0.62em;
    color: #005284;
    white-space: nowrap;
    padding-left: 0.3em;
}

/* Right y-axis column */
.income-chart-yaxis-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding-left: 0.3em;
    border-left: 1px solid #ccc;
    height: 100%;
    min-width: 4em;
}

.income-chart-yvalue {
    font-size: 0.65em;
    color: #888;
    white-space: nowrap;
}

.income-chart-yzero {
}

.income-chart-xaxis {
    display: flex;
    gap: 0.25em;
    margin-top: 0.25em;
    padding: 0 0.1em 0 0.25em;
    box-sizing: border-box;
    max-width: calc(100% - 4.5em);
}

.income-chart-xlabel {
    flex: 1;
    min-width: 0;
    font-size: 0.6em;
    color: #888;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===============================================================
   SORTABLE TABLE COLUMNS
   =============================================================== */

th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th.sortable:hover {
    background: #003d66;
}

th.sortable .sort-icon {
    font-size: 0.75em;
    opacity: 0.4;
    margin-left: 0.2em;
}

th.sort-asc .sort-icon::after  { content: " ↑"; opacity: 1; }
th.sort-desc .sort-icon::after { content: " ↓"; opacity: 1; }
th.sort-asc .sort-icon,
th.sort-desc .sort-icon { opacity: 1; }

/* ===============================================================
   SEARCH ROW
   =============================================================== */

.investments-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--set-header-bg);
    color: var(--set-header-color);
    padding: 0.5em 0.75em;
    margin: 0;
    font-size: 1em;
}

.search-row {
    display: flex;
    gap: 0.75em;
    align-items: flex-end;
    flex-wrap: wrap;
}

.search-left-group {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    flex: 2;
}

.search-above-label {
    font-size: 0.85em;
    color: var(--panel-label-color);
    white-space: nowrap;
    min-height: 1.2em;
}

.search-inner-row {
    display: flex;
    gap: 0.75em;
    align-items: center;
    flex-wrap: wrap;
}

.version-info-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35em;
    flex: 1;
    flex-shrink: 0;
}

.version-btn-row {
    display: flex;
    gap: 0.5em;
}

.version-info-label {
    font-size: 0.85em;
    color: var(--panel-label-color);
    white-space: nowrap;
    text-align: center;
}

.version-info-label strong {
    color: #005284;
}

.btn-save-version {
    background: var(--btn-gray-bg);
    color: var(--btn-gray-color);
    transition: background 0.2s, color 0.2s;
}

.btn-save-version.has-changes {
    background: var(--btn-blue-bg);
    color: var(--btn-blue-color);
}

.search-container {
    position: relative;
    flex-grow: 1;
    max-width: 25em;
}

#autocomplete-list {
    position: absolute;
    border: 1px solid var(--border);
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--autocomplete-bg);
    max-height: 12.5em;
    overflow-y: auto;
    box-shadow: 0 0.25em 0.75em rgba(0,0,0,0.15);
}

.autocomplete-item {
    padding: 0.75em;
    cursor: pointer;
    border-bottom: 1px solid var(--autocomplete-border);
    font-size: 0.875em;
    text-align: left;
}

.autocomplete-item:hover {
    background-color: var(--autocomplete-hover);
}

/* ===============================================================
   UNIFIED MODAL SYSTEM (dm-modal)
   Used for: logout confirmation, coming soon, and future dialogs
   =============================================================== */

.dm-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: var(--modal-overlay);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.dm-modal.show {
    display: flex;
    animation: dmFadeIn 0.25s ease forwards;
}

@keyframes dmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.dm-modal-content {
    background: var(--modal-bg);
    padding: 1.5em;
    border-radius: 0.5em;
    width: 25em;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 0.625em 1.875em var(--modal-shadow);
}

.dm-modal-content h3 {
    margin-top: 0;
    margin-bottom: 0.5em;
}

.dm-modal-content p {
    color: var(--panel-label-color);
    margin-bottom: 0;
}

.dm-modal-buttons {
    display: flex;
    justify-content: center;
    margin-top: 1.25em;
    gap: 0.5em;
}

.dm-modal-buttons button {
    flex: 1;
    max-width: 12em;
}

/* Input field inside modal */
.dm-modal-input-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-top: 0.75em;
    margin-bottom: 0.25em;
}

.dm-modal-input-label {
    font-size: 0.95em;
    color: var(--panel-label-color);
    white-space: nowrap;
    flex-shrink: 0;
}

.dm-modal-input {
    width: calc(100% - 1.5em);
    box-sizing: border-box;
    padding: 0.5em 0.75em;
    border: 1px solid var(--border);
    border-radius: 0.3em;
    font-size: 0.95em;
    outline: none;
}

.dm-modal-input:focus {
    border-color: #005284;
    box-shadow: 0 0 0 2px rgba(0,82,132,0.15);
}

/* Warning style for confirm modal */
.dm-modal-warning {
    color: #c0392b;
    font-size: 0.85em;
    margin-top: 0.5em !important;
    font-weight: 600;
}

/* Toast notification */
.toast-notification {
    position: fixed;
    top: 20em;
    left: 50%;
    transform: translateX(-50%) translateY(-1em);
    background: #ffffff;
    color: #000000;
    padding: 2.6em 6em;
    border-radius: 0.5em;
    font-size: 1em;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 0.25em 1em rgba(0,0,0,0.25);
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* New Set modal uses .modal — keep for compatibility */
.modal {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal.hidden {
    display: none !important;
}

.modal.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--modal-bg);
    border-radius: 0.5em;
    padding: 1.25em 1.5em;
    max-width: 25em;
    width: 90%;
    text-align: center;
    box-shadow: 0 0.625em 1.5em var(--modal-shadow);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 0.5em;
}

.modal-buttons {
    display: flex;
    justify-content: space-between;
    gap: 0.5em;
    margin-top: 1em;
}

.modal-buttons .btn {
    flex: 1;
    min-width: 5em;
}

/* ===============================================================
   CONTROLS BOX + BUTTONS
   =============================================================== */

main {
    border: 1px solid var(--list-border);
    padding-bottom: 0.625em;
}

.controls-box {
    background: var(--controls-bg);
    padding: 0.25em 1.25em 0.5em 1.25em;
    border-radius: 0.5em;
    border: 1px solid var(--border);
    max-width: 71.25em;
    margin: 0em 1em;
}

.btn {
    padding: 0.625em 0.9em;
    cursor: pointer;
    border: none;
    border-radius: 0.25em;
    transition: 0.2s;
    font-size: 0.875em;
}

.btn-small {
    padding: 0.3em 0.5em;
    font-size: 0.8em;
}

.btn-blue  { background: var(--btn-blue-bg);  color: var(--btn-blue-color);  }
.btn-green { background: var(--btn-green-bg); color: var(--btn-green-color); }
.btn-gray  { background: var(--btn-gray-bg);  color: var(--btn-gray-color);  }
.btn-red   { background: var(--btn-red-bg);   color: var(--btn-red-color);   }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===============================================================
   TABLE
   =============================================================== */

table {
    width: 97%;
    border-collapse: collapse;
    background: var(--table-bg);
    margin: 0.6em 0em 0em 1em;
    box-shadow: 0 0.125em 0.625em rgba(0, 0, 0, 0.05);
}

th {
    background: var(--table-th-bg);
    text-align: left;
    /* border-bottom: 2px solid var(--table-border); */
    font-size: 0.8em;
    font-weight: normal;
    color: var(--table-th-color);
    padding: 0.3em 0.2em;
}

td {
    border-top: 1px solid var(--table-border);
    font-size: 0.75em;
}

.delete-btn {
    color: var(--table-delete-color);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.125em;
}

#totalsRow { display: none; }

#totalsRow td {
    background: var(--table-th-bg);
    color: var(--table-th-color);
    padding: 0.5em;
    font-weight: normal;
}

#totalMVCell,
#totalAICell {
    text-align: right;
}

.mv-cell,
.inc-cell {
    text-align: right;
}

.totals-label {
    text-align: right;
}

.totals-value {
    text-align: right;
    font-weight: bold;
}

/* Right-align numeric columns */
.num-right {
    text-align: right;
}

th.num-right {
    text-align: right;
}

/* ===============================================================
   SUMMARY DASHBOARD
   =============================================================== */

.summary-dashboard {
    background: var(--table-th-bg);
    padding: 0;
    text-align: center;
    font-weight: normal;
    color: #ffffff;
}

.stat-card {
    width: 30%;
    float: left;
    padding: 0.5em;
    color: #ffffff;
}

.stat-card span {
    padding-left: 1em;
    font-weight: 600;
    color: #ffffff;
}

/* ===============================================================
   FETCH PROGRESS POPUP
   =============================================================== */

.fetch-progress-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.5em;
    padding: 1.5em 2em;
    z-index: 99998;
    box-shadow: 0 0.5em 2em rgba(0,0,0,0.2);
    min-width: 18em;
    text-align: center;
}

.fetch-progress-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75em;
}

.fetch-progress-spinner {
    width: 1.5em;
    height: 1.5em;
    border: 3px solid #e0e0e0;
    border-top-color: #005284;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.fetch-progress-text {
    font-size: 0.9em;
    color: var(--panel-label-color);
    font-weight: 600;
}

.fetch-progress-source {
    font-size: 0.75em;
    color: #888;
    margin-top: 0.25em;
    min-height: 1em;
}

.fetch-progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.15);
    z-index: 99997;
}

/* ===============================================================
   SYMBOL DETAIL POPUP
   =============================================================== */

.symbol-detail-popup {
    position: fixed;
    z-index: 99999;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 0.5em;
    box-shadow: 0 0.25em 1em rgba(0,0,0,0.2);
    min-width: 18em;
    max-width: 24em;
    font-size: 0.85em;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.symbol-detail-header {
    padding: 1em 1.25em 0.5em 1.25em;
    flex-shrink: 0;
}

.symbol-detail-popup h4 {
    margin: 0 0 0.5em 0;
    color: #005284;
    font-size: 1.1em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4em;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25em;
}

.symbol-detail-company {
    font-size: 0.8em;
    font-weight: normal;
    color: #666;
}

.symbol-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2em 0;
    border-bottom: 1px solid #f0f0f0;
}

.symbol-detail-label {
    color: #666;
}

.symbol-detail-value {
    font-weight: 600;
    color: #005284;
}

.symbol-detail-warn {
    color: #e07000 !important;
}

.symbol-detail-mismatch {
    font-size: 0.8em;
    color: #e07000;
    margin-top: 0.4em;
    padding: 0.3em 0.4em;
    background: #fff8f0;
    border: 1px solid #f0c080;
    border-radius: 0.3em;
    line-height: 1.4;
}

.symbol-detail-history {
    padding: 0 1.25em 0 1.25em;
    flex-shrink: 0;
}

.symbol-detail-history h5 {
    margin: 0.5em 0 0.25em 0;
    color: #005284;
    font-weight: 600;
    font-size: 0.9em;
    border-top: 1px solid #e0e0e0;
    padding-top: 0.5em;
}

.symbol-detail-hist-header {
    font-size: 0.82em;
    color: #555;
    margin-bottom: 0.25em;
}

.symbol-detail-hist-scroll {
    overflow-y: auto;
    max-height: 22em;
    border: 1px solid #f0f0f0;
    border-radius: 0.25em;
    padding: 0.1em 0.25em;
}

.symbol-detail-pay-row {
    display: flex;
    justify-content: space-between;
    padding: 0.18em 0;
    color: #555;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.95em;
}

/* Payments older than 12 months — dimmed */
.symbol-detail-pay-older {
    opacity: 0.45;
}

.symbol-detail-pay-amount {
    font-weight: 600;
    color: #333;
}

.symbol-detail-no-history {
    color: #999;
    font-size: 0.85em;
    margin-top: 0.25em;
    font-style: italic;
}

.symbol-detail-footer {
    padding: 0.75em 1.25em;
    text-align: right;
    flex-shrink: 0;
    border-top: 1px solid #f0f0f0;
    margin-top: 0.5em;
}

.symbol-link {
    color: #005284;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 700;
}

.symbol-link:hover {
    color: #003d66;
}

/* ===============================================================
   RESEARCH PANEL
   =============================================================== */

/* Research panel two-column layout */
.research-content-row {
    display: flex;
    gap: 1em;
    align-items: flex-start;
}

.research-left {
    flex: 0 0 auto;
    width: 50%;
    min-width: 0;
}

.research-right {
    flex: 1;
    min-width: 0;
    padding: 0.5em;
}

.research-table-wrap {
    max-height: 14em;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--table-border);
    border-radius: 0.25em;
}

.research-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875em;
    table-layout: fixed;
}

.research-table th {
    background: var(--table-th-bg);
    color: var(--table-th-color);
    padding: 0.3em 0.5em;
    text-align: left;
    font-weight: normal;
    position: sticky;
    top: 0;
    z-index: 1;
}

.research-table td {
    padding: 0.3em 0.5em;
    border-bottom: 1px solid var(--table-border);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.research-table tr:nth-child(even) td {
    background: #f8f8f8;
}

/* Column widths */
.research-table th:nth-child(1),
.research-table td:nth-child(1) { width: 15%; }

.research-table th:nth-child(2),
.research-table td:nth-child(2) { width: 35%; }

.research-table th:nth-child(3),
.research-table td:nth-child(3) { width: 25%; }

.research-table th:nth-child(4),
.research-table td:nth-child(4) { width: 25%; font-size: 0.75em; }

/* Centered columns */
.col-center {
    text-align: center !important;
}

.research-symbol-link {
    color: #005284;
    text-decoration: none;
    font-weight: 700;
}

.research-symbol-link:hover {
    text-decoration: underline;
    color: #003d66;
}

.research-last-updated {
    font-size: 0.75em;
    color: #999;
    padding: 0.3em 0.5em 0.2em 0.5em;
    text-align: right;
}

/* ===============================================================
   RESPONSIVE
   =============================================================== */

@media (max-width: 600px) {
    .manager-row {
        flex-direction: column;
    }
    .manager-panel {
        min-width: unset;
    }
}