html {
    min-height: 100%;
}

body {
    min-height: 100%;
}

/* Dashboard warning palette (verdict / protection states) */
:root {
    --warning: #FF9B05;
    --warning-strong: #FF9B05;
    --warning-border: #FF9B0559;
    --warning-threshold: #FF9B05;
    --warning-threshold-hover: #FFAB2E;
    --warning-threshold-border: #FF9B0573;
}

.text-verdict-warning {
    color: var(--warning-strong) !important;
}

.text-verdict-threshold {
    color: var(--warning-threshold) !important;
}

.text-bg-verdict-warning {
    color: #000 !important;
    background-color: var(--warning-strong) !important;
    border: 1px solid var(--warning-border);
}

.text-bg-verdict-threshold {
    color: #000 !important;
    background-color: var(--warning-threshold) !important;
    border: 1px solid var(--warning-threshold-border);
}

.text-bg-verdict-threshold:hover {
    background-color: var(--warning-threshold-hover) !important;
}

.form-control.text-verdict-warning:disabled,
.form-control.text-verdict-threshold:disabled {
    opacity: 1;
}

.form-control.text-verdict-warning:disabled {
    color: var(--warning-strong) !important;
    -webkit-text-fill-color: var(--warning-strong);
}

.form-control.text-verdict-threshold:disabled {
    color: var(--warning-threshold) !important;
    -webkit-text-fill-color: var(--warning-threshold);
}

/* Sidebar styling */
.left-sidenav {
    width: 240px;
    flex-shrink: 0;
    align-self: stretch;
    min-height: 100%;
    background-color: #f8f9fa; /* light gray */
    padding-top: 1rem;
    transition: all 0.3s ease-in-out;
}

/* Sidebar brand */
.sidebar-brand {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    letter-spacing: 0.5px;
}

/* Sidebar links */
.left-sidenav .nav-link {
    color: #333;
    font-weight: 500;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-radius: 8px;
    margin: 4px 12px;
    transition: background 0.2s ease, color 0.2s ease;
}

    .left-sidenav .nav-link i {
        width: 20px;
        height: 20px;
    }

    /* Hover effect */
    .left-sidenav .nav-link:hover {
        background-color: #e9ecef;
        color: #0d6efd; /* Bootstrap primary */
        text-decoration: none;
    }

    /* Active menu */
    .left-sidenav .nav-link.active {
        background-color: #0d6efd;
        color: white;
    }

        /* Active icon turns white */
        .left-sidenav .nav-link.active i {
            color: white;
        }

/* Page wrapper (fixes sidebar overlap) */
#wrapper {
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    min-height: 100vh;
    align-items: stretch;
}

/* Push content aside when sidebar is visible */
#page-content-wrapper {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    background-color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

.container-fluid.dashboard-main {
    padding-top: 0 !important;
    padding-bottom: 1rem !important;
}

.dashboard-page {
    width: 100%;
    max-width: 100%;
}

.dashboard-brand {
    margin: 0;
    padding: 1.5rem 0;
    line-height: 0;
}

.dashboard-page-body {
    min-width: 0;
}

.dashboard-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1070;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(1px);
}

.dashboard-loading-overlay.is-active {
    display: flex;
}

.dashboard-loading-overlay-panel {
    padding: 1.25rem 1.75rem;
    border-radius: 0.5rem;
    background-color: #fff;
    box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.18);
}

[data-bs-theme="dark"] .dashboard-loading-overlay {
    background-color: rgba(17, 24, 39, 0.78);
}

[data-bs-theme="dark"] .dashboard-loading-overlay-panel {
    background-color: #1f2937;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.45);
}

.dashboard-brand-logo {
    display: block;
    margin: 0 auto;
    padding: 0;
    max-width: min(100%, 480px);
    height: auto;
    vertical-align: top;
}

.dashboard-brand-logo-dark {
    display: none;
}

[data-bs-theme="dark"] .dashboard-brand-logo-light {
    display: none;
}

[data-bs-theme="dark"] .dashboard-brand-logo-dark {
    display: block;
}

[data-bs-theme="dark"],
[data-bs-theme="dark"] body,
[data-bs-theme="dark"] #wrapper,
[data-bs-theme="dark"] #page-content-wrapper,
[data-bs-theme="dark"] #page-content-wrapper > .container-fluid,
[data-bs-theme="dark"] .container-fluid.py-3 {
    background-color: #111827 !important;
    color: #e5e7eb;
}

