/* =====================
   7. DASHBOARD PAGE
   ===================== */

.dashboard {
    max-width: 1024px;
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.dashboard-controls {
    display: flex;
    flex-direction: column;
    min-height: 42px;
    margin-top: 1rem;
}

.section-title {
    width: min(100%, 46rem);
    margin: 0 auto 0.2rem;
    font-family: "Avenir Next", "Helvetica Neue", sans-serif;
    font-size: clamp(1.1rem, 1rem + 0.45vw, 1.3rem);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-align: center;
}

.subsection-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 1.1rem auto 0.35rem;
    width: min(100%, 46rem);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.subsection-title::before,
.subsection-title::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--border-subtle);
}

.daily-subsection-title {
    margin-top: 0.35rem;
}

.portfolio-subsection-title {
    margin-top: 1.35rem;
}

.portfolio-table-wrapper {
    position: relative;
    overflow: hidden;
    overflow-x: auto;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    isolation: isolate;
    box-shadow:
        inset 0 1px 0 var(--border-subtle),
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 8px 20px rgba(0, 0, 0, 0.25);
}

.daily-summary-boxes,
.signal-summary-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 0.6rem;
    margin: 0 auto 1.25rem;
    width: min(100%, 38rem);
    justify-items: stretch;
    align-items: stretch;
}

.summary-switcher {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.summary-switch {
    border: 1px solid var(--border-default);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.38rem 0.8rem;
    text-transform: uppercase;
}

.summary-switch.is-active {
    border-color: var(--accent-border);
    background: var(--accent-bg);
    color: var(--accent-soft);
}

.daily-summary-boxes .summary-card:not(.is-mobile-active),
.signal-summary-boxes .summary-card:not(.is-mobile-active) {
    display: none;
}

.signal-summary-card {
    border-top: 2px solid var(--border-strong);
}

.signal-summary-card .summary-card-title {
    color: var(--text-primary);
}

.signal-summary-buy {
    border-top-color: var(--signal-buy);
}

.signal-summary-buy .summary-card-title {
    color: var(--signal-buy);
}

.signal-summary-sell {
    border-top-color: var(--signal-sell);
}

.signal-summary-sell .summary-card-title {
    color: var(--signal-sell);
}

.daily-summary-boxes > .summary-card {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.summary-card {
    position: relative;
    min-width: 18rem;
    max-width: 100%;
    width: 100%;
    border: 1px solid var(--border-default);
    border-radius: 8px;
    background: var(--bg-surface);
    overflow: hidden;
    isolation: isolate;
    padding: 0.6rem;
    box-sizing: border-box;
    box-shadow:
        inset 0 1px 0 var(--border-subtle),
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 8px 20px rgba(0, 0, 0, 0.25);
    transition: box-shadow 0.25s ease;
}

.summary-card:hover {
    border-color: var(--border-strong);
}

.summary-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0 0 0.65rem;
    color: var(--accent-soft);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.summary-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.4rem;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    background: var(--bg-hover);
    color: var(--text-primary);
}

.summary-item-name,
.summary-link.summary-item-name {
    display: block;
    min-width: 0;
    flex: 1 1 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    overflow: hidden;
    font-size: 0.88rem;
}

.summary-link {
    color: inherit;
    text-decoration: none;
    display: block;
    max-width: 100%;
}

.summary-link:hover,
.summary-link:focus-visible {
    color: var(--accent);
    text-decoration: none;
}

.summary-item-change {
    font-weight: 700;
    min-width: 5.5ch;
    text-align: right;
}

.summary-item-change.positive {
    color: var(--score-good);
}

.summary-item-change.negative {
    color: var(--score-poor);
}

.summary-empty {
    justify-content: center;
    color: var(--text-muted);
}

.mobile-cards-view {
    display: none;
}

.mobile-cards-view-measure {
    position: absolute;
    left: -9999px;
    top: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: -1;
}

.portfolio-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: clamp(0.82rem, 0.72rem + 0.52vw, 1.0rem);
}

.portfolio-table thead {
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border-default);
}

.portfolio-table th,
.portfolio-table td {
    padding: 1em;
    box-sizing: border-box;
    vertical-align: middle;
}

.portfolio-table th {
    color: var(--accent-soft);
    font-weight: 700;
}

