.backup-page {
  height: 100%;
  overflow: auto;
  padding: 20px;
  color: var(--text-primary);
  background: var(--bg-primary);
}

.backup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;

  h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: 0;
  }

  p {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
  }
}

.backup-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.resource-options {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: -6px 0 14px;

  label {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 34px;
    padding: 7px 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
  }

  input {
    margin: 0;
  }

  svg {
    color: var(--primary);
  }
}

.primary-btn,
.secondary-btn {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;

  &:disabled {
    opacity: 0.55;
    cursor: not-allowed;
  }
}

.primary-btn {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

.secondary-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);

  &:not(:disabled):hover {
    background: var(--bg-tertiary);
  }
}

.backup-status-band {
  min-height: 76px;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 0;
}

.status-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.status-body {
  min-width: 0;
  flex: 1;
}

.status-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.status-detail {
  color: var(--text-secondary);
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.progress-track {
  margin-top: 10px;
  height: 5px;
  background: var(--bg-tertiary);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.2s ease;
}

.backup-summary,
.restore-result {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.summary-item,
.restore-result > div {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  padding: 12px;
  min-height: 66px;
  display: flex;
  flex-direction: column;
  gap: 6px;

  svg {
    color: var(--primary);
  }

  span {
    color: var(--text-secondary);
    font-size: 12px;
  }

  strong {
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.1;
  }
}

.backup-detail {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.detail-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;

  h2 {
    margin: 0;
    font-size: 17px;
  }

  span {
    color: var(--text-secondary);
    font-size: 12px;
  }
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;

  div {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    min-width: 0;
  }

  span {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 5px;
  }

  strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }
}

.db-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.db-row {
  display: grid;
  grid-template-columns: 110px 80px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 0;
  font-size: 13px;

  span {
    color: var(--primary);
    font-weight: 700;
  }

  strong {
    font-weight: 600;
  }

  em {
    color: var(--text-secondary);
    font-style: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 760px) {
  .backup-header {
    flex-direction: column;
  }

  .backup-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .backup-summary,
  .restore-result,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .db-row {
    grid-template-columns: 82px 64px minmax(0, 1fr);
  }
}
