* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #0b0f16;
    color: #e6edf7;
}

.page {
    max-width: 1680px;
    margin: 0 auto;
    padding: 24px;
}

.hero {
    margin-bottom: 18px;
}

h1 {
    margin: 0 0 8px 0;
    font-size: 32px;
    line-height: 1.2;
    color: #f5f7fb;
}

h2 {
    margin: 0;
    font-size: 20px;
    color: #f5f7fb;
}

.subhead {
    margin: 0;
    color: #b6c2d1;
    font-size: 15px;
}

.panel {
    background: #121923;
    border: 1px solid #2b3647;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 18px;
}

.error-panel {
    border-color: #8f2d2d;
    background: #231414;
    color: #ffd2d2;
}

.group-grid {
    display: grid;
    gap: 16px;
}

.input-group {
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 14px;
    margin: 0;
    background: #0f141d;
    min-width: 0;
}

.input-group legend {
    padding: 0 10px;
    color: #dbe4ef;
    font-weight: bold;
    font-size: 14px;
}

.field-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 8px;
}

.field-stack-vertical {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    min-width: 0;
}

label {
    font-size: 13px;
    color: #b7c3d4;
}

input,
select,
button {
    font: inherit;
}

input,
select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #3a475a;
    background: #0b1118;
    color: #eef4fd;
    outline: none;
}

input:focus,
select:focus {
    border-color: #6ca3ff;
    box-shadow: 0 0 0 2px rgba(108, 163, 255, 0.18);
}

.actions-panel {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: linear-gradient(to bottom, rgba(19, 28, 40, 0.95), rgba(13, 20, 30, 0.95));
}

.actions-panel-title {
    margin-bottom: 25px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9fb1c8;
}

.actions-row {
    display: grid;
    gap: 12px;
    align-items: stretch;
}

.action-item {
    min-width: 0;
    display: grid;
    grid-template-rows: 18px minmax(52px, auto);
    gap: 8px;
}

.action-strategy {
    display: grid;
    grid-template-rows: 18px minmax(52px, auto);
    gap: 8px;
}

.action-label {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.03em;
    color: #c2d0e1;
    line-height: 1;
}

.action-button-wrap::before {
    content: "";
    display: block;
    height: 18px;
}

.action-control {
    width: 100%;
    min-height: 52px;
    height: 52px;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid #42526a;
    background: #08111b;
    color: #f5f8fd;
    font-size: 14px;
    line-height: 1.2;
}

.action-control:focus {
    border-color: #7aa8ff;
    box-shadow: 0 0 0 2px rgba(122, 168, 255, 0.22);
}

.btn-primary,
.btn-secondary {
    width: 100%;
    min-height: 52px;
    height: 52px;
    border: 1px solid #3b495e;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    line-height: 1.2;
}

.action-button {
    width: 100%;
    height: 52px;
}

.btn-primary {
    background: #2852d1;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1f44b2;
}

.btn-secondary {
    background: #1b2431;
    color: #f0f4fa;
}

.btn-secondary:hover {
    background: #243041;
}

.table-panel,
.notes-panel {
    overflow: hidden;
}

.table-topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.planner-params {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    margin: 10px 0 0 0;
}

.param-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid #334155;
    border-radius: 999px;
    background: rgba(17, 24, 37, 0.88);
    color: #d4deea;
    font-size: 13px;
    line-height: 1.2;
}

.param-pill strong {
    color: #9cc3ff;
    font-weight: bold;
}

.strategy-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.legend-pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.02em;
}

.legend-aggressive {
    border-color: #c94141;
    color: #ffb1b1;
    background: rgba(201, 65, 65, 0.12);
}

.legend-moderate {
    border-color: #d17d29;
    color: #ffd09b;
    background: rgba(209, 125, 41, 0.12);
}

.legend-normal {
    border-color: #66bb6a;
    color: #c8f5ca;
    background: rgba(102, 187, 106, 0.12);
}