.sort-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: inherit;
    gap: 0.22em;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.sort-arrow {
    display: inline-block;
    width: 0.8em;
    color: var(--accent-soft);
    font-size: 0.9em;
    line-height: 1;
    text-align: center;
}

.sort-trigger.active .sort-arrow,
.sort-trigger:hover .sort-arrow {
    color: var(--accent-soft);
}

.portfolio-table td {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
}

.portfolio-table tbody tr {
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border-default);
    transition: background 0.2s ease;
    height: 88px;
}

.portfolio-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.06);
}

.portfolio-row {
    display: none;
}

.portfolio-row.is-visible {
    display: table-row;
}

.change-value {
    font-weight: 600;
}

.change-value.positive {
    color: var(--score-good);
}

.change-value.negative {
    color: var(--score-poor);
}

.stock-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    max-width: 100%;
    overflow: hidden;
}

.stock-name-label {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.25;
}

.stock-symbol {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    line-height: 1;
    text-transform: uppercase;
}

.mobile-only-label {
    display: none;
}

.desktop-only-label {
    display: inline;
}

.mobile-cell-label {
    display: none;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.fscore-badge {
    display: inline-block;
    padding: 0.4em 0.8em;
    border-radius: 6px;
    font-weight: 700;
    text-align: center;
    min-width: 2em;
}

.fscore-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35em;
    height: 100%;
    justify-content: center;
}

.fscore-date {
    display: block;
    font-size: 0.7em;
    color: var(--text-muted);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fscore-badge.score-green {
    background: rgba(16, 185, 129, 0.18);
    color: var(--signal-buy);
}

.fscore-badge.score-yellow {
    background: rgba(179, 179, 179, 0.18);
    color: var(--score-neutral);
}

.fscore-badge.score-red {
    background: rgba(239, 68, 68, 0.14);
    color: var(--signal-sell);
}

.signal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.4em 0.8em;
    border-radius: 6px;
    font-weight: 600;
    font-size: clamp(0.76rem, 0.72rem + 0.2vw, 0.85rem);
}

.signal-badge.buy {
    background: rgba(16, 185, 129, 0.16);
    color: var(--signal-buy);
}

.signal-badge.sell {
    background: rgba(239, 68, 68, 0.12);
    color: var(--signal-sell);
}

.signal-badge.neutral {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.analyst-rating-badge {
    display: inline-block;
    font-size: inherit;
    line-height: 1.1;
    font-weight: 600;
    white-space: normal;
    text-align: center;
    color: var(--text-muted);
}

.analyst-rating-badge.strong-buy {
    color: var(--score-strong);
}

.analyst-rating-badge.buy {
    color: var(--score-good);
}

.analyst-rating-badge.hold {
    color: var(--accent-soft);
}

.analyst-rating-badge.sell {
    color: var(--score-weak);
}

.analyst-rating-badge.strong-sell {
    color: var(--score-poor);
}

.action-link {
    background: none;
    border: 0;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-align: left;
    text-decoration: none;
    transition: color 0.2s ease;
}

.action-link:hover {
    color: var(--accent-soft);
}

.stock-name.action-link {
    color: var(--text-primary);
}

.stock-name.action-link:hover,
.stock-name.action-link:focus-visible {
    color: var(--accent-soft);
}

.empty-state {
    text-align: center;
    padding: 3em;
    color: var(--text-secondary);
    font-size: clamp(0.92rem, 0.86rem + 0.35vw, 1.1rem);
}

.mobile-stock-card {
    position: relative;
    width: 100%;
    border: 1px solid var(--border-default);
    border-radius: 16px;
    overflow: hidden;
    isolation: isolate;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    box-shadow:
        inset 0 1px 0 var(--border-subtle),
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 8px 20px rgba(0, 0, 0, 0.28);
    transition: box-shadow 0.25s ease;
}

.mobile-stock-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--bg-surface);
    z-index: -1;
}

.mobile-stock-card:hover,
.mobile-stock-card:focus-within {
    border-color: var(--border-strong);
}

.mobile-stock-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
    align-items: center;
    padding: 0.78rem 0.85rem;
    border-bottom: 1px solid var(--border-default);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.mobile-stock-toggle {
    display: none;
}

.mobile-stock-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.6rem;
}

.mobile-stock-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
}

.mobile-stock-name {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
    max-width: 100%;
}

