/* holdout-panel.css — shared validation & scoring panel.
   Pairs with shared/js/holdout_panel.js (window.HoldoutPanel).
   Styled to sit quietly at the bottom of a tool page: closed, it is one line. */

.holdout-panel {
    margin-top: 1rem;
    border: 1px solid var(--app-border, #d6dfea);
    border-radius: 8px;
    background: var(--app-card-bg, #ffffff);
    color: var(--app-text, #1f2a37);
    font-size: 0.95rem;
}

.holdout-panel.is-active {
    border-color: var(--app-accent, #2a7de1);
}

.holdout-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
}

.holdout-summary::-webkit-details-marker {
    display: none;
}

.holdout-summary::before {
    content: "\25B8";
    display: inline-block;
    transition: transform 0.15s ease;
    color: var(--app-muted, #6b7a8d);
}

.holdout-panel[open] > .holdout-summary::before {
    transform: rotate(90deg);
}

.holdout-summary:focus-visible {
    outline: 2px solid var(--app-accent, #2a7de1);
    outline-offset: 2px;
}

.holdout-badge {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--app-surface-alt, #eef3f9);
    color: var(--app-muted, #6b7a8d);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.holdout-summary-state {
    margin-left: auto;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--app-accent, #2a7de1);
}

.holdout-body {
    padding: 0 14px 14px;
}

.holdout-intro {
    margin: 0 0 12px;
    color: var(--app-muted, #6b7a8d);
}

/* Tabs ------------------------------------------------------------------- */

.holdout-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--app-border, #d6dfea);
    margin-bottom: 14px;
}

.holdout-tab {
    padding: 8px 14px;
    font: inherit;
    font-weight: 600;
    color: var(--app-muted, #6b7a8d);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.holdout-tab:hover {
    color: var(--app-text, #1f2a37);
}

.holdout-tab.is-active {
    color: var(--app-accent, #2a7de1);
    border-bottom-color: var(--app-accent, #2a7de1);
}

.holdout-tab:focus-visible {
    outline: 2px solid var(--app-accent, #2a7de1);
    outline-offset: -2px;
}

/* Controls --------------------------------------------------------------- */

.holdout-toggle {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
}

.holdout-toggle-sub {
    font-weight: 400;
    margin-top: 6px;
}

.holdout-toggle input {
    margin-top: 3px;
    flex: 0 0 auto;
}

.holdout-help {
    margin: 6px 0 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--app-muted, #6b7a8d);
}

.holdout-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
    margin-top: 14px;
    padding: 12px;
    border-radius: 6px;
    background: var(--app-surface-alt, #f7f9fc);
}

.holdout-controls.is-disabled {
    opacity: 0.5;
}

.holdout-field-wide {
    grid-column: 1 / -1;
}

.holdout-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.holdout-range-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.holdout-range-row input[type="range"] {
    flex: 1 1 auto;
    min-width: 0;
}

.holdout-range-value {
    flex: 0 0 auto;
    min-width: 4ch;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.holdout-radios {
    margin: 0;
    padding: 0;
    border: none;
}

/* Dropzone --------------------------------------------------------------- */

.holdout-dropzone {
    margin-top: 12px;
    padding: 20px;
    text-align: center;
    border: 2px dashed var(--app-border, #d6dfea);
    border-radius: 8px;
    background: var(--app-surface-alt, #f7f9fc);
}

.holdout-dropzone.dragover {
    border-color: var(--app-accent, #2a7de1);
    background: var(--app-accent-soft, #eaf3fd);
}

.holdout-dropzone-text {
    margin: 0 0 10px;
    color: var(--app-muted, #6b7a8d);
}

.holdout-file-input {
    display: none;
}

.holdout-btn {
    padding: 7px 14px;
    font: inherit;
    font-weight: 600;
    color: var(--app-text, #1f2a37);
    background: var(--app-card-bg, #ffffff);
    border: 1px solid var(--app-border, #d6dfea);
    border-radius: 6px;
    cursor: pointer;
}

.holdout-btn:hover {
    border-color: var(--app-accent, #2a7de1);
}

.holdout-btn:focus-visible {
    outline: 2px solid var(--app-accent, #2a7de1);
    outline-offset: 1px;
}

.holdout-btn-primary {
    margin-top: 12px;
    color: #ffffff;
    background: var(--app-accent, #2a7de1);
    border-color: var(--app-accent, #2a7de1);
}

.holdout-status {
    margin: 10px 0 0;
    font-size: 0.88rem;
    min-height: 1.2em;
}

.holdout-status.is-error {
    color: var(--app-error, #b3261e);
    font-weight: 600;
}

.holdout-status.is-ok {
    color: var(--app-success, #1b6b3a);
}

/* Results ---------------------------------------------------------------- */

.holdout-results:not(:empty) {
    margin-top: 16px;
}

.holdout-heading {
    margin: 16px 0 8px;
    font-size: 0.95rem;
}

.holdout-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    font-size: 0.88rem;
}

.holdout-table th,
.holdout-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid var(--app-border, #d6dfea);
}

.holdout-table thead th {
    background: var(--app-surface-alt, #f7f9fc);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--app-muted, #6b7a8d);
}

.holdout-table tbody td {
    font-variant-numeric: tabular-nums;
}

.holdout-preview {
    display: block;
    max-height: 320px;
    overflow: auto;
    white-space: nowrap;
}

/* The train-vs-holdout gap is the lesson, so it gets the loudest treatment. */
.holdout-gap {
    padding: 12px 14px;
    border-left: 4px solid var(--app-muted, #6b7a8d);
    border-radius: 4px;
    background: var(--app-surface-alt, #f7f9fc);
}

.holdout-gap.is-good {
    border-left-color: var(--app-success, #1b6b3a);
}

.holdout-gap.is-watch {
    border-left-color: var(--app-warning, #a86400);
}

.holdout-gap.is-warn {
    border-left-color: var(--app-error, #b3261e);
}

.holdout-gap-headline {
    margin: 0 0 6px;
    font-weight: 700;
}

.holdout-gap-detail {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.5;
}

.holdout-notes {
    margin: 10px 0 0;
    padding-left: 20px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.holdout-notes.is-warn {
    color: var(--app-error, #b3261e);
}

.holdout-skips {
    margin-top: 14px;
    padding: 10px 12px;
    border: 1px solid var(--app-border, #d6dfea);
    border-radius: 6px;
}

.holdout-skips-headline {
    margin: 0;
    font-weight: 600;
}

/* Banner the tool shows next to its coefficients while a split is active. */
.holdout-active-banner {
    margin: 10px 0;
    padding: 8px 12px;
    border-left: 4px solid var(--app-accent, #2a7de1);
    border-radius: 4px;
    background: var(--app-accent-soft, #eaf3fd);
    font-size: 0.88rem;
    font-weight: 600;
}

@media (max-width: 640px) {
    .holdout-controls {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .holdout-summary::before {
        transition: none;
    }
}
