:root {
  /* Neutral surfaces */
  --surface-0: #0a0a0b;
  --surface-1: #111113;
  --surface-2: #17171a;
  --surface-3: #1f1f23;

  /* Neutral text */
  --neutral-weak: #6b6b73;
  --neutral-mid: #9a9aa3;
  --neutral-strong: #e6e6ea;

  /* Accent (protected / healthy) */
  --accent: #3fb950;
  --accent-weak: #2ea043;
  --accent-dim: rgba(63, 185, 80, 0.12);

  /* Danger (failed / unprotected) */
  --danger: #f85149;
  --danger-weak: #da3633;
  --danger-dim: rgba(248, 81, 73, 0.12);

  /* Structure */
  --border: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.06);

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Typography */
  --font-sans: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Motion (duration only; easing is always ease-out) */
  --motion-fast: 120ms;
  --motion-base: 160ms;
  --motion-slow: 240ms;

  /* Elevation — single layer, modal/dialog only */
  --shadow-elevated: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Shared focus ring. Quiet, never a glow. */
:where(a, button, input, .toggle, .filter):focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

* { box-sizing: border-box; }

/* The hidden attribute must always win over component display rules
   (e.g. .cloud-error { display:flex }). Without this an element that is
   meant to be hidden but has a display property set renders anyway. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 18px;
  background: var(--surface-0);
  color: var(--neutral-mid);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Typography helpers */
.text-lg { font-size: 18px; line-height: 26px; font-weight: 600; color: var(--neutral-strong); }
.text-md { font-size: 15px; line-height: 22px; font-weight: 500; color: var(--neutral-strong); }
.text-sm { font-size: 13px; line-height: 18px; }
.text-xs { font-size: 11px; line-height: 16px; }
.mono, .text-mono { font-family: var(--font-mono); font-size: 12px; line-height: 18px; }
.neutral-weak { color: var(--neutral-weak); }
.neutral-mid { color: var(--neutral-mid); }
.neutral-strong { color: var(--neutral-strong); }

/* Layout */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top navigation bar */
.topbar-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.topbar-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-sm);
}
.brand__mark {
  width: 28px;
  height: 28px;
  color: var(--accent);
  flex-shrink: 0;
}
.brand__name {
  font-weight: 600;
  color: var(--neutral-strong);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.topbar-nav__version { color: var(--neutral-weak); }

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Welcome / onboarding (disconnected first-run state) */
.onboarding {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
}

.hero-card {
  width: 100%;
  max-width: 480px;
  padding: var(--space-8);
  background: #161b22;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-card__icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid rgba(63, 185, 80, 0.28);
  box-shadow: 0 0 0 1px rgba(63, 185, 80, 0.05), 0 0 28px rgba(63, 185, 80, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.hero-card__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: #fff;
}

.hero-card__subtitle {
  margin: var(--space-2) 0 0;
  font-size: 13px;
  line-height: 21px;
  color: var(--neutral-mid);
  max-width: 360px;
}

.hero-card__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  max-width: 100%;
  margin-top: var(--space-6);
  padding: 10px 16px;
  border-radius: 8px;
  background: #ffffff;
  color: #000000;
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--motion-fast) ease-out, transform var(--motion-fast) ease-out;
}
.hero-card__cta:hover { background: #e6e8eb; }
.hero-card__cta:active { transform: scale(0.99); }

.hero-card__trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: var(--space-4) 0 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--neutral-weak);
}

/* Connected dashboard */
.dashboard {
  flex: 1;
  width: 100%;
  max-width: 1152px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Integration pills in the top navigation bar */
.conn-pills {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.conn-pill {
  position: relative;
}
.conn-pill__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--neutral-strong);
  font-family: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--motion-fast) ease-out, border-color var(--motion-fast) ease-out;
}
.conn-pill__btn:hover {
  background: var(--surface-3);
  border-color: rgba(255, 255, 255, 0.14);
}
.conn-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neutral-weak);
  flex-shrink: 0;
}
.conn-pill__dot--on {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.16);
}
.conn-pill__label {
  color: var(--neutral-strong);
  font-variant-numeric: tabular-nums;
}
.conn-pill__chevron {
  color: var(--neutral-weak);
  flex-shrink: 0;
}
.conn-pill__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 170px;
  padding: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity var(--motion-fast) ease-out, transform var(--motion-fast) ease-out;
}
.conn-pill:hover .conn-pill__menu,
.conn-pill.is-open .conn-pill__menu,
.conn-pill:focus-within .conn-pill__menu {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.conn-pill__item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--neutral-strong);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.conn-pill__item:hover,
.conn-pill__item:focus-visible {
  background: var(--surface-2);
  text-decoration: none;
}

