.cloud-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.cloud-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #d8dee9;
  border-radius: 999px;
  color: #65728a;
  background: rgba(255, 255, 255, .9);
  font-size: 12px;
  font-weight: 800;
}

.cloud-status::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9aa5b8;
  content: "";
}

.cloud-status.synced {
  color: #217a3a;
  border-color: #a8d9b7;
  background: #edf9f1;
}

.cloud-status.synced::before { background: #2f9e6d; }
.cloud-status.syncing::before { background: #d49b16; animation: cloud-pulse .8s ease-in-out infinite alternate; }
.cloud-status.offline,
.cloud-status.error { color: #8b1010; border-color: #efb8b8; background: #fff1f1; }
.cloud-status.offline::before,
.cloud-status.error::before { background: #d95555; }

@keyframes cloud-pulse {
  to { opacity: .28; }
}

.cloud-button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #cfd7e5;
  border-radius: 8px;
  color: #27364f;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.cloud-button.primary {
  color: #fff;
  border-color: #2f6fed;
  background: #2f6fed;
}

.cloud-account {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-history-actions {
  display: inline-flex;
  gap: 6px;
}

.json-backup-button {
  color: #67501a;
  border-color: #dec77f;
  background: #fff9e8;
}

.cloud-auth-mask {
  z-index: 95;
}

.cloud-auth-panel {
  width: min(100%, 430px);
  overflow: hidden;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .32);
}

.cloud-auth-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 22px 15px;
  border-bottom: 1px solid var(--line);
}

.cloud-auth-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
}

.cloud-auth-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.cloud-auth-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--muted);
  background: #eef2f8;
  font-size: 22px;
}

.cloud-auth-form {
  display: grid;
  gap: 14px;
  padding: 20px 22px 22px;
}

.cloud-auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.cloud-auth-form input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d8dee9;
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: #f9fbfe;
}

.cloud-auth-form input:focus {
  border-color: #2f6fed;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}

.cloud-auth-message {
  padding: 11px 12px;
  border-radius: 8px;
  color: #245d37;
  background: #edf9f1;
  font-size: 13px;
  line-height: 1.5;
}

.cloud-auth-message.error {
  color: #8b1010;
  background: #ffecec;
}

.cloud-auth-submit {
  min-height: 44px;
  border-radius: 9px;
  color: #fff;
  background: #2f6fed;
  font-weight: 800;
}

.cloud-auth-switch {
  color: #2f6fed;
  background: transparent;
  font-size: 13px;
}

.cloud-sync-note {
  position: fixed;
  z-index: 70;
  right: 16px;
  bottom: 82px;
  max-width: min(360px, calc(100% - 32px));
  padding: 11px 14px;
  border: 1px solid #efb8b8;
  border-radius: 9px;
  color: #8b1010;
  background: #fff1f1;
  box-shadow: 0 8px 26px rgba(31, 42, 61, .12);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 700px) {
  .topbar {
    flex-wrap: wrap;
  }

  .cloud-controls {
    width: 100%;
    order: 3;
    margin-left: 0;
  }

  .cloud-status {
    margin-right: auto;
  }

  .history-tools {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