.legend-slow {
    border-color: #d8d06a;
    color: #fff5b3;
    background: rgba(216, 208, 106, 0.12);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #2b3647;
    border-radius: 10px;
}

.planner-table,
.notes-table {
    width: 100%;
    border-collapse: collapse;
}

.planner-table {
    min-width: 1450px;
}

.planner-table th,
.planner-table td,
.notes-table th,
.notes-table td {
    border: 1px solid #2a3545;
    padding: 10px 12px;
    text-align: center;
    white-space: nowrap;
    transition: background 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.planner-table thead th,
.notes-table thead th {
    background: #161f2c;
    color: #f4f7fc;
    font-weight: bold;
}

.event-col {
    min-width: 130px;
    text-align: left;
    padding-left: 14px;
    font-weight: bold;
    background: #111825;
}

.sticky-col {
    position: sticky;
    left: 0;
    z-index: 3;
}

.group-head {
    font-size: 14px;
    letter-spacing: 0.02em;
    border-bottom-width: 2px;
}

.aggressive-head {
    background: linear-gradient(to bottom, rgba(201, 65, 65, 0.22), rgba(201, 65, 65, 0.10));
    border-top: 3px solid #c94141;
    color: #ffcdcd;
}

.moderate-head {
    background: linear-gradient(to bottom, rgba(209, 125, 41, 0.22), rgba(209, 125, 41, 0.10));
    border-top: 3px solid #d17d29;
    color: #ffd8ad;
}

.normal-head {
    background: linear-gradient(to bottom, rgba(102, 187, 106, 0.22), rgba(102, 187, 106, 0.10));
    border-top: 3px solid #66bb6a;
    color: #d8ffd9;
}

.slow-head {
    background: linear-gradient(to bottom, rgba(216, 208, 106, 0.22), rgba(216, 208, 106, 0.10));
    border-top: 3px solid #d8d06a;
    color: #fff8c5;
}

.aggressive-sub,
.moderate-sub,
.normal-sub,
.slow-sub {
    font-size: 12px;
}

.aggressive-sub {
    background: rgba(201, 65, 65, 0.12);
    color: #ffd3d3;
}

.moderate-sub {
    background: rgba(209, 125, 41, 0.12);
    color: #ffe0bd;
}

.normal-sub {
    background: rgba(102, 187, 106, 0.12);
    color: #dbffdc;
}

.slow-sub {
    background: rgba(216, 208, 106, 0.12);
    color: #fff9cd;
}

.planner-table tbody .aggressive-cell {
    background-color: rgba(201, 65, 65, 0.08);
}

.planner-table tbody tr:nth-child(even) .aggressive-cell {
    background-color: rgba(201, 65, 65, 0.14);
}

.planner-table tbody .moderate-cell {
    background-color: rgba(209, 125, 41, 0.08);
}

.planner-table tbody tr:nth-child(even) .moderate-cell {
    background-color: rgba(209, 125, 41, 0.14);
}

.planner-table tbody .normal-cell {
    background-color: rgba(102, 187, 106, 0.08);
}

.planner-table tbody tr:nth-child(even) .normal-cell {
    background-color: rgba(102, 187, 106, 0.14);
}

.planner-table tbody .slow-cell {
    background-color: rgba(216, 208, 106, 0.08);
}

.planner-table tbody tr:nth-child(even) .slow-cell {
    background-color: rgba(216, 208, 106, 0.14);
}

.group-divider {
    border-right-width: 3px;
    border-right-color: #475569;
    border-right: 2px solid rgba(255,255,255,0.08);
}

.target-band {
    box-shadow: inset 0 0 0 2px rgba(80, 180, 255, 0.65);
    font-weight: bold;
}

.final-safe {
    border-bottom: 3px solid #ffd166 !important;
}

.empty-cell {
    color: transparent;
}

.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.notes-toggle {
    width: auto;
    min-width: 140px;
    height: 44px;
    min-height: 44px;
    padding: 8px 16px;
}

.notes-content.is-hidden {
    display: none;
}

.notes-table td {
    white-space: normal;
    text-align: left;
    vertical-align: top;
}

.notes-table td:not(:last-child),
.notes-table th:not(:last-child) {
    text-align: center;
}

.strategy-name {
    font-weight: bold;
}

.aggressive-label {
    color: #ffb4b4;
}

.moderate-label {
    color: #ffc98e;
}

.normal-label {
    color: #c9f7cb;
}

.slow-label {
    color: #fff1a8;
}

.planner-table.selected-aggressive .moderate-cell,
.planner-table.selected-aggressive .normal-cell,
.planner-table.selected-aggressive .slow-cell,
.planner-table.selected-moderate .aggressive-cell,
.planner-table.selected-moderate .normal-cell,
.planner-table.selected-moderate .slow-cell,
.planner-table.selected-normal .aggressive-cell,
.planner-table.selected-normal .moderate-cell,
.planner-table.selected-normal .slow-cell,
.planner-table.selected-slow .aggressive-cell,
.planner-table.selected-slow .moderate-cell,
.planner-table.selected-slow .normal-cell {
    opacity: 0.58;
}

.planner-table.selected-aggressive .aggressive-cell,
.planner-table.selected-moderate .moderate-cell,
.planner-table.selected-normal .normal-cell,
.planner-table.selected-slow .slow-cell {
    position: relative;
    z-index: 1;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.planner-table.selected-aggressive .aggressive-head,
.planner-table.selected-aggressive .aggressive-sub,
.planner-table.selected-moderate .moderate-head,
.planner-table.selected-moderate .moderate-sub,
.planner-table.selected-normal .normal-head,
.planner-table.selected-normal .normal-sub,
.planner-table.selected-slow .slow-head,
.planner-table.selected-slow .slow-sub {
    box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.03);
}

.planner-table.selected-aggressive .aggressive-head,
.planner-table.selected-aggressive .aggressive-sub,
.planner-table.selected-aggressive .aggressive-cell {
    border-left-color: #c94141;
    border-right-color: #c94141;
}

.planner-table.selected-moderate .moderate-head,
.planner-table.selected-moderate .moderate-sub,
.planner-table.selected-moderate .moderate-cell {
    border-left-color: #d17d29;
    border-right-color: #d17d29;
}

.planner-table.selected-normal .normal-head,
.planner-table.selected-normal .normal-sub,
.planner-table.selected-normal .normal-cell {
    border-left-color: #66bb6a;
    border-right-color: #66bb6a;
}

.planner-table.selected-slow .slow-head,
.planner-table.selected-slow .slow-sub,
.planner-table.selected-slow .slow-cell {
    border-left-color: #d8d06a;
    border-right-color: #d8d06a;
}

@media (max-width: 319px) {
    .group-grid {
        grid-template-columns: 1fr;
    }

    .field-stack,
    .field-stack-vertical {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .table-topbar,
    .notes-header {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-row {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 320px) and (max-width: 699px) {
    .group-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .field-stack,
    .field-stack-vertical {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .group-grid .input-group:last-child {
        grid-column: 1 / -1;
    }

    .group-grid .input-group:last-child .field-stack,
    .group-grid .input-group:last-child .field-stack-vertical {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px 14px;
    }

    .table-topbar,
    .notes-header {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-row {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 700px) and (max-width: 1199px) {
    .group-grid {
        grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    }

    .field-stack,
    .field-stack-vertical {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .actions-row {
        grid-template-columns: 1.5fr 1fr 1fr;
    }

    .table-topbar {
        flex-direction: column;
    }
}

@media (min-width: 1200px) {
    .group-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .field-stack,
    .field-stack-vertical {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .actions-row {
        grid-template-columns: 1.7fr 1fr 1fr;
    }
}