/* Repository command card */
.repo-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.repo-card__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 64px;
  z-index: 30;
  background: var(--surface-1);
}
.repo-card__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--neutral-strong);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.count-badge {
  font-size: 11px;
  line-height: 1;
  font-weight: 500;
  color: var(--neutral-mid);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 7px;
  font-variant-numeric: tabular-nums;
}
.repo-filters {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.repo-card__spacer { flex: 1; }
.repo-card__head #flash { margin-bottom: 0; }
.backup-dest {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 2px 0 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-0);
  min-width: 0;
}
.backup-dest__legend {
  grid-column: 1 / -1;
  padding: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--neutral-mid);
}
.backup-dest__option {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-1);
  cursor: pointer;
  min-width: 0;
  transition: border-color var(--motion-fast) ease-out, background var(--motion-fast) ease-out;
}
.backup-dest__option:hover {
  background: var(--surface-2);
}
.backup-dest__option:has(input:checked) {
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.backup-dest__option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.backup-dest__option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.backup-dest__icon {
  display: grid;
  place-items: center;
  color: var(--neutral-mid);
}
.backup-dest__option:has(input:checked) .backup-dest__icon {
  color: var(--accent);
}
.backup-dest__copy { min-width: 0; }
.backup-dest__name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--neutral-strong);
}
.backup-dest__desc {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--neutral-mid);
}
.backup-dest__mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid #4b4b53;
  border-radius: 50%;
  color: #0a0a0b;
}
.backup-dest__mark svg { opacity: 0; }
.backup-dest__option:has(input:checked) .backup-dest__mark {
  border-color: var(--accent);
  background: var(--accent);
}
.backup-dest__option:has(input:checked) .backup-dest__mark svg { opacity: 1; }
@media (max-width: 720px) {
  .backup-dest { grid-template-columns: 1fr; }
}

/* Unified repository list */
.repo-table {
  border-top: 1px solid var(--border-soft);
}
.repo-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.4fr auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--motion-fast) ease-out;
}
.repo-row:last-child { border-bottom: none; }
.repo-row:hover { background: rgba(255, 255, 255, 0.02); }
.repo-row--head {
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  background: transparent;
  position: sticky;
  top: 120px;
  z-index: 25;
  background: var(--surface-1);
}
.repo-row--head:hover { background: transparent; }
.repo-row--head .repo-col {
  font-size: 11px;
  line-height: 16px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--neutral-weak);
}
.repo-col { min-width: 0; }
.repo-name {
  font-weight: 600;
  color: var(--neutral-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.repo-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 6px;
}
.repo-branch {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  color: var(--neutral-mid);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 6px;
}
.repo-vis {
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.repo-vis--private {
  color: #d29922;
  background: rgba(210, 153, 34, 0.1);
  border-color: rgba(210, 153, 34, 0.3);
}
.repo-vis--public {
  color: var(--neutral-mid);
  background: var(--surface-2);
  border-color: var(--border);
}
.repo-activity {
  font-size: 12px;
  line-height: 18px;
  color: var(--neutral-mid);
  white-space: nowrap;
}
.backup-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1;
  color: var(--neutral-mid);
}
.backup-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neutral-weak);
  flex-shrink: 0;
}
.backup-pill--on { color: var(--accent); }
.backup-pill--on .backup-pill__dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.16);
}
.repo-backup {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.repo-backup__text {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  color: var(--neutral-strong);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.repo-backup__text--muted { color: var(--neutral-weak); }
.repo-backup__text--failed { color: var(--danger); }
.repo-drive-link {
  font-size: 11px;
  line-height: 16px;
  color: var(--neutral-mid);
  white-space: nowrap;
}
.repo-drive-link:hover { color: var(--accent); }

.repo-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: flex-end;
}

.repo-actions__stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.repo-actions__stack .btn,
.repo-actions__stack .btn--primary {
  width: 100%;
  text-align: center;
}

/* Backup activity card */
.activity-card .panel__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.activity-card .panel__head svg {
  color: var(--neutral-weak);
}
.activity-empty {
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.activity-empty svg {
  color: var(--neutral-weak);
  margin-bottom: var(--space-1);
}
.activity-empty__title {
  margin: 0;
  font-weight: 500;
  font-size: 13px;
  color: var(--neutral-strong);
}
.activity-empty__body {
  margin: 0;
  font-size: 12px;
  color: var(--neutral-weak);
}

@media (max-width: 900px) {
  .repo-row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
    padding: var(--space-4);
  }
  .repo-actions { justify-content: flex-start; }
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  min-height: 26px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--neutral-strong);
  cursor: pointer;
  transition: background var(--motion-fast) ease-out, border-color var(--motion-fast) ease-out;
}
.btn:hover { background: var(--surface-3); }
.btn--primary {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(63, 185, 80, 0.3);
}
.btn--primary:hover { background: rgba(63, 185, 80, 0.18); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--surface-2); }
.btn:disabled, .btn.is-loading { opacity: 0.7; pointer-events: none; }

