:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --fg: #1b1f24;
  --muted: #55606b;
  --card: #ffffff;
  --line: #dfe3e8;
  --accent: #1e6fd9;
  --accent-fg: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --fg: #e8eaed;
    --muted: #9aa4ae;
    --card: #1c2024;
    --line: #2c3238;
    --accent: #6fa8ff;
    --accent-fg: #10131a;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
}

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 650; text-decoration: none; color: inherit; letter-spacing: -.01em; }
.site-header nav { display: flex; align-items: center; gap: .75rem; }
.who { color: var(--muted); font-size: .9rem; }

main {
  flex: 1;
  width: 100%; max-width: 34rem;
  margin: 0 auto; padding: 2rem 1.25rem;
}

.hero { text-align: center; margin-bottom: 2rem; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 1rem; }
.lede { margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.actions { display: flex; gap: .75rem; justify-content: center; margin-top: 1.5rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem;
}

form { display: flex; flex-direction: column; gap: .9rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; color: var(--muted); }
label.check { flex-direction: row; align-items: flex-start; gap: .5rem; }
label.check input { width: auto; margin-top: .3rem; }
input[type=text], input[type=email], input[type=password] {
  width: 100%;
  padding: .6rem .7rem;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  display: inline-block;
  padding: .6rem 1rem;
  font: inherit; font-weight: 550;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
  color: inherit;
  background: transparent;
  cursor: pointer;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-ghost:hover, .btn-primary:hover { filter: brightness(1.07); }

.alt { margin: 1.25rem 0 0; font-size: .9rem; color: var(--muted); text-align: center; }
a { color: var(--accent); }

.flashes { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.flash { padding: .65rem .8rem; border-radius: 7px; border: 1px solid var(--line); font-size: .92rem; }
.flash-danger  { border-color: #d9534f; }
.flash-warning { border-color: #d9a441; }
.flash-success { border-color: #3fa45b; }

.divider {
  display: flex; align-items: center; gap: .75rem;
  margin: 1.5rem 0 1rem; color: var(--muted); font-size: .85rem;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.sso { display: flex; flex-direction: column; gap: .6rem; }
.sso .btn { text-align: center; }

.card + .card { margin-top: 1.25rem; }
.status { margin: 0 0 1rem; color: var(--muted); font-size: .95rem; }
.status.ok { color: #3fa45b; }
.inline-form { margin-top: .75rem; }

.formmsg { margin: .25rem 0 0; font-size: .9rem; min-height: 1.2em; }
.formmsg.ok  { color: #3fa45b; }
.formmsg.err { color: #d9534f; }

.site-footer {
  padding: 1.25rem;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ── Backup status page ─────────────────────────────────────────────────── */
/* Semantic state colours, kept separate from the accent so "needs attention"
   never blends into ordinary branding. */
:root {
  --st-ok:       #3fa45b;
  --st-warning:  #c9880f;
  --st-critical: #d9534f;
  --st-unknown:  #868c96;
}

.tablewrap { overflow-x: auto; }

table.status {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
table.status th {
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 .6rem .5rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.status td {
  padding: .55rem .6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}
table.status tr:last-child td { border-bottom: 0; }
table.status .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.status .host { font-weight: 600; white-space: nowrap; }
table.status .reason { white-space: nowrap; }
table.status .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .85em; }
table.status tr.subrow td { border-bottom: 1px solid var(--line); padding-top: 0; font-size: .82rem; }

.pill {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 3px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.pill.ok       { color: var(--st-ok); }
.pill.warning  { color: var(--st-warning); }
.pill.critical { color: var(--st-critical); }
.pill.unknown  { color: var(--st-unknown); }

.empty { margin: 0; }

/* ── Signed-in user menu ────────────────────────────────────────────────── */
/* [hidden] must win over the panel's own display, or the menu renders open
   on every page load. */
[hidden] { display: none !important; }

.usermenu { position: relative; display: inline-block; }

.usermenu-toggle { display: inline-flex; align-items: center; gap: .4rem; }
.usermenu-toggle .caret { font-size: .7em; opacity: .7; }
.usermenu-toggle[aria-expanded="true"] { border-color: var(--accent); }

.usermenu-panel {
  position: absolute;
  top: calc(100% + .4rem);
  right: 0;
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: .3rem;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
}

.usermenu-panel a {
  padding: .5rem .6rem;
  border-radius: 5px;
  text-decoration: none;
  color: var(--fg);
  font-size: .92rem;
  white-space: nowrap;
}
.usermenu-panel a:hover { background: var(--bg); }
.usermenu-panel a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── Backup file browser ────────────────────────────────────────────────── */
.crumbs { font-size: .9rem; margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: baseline; }
.crumbs .sep { color: var(--muted); }
.crumbs .here { font-weight: 600; }
.upline { margin: 0 0 .75rem; font-size: .9rem; }
table.filelist td { vertical-align: middle; }
table.filelist .ficon { margin-right: .45rem; opacity: .75; }
.restore { font-size: .82rem; white-space: nowrap; }

.upline { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.restore.thisfolder { font-weight: 600; }