.mobile-stock-name-text {
    display: -webkit-box;
    min-height: 3em;
    height: 3em;
    overflow: hidden;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mobile-stock-symbol {
    display: block;
    margin-top: 0.16rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.mobile-stock-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
    align-items: stretch;
}

.mobile-stock-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.38rem;
    min-width: 4.55rem;
}

.mobile-stock-summary-price {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
    text-align: right;
}

.mobile-stock-panel {
    display: block;
    padding: 0.85rem;
}

.mobile-stock-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    padding: 0.16rem 0.08rem;
    border-radius: 0;
    background: transparent;
    border: 0;
    min-height: 1.9rem;
    min-width: 0;
    height: 100%;
}

.mobile-stock-metric.change-chip,
.mobile-stock-metric.dividend-chip,
.mobile-stock-metric.fscore-chip {
    align-items: center;
}

.mobile-stock-metric-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    line-height: 1;
    text-align: center;
    min-height: 1em;
}

.mobile-stock-metric-value {
    text-align: center;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.92rem;
    min-width: 0;
    display: flex;
    width: 100%;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    line-height: 1;
    min-height: 2.15em;
}

.mobile-stock-metric.change-chip .mobile-stock-metric-value,
.mobile-stock-metric.dividend-chip .mobile-stock-metric-value,
.mobile-stock-metric.fscore-chip .mobile-stock-metric-value {
    text-align: center;
}

.mobile-stock-metric-value .change-value.positive {
    color: var(--score-good);
}

.mobile-stock-metric-value .change-value.negative {
    color: var(--score-poor);
}

.mobile-stock-metric-value .fscore-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.mobile-stock-metric-value .fscore-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: 0;
    box-shadow: none;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1;
    font-weight: 700;
}

.mobile-stock-metric-value .fscore-badge.score-green {
    color: var(--score-strong);
}

.mobile-stock-metric-value .fscore-badge.score-yellow {
    color: var(--score-neutral);
}

.mobile-stock-metric-value .fscore-badge.score-red {
    color: var(--signal-sell);
}

.mobile-stock-metric-value .analyst-rating-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.15em;
    line-height: 1.05;
}

.mobile-stock-metric-value .fscore-date {
    white-space: nowrap;
    text-align: center;
}

.col-name {
    width: 32%;
    text-align: left;
}

.table-name-search {
    width: 9rem;
    min-width: 0;
}

.col-price {
    width: 12%;
    text-align: right;
}

.col-change {
    width: 12%;
    text-align: right;
}

.col-dividend {
    width: 11%;
    text-align: right;
}

.col-fscore {
    width: 10%;
    text-align: center;
}

.col-analyst {
    width: 10%;
    text-align: center;
}

.pag-controls {
    display: flex;
    width: 100%;
    justify-content: flex-end;
    align-items: center;
    gap: 0.55em;
    margin: 0;
    padding: 0.62em 0.85em;
    border-top: 1px solid var(--border-default);
    border-radius: 0 0 8px 8px;
    background: var(--bg-surface);
    min-height: 45px;
    box-sizing: border-box;
}

.pag-btn {
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0.48em 0.78em;
    background: var(--accent-bg);
    color: rgba(255, 205, 130, 0.96);
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    font-size: clamp(1.08rem, 1rem + 0.55vw, 1.3rem);
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-text-stroke: 0.02em currentColor;
    -webkit-appearance: none;
    appearance: none;
}

.pag-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.3rem;
    min-width: 6ch;
    padding: 0.32rem 0.8rem;
    border-radius: 999px;
    background: var(--bg-hover);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: clamp(0.76rem, 0.72rem + 0.2vw, 0.9rem);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    white-space: nowrap;
}

.portfolio-section {
    display: flex;
    flex-direction: column;
      gap: 1em;
}

.filters-wrapper {
    display: flex;
    gap: 0.9em;
    margin-bottom: 0.4em;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    min-height: 34px;
    width: 100%;
}

.filter-group {
    display: flex;
    gap: 0.45em;
    align-items: center;
    min-height: 32px;
    flex: 0 0 auto;
}

.search-filter-group {
    justify-content: center;
}