/* Status indicators */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status--protected { color: var(--accent); background: var(--accent-dim); border-color: rgba(63, 185, 80, 0.3); }
.status--stale { color: var(--neutral-mid); background: var(--surface-2); border-color: var(--border); }
.status--failed { color: var(--danger); background: var(--danger-dim); border-color: rgba(248, 81, 73, 0.3); }
.status--progress { color: var(--neutral-mid); background: var(--surface-2); border-color: var(--border); }

/* Status dot shown in the protected-repositories latest-backup column. */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--green { background: var(--accent); }
.status-dot--never { background: var(--neutral-weak); }

/* Staleness badge shown next to repositories whose last push is older than the
   configured threshold. */
.badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  vertical-align: middle;
  white-space: nowrap;
}
.badge--stale {
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid rgba(248, 81, 73, 0.3);
}

/* Surfaces */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.panel__head {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  color: var(--neutral-strong);
}
.panel__body { padding: var(--space-4); }

.panel__body--flush { padding: 0; }

@media (max-width: 860px) {
  .panel__body--flush { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 560px; }
}

.section { margin-bottom: var(--space-6); }
.section__head { margin-bottom: var(--space-3); }
.stack { display: flex; flex-direction: column; gap: var(--space-2); }
.stack--row { flex-direction: row; flex-wrap: wrap; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--neutral-weak);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-soft);
  color: var(--neutral-mid);
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: none; }

/* Empty states */
.empty {
  padding: var(--space-6) var(--space-4);
  text-align: left;
}
.empty__title {
  font-weight: 500;
  font-size: 13px;
  color: var(--neutral-strong);
  margin: 0 0 var(--space-1);
}
.empty__body { color: var(--neutral-weak); margin: 0; }
.connect-btn { display: inline-block; align-self: flex-start; margin-top: var(--space-3); }

/* Cloud repository loading / error banners */
.cloud-loading {
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
  font-size: 13px;
  color: var(--neutral-weak);
}
.cloud-error {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid rgba(248, 81, 73, 0.3);
}
.cloud-error #cloudErrorText { flex: 1; }

/* Forms */
.form { display: flex; flex-direction: column; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--space-4); }
.field--row { flex-direction: row; align-items: center; gap: var(--space-3); }
.field__label { font-size: 12px; color: var(--neutral-mid); }
.input {
  font-family: inherit;
  font-size: 13px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--neutral-strong);
}
.input:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; }
.form__actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }

.toggle {
  width: 34px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  position: relative;
  display: inline-block;
  cursor: pointer;
}
.toggle__knob {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--neutral-mid);
}
.toggle.is-on {
  background: var(--accent-dim);
  border-color: rgba(63, 185, 80, 0.3);
}
.toggle.is-on .toggle__knob {
  background: var(--accent);
  transform: translateX(16px);
}

.field__row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.field__hint {
  margin: 0;
  font-size: 11px;
  line-height: 14px;
  color: var(--neutral-weak);
}
.field__meta {
  margin: 0;
  font-size: 11px;
  color: var(--neutral-weak);
}
.field__error {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
}
.creds-ok { color: var(--accent); }
.creds-missing { color: var(--danger); }

.field.field--error .input {
  border-color: var(--danger);
}
.input[aria-invalid="true"] { border-color: var(--danger); }

.form__flash {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: var(--space-3);
}
.form__flash--error {
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid rgba(248, 81, 73, 0.3);
}
.form__flash--success {
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(63, 185, 80, 0.3);
}

/* Loading states */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.progress__bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 160ms ease-out;
}
.progress--indeterminate { margin-bottom: -2px; }
.progress--indeterminate .progress__bar {
  width: 30%;
  animation: indet 1.1s ease-in-out infinite;
}
@keyframes indet {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(330%); }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Visually hidden (a11y) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Dashboard selection */
.check-col { width: 36px; }
.check-col input { display: block; }
.repo-select { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }

