/* The channel grid gets the whole page: forty sliders need every pixel of
   it. The tuning panel does not, so they stack rather than sitting side by
   side as they used to. */
.panels {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.panel.narrow {
    max-width: 30rem;
}

/* Settings down the rows, channels across the columns: the layout that
   makes "is drive tuned differently from delivery?" a glance rather than
   a memory exercise. */
/* Below roughly 900px forty sliders stop fitting at a usable width.
   Scrolling the grid itself is the lesser evil: the alternative is the
   whole page sliding sideways, which takes the nav and the tuning panel
   with it. */
/* The floor is set so a 1000px window — a laptop at its default size — still
   shows all five channels without scrolling; below that the sliders would
   be too short to aim with, and scrolling is the better trade. */
.channel-grid {
    width: 100%;
    border-collapse: collapse;
    min-width: 53rem;
    table-layout: fixed;
}

.channel-grid th, .channel-grid td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid #2a2b31;
    text-align: center;
}

.channel-grid thead th {
    color: #cfe3ff;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-bottom: 1px solid #3a3b42;
    white-space: nowrap;
}

.channel-grid tbody tr:last-child td {
    border-bottom: none;
}

.channel-grid tbody tr:hover {
    background: #26272d;
}

/* Fixed so the five channels are equal and the labels cannot squeeze the
   sliders as the wording changes. */
.channel-grid col.labels {
    width: 13rem;
}

.row-name {
    text-align: left;
    font-size: 0.8rem;
    color: #ccc;
    font-weight: 400;
    padding-right: 1rem;
}

.row-range {
    display: block;
    font-size: 0.68rem;
    color: #666;
    margin-top: 0.1rem;
}

/* The readout sits above its slider rather than beside it: beside it, the
   number moves as the handle does and is hard to read while dragging. */
.cell-value {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #cfe3ff;
    font-variant-numeric: tabular-nums;
    margin-bottom: 0.15rem;
}

.channel-grid input[type=range] {
    width: 100%;
    accent-color: #2d5fa3;
    margin: 0;
}

/* A value the file holds that no slider position can represent. The slider
   has already clamped it, so this marks that what is shown is not what is
   on disk. */
.cell.bad .cell-value {
    color: #ff9c9c;
}

.cell.bad input[type=range] {
    accent-color: #a34d4d;
}

/* A dial this channel cannot use at all — no slider is drawn here, rather
   than a disabled one, so there is nothing on the cell that looks
   operable and isn't. */
.cell.locked {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 1.9rem;
}

.cell-unavailable {
    color: #666;
    font-size: 0.78rem;
    font-style: italic;
    cursor: help;
}

/* ---- The preview chart ---------------------------------------- */

.preview {
    margin-top: 1.4rem;
    border-top: 1px solid #33343a;
    padding-top: 1.1rem;
}

.preview h3 {
    margin: 0;
    font-size: 0.9rem;
    color: #e6e6e6;
}

.preview-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.3rem;
}

.popout-btn {
    flex: none;
    background: transparent;
    color: #9ecbff;
    border: 1px solid #3a4a5a;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
}

.popout-btn:hover {
    border-color: #4a6a8a;
    filter: none;
    background: #26313d;
}

.preview-intro {
    margin: 0 0 0.9rem;
    color: #888;
    font-size: 0.8rem;
    line-height: 1.5;
}

/* Two independent groups, one per comparison line, stacked above the plot
   where a filter belongs rather than beside the chart or below it. */
.line-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 0.9rem;
}

.line-control-group {
    flex: 1 1 22rem;
    border: 1px solid #33343a;
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
    background: #1e1f24;
}

.line-control-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.55rem;
    font-size: 0.82rem;
    color: #e6e6e6;
    font-weight: 600;
}

/* Neutral colour on purpose: the swatch communicates the dash pattern, not
   a channel — every channel draws its comparison lines in its own colour
   with this same style. */