.search-input,
.filter-input,
.reset-btn {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    color-scheme: dark;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.search-input {
    display: block;
    width: 100%;
    min-height: 38px;
    padding: 0.46em 0.72em;
    border-radius: 6px;
    font-size: 0.98em;
    box-shadow: inset 0 1px 0 var(--border-subtle), 0 0 0 1px rgba(0, 0, 0, 0.12);
    letter-spacing: 0.01em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:hover {
    border-color: var(--border-strong);
    box-shadow: inset 0 1px 0 var(--border-subtle), 0 0 0 1px var(--border-default);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--accent-bg), inset 0 1px 0 var(--border-subtle);
}

.filter-input,
.reset-btn {
    min-height: 38px;
    padding: 0.42em 0.7em;
    font-size: 0.92em;
}

.filter-input {
    min-width: 96px;
    border-radius: 4px;
}

.filter-input,
.filter-input option,
.filter-input optgroup {
    font-size: 0.96em !important;
}

#fscore-filter {
    min-width: 112px;
}

#dividend-filter {
    min-width: 92px;
}

.reset-btn {
    min-width: 102px;
    border-radius: 4px;
    font-size: 0.96em;
    font-weight: 500;
}

.filter-input:hover {
    border-color: var(--border-strong);
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-elevated);
}