[data-bs-theme="dark"] .navbar,
[data-bs-theme="dark"] .left-sidenav {
    background-color: #182235 !important;
    border-color: #334155 !important;
}

[data-bs-theme="dark"] .sidebar-brand,
[data-bs-theme="dark"] .left-sidenav .nav-link,
[data-bs-theme="dark"] .navbar span {
    color: #e5e7eb !important;
}

[data-bs-theme="dark"] .left-sidenav .nav-link:hover {
    background-color: #24344d;
    color: #93c5fd !important;
}

[data-bs-theme="dark"] .card {
    background-color: #182235;
    border-color: #334155;
    color: #e5e7eb;
}

[data-bs-theme="dark"] .text-muted {
    color: #9ca3af !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
    background-color: #0f172a;
    border-color: #334155;
    color: #e5e7eb;
}

[data-bs-theme="dark"] .form-control:disabled {
    background-color: #1f2937;
    color: #cbd5e1;
}

.trade-count-limited-input {
    background-color: #eef2f7;
}

[data-bs-theme="dark"] .trade-count-limited-input {
    background-color: #1f2937;
    border-color: #475569;
}

[data-bs-theme="dark"] .nav-tabs {
    border-bottom-color: #334155;
}

[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #0f172a;
    border-color: #334155 #334155 #0f172a;
    color: #f8fafc;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: #182235;
    --bs-table-color: #e5e7eb;
    --bs-table-striped-bg: #22304a;
    --bs-table-striped-color: #e5e7eb;
    --bs-table-border-color: #334155;
}

[data-bs-theme="dark"] .dataTables_wrapper,
[data-bs-theme="dark"] .dataTables_info,
[data-bs-theme="dark"] .dataTables_length,
[data-bs-theme="dark"] .dataTables_filter {
    color: #e5e7eb !important;
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #182235;
    border-color: #334155;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #e5e7eb;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #24344d;
    color: #f8fafc;
}

.verdict-panel {
    border: 1px solid rgba(13, 110, 253, 0.18);
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.08), rgba(25, 135, 84, 0.06));
}

.verdict-header {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.verdict-header-copy {
    min-width: 0;
}

.verdict-header-actions {
    flex-shrink: 0;
}

@media (min-width: 1200px) {
    .verdict-header {
        flex-direction: row;
        align-items: flex-start;
        gap: 0;
    }

    .verdict-header-copy {
        flex: 1 1 auto;
        max-width: calc(100% - 24rem);
        padding-right: 3rem;
    }

    .verdict-header-actions {
        margin-left: auto;
        padding-left: 2.5rem;
    }
}

.verdict-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.verdict-metric {
    min-height: 96px;
    padding: 0.85rem;
    border: 1px solid rgba(108, 117, 125, 0.18);
    border-radius: 0.85rem;
    background-color: rgba(255, 255, 255, 0.86);
}

.verdict-metric span {
    display: block;
    margin-bottom: 0.4rem;
    color: #6c757d;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.verdict-metric > span > span {
    display: inline;
}

.verdict-metric .verdict-min-lot-hint {
    display: inline;
    margin-left: 0.2rem;
    vertical-align: middle;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.verdict-metric strong {
    display: block;
    color: #111827;
    font-size: 1.15rem;
    line-height: 1.2;
}

#VerdictNextLot.verdict-next-lot-hero {
    font-size: 2.875rem;
    line-height: 1.05;
}

#verdictMetricNextAction:has(.verdict-next-lot-hero) {
    min-height: 0;
}

.verdict-metric-primary {
    border-color: rgba(13, 110, 253, 0.34);
    background-color: rgba(13, 110, 253, 0.1);
}

.verdict-metric-hero {
    border-color: rgba(13, 110, 253, 0.5);
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.16), rgba(25, 135, 84, 0.1));
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, 0.12);
}

.verdict-metric-hero-trmms strong {
    color: #0d6efd;
}

.verdict-metric-hero-fixed strong {
    color: #146c43;
}

.verdict-metric-subtext {
    margin-top: 0.35rem;
    color: #4b5563;
    font-size: 0.78rem;
    line-height: 1.3;
}

.verdict-metric-advantage strong {
    font-size: 1.3rem;
    line-height: 1.4;
}

.verdict-metric-advantage-dual strong {
    font-size: 1.22rem;
    line-height: 1.45;
}

.model-results-summary {
    min-height: 12.75rem;
}

