:root {
    --bg-color: #151719;
    --card-bg: #202326;
    --card-border: #383d41;
    --text-main: #edf0f2;
    --text-dim: #a2a8ad;
    --accent-color: #ed8738;
    --accent-hover: #ffa052;
    --success: #82c991;
    --danger: #dd756d;
    --shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

* {
    scrollbar-color: #34475b #0b121d;
}

body {
    min-height: 100vh;
    padding: 28px 20px 48px;
    color: var(--text-main);
    background: #151719;
    font-family: "Segoe UI", Arial, sans-serif;
}

.main-wrapper {
    max-width: 1920px;
    margin: 0 auto;
}

.panel {
    padding: 0;
}

#main-panel > .container {
    max-width: 1920px;
}

#main-panel > .container > header {
    margin: 0 0 24px;
    padding: 20px 22px;
    border: 1px solid #383d41;
    border-bottom: 2px solid #dd762c;
    border-radius: 8px;
    background: #1a1d1f;
    box-shadow: var(--shadow);
}

.header-top {
    align-items: center;
}

.app-heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.app-kicker {
    color: #f39a53;
    font-size: 0.66rem;
    font-weight: 650;
    letter-spacing: 0.12em;
}

.app-heading-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.app-heading h1 {
    color: #f0f2f3;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.72rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    opacity: 1;
}

.app-version {
    padding: 3px 7px;
    border: 1px solid #46494b;
    border-radius: 4px;
    color: #f2a05d;
    font-size: 0.64rem;
    letter-spacing: 0.06em;
}

.header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.header-actions .btn-war-room {
    padding: 9px 13px;
    border: 1px solid #414649;
    border-radius: 5px;
    background: #272b2e;
    color: #dce0e2;
    box-shadow: none;
    font-size: 0.78rem;
}

.header-actions .btn-war-room:hover {
    transform: none;
    border-color: #de7c31;
    background: #34251b;
    color: #fff0e3;
}

.settings-button {
    width: 38px;
    height: 38px;
    border-color: #414649;
    border-radius: 5px;
    background: #272b2e;
}

.header-actions #open-api-settings {
    order: 1;
    margin-left: 5px;
}

.dashboard-layout {
    display: grid;
    grid-template-areas: "cooldowns dashboard checklist";
    grid-template-columns: minmax(205px, 0.74fr) minmax(0, 2.45fr) minmax(270px, 0.94fr);
    align-items: start;
    gap: 16px;
    width: 100%;
    max-width: none;
    margin: 0;
    position: static;
    left: auto;
    transform: none;
}

#cooldown-panel {
    grid-area: cooldowns;
}

#dashboard {
    grid-area: dashboard;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
}

#checklist-panel {
    grid-area: checklist;
}

.side-panel {
    position: sticky;
    top: 16px;
    width: auto;
    min-width: 0;
}

.side-panel .container {
    width: 100%;
}

.cooldown-container,
.travel-stocks-container,
.checklist-panel-container,
.stats-group,
.chart-section {
    border: 1px solid #383d41;
    border-radius: 7px;
    background: #1c1f22;
    box-shadow: var(--shadow);
}

.cooldown-container {
    padding: 14px;
}

.cooldown-list {
    gap: 7px;
}

.cooldown-item {
    align-items: flex-start;
    padding: 10px 11px;
    border: 1px solid #383d41;
    border-left: 2px solid #ed8738;
    border-radius: 4px;
    background: #151719;
    text-align: left;
}

.cd-left {
    align-items: flex-start;
    text-align: left;
}

.cooldown-time {
    font-size: 0.96rem;
}

.travel-stocks-container {
    margin-top: 12px;
    padding: 14px;
}

.checklist-panel-container {
    position: static;
    max-height: calc(100vh - 32px);
    padding: 12px;
    overflow-y: auto;
}

.checklist-panel-toggle {
    padding: 2px 2px 10px;
    color: #e3edf3;
    font-size: 0.95rem;
}

.daily-checklist {
    gap: 9px;
}

.checklist-overall-count {
    color: #f39a53;
    font-size: 0.84rem;
}

.checklist-group {
    gap: 7px;
    padding: 9px;
    border-color: #383d41;
    border-radius: 5px;
    background: #151719;
    box-shadow: none;
}

.checklist-header {
    color: #e3e7e9;
    font-size: 0.83rem;
}

.checklist-count {
    font-size: 0.68rem;
}

.checklist-item,
.checklist-panel-container .checklist-item {
    min-height: 36px;
    padding: 7px 8px;
    border-color: #37393a;
    border-left-width: 2px;
    border-radius: 4px;
    background: #202325;
}

.checklist-item.completed {
    border-color: rgba(91, 150, 100, 0.5);
    border-left-color: #75ab7b;
    background: rgba(35, 55, 37, 0.48);
}

.checklist-item.incomplete {
    border-color: rgba(172, 91, 77, 0.4);
    border-left-color: #b66b59;
    background: rgba(52, 33, 29, 0.42);
}