.reset-btn:hover {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

.pag-btn:hover {
    background: var(--accent-bg);
    border-color: var(--accent-border);
    color: var(--accent);
}

.pag-btn:active {
    background: var(--accent-bg);
    border-color: var(--accent-border);
}

@media (max-width: 1280px) {
    .dashboard {
        max-width: 90%;
    }
    .portfolio-table {
        font-size: clamp(0.76rem, 0.68rem + 0.42vw, 0.88rem);
    }

    .portfolio-table th,
    .portfolio-table td {
        padding: 0.75em;
    }

    .pag-controls {
        gap: 0.22em;
    }
}

@media (max-width: 768px) {
    body.dashboard-view .header .page-name {
        text-align: center;
    }

    .dashboard-controls {
        min-height: 38px;
    }

    .filters-wrapper {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: clamp(0.35rem, 1vw, 0.5rem);
        align-items: stretch;
        width: min(100%, 24rem);
        margin-inline: auto;
    }

    .search-filter-group {
        grid-column: 1 / -1;
        width: 100%;
    }

    .table-name-search {
        width: 100%;
        min-height: 36px;
    }

    .filter-group {
        gap: clamp(0.18rem, 0.6vw, 0.3rem);
        min-height: 30px;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        min-height: 36px;
        padding: clamp(0.34rem, 0.85vw, 0.42rem) clamp(0.56rem, 1.2vw, 0.66rem);
        font-size: clamp(0.9rem, 0.85rem + 0.24vw, 0.98rem);
    }

    .filter-input {
        width: 100%;
        min-height: 36px;
        padding: clamp(0.32rem, 0.8vw, 0.38rem) clamp(0.52rem, 1.08vw, 0.6rem);
        font-size: clamp(0.92rem, 0.86rem + 0.24vw, 1rem) !important;
    }

    .reset-btn {
        width: 100%;
        min-height: 36px;
        padding: clamp(0.32rem, 0.8vw, 0.38rem) clamp(0.56rem, 1.08vw, 0.64rem);
        font-size: clamp(0.9rem, 0.85rem + 0.24vw, 0.98rem);
    }

    .pag-controls {
        gap: 0.22em;
    }

    .pag-btn {
        padding: 0.38em 0.58em;
        -webkit-text-stroke: 0.018em currentColor;
    }

    .pag-info {
        font-size: 0.82em;
    }

    .portfolio-table th,
    .portfolio-table td {
        padding: 0.75em;
    }

    .col-name { width: 30%; }
    .col-price { width: 13%; }
    .col-change { width: 13%; }
    .col-dividend { width: 11%; }
    .col-fscore { width: 10%; }
    .col-analyst { width: 10%; }
}

@media (max-width: 700px) {
    .price-chart-wrapper {
        display: none !important;
    }

    .dashboard {
        --mobile-list-width: min(94%, 32rem);
        --mobile-list-gap: clamp(0.6rem, 1.8vw, 0.75rem);
        --mobile-panel-padding: clamp(0.72rem, 2.4vw, 0.9rem);
        --mobile-card-head-padding: clamp(0.72rem, 2.3vw, 0.85rem);
        --mobile-summary-width: clamp(4rem, 17vw, 4.6rem);
        width: 100%;
        margin: 0.75rem auto 0;
        gap: 1.2rem;
    }

    .section-title,
    .subsection-title,
    .dashboard-controls,
    .daily-summary-boxes,
    .signal-summary-boxes,
    .mobile-cards-view,
    .filters-wrapper,
    .pag-controls {
        width: var(--mobile-list-width);
    }

    .portfolio-section {
        gap: 0.65rem;
    }

    .portfolio-table {
        display: none;
    }

    .fscore-date,
    .mobile-stock-metric-value .fscore-date {
        display: none;
    }

    .mobile-cards-view {
        display: flex;
        flex-direction: column;
        gap: clamp(0.9rem, 2.6vw, 1.15rem);
        margin-inline: auto;
    }

    .mobile-only-label {
        display: inline;
    }

    .desktop-only-label {
        display: none;
    }

    .dashboard-controls {
        min-height: clamp(7rem, 22vw, 8.25rem);
        margin: 0 auto;
    }

    .daily-summary-boxes {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 0 auto 1rem;
        gap: clamp(1rem, 2.4vw, 1.2rem);
    }

    .summary-switcher {
        width: 100%;
        margin: 0;
    }

    .summary-card-title .summary-switcher {
        width: auto;
        flex-shrink: 0;
    }

    .daily-summary-boxes > .summary-card {
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    .filters-wrapper {
        gap: clamp(0.28rem, 1.4vw, 0.36rem);
    }

    .filter-group {
        gap: clamp(0.12rem, 0.7vw, 0.18rem);
    }

    .search-filter-group {
        margin: 0;
        align-items: stretch;
    }

    .table-name-search {
        text-align: left;
        margin: 0;
    }

    .search-input {
        min-height: 36px;
        padding: clamp(0.28rem, 1vw, 0.34rem) clamp(0.5rem, 1.5vw, 0.58rem);
        font-size: clamp(0.88rem, 0.82rem + 0.48vw, 0.96rem);
        border-color: var(--border-strong);
        background: var(--bg-surface);
    }

    .filter-input {
        padding: clamp(0.28rem, 1vw, 0.34rem) clamp(0.5rem, 1.45vw, 0.58rem);
        font-size: clamp(0.94rem, 0.88rem + 0.58vw, 1.04rem) !important;
        border-color: var(--border-strong);
        background: var(--bg-surface);
    }

    .reset-btn {
        padding: clamp(0.28rem, 1vw, 0.34rem) clamp(0.5rem, 1.4vw, 0.58rem);
        font-size: clamp(0.88rem, 0.82rem + 0.44vw, 0.96rem);
        border-color: var(--border-strong);
        background: var(--bg-surface);
        justify-self: stretch;
    }

    .pag-controls {
        justify-content: space-between;
        gap: 0.5rem;
        margin: 0.35rem auto 0;
        padding: 0.5rem 0;
        border-top: 0;
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .pag-btn {
        min-width: 2.7rem;
        min-height: 2.35rem;
        padding: 0.34em 0.66em;
        background: var(--accent-bg);
        border-color: var(--accent-border);
        -webkit-text-stroke: 0.016em currentColor;
    }

    .pag-info {
        flex: 1 1 auto;
        min-height: 2.35rem;
        min-width: 9ch;
        padding: 0.26rem 0.5rem;
        background: var(--bg-hover);
        border-color: var(--border-strong);
        font-size: 0.84rem;
    }

    .portfolio-table-wrapper {
        min-height: auto;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        overflow-x: visible;
    }

    .mobile-stock-toggle {
        padding: 0;
    }

    .mobile-stock-card-head {
        padding: var(--mobile-card-head-padding);
    }

    .mobile-stock-header {
        align-items: center;
    }

    .mobile-stock-name {
        font-size: 0.86rem;
    }

    .mobile-stock-symbol {
        font-size: 0.68rem;
    }

    .mobile-stock-summary {
        min-width: var(--mobile-summary-width);
        gap: 0.3rem;
    }

    .mobile-stock-summary-price {
        font-size: 0.86rem;
    }

    .mobile-stock-panel {
        padding: var(--mobile-panel-padding);
    }

    .mobile-stock-metric-value .fscore-container {
        gap: 0.08rem;
    }

    .mobile-stock-metric {
        padding: 0.12rem 0.06rem;
        gap: 0.08rem;
        min-height: 1.72rem;
    }

    .mobile-stock-metric-label {
        font-size: 0.56rem;
    }

    .mobile-stock-metric-value {
        font-size: 0.84rem;
    }

    .mobile-stock-metric.change-chip .mobile-stock-metric-value,
    .mobile-stock-metric.dividend-chip .mobile-stock-metric-value,
    .mobile-stock-metric.fscore-chip .mobile-stock-metric-value,
    .mobile-stock-metric.analyst-chip .mobile-stock-metric-value {
        text-align: center;
    }

    .mobile-stock-metric-value .change-value {
        display: inline-block;
    }

    .mobile-stock-metric-value .fscore-container {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

}

@media (max-width: 500px) {
    .pag-btn {
        width: 2.7rem;
        height: 2.35rem;
        min-width: 2.7rem;
        min-height: 2.35rem;
        padding: 0;
        line-height: 1;
    }
}

@media (max-width: 374px) {
    .dashboard {
        --mobile-card-head-padding: 0.6rem 0.7rem;
        --mobile-panel-padding: 0.6rem 0.7rem;
        --mobile-summary-width: clamp(3.6rem, 14vw, 4.2rem);
        width: min(94%, 32rem);
        overflow-x: clip;
    }

    .mobile-stock-metric {
        padding: 0.1rem 0.04rem;
        min-height: 1.6rem;
    }

    .mobile-stock-metric-label {
        font-size: 0.5rem;
    }

    .mobile-stock-metric-value {
        font-size: 0.74rem;
    }

    .mobile-stock-name {
        font-size: 0.8rem;
    }

    .mobile-stock-summary-price {
        font-size: 0.8rem;
    }

    .pag-info {
        min-width: 7ch;
    }
}

.price-chart-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 10.5rem;
    grid-template-rows: auto auto;
    gap: 1rem;
    align-items: stretch;
    margin-top: 0.9rem;
}

.price-chart-wrapper[hidden] {
    display: none;
}

.price-chart-wrapper:has(.chart-rating-box[hidden]) {
    grid-template-columns: minmax(0, 1fr);
}

.panel-surface {
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--bg-surface);
    box-sizing: border-box;
}

.analysis-panel {
    transition: box-shadow 0.25s ease;
}

#price-chart-canvas[hidden] {
    display: none;
}

#price-chart-canvas {
    flex: 1 1 auto;
    min-height: 0;
}