.line-swatch {
    display: inline-block;
    width: 26px;
    border-top: 3px solid #9ecbff;
}

.line-swatch-a {
    border-top-style: dashed;
}

.line-swatch-b {
    border-top-style: dotted;
}

.modifiers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.modifier {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #e6e6e6;
    padding: 0.35rem 0.6rem;
    border: 1px solid #44454d;
    border-radius: 6px;
    background: #1a1b1f;
    cursor: pointer;
    white-space: nowrap;
}

.modifier input {
    margin: 0;
    cursor: pointer;
}

.modifier:hover {
    border-color: #5a5b66;
}

.modifier-note {
    font-size: 0.75rem;
    color: #777;
    margin-left: 0.2rem;
}

/* The advanced line: a third, independent box below A/B rather than a
   fourth checkbox inside either of them — it is not one of the five fixed
   channels, so it does not belong to a line-control-group the way A/B do. */
.advanced-line {
    border: 1px dashed #44454d;
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
    background: #1e1f24;
    margin-bottom: 0.9rem;
}

.advanced-line-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.modifier-advanced-toggle {
    background: transparent;
    border: none;
    padding: 0;
}

.modifier-advanced-toggle:hover {
    border-color: transparent;
}

/* Neutral on purpose, unlike the five channel colours or the A/B dash
   styles: this line is not tied to a fixed channel, so it gets no colour
   any of them already own. */
.line-swatch-advanced {
    border-top-style: solid;
    border-top-color: #999;
}

.advanced-channel {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 600;
    color: #cfcfcf;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: #2a2b31;
}

.advanced-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px dashed #33343a;
}

.advanced-group {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem;
    flex: 1 1 18rem;
}

.advanced-group-label {
    flex: 1 1 100%;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #888;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.advanced-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: #999;
}

.advanced-field select,
.advanced-field input[type="number"] {
    padding: 0.3rem 0.5rem;
    border: 1px solid #44454d;
    border-radius: 5px;
    background: #1a1b1f;
    color: #e6e6e6;
    font-size: 0.8rem;
    font-family: inherit;
}

.advanced-field input[type="number"] {
    width: 6rem;
}

.chart-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.6rem;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.zoom-label {
    font-size: 0.75rem;
    color: #888;
}

.zoom-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: #cfe3ff;
    min-width: 2.6rem;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* More specific than the page's generic `button` rule, so these win
   without an !important. */
.zoom-controls button.zoom-btn {
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    line-height: 1;
    background: #33343a;
}

.zoom-controls button.zoom-btn:hover {
    filter: brightness(1.2);
}

.zoom-controls button.zoom-reset {
    width: auto;
    padding: 0.25rem 0.6rem;
    font-size: 0.72rem;
}

/* Chart.js measures a canvas against its immediate parent, so that parent
   exists purely to be measured: no padding of its own, a definite height,
   and the canvas as its only child. */
.chart-canvas {
    position: relative;
    height: 32rem;
}

.panel {
    border: 1px solid #33343a;
    border-radius: 8px;
    padding: 1.1rem 1.2rem;
    background: #232429;
}

.panel-intro {
    margin: 0 0 1.1rem;
    color: #888;
    font-size: 0.8rem;
    line-height: 1.5;
}

.panel-file {
    font-family: monospace;
    font-size: 0.72rem;
    color: #667;
}

.field {
    margin-bottom: 1.05rem;
}

.field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.field-name {
    font-size: 0.8rem;
    color: #ccc;
}

.field-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: #cfe3ff;
    font-variant-numeric: tabular-nums;
}

input[type=range] {
    width: 100%;
    accent-color: #2d5fa3;
    margin: 0;
}

.scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: #666;
    margin-top: 0.15rem;
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.2rem;
}

button {
    border: 1px solid #44454d;
    border-radius: 6px;
    background: #2d5fa3;
    color: #fff;
    padding: 0.45rem 0.9rem;
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

button:hover {
    filter: brightness(1.15);
}

button.secondary {
    background: #33343a;
    color: #ccc;
}

button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    filter: none;
}

