/* ════════════════════════════════════════════════════════════════════════
   BACKUPS TAB — point-in-time rollback for one realm.

   Built on the same panel primitive as the rest of the cockpit
   (.ovt-ck-panel / .ovt-ck-sec), so it reads as part of the drill-down
   rather than a bolted-on feature.

   The one deliberate visual break: the "write straight into the live
   world" switch. Everything else here is reversible because it restores
   into *_restored folders. That switch is not, so it is the only element
   on the page allowed to shout.
   ════════════════════════════════════════════════════════════════════════ */

.ovt-bkp { display: flex; flex-direction: column; gap: 1rem; }

.ovt-bkp-muted {
    font-size: 0.78rem;
    color: var(--ovt-fg-dim);
    padding: 0.35rem 0;
}

/* ─── coverage strip ─────────────────────────────────────────────────── */

.ovt-bkp-covrow { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }

.ovt-bkp-state {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.3rem 0.6rem;
    border: 1px solid currentColor;
    border-radius: 3px;
}

.ovt-bkp-covmeta {
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
    font-size: 0.78rem;
    color: var(--ovt-fg-muted);
}

.ovt-bkp-covmeta .dim {
    font-size: 0.68rem;
    color: var(--ovt-fg-dim);
    word-break: break-all;
}

/* ─── two-column working area ────────────────────────────────────────── */

.ovt-bkp-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}

@media (max-width: 900px) {
    .ovt-bkp-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ─── restore points ─────────────────────────────────────────────────── */

.ovt-bkp-snaps {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.ovt-bkp-snap {
    appearance: none;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid transparent;
    border-left: 2px solid var(--ovt-hairline);
    border-radius: 0 3px 3px 0;
    background: rgba(255, 255, 255, 0.015);
    transition: border-color 0.14s ease, background 0.14s ease;
}

.ovt-bkp-snap:hover {
    background: rgba(255, 255, 255, 0.035);
    border-left-color: var(--ovt-fg-dim);
}

.ovt-bkp-snap.is-on {
    border-left-color: var(--ovt-green);
    background: rgba(16, 185, 129, 0.07);
}

.ovt-bkp-snap .when {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.72rem;
    color: var(--ovt-fg);
    font-variant-numeric: tabular-nums;
}

.ovt-bkp-snap .meta { font-size: 0.66rem; color: var(--ovt-fg-dim); }
.ovt-bkp-snap .errs { font-size: 0.62rem; color: var(--ovt-amber); }

/* ─── scope picker ───────────────────────────────────────────────────── */

.ovt-bkp-scopes { display: flex; flex-direction: column; gap: 0.35rem; }

.ovt-bkp-scope {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: "radio name" "radio sub";
    gap: 0 0.55rem;
    align-items: center;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--ovt-hairline);
    border-radius: 3px;
    cursor: pointer;
    transition: border-color 0.14s ease, background 0.14s ease;
}

.ovt-bkp-scope:hover { background: rgba(255, 255, 255, 0.025); }

.ovt-bkp-scope.is-on {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.06);
}

.ovt-bkp-scope input { grid-area: radio; accent-color: var(--ovt-green); }

.ovt-bkp-scope-name {
    grid-area: name;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ovt-fg);
}

.ovt-bkp-scope-sub { grid-area: sub; font-size: 0.7rem; color: var(--ovt-fg-dim); }

/* ─── target pickers ─────────────────────────────────────────────────── */

.ovt-bkp-target {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px solid var(--ovt-hairline);
}

.ovt-bkp-lbl {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ovt-fg-dim);
}

.ovt-bkp-select {
    width: 100%;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--ovt-hairline);
    border-radius: 3px;
    background: var(--ovt-bg-deeper, #06080a);
    color: var(--ovt-fg);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.72rem;
}

.ovt-bkp-select:focus {
    outline: none;
    border-color: var(--ovt-green);
}

.ovt-bkp-hint { font-size: 0.68rem; color: var(--ovt-fg-dim); }

/* ─── apply ──────────────────────────────────────────────────────────── */

.ovt-bkp-plan {
    font-size: 0.82rem;
    color: var(--ovt-fg-muted);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.ovt-bkp-plan strong { color: var(--ovt-fg); font-weight: 700; }

/* the only irreversible control here, so the only one that shouts */
.ovt-bkp-direct {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--ovt-hairline);
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--ovt-fg-muted);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.ovt-bkp-direct input { margin-top: 0.15rem; accent-color: var(--ovt-red); }

.ovt-bkp-direct em {
    display: block;
    font-style: normal;
    font-size: 0.7rem;
    color: var(--ovt-fg-dim);
    margin-top: 0.12rem;
}