.price-chart-section {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    height: auto;
    width: 100%;
    min-width: 0;
    isolation: isolate;
    padding: 1.25em 1.5em 1.5em;
    box-shadow:
        inset 0 1px 0 var(--border-subtle),
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 8px 20px rgba(0, 0, 0, 0.25);
    border-top: 2px solid #f97316;
}

.price-chart-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 1em;
}

.price-chart-heading {
    min-width: 0;
    width: min(34rem, calc(100% - 8rem));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.panel-kicker {
    color: #f97316;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.price-chart-title {
    font-family: "Avenir Next", "Helvetica Neue", sans-serif;
    font-size: clamp(1.1rem, 0.95rem + 0.7vw, 1.5rem);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
}

.price-chart-symbol {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1;
    text-transform: uppercase;
}

.price-chart-close-btn {
    position: absolute;
    right: 0;
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 0.3em 0.7em;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.price-chart-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.price-chart-intervals {
    display: flex;
    gap: 0.4em;
    justify-content: center;
    margin-bottom: 0.9em;
}

.price-chart-main {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.chart-rating-box {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    padding: 1rem 0.8rem;
    border-top: 2px solid var(--accent);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chart-rating-box[hidden] {
    display: none;
}

.chart-rating-title {
    margin: 0;
    color: var(--accent-soft);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-align: center;
    text-transform: uppercase;
}

.chart-rating-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
}

.chart-rating-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chart-rating-box .analyst-rating-badge,
.chart-rating-box .fscore-badge {
    font-size: 0.95rem;
}

.chart-rating-box .fscore-badge {
    font-size: 1.15rem;
}

.chart-metric-value {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
}

.chart-price-item .chart-metric-value {
    font-size: 1.15rem;
}

.chart-dividend-value {
    color: var(--text-secondary);
    font-weight: 600;
}

.chart-metric-value.positive {
    color: var(--score-good);
}

.chart-metric-value.negative {
    color: var(--score-poor);
}

.chart-metric-value.neutral {
    color: var(--text-secondary);
}

.price-chart-visual {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.price-side-column {
    grid-column: 1 / -1;
    grid-row: 2;
    flex: none;
    display: grid;
    grid-template-columns: minmax(0, 13fr) minmax(0, 7fr);
    align-items: stretch;
    gap: 1rem;
    align-self: stretch;
    width: 100%;
    max-width: none;
}

.price-side-column.no-signals {
    grid-template-columns: minmax(0, 1fr);
}

.price-side-column.no-range .signal-table-box {
    grid-column: 1;
}

.price-side-column.no-range {
    grid-template-columns: minmax(0, 7fr) minmax(0, 13fr);
}

.signal-table-box {
    display: flex;
    flex: 0 0 15rem;
    flex-direction: column;
    height: 16rem;
    min-width: 0;
    padding: 1rem;
    box-shadow:
        inset 0 1px 0 var(--border-subtle),
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 8px 20px rgba(0, 0, 0, 0.2);
    border-top: 2px solid #e879f9;
}

.signal-table-box[hidden] {
    display: none;
}

.signal-table-title {
    margin: 0 0 0.7rem;
    color: #e879f9;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-align: center;
    text-transform: uppercase;
}

.signal-table-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: auto;
    overflow-y: auto;
    margin-right: -1rem;
    padding-right: 0.55rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.28) transparent;
}

.signal-table-wrapper::-webkit-scrollbar {
    width: 4px;
}

.signal-table-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.signal-table-wrapper::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
}

.signal-table-wrapper:hover {
    scrollbar-color: rgba(148, 163, 184, 0.48) transparent;
}

.signal-table-wrapper:hover::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.42);
}