.model-results-summary .row {
    min-height: 2.35rem;
}

.model-results-summary label {
    margin-bottom: 0;
}

.verdict-min-lot-hint {
    cursor: help;
    color: #6c757d;
    font-size: 1.05rem;
    line-height: 1;
    padding: 10px;
    margin: -10px;
    box-sizing: content-box;
}

.verdict-survival-value {
    display: flex;
    align-items: flex-start;
    gap: 0.2rem;
}

.verdict-survival-value strong {
    display: block;
    flex: 1 1 auto;
}

.verdict-expand-toggle {
    flex: 0 0 auto;
    margin-top: 0.2rem;
    border: 0;
    background: transparent;
    padding: 0;
    line-height: 1;
    cursor: pointer;
}

.verdict-expand-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #6c757d;
    transition: transform 0.15s ease;
}

.verdict-expand-toggle.is-open .verdict-expand-arrow {
    transform: rotate(180deg);
}

.verdict-survival-details {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(108, 117, 125, 0.22);
    color: #4b5563;
    font-size: 0.78rem;
    line-height: 1.45;
}

[data-bs-theme="dark"] .verdict-survival-details {
    color: #cbd5e1;
    border-top-color: rgba(148, 163, 184, 0.28);
}

[data-bs-theme="dark"] .verdict-expand-arrow {
    border-top-color: #94a3b8;
}

.verdict-tooltip .tooltip-inner {
    max-width: 360px;
    text-align: left;
}

.verdict-badge {
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
}

[data-bs-theme="dark"] .verdict-panel {
    border-color: rgba(96, 165, 250, 0.28);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(22, 163, 74, 0.12));
}

[data-bs-theme="dark"] .verdict-metric {
    border-color: #334155;
    background-color: rgba(15, 23, 42, 0.82);
}

[data-bs-theme="dark"] .verdict-metric-primary {
    border-color: rgba(96, 165, 250, 0.46);
    background-color: rgba(37, 99, 235, 0.18);
}

[data-bs-theme="dark"] .verdict-metric-hero {
    border-color: rgba(96, 165, 250, 0.58);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.24), rgba(22, 163, 74, 0.14));
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.16);
}

[data-bs-theme="dark"] .verdict-metric-hero-trmms strong {
    color: #93c5fd;
}

[data-bs-theme="dark"] .verdict-metric-hero-fixed strong {
    color: #86efac;
}

[data-bs-theme="dark"] .verdict-metric-subtext {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .verdict-metric span {
    color: #9ca3af;
}

[data-bs-theme="dark"] .verdict-metric strong {
    color: #f8fafc;
}

#verdictReason {
    line-height: 1.55;
}

#verdictReason strong {
    color: #146c43;
    font-weight: 700;
}

[data-bs-theme="dark"] #verdictReason strong {
    color: #86efac;
}

/* Mobile adjustments */
@media (max-width: 992px) {
    .left-sidenav {
        width: 100%;
    }

    .verdict-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    #page-content-wrapper > .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .verdict-header-actions {
        width: 100%;
    }

    .verdict-header-actions .btn {
        width: 100%;
    }

    #verdictReason {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    #dashboardSettingsTabs {
        flex-wrap: wrap;
        row-gap: 0.35rem;
    }

    #dashboardSettingsTabs .nav-item {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
    }

    #dashboardSettingsTabs .nav-link {
        white-space: normal;
        text-align: center;
        font-size: 0.78rem;
        line-height: 1.2;
        padding: 0.5rem 0.45rem;
    }

    .dashboard-brand-logo {
        max-width: min(100%, 320px);
    }
}

@media (max-width: 576px) {
    .verdict-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-toast-host {
    position: fixed;
    top: 1rem;
    right: 1rem;
    left: 1rem;
    z-index: 1095;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    pointer-events: none;
}

.dashboard-toast-host .toast-container {
    position: static;
    width: min(100%, 28rem);
    max-width: calc(100vw - 2rem);
    pointer-events: auto;
}

.dashboard-toast {
    width: 100%;
    max-width: min(28rem, calc(100vw - 2rem));
}

.dashboard-toast-message,
.dashboard-error-message {
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
}

.dashboard-error-message {
    max-height: min(50vh, 20rem);
    overflow-y: auto;
}

.protection-settings-divider {
    margin: 0.5rem 0;
    border: 0;
    border-top: 1px solid var(--bs-border-color);
    opacity: 0.65;
}