.selection-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.selection-toolbar__status {
  font-size: 12px;
  color: var(--neutral-weak);
  margin-right: auto;
  font-variant-numeric: tabular-nums;
}

.table--rows tbody tr[data-path] { cursor: pointer; }
.table--rows tbody tr.is-selected { background: var(--accent-dim); }
.table--rows tbody tr.is-selected:hover { background: var(--accent-dim); }
.table--rows tbody tr.is-selected .repo-link { color: var(--accent); }
.table--rows tbody tr.is-stale { background: rgba(248, 81, 73, 0.04); }
.table--rows tbody tr.is-busy { pointer-events: none; }
.table--rows tbody tr.is-busy .repo-select { opacity: 0.5; }

/* Scanning indicators */
.scan-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.scan-banner .progress { flex: 1; }

.scan-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
}
.scan-status .progress { flex: 1; }

.scan-note {
  margin: 0 0 var(--space-4);
  padding: var(--space-2) var(--space-3);
  font-size: 12px;
  color: var(--neutral-weak);
  border-left: 3px solid var(--accent);
  background: var(--surface-1);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Folder picker */
.folder-picker {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.folder-picker__current {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}
.folder-picker__name { font-size: 14px; font-weight: 500; color: var(--neutral-strong); }
.folder-picker__path { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Folder browser modal */
.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
}
.modal__head { padding: var(--space-4); border-bottom: 1px solid var(--border); }
.modal__path { margin-top: var(--space-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal__body {
  padding: var(--space-3);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}

.folder-nav { display: flex; align-items: center; gap: var(--space-2); }
.folder-nav__spacer { flex: 1; }

.folder-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.folder-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--motion-fast) ease-out, border-color var(--motion-fast) ease-out;
}
.folder-item:hover, .folder-item:focus-visible { background: var(--surface-2); border-color: var(--border); }
.folder-item__name { color: var(--neutral-strong); font-size: 13px; flex-shrink: 1; }
.folder-item__path { color: var(--neutral-weak); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-error { width: 100%; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: var(--space-4); border-right: 1px solid var(--border-soft); }
.stat:last-child { border-right: none; }
.stat__value {
  font-size: 22px;
  line-height: 1.1;
  color: var(--neutral-strong);
  font-variant-numeric: tabular-nums;
}
.stat__label {
  margin-top: var(--space-2);
  font-size: 11px;
  color: var(--neutral-weak);
}
.summary-meta { margin-top: var(--space-3); }

.stat--danger .stat__value { color: var(--danger); }
.stat--danger .stat__value::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  margin-right: var(--space-2);
  vertical-align: 1px;
}
.table--rows tbody tr { transition: background 120ms ease-out; }
.table--rows tbody tr:hover { background: var(--surface-2); }
.table--rows td:first-child, .table--rows th:first-child { padding-left: var(--space-4); }
.table--rows td:last-child, .table--rows th:last-child { padding-right: var(--space-4); }

@keyframes rowIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.row-enter { animation: rowIn 160ms ease-out both; }
.table--rows tbody tr:nth-child(1) { animation-delay: 0ms; }
.table--rows tbody tr:nth-child(2) { animation-delay: 40ms; }
.table--rows tbody tr:nth-child(3) { animation-delay: 80ms; }
.table--rows tbody tr:nth-child(4) { animation-delay: 120ms; }
.table--rows tbody tr:nth-child(5) { animation-delay: 160ms; }
.table--rows tbody tr:nth-child(6) { animation-delay: 200ms; }
.table--rows tbody tr:nth-child(7) { animation-delay: 240ms; }
.table--rows tbody tr:nth-child(8) { animation-delay: 280ms; }

.status { transition: background 120ms ease-out, color 120ms ease-out, border-color 120ms ease-out; }

.btn.is-loading { opacity: 0.85; pointer-events: none; }

/* Filters */
.filters { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.filter {
  font-size: 12px;
  line-height: 1;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--neutral-mid);
  cursor: pointer;
  transition: background var(--motion-fast) ease-out, color var(--motion-fast) ease-out, border-color var(--motion-fast) ease-out;
}
.filter:hover { background: var(--surface-3); color: var(--neutral-strong); }
.filter.is-active {
  color: var(--neutral-strong);
  background: var(--surface-3);
  border-color: var(--border);
}

/* Repository rows */
.repo-link { color: var(--neutral-strong); font-weight: 500; }
.repo-link:hover { color: var(--accent); }
.row-action { text-align: right; }

/* Detail */
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}
.detail-actions { flex-shrink: 0; }
.detail-meta { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }

.kv { display: flex; flex-direction: column; }
.kv__row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-soft);
}
.kv__row:last-child { border-bottom: none; }
.kv__key { color: var(--neutral-weak); font-size: 12px; }
.kv__val { color: var(--neutral-strong); }