.signal-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.signal-table th,
.signal-table td {
    padding: 0.42rem 0.3rem;
    text-align: right;
    white-space: nowrap;
}

.signal-table th {
    border-bottom: 1px solid var(--border-strong);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
}

.signal-table th:first-child,
.signal-table td:first-child {
    text-align: left;
}

.signal-table-signal.buy {
    color: var(--signal-buy);
    font-weight: 700;
}

.signal-table-signal.sell {
    color: var(--signal-sell);
    font-weight: 700;
}

.price-corridor-box {
    position: relative;
    flex: none;
    height: 16rem;
    min-height: 16rem;
    max-height: 16rem;
    overflow: hidden;
    isolation: isolate;
    padding: 1.25em 1.5em 1.5em;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow:
        inset 0 1px 0 var(--border-subtle),
        0 2px 4px rgba(0, 0, 0, 0.12),
        0 8px 20px rgba(0, 0, 0, 0.25);
    border-top: 2px solid var(--link);
}

.price-corridor-title {
    margin: 0;
    text-align: center;
    color: var(--link-hover);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ---- axis visualization ---- */
.pcorr-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-muted);
    border: 2px solid var(--text-secondary);
    box-sizing: border-box;
    flex-shrink: 0;
    z-index: 1;
}

.pcorr-low .pcorr-dot    { background: rgba(220, 80, 80, 0.9);   border-color: rgba(220, 80, 80, 1); }
.pcorr-median .pcorr-dot { background: rgba(255, 200, 80, 0.9);  border-color: rgba(255, 200, 80, 1); }
.pcorr-high .pcorr-dot   { background: rgba(80, 200, 110, 0.9);  border-color: rgba(80, 200, 110, 1); }
.pcorr-current .pcorr-dot {
    background: var(--accent-soft);
    border-color: var(--accent-soft);
    width: 11px;
    height: 11px;
    box-shadow: 0 0 6px var(--accent-border);
}

.pcorr-low.expected-up .pcorr-dot {
    background: rgba(80, 200, 110, 0.95);
    border-color: rgba(80, 200, 110, 1);
}

.pcorr-low.expected-down .pcorr-dot {
    background: rgba(220, 80, 80, 0.95);
    border-color: rgba(220, 80, 80, 1);
}

.pcorr-line {
    width: 16px;
    height: 1.5px;
    border-radius: 1px;
    background: var(--border-strong);
    flex-shrink: 0;
}

