/* The legacy --color-* palette that used to live here was removed in spec 078: the fib
   overlay panels were its last consumer and they now run on --hz-* tokens. The candle
   canvas itself keeps its own documented dark literals in CandleChart.razor.css, which
   must track the WebGL clear color in js/candleChart.js. */

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    /* 618 tokens (spec 037): six18.css owns the values; dark is the default. */
    background-color: var(--hz-bg);
    color: var(--hz-text);
    font-family: var(--hz-font);
    font-size: 14px;
}

* {
    box-sizing: border-box;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

#blazor-error-ui {
    background: var(--hz-raised);
    color: var(--hz-text);
    padding: 0.6rem 1rem;
    border-top: 2px solid var(--hz-danger);
    position: fixed;
    bottom: 0;
    width: 100%;
    display: none;
}


.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--hz-success);
}

.invalid {
    outline: 1px solid var(--hz-danger);
}

.validation-message {
    color: var(--hz-danger);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkw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0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ─────────────────────────────────────────────────────────────────────────────
   FIB CUSTOMIZATION: CSS HOOKS & LAYOUT SLOTS
   Feature: 005-customize-fib-points — retokenized for spec 078.

   FibSettingsPanel has no scoped stylesheet, so its chrome is themed here.
   These rules used to run on the legacy --color-bg-primary/#181818 palette,
   which meant the fib panel stayed dark-tuned while the rest of the app went
   light. It is a SETTINGS panel, not the candle canvas, so it now follows the
   --hz-* tokens and [data-appearance] like every other surface. (FR-011's
   dark-in-both-modes exception covers the canvas only — see
   CandleChart.razor.css.) Per-level COLOR swatch values remain user data and
   are never themed.
   ───────────────────────────────────────────────────────────────────────────── */

:root {
    --fib-panel-width: 300px;
    --fib-level-height: 2rem;
    --fib-input-padding: 0.5rem;
    --fib-button-height: 2.25rem;
    --fib-label-font-size: 0.875rem;
    --fib-color-swatch-size: 1.5rem;
}

/* Main fib settings panel container */
.fib-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--hz-card);
    border: 1px solid var(--hz-border);
    border-radius: var(--hz-radius-card);
    width: min(var(--fib-panel-width), calc(100vw - 2rem));
    max-width: 90vw;
    overflow-y: auto;
    max-height: min(460px, 45vh);
}

/* Fib levels section — scrollable list */
.fib-panel-levels {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--hz-border);
    border-radius: var(--hz-radius-control);
    padding: 0.5rem;
}

/* Header row: On | Color | Level */
.fib-level-header {
    display: grid;
    grid-template-columns: 2.25rem 3rem minmax(0, 1fr);
    gap: 0.5rem;
    padding: 0.5rem;
    font-weight: 600;
    font-size: var(--hz-label-size);
    letter-spacing: var(--hz-label-tracking);
    text-transform: uppercase;
    color: var(--hz-text-faint);
    border-bottom: 1px solid var(--hz-border-strong);
    margin-bottom: 0.25rem;
}

/* Individual fib level row. The hairline is what separates the row from the
   panel in light mode, where --hz-raised and --hz-card are both white. */
.fib-level-row {
    display: grid;
    grid-template-columns: 2.25rem 3rem minmax(0, 1fr);
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem;
    background-color: var(--hz-raised);
    border: 1px solid var(--hz-border);
    border-radius: var(--hz-radius-control);
    transition: background-color 0.15s ease;
}

    .fib-level-row:hover {
        background-color: var(--hz-brand-soft);
        border-color: var(--hz-brand);
    }

/* Checkbox column */
.fib-col-on {
    justify-self: center;
}

.fib-level-row input.fib-col-on[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    margin: 0;
    accent-color: var(--hz-brand);
    cursor: pointer;
}

/* Color picker column */
.fib-col-color {
    justify-self: center;
}

.fib-level-header .fib-col-color {
    justify-self: start;
    width: auto;
    min-width: 0;
}

/* Swatch chrome only — the swatch VALUE is the trader's own level color. */
.fib-level-row input.fib-col-color[type="color"] {
    width: var(--fib-color-swatch-size);
    min-width: var(--fib-color-swatch-size);
    height: var(--fib-color-swatch-size);
    padding: 0;
    border: 1px solid var(--hz-border-strong);
    border-radius: var(--hz-radius-control);
    cursor: pointer;
    background: transparent;
}

