/* SPDX-License-Identifier: AGPL-3.0-only */
/* Copyright (c) 2026 sol pbc */

.backup-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem;
}

.backup-header {
  margin: 0 0 1rem;
}

.backup-header h1 {
  margin: 0.35rem 0 0;
  font-size: 1.65rem;
  line-height: 1.2;
}

/* the journal-bound brand-lock — the trust promise, always visible */
.backup-lock {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: #b06a1a;
  font-size: 0.95rem;
}

.backup-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #e8923a;
}

.backup-lead {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
}

.backup-bullets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0.8rem 0 0;
  list-style: none;
}

.backup-bullets li {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0 0.6rem;
  border-radius: 999px;
  background: var(--muted-bg, #f0f0f0);
  color: var(--text-muted, #555);
  font-size: 0.82rem;
}

/* state markers exist for tests only — never shown to owners */
.backup-state-markers {
  display: none;
}

.backup-operation {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  background: var(--surface-color, #fff);
}

.backup-spinner {
  flex: none;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: 2px solid var(--border-color, #ddd);
  border-top-color: #e8923a;
  animation: backup-spin 0.8s linear infinite;
}

@keyframes backup-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .backup-spinner {
    animation: none;
  }
}

.backup-panels {
  display: grid;
  gap: 0.75rem;
}

.backup-panel {
  padding: 1.1rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  background: var(--surface-color, #fff);
}

.backup-panel[hidden],
.backup-operation[hidden],
[data-offload-disable-note][hidden],
[data-backend-fields][hidden],
[data-restore-backend-fields][hidden],
.backup-panel-actions[hidden],
.backup-offload-readiness[hidden],
.backup-offload-controls[hidden],
.backup-offload-grid[hidden],
.backup-offload-summary[hidden],
.backup-offload-chip[hidden],
.backup-offload-stakes[hidden],
.backup-offload-tiering[hidden],
.backup-offload-days[hidden],
.backup-offload-day[hidden],
.backup-offload-subline[hidden],
.backup-teardown-gate[hidden],
.backup-error[hidden],
.backup-status-message[hidden] {
  display: none;
}

.backup-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  line-height: 1.25;
}

.backup-panel p {
  margin: 0.45rem 0 0;
  line-height: 1.45;
}

.backup-warning {
  color: #7a3d00;
}

.backup-note,
.backup-status-message,
.backup-hint {
  color: var(--text-muted, #555);
}

.backup-hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.85rem;
}

.backup-error,
.backup-op-error {
  color: #9b1c1c;
}

.backup-disclose {
  margin-top: 0.9rem;
}

.backup-disclose summary {
  cursor: pointer;
  color: #b06a1a;
  font-size: 0.9rem;
}

.backup-disclose p {
  color: var(--text-muted, #555);
}

/* the byo ⟷ hosted-by-sol-pbc mode selector (§2b) */
.backup-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0.4rem 0 1.1rem;
}

.backup-mode {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  text-align: left;
  padding: 0.85rem 0.95rem;
  min-height: 0;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
  background: var(--surface-color, #fff);
  cursor: pointer;
}

.backup-mode.is-selected {
  border-color: #e8923a;
  box-shadow: inset 0 0 0 1px #e8923a;
}

.backup-mode-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.backup-mode-radio {
  flex: none;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: 2px solid var(--border-color, #bbb);
  box-sizing: border-box;
}

.backup-mode.is-selected .backup-mode-radio {
  border-color: #e8923a;
  background: radial-gradient(circle, #e8923a 0 42%, transparent 48%);
}

.backup-mode-title {
  font-weight: 600;
}

.backup-mode-desc {
  color: var(--text-muted, #555);
  font-size: 0.9rem;
}

.backup-mode-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #b06a1a;
  font-size: 0.85rem;
}

.backup-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.backup-panel button,
.backup-panel input,
.backup-panel select,
.backup-panel textarea {
  font: inherit;
}

.backup-panel button {
  min-height: 2.4rem;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 6px;
  background: var(--button-bg, #fff);
  color: var(--text-color, #222);
  padding: 0 0.85rem;
  cursor: pointer;
}

.backup-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/* primary CTA — dark ink on sol-orange (7.13:1), per the design calibration */
.backup-panel button.primary {
  background: #e8923a;
  border-color: #e8923a;
  color: #1a1a1a;
  font-weight: 600;
}

.backup-panel button.primary:hover:not(:disabled) {
  background: #d9821f;
  border-color: #d9821f;
}

.backup-panel button.danger {
  background: var(--surface-color, #fff);
  border-color: #9b1c1c;
  color: #9b1c1c;
}

.backup-panel button.danger:hover:not(:disabled) {
  background: #fbeaea;
}

.backup-panel label {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.75rem;
}

.backup-panel input,
.backup-panel select,
.backup-panel textarea {
  width: 100%;
  min-height: 2.4rem;
  box-sizing: border-box;
  border: 1px solid var(--border-color, #ccc);
  border-radius: 6px;
  background: var(--surface-color, #fff);
  color: var(--text-color, #222);
  padding: 0.45rem 0.55rem;
}

.backup-panel textarea {
  min-height: 6rem;
  resize: vertical;
}

.backup-recovery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.85rem 0;
}

.backup-recovery-grid code {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 6px;
  background: var(--muted-bg, #f4f4f4);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.backup-management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.backup-management-grid section {
  min-height: 4.5rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
}

.backup-management-grid h2 {
  font-size: 0.82rem;
  text-transform: lowercase;
  color: var(--text-muted, #555);
  margin: 0 0 0.3rem;
}

.backup-retention {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border-color, #eee);
}

.backup-retention-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 0.75rem;
}

.backup-offload {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border-color, #eee);
}

.backup-offload-header h2,
.backup-offload-tiering h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  line-height: 1.25;
}

.backup-offload-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 1.45rem;
  margin-top: 0.45rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: #e7f1e9;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 600;
}

.backup-offload-readiness {
  margin-top: 0.8rem;
}

.backup-offload-stakes,
[data-offload-stall-reason] {
  margin-top: 0.8rem;
  padding: 0.7rem 0.8rem;
  border-radius: 8px;
}

.backup-offload-stakes--warning,
[data-offload-stall-reason] {
  border: 1px solid #c99a2e;
  border-left: 3px solid #c99a2e;
  background: #fbf1d6;
  color: #7c4a0c;
}

.backup-offload-stakes--note {
  border: 1px solid var(--border-color, #ddd);
  border-left: 3px solid var(--border-color, #ddd);
  background: var(--muted-bg, #f4f4f4);
  color: var(--text-muted, #555);
}

.backup-offload-controls {
  margin-top: 0.8rem;
}

.backup-offload-input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.backup-offload-input-unit span {
  color: var(--text-muted, #555);
  font-size: 0.85rem;
}

.backup-offload-grid,
.backup-offload-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 0.75rem;
}

.backup-offload-summary {
  margin-top: 0.9rem;
}

.backup-offload-summary section,
.backup-offload-day {
  padding: 0.75rem;
  border: 1px solid var(--border-color, #ddd);
  border-radius: 8px;
}

.backup-offload-summary h3 {
  margin: 0 0 0.3rem;
  color: var(--text-muted, #555);
  font-size: 0.82rem;
  text-transform: lowercase;
}

.backup-offload-subline {
  color: var(--text-muted, #555);
  font-size: 0.86rem;
}

.backup-offload-tiering {
  margin-top: 1rem;
}

.backup-offload-days {
  display: grid;
  gap: 0.55rem;
}

.backup-offload-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.backup-offload-day strong {
  display: block;
}

.backup-teardown {
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border-color, #eee);
}

.backup-teardown-gate {
  margin-top: 0.9rem;
  padding: 0.85rem;
  border: 1px solid #9b1c1c;
  border-left: 3px solid #9b1c1c;
  border-radius: 8px;
  background: #fbeaea;
}

.backup-teardown-gate [data-teardown-stakes] {
  color: #9b1c1c;
}

.backup-teardown-gate [data-teardown-input] {
  max-width: 12rem;
}

@media (max-width: 768px) {
  .backup-shell,
  [data-backup-root] {
    padding-left: calc(var(--menu-bar-width-minimal) + 1rem);
    padding-bottom: calc(var(--app-bar-height) + 3rem);
  }

  body.menu-full .backup-shell,
  body.menu-full [data-backup-root] {
    padding-left: calc(var(--menu-bar-width-full) + 1rem);
  }

  .backup-recovery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .backup-management-grid {
    grid-template-columns: 1fr;
  }

  .backup-offload-grid,
  .backup-offload-summary {
    grid-template-columns: 1fr;
  }

  .backup-offload-day {
    align-items: stretch;
    flex-direction: column;
  }

  .backup-modes {
    grid-template-columns: 1fr;
  }
}