.pcorr-low .pcorr-line    { background: rgba(220, 80, 80, 0.4); }
.pcorr-median .pcorr-line { background: rgba(255, 200, 80, 0.4); }
.pcorr-high .pcorr-line   { background: rgba(80, 200, 110, 0.4); }
.pcorr-low.expected-up .pcorr-line {
    background: rgba(80, 200, 110, 0.45);
}
.pcorr-low.expected-down .pcorr-line {
    background: rgba(220, 80, 80, 0.45);
}
.pcorr-current .pcorr-line {
    background: var(--accent-border);
    height: 2px;
}

.pcorr-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.pcorr-current .pcorr-info {
    text-align: right;
}

/* Compact horizontal price range layout. */
.pcorr-axis-wrap {
    position: relative;
    height: 100%;
    min-height: 12rem;
    width: 100%;
    box-sizing: border-box;
}

.pcorr-track {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    bottom: auto;
    width: 100%;
    height: 3px;
    transform: translateY(-50%);
    border-radius: 2px;
    background: linear-gradient(
        to right,
        rgba(220, 80, 80, 0.55),
        rgba(255, 200, 80, 0.45),
        rgba(80, 200, 110, 0.55)
    );
}

.pcorr-tick {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateX(-50%);
    width: auto;
    height: auto;
    display: block;
}

.pcorr-tick .pcorr-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.pcorr-tick .pcorr-line {
    position: absolute;
    left: 50%;
    top: calc(50% + 6px);
    transform: translateX(-50%);
    width: 1.5px;
    height: 10px;
    margin: 0;
}

.pcorr-tick .pcorr-info {
    position: absolute;
    left: 50%;
    top: calc(50% + 18px);
    transform: translateX(-50%);
    text-align: center;
    white-space: nowrap;
}

.pcorr-current {
    position: absolute;
    right: auto;
    left: 0;
    top: 50%;
    transform: translateX(-50%);
}

.pcorr-current .pcorr-line {
    top: calc(50% - 22px);
    height: 16px;
}

.pcorr-current .pcorr-info {
    top: calc(50% - 66px);
    bottom: auto;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.pcorr-low .pcorr-line {
    height: 18px;
}

.pcorr-low .pcorr-info {
    top: calc(50% + 30px);
}

.pcorr-median .pcorr-line {
    height: 40px;
}

.pcorr-median .pcorr-info {
    top: calc(50% + 52px);
}

.pcorr-high .pcorr-line {
    height: 62px;
}

.pcorr-high .pcorr-info {
    top: calc(50% + 74px);
}

.pcorr-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.pcorr-val {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pcorr-current .pcorr-label { color: var(--accent-border); }
.pcorr-current .pcorr-val   { color: var(--accent-soft); font-size: 0.88rem; }

.interval-btn {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 0.28em 0.72em;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.interval-btn:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-color: var(--border-strong);
}

.interval-btn.is-active {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.price-chart-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.col-name .action-link.chart-active {
    color: var(--accent) !important;
}

@media (max-width: 750px) {
    .signal-table-box {
        padding: 0.7rem;
    }

    .signal-table-wrapper {
        margin-right: -0.7rem;
        padding-right: 0.4rem;
        overflow-x: auto;
    }

    .signal-table {
        font-size: 0.7rem;
    }

    .signal-table th,
    .signal-table td {
        padding: 0.35rem 0.15rem;
    }
}

@media (min-width: 501px) and (max-width: 700px) {
    .dashboard {
        --mobile-list-width: min(100%, clamp(24rem, 86vw, 32rem));
        --mobile-list-gap: clamp(0.68rem, 1.6vw, 0.8rem);
        --mobile-panel-padding: clamp(0.8rem, 1.9vw, 0.95rem);
        --mobile-card-head-padding: clamp(0.8rem, 1.8vw, 0.9rem);
        --mobile-summary-width: clamp(4.2rem, 9vw, 4.8rem);
        width: min(94%, 40rem);
    }

    .dashboard-controls {
        min-height: clamp(6.2rem, 15vw, 7.1rem);
        margin: 0 auto;
    }

    .daily-summary-boxes {
        margin: 0 auto 1rem;
    }

    .filters-wrapper {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
        margin: 0 auto;
    }

    .mobile-stock-name {
        font-size: 0.94rem;
    }

    .mobile-stock-summary-price {
        font-size: 0.92rem;
    }

    .mobile-stock-metrics {
        gap: 0.5rem;
    }
}
