/* Backup console. Tokens copied from core/staff/static/staff/staff.css so the
   console reads as part of the same product; the bundle is independent, as
   the staff and public bundles are (D2/D3). */

@font-face {
    font-family: 'Arsenal';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/arsenal-400-latin.woff2') format('woff2');
}
@font-face {
    font-family: 'Arsenal';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/arsenal-700-latin.woff2') format('woff2');
}

:root {
    --color-bg:          #fffdf0;
    --color-surface:     #ffffff;
    --color-surface-alt: #f0f9ff;
    --color-border:      #d6e5f0;
    --color-primary:     #00548a;
    --color-accent:      #57beff;
    --color-text:        #001624;
    --color-text-muted:  #5b7284;
    --color-text-light:  #ffffff;
    --color-status-ok:   #558a00;
    --color-status-warn: #8a7a00;
    --color-status-err:  #8a0055;
    --font-family: 'Arsenal', Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font: 17px/1.45 var(--font-family);
}

[hidden] { display: none !important; }

h1, h2 { margin: 0 0 4px; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
.muted { color: var(--color-text-muted); margin: 0 0 12px; }

/* --- bar ------------------------------------------------------------------ */

.bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 24px;
    background: var(--color-primary);
    color: var(--color-text-light);
}
.brand { color: inherit; text-decoration: none; font-weight: 700; font-size: 20px; }
.brand span { font-weight: 400; opacity: .8; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: inherit; text-decoration: none; opacity: .85; }
.nav a[aria-current="page"] { opacity: 1; border-bottom: 2px solid var(--color-accent); }

/* --- layout --------------------------------------------------------------- */

.page { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 20px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    min-width: 0;
}
.login-card { max-width: 380px; margin: 8vh auto 0; width: 100%; }
.login-card form { display: grid; gap: 12px; }
.login-card label { display: grid; gap: 4px; }

/* --- controls ------------------------------------------------------------- */

input, select, button { font: inherit; color: inherit; }
input, select {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 6px 10px;
    background: var(--color-surface);
    min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn {
    border: 1px solid var(--color-primary);
    background: var(--color-surface);
    color: var(--color-primary);
    border-radius: 999px;
    padding: 6px 16px;
    cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: progress; }
.btn-primary { background: var(--color-primary); color: var(--color-text-light); }
.btn-quiet { border-color: rgba(255, 255, 255, .6); background: transparent; color: inherit; }

.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    border: 1px solid var(--color-primary);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 12px;
}
.segmented button {
    border: 0;
    background: transparent;
    color: var(--color-primary);
    padding: 6px 14px;
    cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--color-primary); color: var(--color-text-light); }
.level-help { min-height: 3em; color: var(--color-text-muted); margin: 0 0 12px; }

.inline-form { display: flex; gap: 8px; }
.inline-form input { font-family: var(--mono); font-size: 15px; flex: 1 1 8em; width: 8em; }
.btn { white-space: nowrap; flex-shrink: 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--color-text-muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.filter { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 12px 0 16px; }
.filter label { display: grid; gap: 4px; }

.alert {
    margin: 0;
    padding: 10px 14px;
    border-radius: 6px;
    background: #fbeef5;
    color: var(--color-status-err);
    border: 1px solid #efc6dc;
}
.alert[data-level="ok"] { background: #f1f7e8; color: var(--color-status-ok); border-color: #d3e6b8; }

/* --- tables --------------------------------------------------------------- */

.table-wrap { overflow-x: auto; position: relative; }  /* contains the visually-hidden header label */
.table { width: 100%; min-width: 640px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--color-border); vertical-align: top; }
.table th { color: var(--color-text-muted); font-weight: 400; }
.table th, .table td { white-space: nowrap; }
.table .mono, .logs td:first-child { font-family: var(--mono); font-size: 14px; white-space: nowrap; }
.logs td:last-child { font-family: var(--mono); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

.pill {
    display: inline-block;
    padding: 1px 10px;
    border-radius: 999px;
    font-size: 14px;
    border: 1px solid currentColor;
}
.pill-success, .pill-INFO { color: var(--color-status-ok); }
.pill-running, .pill-WARNING, .pill-queued, .pill-ignored { color: var(--color-status-warn); }
.pill-failed, .pill-ERROR, .pill-CRITICAL, .pill-timeout { color: var(--color-status-err); }
.pill-enc-ready { color: var(--color-status-ok); }
.pill-enc-disabled { color: var(--color-status-warn); }
.pill-enc-error { color: var(--color-status-err); }
.enc-message, .enc-hint { display: block; margin-top: 4px; }
.enc-hint { color: var(--color-text-muted); font-size: 15px; }

/* --- card actions: the primary action sits at the bottom of its card, so the
   Level card's "Run a backup now" and the Status card's "Restore from files"
   line up across the row. ------------------------------------------------- */

.grid > .card { display: flex; flex-direction: column; align-items: flex-start; }
.grid > .card > .facts, .grid > .card > .level-help { align-self: stretch; }
.grid > .card > #runNow, .grid > .card > .restore-from-files { margin-top: auto; }
.grid > .card > .level-help { margin-bottom: 16px; }
.restore-from-files { position: relative; padding-top: 16px; }
.source-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% - 8px);
    z-index: 5;
    display: grid;
    gap: 6px;
    padding: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 22, 36, .12);
}
.source-menu .btn { text-align: left; }
.btn-small { padding: 3px 12px; font-size: 15px; }
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
.alert a { color: inherit; font-weight: 700; }

/* --- restore confirmation dialog ------------------------------------------ */

dialog {
    width: min(520px, calc(100vw - 32px));
    padding: 22px 24px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    color: var(--color-text);
}
dialog::backdrop { background: rgba(0, 22, 36, .45); }
dialog h2 { margin-bottom: 14px; }
dialog .facts { margin-bottom: 14px; }
.dialog-warning {
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #fbf7e6;
    color: #5c5100;
    border: 1px solid #eadfa8;
    font-size: 15px;
}
.dialog-warning code { font-family: var(--mono); font-size: 14px; }
.confirm-field { display: block; margin-bottom: 16px; }
.confirm-field input { width: 100%; font-family: var(--mono); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.pill-partial, .pill-uploaded { color: var(--color-status-warn); }
.pill-pruned { color: var(--color-text-muted); }

/* --- guide (D118) ----------------------------------------------------------- */

.guide { max-width: 900px; margin: 0 auto; width: 100%; padding: 24px 32px 32px; }
.guide h1 { font-size: 30px; margin-bottom: 12px; }
.guide h2 { margin: 30px 0 10px; padding-top: 18px; border-top: 1px solid var(--color-border); }
.guide p, .guide li { max-width: 72ch; }
.guide ol, .guide ul { padding-left: 1.4em; }
.guide li { margin: 6px 0; }
.guide blockquote {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
}
.guide blockquote p { margin: 0; }
.guide code { font-family: var(--mono); font-size: 14px; background: var(--color-surface-alt); padding: 1px 4px; border-radius: 4px; }
.guide pre {
    margin: 10px 0 16px;
    padding: 12px 14px;
    background: #0f2433;
    color: #e6f1f8;
    border-radius: 6px;
    overflow-x: auto;
}
.guide pre code { background: none; color: inherit; padding: 0; font-size: 13.5px; }
.guide .guide-table { min-width: 560px; }
.guide .guide-table td, .guide .guide-table th { white-space: normal; vertical-align: top; }
.guide .guide-table td:first-child { min-width: 11em; }

@media (max-width: 560px) {
    .bar { padding: 10px 16px; }
    .card { padding: 14px; }
    .guide { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