/* Label column (ratio % or custom ratio input) */
.fib-col-label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-family: var(--hz-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--fib-label-font-size);
    color: var(--hz-text);
    word-break: break-word;
    padding-left: 0.25rem;
}

/* Input field for ratio value */
.fib-col-label input[type="number"] {
    width: 100%;
    padding: var(--fib-input-padding);
    font-family: var(--hz-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--fib-label-font-size);
    background-color: var(--hz-card);
    color: var(--hz-text);
    border: 1px solid var(--hz-border-strong);
    border-radius: var(--hz-radius-control);
}

    .fib-col-label input[type="number"]:focus {
        border-color: var(--hz-brand);
        box-shadow: 0 0 0 1px var(--hz-brand);
        outline: none;
    }

/* Delete button (per custom level) — quiet until hovered. */
.fib-delete-btn {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    background-color: transparent;
    color: var(--hz-text-faint);
    border: none;
    border-radius: var(--hz-radius-control);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}

    .fib-delete-btn:hover {
        background-color: var(--hz-danger-soft);
        color: var(--hz-danger);
    }

    .fib-delete-btn:active {
        background-color: color-mix(in srgb, var(--hz-danger) 22%, transparent);
        color: var(--hz-danger);
    }

/* T025: Custom ratio section */
.fib-custom-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: var(--hz-raised);
    border: 1px dashed var(--hz-border-strong);
    border-radius: var(--hz-radius-control);
}

.fib-custom-header {
    font-weight: 600;
    font-size: var(--hz-label-size);
    letter-spacing: var(--hz-label-tracking);
    text-transform: uppercase;
    color: var(--hz-text-faint);
}

.fib-custom-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.fib-custom-input {
    flex: 1;
    min-width: 0;
    padding: var(--fib-input-padding);
    font-family: var(--hz-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--fib-label-font-size);
    background-color: var(--hz-card);
    color: var(--hz-text);
    border: 1px solid var(--hz-border-strong);
    border-radius: var(--hz-radius-control);
}

    .fib-custom-input:focus {
        border-color: var(--hz-brand);
        box-shadow: 0 0 0 1px var(--hz-brand);
        outline: none;
    }

    .fib-custom-input::placeholder {
        color: var(--hz-text-faint);
    }

/* Add custom button — the section's primary action, so it carries the gold. */
.fib-add-custom-btn {
    padding: var(--fib-input-padding) 0.75rem;
    font-family: var(--hz-font);
    font-size: var(--fib-label-font-size);
    background-color: var(--hz-brand);
    color: var(--hz-on-brand);
    border: 1px solid var(--hz-brand);
    border-radius: var(--hz-radius-control);
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-weight: 600;
    white-space: nowrap;
}

    .fib-add-custom-btn:hover:not(:disabled) {
        background-color: var(--hz-brand-hover);
        border-color: var(--hz-brand-hover);
    }

    .fib-add-custom-btn:active:not(:disabled) {
        background-color: var(--hz-brand-deep);
        border-color: var(--hz-brand-deep);
    }

    .fib-add-custom-btn:disabled {
        background-color: var(--hz-raised);
        border-color: var(--hz-border-strong);
        color: var(--hz-text-faint);
        cursor: not-allowed;
        opacity: 0.6;
    }

/* Custom levels list */
.fib-custom-levels-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.25rem;
}

.fib-custom-level-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: var(--hz-raised);
    border: 1px solid var(--hz-border);
    border-radius: var(--hz-radius-badge);
    transition: background-color 0.15s ease;
}

    .fib-custom-level-item:hover {
        background-color: var(--hz-brand-soft);
        border-color: var(--hz-brand);
    }

.fib-custom-ratio {
    min-width: 3rem;
    font-family: var(--hz-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--fib-label-font-size);
    color: var(--hz-text);
    font-weight: 500;
}

/* Chrome only — background-color comes from the level's own color (inline). */
.fib-custom-color {
    width: var(--fib-color-swatch-size);
    height: var(--fib-color-swatch-size);
    border: 1px solid var(--hz-border-strong);
    border-radius: var(--hz-radius-control);
    flex-shrink: 0;
}

/* Add custom ratio section */
.fib-add-custom-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--hz-border);
}