.status {
    font-size: 0.78rem;
    color: #888;
}

.status.ok {
    color: #7ee0a3;
}

.status.bad {
    color: #ff9c9c;
}

.conflict {
    display: none;
    margin-top: 0.9rem;
    padding: 0.6rem 0.7rem;
    border-left: 2px solid #6f5a1f;
    background: #24211a;
    color: #ffe9b0;
    font-size: 0.78rem;
    line-height: 1.45;
}

.conflict.shown {
    display: block;
}

.conflict .actions {
    margin-top: 0.6rem;
}

/* ---------- Simple / Advanced ---------- */

/* The switch sits on the title's line, at the right, so it reads as a
   choice about the whole page rather than about one panel. */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.view-switch, .segmented {
    display: inline-flex;
    border: 1px solid #44454d;
    border-radius: 6px;
    overflow: hidden;
}

.view-switch button.view-btn, .segmented button.seg-btn {
    border: none;
    border-radius: 0;
    background: #26272d;
    color: #9aa;
    padding: 0.4rem 0.9rem;
}

.view-switch button.view-btn + button.view-btn,
.segmented button.seg-btn + button.seg-btn {
    border-left: 1px solid #44454d;
}

.view-switch button.view-btn.on, .segmented button.seg-btn.on {
    background: #202a38;
    color: #cfe3ff;
    box-shadow: inset 0 -2px 0 #2d5fa3;
}

.segmented button.seg-btn {
    font-size: 0.78rem;
    padding: 0.32rem 0.7rem;
}

.seg-sub {
    color: #778;
    font-size: 0.7rem;
}

.segmented button.seg-btn.on .seg-sub {
    color: #9fb7d9;
}

.easy-params {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 2rem;
    margin-bottom: 0.9rem;
}

.easy-param {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: #ccc;
}

.easy-param select, .easy-param input, .easy-capacity input {
    background: #26272d;
    color: #e6e6e6;
    border: 1px solid #44454d;
    border-radius: 4px;
    padding: 0.25rem 0.4rem;
    font-family: inherit;
}

.easy-param input, .easy-capacity input {
    width: 3.5rem;
}

.easy-summary {
    font-size: 0.88rem;
    color: #ccc;
    line-height: 1.5;
}

.easy-summary strong {
    color: #cfe3ff;
}

.easy-table {
    border-collapse: collapse;
    width: auto;
    min-width: 34rem;
}

.easy-table th, .easy-table td {
    padding: 0.4rem 0.9rem;
    border-bottom: 1px solid #2a2b31;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
}

.easy-table thead th {
    color: #cfe3ff;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.easy-table tbody th.row-name {
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
    color: #ccc;
}

.easy-table tr.muted td, .easy-table tr.muted th {
    color: #666;
}

.easy-capacity {
    white-space: nowrap;
    color: #888;
}

.easy-capacity input {
    margin: 0 0.4rem;
}

.easy-role {
    color: #778;
    font-size: 0.72rem;
}

.easy-capped {
    color: #ffcf7a;
    font-size: 0.72rem;
    cursor: help;
}

.easy-strength {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    margin-top: 1.1rem;
}

.easy-strength-head {
    font-size: 0.82rem;
    color: #ccc;
}

.easy-strength-value {
    font-size: 0.82rem;
    color: #cfe3ff;
}

.easy-note {
    font-size: 0.78rem;
    color: #888;
}

.easy-note:empty {
    display: none;
}

.easy-note.warn, .easy-warnings li.warn {
    padding: 0.45rem 0.7rem;
    border-left: 2px solid #6f5a1f;
    background: #24211a;
    color: #ffe9b0;
}

.easy-warnings {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.8rem;
}

.easy-warnings li.info {
    padding: 0.45rem 0.7rem;
    border-left: 2px solid #2d5fa3;
    background: #1f2530;
    color: #cfe3ff;
}