.backup-status .kv__val { color: var(--neutral-mid); }
.backup-status .progress { margin: var(--space-3) 0; }

/* Backup activity: live rows for in-flight backups. */
.backup-activity { display: flex; flex-direction: column; gap: var(--space-3); }
.backup-activity__row {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-1);
}
.backup-activity__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.backup-activity__spacer { flex: 1; }
.backup-activity__track {
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.backup-activity__bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 160ms ease-out;
}
.backup-activity__bar--indeterminate {
  width: 30%;
  animation: indet 1.1s ease-in-out infinite;
}

/* Landing page — unauthenticated product overview */
.landing {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.hero-card--landing {
  max-width: 720px;
  padding: var(--space-8) var(--space-6);
}
.hero-card--landing .hero-card__icon { width: 64px; height: 64px; }
.hero-card--landing .hero-card__title { font-size: 26px; line-height: 1.25; }
.hero-card--landing .hero-card__subtitle { max-width: 520px; font-size: 14px; line-height: 22px; }

.landing-eyebrow {
  margin: 0 0 var(--space-2);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-card__anchor {
  margin: var(--space-4) 0 0;
  font-size: 12px;
}
.hero-card__anchor a { color: var(--neutral-mid); }
.hero-card__anchor a:hover { color: var(--neutral-strong); }

.landing-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.landing-section__head {
  margin: 0 auto;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.landing-section__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--neutral-strong);
}
.landing-section__sub {
  margin: var(--space-2) 0 0;
  font-size: 13px;
  line-height: 21px;
  color: var(--neutral-mid);
  max-width: 560px;
}

/* Backup flow: GitHub -> GitSafe -> Drive -> bundle -> download -> restore */
.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: var(--space-2);
}
.flow__step {
  flex: 1 1 0;
  min-width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-3);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.flow__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--neutral-strong);
  flex-shrink: 0;
}
.flow__icon--accent {
  color: var(--accent);
  border-color: rgba(63, 185, 80, 0.28);
  background: var(--accent-dim);
}
.flow__body { display: flex; flex-direction: column; gap: var(--space-1); }
.flow__name { font-size: 13px; font-weight: 500; color: var(--neutral-strong); }
.flow__desc { font-size: 11px; line-height: 15px; color: var(--neutral-weak); }
.flow__arrow {
  align-self: center;
  color: var(--neutral-weak);
  flex-shrink: 0;
  display: flex;
  transition: color var(--motion-fast) ease-out;
}
.flow__step:hover { animation: flowBob 0.6s ease-in-out infinite; }
.flow__step:hover + .flow__arrow { color: var(--accent); }
.flow__arrow:hover { color: var(--accent); }

@keyframes flowBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* Restore steps: numbered, one per row */
.restore-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.restore-step {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-soft);
}
.restore-step:last-child { border-bottom: none; }
.restore-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(63, 185, 80, 0.3);
}
.restore-content { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.restore-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--neutral-strong); }
.restore-desc { margin: 0; font-size: 13px; line-height: 20px; color: var(--neutral-mid); }

/* Inline and block code */
.code-inline {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 5px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--neutral-strong);
}
.code {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  color: var(--neutral-strong);
  overflow-x: auto;
}
.code-prompt { color: var(--neutral-weak); user-select: none; flex-shrink: 0; }

@media (max-width: 860px) {
  .flow { flex-wrap: wrap; }
  .flow__step { flex: 1 1 calc(50% - var(--space-2)); min-width: 150px; }
  .flow__arrow { display: none; }
}

@media (max-width: 520px) {
  .flow__step { flex: 1 1 100%; }
}

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2n) { border-right: none; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--border-soft); }
}

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

/* Daily backups card */
.daily-card { margin-bottom: var(--space-4); }
.daily-card .panel__head { display: flex; align-items: center; gap: var(--space-2); }
.daily-card .field__hint { margin-top: var(--space-2); }
.daily-status--ok { color: var(--accent); }
.daily-status--warn { color: #d29922; }
.daily-status--error { color: #f85149; }
.daily-reauth { margin: var(--space-3) 0 0; }
.toggle:disabled { opacity: 0.5; cursor: not-allowed; }