.fib-add-custom-input {
    flex: 1;
    padding: var(--fib-input-padding);
    font-family: var(--hz-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--fib-label-font-size);
    background-color: var(--hz-card);
    color: var(--hz-text);
    border: 1px solid var(--hz-border-strong);
    border-radius: var(--hz-radius-control);
    min-width: 0;
}

    .fib-add-custom-input:focus {
        border-color: var(--hz-brand);
        box-shadow: 0 0 0 1px var(--hz-brand);
        outline: none;
    }

    .fib-add-custom-input::placeholder {
        color: var(--hz-text-faint);
    }

/* Display options section */
.fib-display-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--hz-border);
    border-bottom: 1px solid var(--hz-border);
}

.fib-option-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .fib-option-row label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: var(--fib-label-font-size);
        cursor: pointer;
        flex: 1;
    }

    .fib-option-row input[type="checkbox"] {
        width: 1rem;
        height: 1rem;
        accent-color: var(--hz-brand);
        cursor: pointer;
    }

/* Dropdown selects (line style, line width, label position) */
.fib-select {
    width: 100%;
    padding: var(--fib-input-padding);
    font-family: var(--hz-font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--fib-label-font-size);
    background-color: var(--hz-card);
    color: var(--hz-text);
    border: 1px solid var(--hz-border-strong);
    border-radius: var(--hz-radius-control);
    cursor: pointer;
}

    .fib-select:focus {
        border-color: var(--hz-brand);
        box-shadow: 0 0 0 1px var(--hz-brand);
        outline: none;
    }

.fib-select-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fib-select-label {
    font-size: var(--hz-label-size);
    letter-spacing: var(--hz-label-tracking);
    text-transform: uppercase;
    color: var(--hz-text-faint);
    font-weight: 600;
}

/* Clear all drawings button — destructive, so it stays quiet (soft danger)
   rather than shouting as a solid red fill. */
.fib-clear-btn {
    height: 1.7rem;
    padding: 0 0.6rem;
    font-family: var(--hz-font);
    font-size: var(--fib-label-font-size);
    background-color: var(--hz-danger-soft);
    color: var(--hz-danger);
    border: 1px solid color-mix(in srgb, var(--hz-danger) 32%, transparent);
    border-radius: var(--hz-radius-control);
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-weight: 600;
}

    .fib-clear-btn:hover {
        background-color: color-mix(in srgb, var(--hz-danger) 20%, transparent);
        border-color: var(--hz-danger);
    }

    .fib-clear-btn:active {
        background-color: color-mix(in srgb, var(--hz-danger) 28%, transparent);
        border-color: var(--hz-danger);
    }

/* Error/validation message. (Two identical .fib-error-message rules used to be
   declared in this file; merged here into the single effective result.) */
.fib-error-message {
    font-size: var(--fib-label-font-size);
    color: var(--hz-danger);
    padding: 0.5rem;
    background-color: var(--hz-danger-soft);
    border: 1px solid color-mix(in srgb, var(--hz-danger) 32%, transparent);
    border-left: 3px solid var(--hz-danger);
    border-radius: var(--hz-radius-control);
    word-wrap: break-word;
}

.fib-success-message {
    font-size: var(--fib-label-font-size);
    color: var(--hz-success);
    padding: 0.5rem;
    background-color: var(--hz-success-soft);
    border: 1px solid color-mix(in srgb, var(--hz-success) 32%, transparent);
    border-left: 3px solid var(--hz-success);
    border-radius: var(--hz-radius-control);
}

/* Scrollbar styling for fib-panel-levels */
.fib-panel-levels::-webkit-scrollbar {
    width: 6px;
}

.fib-panel-levels::-webkit-scrollbar-track {
    background-color: var(--hz-card);
}

.fib-panel-levels::-webkit-scrollbar-thumb {
    background-color: var(--hz-border-strong);
    border-radius: var(--hz-radius-badge);
}

    .fib-panel-levels::-webkit-scrollbar-thumb:hover {
        background-color: var(--hz-text-faint);
    }

/* Native <option> popups are painted by the OS — pin them to the themed
   surface so they follow [data-appearance] instead of the browser default. */
.fib-select option {
    background-color: var(--hz-card);
    color: var(--hz-text);
}

/* Overlay-specific sizing: ensure fib content fills left drawer */
.fib-side-overlay .fib-panel {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
}

.fib-side-overlay .fib-panel-levels {
    flex: 1;
    min-height: 0;
    max-height: none;
}