.checklist-text,
.checklist-panel-container .checklist-text {
    font-size: 0.75rem;
}

.core-grid-single-line {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    justify-content: stretch;
    gap: 10px;
    margin-bottom: 12px;
}

.core-grid-single-line .card {
    min-width: 0;
    padding: 14px 10px;
}

.card,
.summary-card,
.t-stat-card {
    border: 1px solid #343739;
    border-radius: 6px;
    background: #1c1f21;
    box-shadow: none;
}

.card:hover {
    border-color: #b66b35;
    background: #25292c;
}

.card-label,
.summary-label {
    color: #aeb4b8;
    font-size: 0.64rem;
    letter-spacing: 0.1em;
}

.card-value {
    color: #e8e2d7;
    font-size: clamp(1.05rem, 1.4vw, 1.4rem);
}

.efficiency-grid {
    gap: 10px;
    margin-bottom: 12px;
}

.efficiency-card {
    padding: 12px 14px;
    text-align: left;
}

.stats-group {
    gap: 10px;
    margin-bottom: 12px;
    padding: 11px 12px 12px;
}

.stats-group-header {
    color: #aeb4b8;
    font-size: 0.68rem;
    letter-spacing: 0.11em;
}

.stats-group-value {
    color: #edf0f2;
    font-size: 1.05rem;
}

.stats-group-body {
    gap: 10px;
}

.summary-grid,
.economy-grid,
.battle-stats-grid,
.work-stats-grid {
    gap: 9px;
    margin-bottom: 0;
}

.summary-card {
    min-height: 76px;
    padding: 11px;
}

.summary-pill {
    font-size: 0.79rem;
}

.chart-section {
    padding: 16px;
}

.chart-controls {
    justify-content: flex-start;
}

.btn-range,
#chart-metric {
    border-color: rgba(91, 122, 143, 0.3);
    border-radius: 8px;
    background: #101a27;
}

.btn-range.active {
    border-color: #ed8738;
    background: #3a291d;
    color: #ffbd87;
}

.panel:not(#main-panel) > .container {
    width: min(100%, 1500px);
    max-width: 1500px;
}

.panel:not(#main-panel) > .container > header {
    margin-bottom: 20px;
    padding: 16px 18px;
    border: 1px solid #383d41;
    border-bottom: 2px solid #dd762c;
    border-radius: 7px;
    background: #1a1d1f;
}

.panel:not(#main-panel) .header-top h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.panel:not(#main-panel) .btn-war-room {
    border: 1px solid #414649;
    border-radius: 5px;
    background: #242729;
    color: #e3e7e9;
    box-shadow: none;
}

.panel:not(#main-panel) .btn-war-room:hover {
    transform: none;
    border-color: #de7c31;
    background: #34251b;
}

#war-room-panel,
#chain-watching-panel,
#education-panel,
#energy-panel,
#targets-panel {
    padding: 24px;
    background: var(--bg-color);
}

.settings-dialog {
    border-color: #46494b;
    border-radius: 7px;
    background: #1b1e20;
}

.t-pagination:not([hidden]) {
    display: flex;
}

.t-pagination {
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 14px 0 4px;
    color: var(--text-dim);
    font-size: 0.82rem;
}

.t-pagination-button {
    padding: 8px 12px;
    border: 1px solid #414649;
    border-radius: 5px;
    background: #272b2e;
    color: var(--text-main);
    font: inherit;
    cursor: pointer;
}

.t-pagination-button:hover:not(:disabled) {
    border-color: #de7c31;
    background: #34251b;
}

.t-pagination-button:disabled {
    cursor: default;
    opacity: 0.45;
}

.settings-button:focus-visible,
.header-actions button:focus-visible,
.panel button:focus-visible,
.panel a:focus-visible {
    outline: 2px solid #ffa052;
    outline-offset: 3px;
}

@media (max-width: 1320px) {
    .dashboard-layout {
        grid-template-areas:
            "dashboard dashboard"
            "cooldowns checklist";
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .side-panel {
        position: static;
    }

    .checklist-panel-container {
        max-height: 680px;
    }
}

@media (max-width: 760px) {
    body {
        padding: 12px 10px 28px;
    }

    #main-panel > .container > header {
        padding: 15px;
    }

    .header-top {
        align-items: flex-start;
        flex-direction: column;
        gap: 13px;
    }

    .app-heading h1 {
        font-size: 1.4rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 2px 1px 5px;
    }

    .header-actions .btn-war-room {
        flex: 0 0 auto;
    }

    .dashboard-layout {
        grid-template-areas:
            "dashboard"
            "cooldowns"
            "checklist";
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

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

    .core-grid-single-line .card:last-child {
        grid-column: span 2;
    }

    .panel:not(#main-panel) > .container > header {
        padding: 13px;
    }

    .panel:not(#main-panel) .header-top {
        flex-direction: row;
        align-items: center;
    }

    #war-room-panel,
    #chain-watching-panel,
    #education-panel,
    #targets-panel {
        padding: 12px 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