.ovt-bkp-direct.is-on {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(248, 113, 113, 0.06);
    color: var(--ovt-red);
}

.ovt-bkp-direct.is-on em { color: var(--ovt-red); opacity: 0.85; }

.ovt-bkp-gate {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.6rem;
}

.ovt-bkp-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    margin-top: 0.8rem;
}

.ovt-bkp-result {
    margin-top: 0.8rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--ovt-hairline);
    border-radius: 3px;
    font-size: 0.78rem;
}

.ovt-bkp-result.is-ok  { border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.05); }
.ovt-bkp-result.is-bad { border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.05); }

.ovt-bkp-result .head {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.ovt-bkp-result.is-ok .head  { color: var(--ovt-green-soft); }
.ovt-bkp-result.is-bad .head { color: var(--ovt-red); }

.ovt-bkp-result .det {
    margin: 0.4rem 0 0;
    padding: 0.45rem 0.55rem;
    background: var(--ovt-bg-deeper, #06080a);
    border-radius: 3px;
    font-size: 0.68rem;
    color: var(--ovt-fg-dim);
    white-space: pre-wrap;
    max-height: 180px;
    overflow-y: auto;
}

/* ─── region targeting by coordinate ─────────────────────────────────── */

.ovt-bkp-coords {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.ovt-bkp-axis {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ovt-fg-dim);
}

.ovt-bkp-num {
    width: 7rem;
    min-width: 0;
    padding: 0.38rem 0.5rem;
    border: 1px solid var(--ovt-hairline);
    border-radius: 3px;
    background: var(--ovt-bg-deeper, #06080a);
    color: var(--ovt-fg);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.ovt-bkp-num:focus { outline: none; border-color: var(--ovt-green); }

.ovt-bkp-span {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72rem;
    color: var(--ovt-fg-dim);
    cursor: pointer;
}

.ovt-bkp-span input { accent-color: var(--ovt-green); }

.ovt-bkp-solved {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--ovt-hairline);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.015);
}

.ovt-bkp-solved-head {
    font-size: 0.72rem;
    color: var(--ovt-fg-muted);
    margin-bottom: 0.4rem;
}

.ovt-bkp-solved-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.ovt-bkp-rgn {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.66rem;
    padding: 0.18rem 0.4rem;
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 2px;
    background: rgba(16, 185, 129, 0.07);
    color: var(--ovt-green-soft);
    white-space: nowrap;
}

/* a region the coordinates cover but the snapshot does not contain: usually
   means nobody had been there yet when the backup was taken */
.ovt-bkp-rgn.is-missing {
    border-color: var(--ovt-hairline);
    background: transparent;
    color: var(--ovt-fg-dim);
    text-decoration: line-through;
}

.ovt-bkp-warnline {
    margin-top: 0.45rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--ovt-hairline);
    font-size: 0.7rem;
    color: var(--ovt-amber);
    line-height: 1.5;
}

/* ─── live-restore pre-flight ────────────────────────────────────────── */

.ovt-bkp-preflight {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.6rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 3px;
    background: rgba(251, 191, 36, 0.04);
}

.ovt-bkp-ok {
    font-size: 0.74rem;
    color: var(--ovt-green-soft);
}

.ovt-bkp-blockers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* a player standing where the rollback is about to land */
.ovt-bkp-blocker {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.66rem;
    padding: 0.2rem 0.45rem;
    border: 1px solid rgba(248, 113, 113, 0.45);
    border-radius: 2px;
    background: rgba(248, 113, 113, 0.08);
    color: var(--ovt-red);
    white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════════════
   OVERFLOW CONTAINMENT

   Grid and flex children default to min-width:auto, so a long path, a wide
   table or the file manager (built for a full-width page) pushes the whole
   tab panel wider than the viewport and the layout "flies off the page".
   min-width:0 lets them shrink; the scroll then happens inside the element
   that is actually too wide instead of on the document.
   ════════════════════════════════════════════════════════════════════════ */

.ovt-bkp-grid > *,
.ovt-bkp,
.ovt-bkp-covrow > * { min-width: 0; }

.ovt-tabpanel,
.ovt-tab-backups,
.ovt-tab-files { min-width: 0; max-width: 100%; overflow-x: hidden; }

/* the files manager hosted inside a tab: it was laid out for its own page,
   so it needs an explicit ceiling and its own scroll rather than the page's */
.ovtf-panel-root {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
}

.ovtf-panel-root .ovtf-body { min-width: 0; }
.ovtf-panel-root pre,
.ovtf-panel-root textarea { max-width: 100%; }
