/* Account Hub — settings profile card redesign */
#settings-profile-card.cs-ah {
  padding: 14px 16px 16px;
  border-radius: 20px;
  background:
    linear-gradient(165deg, rgba(207, 179, 120, 0.14) 0%, transparent 42%),
    var(--card-bg);
}

.cs-ah-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cs-ah-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.cs-ah-avatar.profile-avatar-wrapper {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.cs-ah-avatar .profile-avatar {
  width: 64px;
  height: 64px;
}

.cs-ah-avatar .profile-avatar-icon-default {
  font-size: 1.55rem;
}

.cs-ah-identity-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.cs-ah .profile-nickname-row {
  justify-content: flex-start;
}

.cs-ah .profile-nickname {
  max-width: 180px;
  text-align: left;
  font-size: 1.05rem;
}

.cs-ah-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cs-ah .profile-email {
  display: inline-block;
  max-width: 200px;
  text-align: left;
  color: #9a9a9a;
}

.cs-ah-adfree-slot:empty {
  display: none;
}

/* Metrics strip */
.cs-ah-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(207, 179, 120, 0.22);
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
}

.cs-ah-metric {
  padding: 12px 8px;
  text-align: center;
  position: relative;
}

.cs-ah-metric + .cs-ah-metric::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18%;
  bottom: 18%;
  width: 1px;
  background: rgba(0, 0, 0, 0.06);
}

.cs-ah-metric__value {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--primary-color, #333);
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.cs-ah-metric__label {
  margin-top: 3px;
  font-size: 0.68rem;
  font-weight: 500;
  color: #9a9a9a;
  letter-spacing: 0.02em;
}

.cs-ah-metric--warn .cs-ah-metric__value {
  color: #c0392b;
}

.cs-ah-metric--warn {
  background: rgba(220, 53, 69, 0.06);
}

/* Cloud status */
.cs-ah-cloud {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 28px;
}

.cs-ah-cloud-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
  flex: 1;
}

.cs-ah-cloud-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.cs-ah-cloud-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.cs-ah-cloud-chip--off {
  background: rgba(0, 0, 0, 0.05);
  color: #999;
}

.cs-ah-cloud-chip--on {
  background: rgba(52, 168, 83, 0.12);
  color: #2e7d32;
  border: 1px solid rgba(52, 168, 83, 0.25);
}

.cs-ah-cloud-sync {
  font-size: 0.72rem;
  color: #aaa;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cs-ah-cloud-refresh {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: #9a7a30;
  font-size: 0.72rem;
  font-weight: 650;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.cs-ah-cloud-refresh:hover {
  background: rgba(207, 179, 120, 0.12);
  color: #7a5c20;
}

/* Toast spacing above sync CTA */
#settings-profile-card.cs-ah .profile-toast-wrap {
  padding: 0;
  margin: 0;
}

#settings-profile-card.cs-ah .profile-toast-wrap .gd-toast {
  margin: 4px 0 14px;
}

#settings-profile-card.cs-ah .profile-toast-wrap .gd-toast.d-none {
  margin: 0;
  padding: 0;
  border: none;
  min-height: 0;
}

#settings-profile-card.cs-ah .cs-ah-actions.profile-action-row {
  margin-top: 4px;
}

/* Actions */
.cs-ah-actions.profile-action-row {
  padding: 0;
  margin: 0;
  gap: 8px;
  align-items: stretch;
}

.cs-ah-cta {
  width: auto;
  flex: 1;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-profile-devices.cs-ah-cta-secondary {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  min-width: 108px;
  border-radius: 14px;
  border: 1.5px solid rgba(207, 179, 120, 0.45);
  background: rgba(255, 255, 255, 0.75);
  color: #8a6d1f;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-profile-devices.cs-ah-cta-secondary:hover {
  background: rgba(207, 179, 120, 0.14);
}

.btn-profile-devices.cs-ah-cta-secondary:active {
  transform: scale(0.98);
}

.cs-ah-cta:active {
  transform: scale(0.98);
}

.cs-ah-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 2px;
  margin-top: 12px;
  padding-top: 2px;
}

.cs-ah-link {
  border: none;
  background: none;
  padding: 4px 6px;
  font-size: 0.74rem;
  color: #9a7a30;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
}

.cs-ah-link:hover {
  color: #7a5c20;
  text-decoration: underline;
}

.cs-ah-dot {
  color: #ccc;
  font-size: 0.7rem;
  user-select: none;
}

/* Login modal alignment */
.cs-ah-login-lead {
  font-size: 0.88rem;
  color: #555;
  margin-bottom: 6px;
  line-height: 1.55;
}

.cs-ah-login-sub {
  font-size: 0.78rem;
  color: #999;
  margin-bottom: 18px;
  line-height: 1.5;
}

.cs-ah-login-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
}

.cs-ah-link-btn {
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cs-ah-link-btn:hover {
  background: rgba(207, 179, 120, 0.1);
  border-color: rgba(207, 179, 120, 0.35);
}

.cs-ah-link-btn--muted {
  border: none;
  background: transparent;
  color: #999;
  font-weight: 500;
}

.cs-ah-gis {
  margin-top: 4px;
}

/* Hide legacy duplicate status mount spacing when empty */
#cs-sponsor-status-card:empty {
  display: none;
}

/* Dark theme */
body.dark-theme #settings-profile-card.cs-ah {
  background:
    linear-gradient(165deg, rgba(207, 179, 120, 0.1) 0%, transparent 42%),
    #1e1e1e;
}

body.dark-theme .cs-ah-metrics {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(207, 179, 120, 0.18);
}

body.dark-theme .cs-ah-metric + .cs-ah-metric::before {
  background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .cs-ah-metric__value {
  color: #e8e8e8;
}

body.dark-theme .cs-ah-metric__label {
  color: #777;
}

body.dark-theme .cs-ah-cloud-chip--off {
  background: rgba(255, 255, 255, 0.06);
  color: #777;
}

body.dark-theme .cs-ah-link {
  color: #d4b87a;
}

body.dark-theme .cs-ah-login-lead {
  color: #ccc;
}

body.dark-theme .cs-ah-link-btn {
  background: #252525;
  border-color: rgba(255, 255, 255, 0.1);
  color: #ddd;
}

@media (prefers-reduced-motion: reduce) {
  .cs-ah-cta {
    transition: none;
  }
}

/* Profile CTA: title + subtitle + 需贊助 badge */
.cs-ah-cta-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.cs-ah-cta-text-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  line-height: 1.2;
}

#profileSignInBtnText {
  font-size: 0.92rem;
  font-weight: 700;
}

.cs-ah-cta-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cs-ah-need-sponsor {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
}

/* Standalone Google login modal */
.cs-login-modal {
  border: none;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(66, 133, 244, 0.16), transparent 55%),
    radial-gradient(90% 60% at 100% 100%, rgba(207, 179, 120, 0.18), transparent 50%),
    var(--card-bg, #fff);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);
}

.cs-login-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}

.cs-login-modal__body {
  position: relative;
  padding: 36px 24px 28px;
  text-align: center;
}

.cs-login-modal__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 24px rgba(66, 133, 244, 0.12);
}

.cs-login-modal__title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-color, #222);
  margin: 0 0 8px;
}

.cs-login-modal__lead {
  font-size: 0.88rem;
  color: #555;
  line-height: 1.55;
  margin: 0 0 6px;
}

.cs-login-modal__hint {
  font-size: 0.76rem;
  color: #999;
  line-height: 1.45;
  margin: 0 0 20px;
}

.cs-login-modal__gis {
  margin: 4px 0 14px;
}

.cs-login-modal__msg {
  min-height: 1.2em;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 16px;
}

.cs-login-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cs-login-modal__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.cs-login-modal__btn:active {
  transform: scale(0.98);
}

.cs-login-modal__btn--primary {
  border: 1px solid rgba(207, 179, 120, 0.45);
  background: linear-gradient(135deg, rgba(207, 179, 120, 0.18), rgba(232, 213, 163, 0.12));
  color: #8a6d1f;
}

.cs-login-modal__btn--primary:hover {
  background: linear-gradient(135deg, rgba(207, 179, 120, 0.28), rgba(232, 213, 163, 0.18));
}

.cs-login-modal__btn--ghost {
  border: none;
  background: transparent;
  color: #888;
  font-weight: 600;
}

.cs-login-modal__btn--ghost:hover {
  color: #9a7a30;
  background: rgba(207, 179, 120, 0.08);
}

.cs-report-modal {
  border-radius: 20px;
  border: none;
  overflow: hidden;
}

.cs-report-modal__header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 16px 20px;
}

.cs-report-modal__sub {
  font-size: 0.76rem;
  color: #999;
  margin-top: 4px;
}

body.dark-theme .cs-login-modal {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(66, 133, 244, 0.2), transparent 55%),
    radial-gradient(90% 60% at 100% 100%, rgba(207, 179, 120, 0.12), transparent 50%),
    #1e1e1e;
}

body.dark-theme .cs-login-modal__icon {
  background: #2a2a2a;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .cs-login-modal__title {
  color: #f0f0f0;
}

body.dark-theme .cs-login-modal__lead {
  color: #ccc;
}

body.dark-theme .cs-login-modal__btn--primary {
  color: #e8d5a3;
}

body.dark-theme .cs-ah-cloud-refresh {
  color: #d4b87a;
}

body.dark-theme .btn-profile-devices.cs-ah-cta-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(207, 179, 120, 0.35);
  color: #e8d5a3;
}

/* Device manager cards */
.cs-dev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cs-dev-head__count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #8a6d1f;
  background: linear-gradient(135deg, rgba(207, 179, 120, 0.22), rgba(232, 213, 163, 0.12));
  border: 1px solid rgba(207, 179, 120, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.cs-dev-head__count::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.cs-dev-reload {
  border: none;
  background: rgba(0, 0, 0, 0.04);
  color: #666;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.cs-dev-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cs-dev-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(250, 247, 240, 0.9));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

.cs-dev-card--current {
  border-color: rgba(207, 179, 120, 0.45);
  background: linear-gradient(165deg, rgba(207, 179, 120, 0.14), rgba(255, 255, 255, 0.95));
}

.cs-dev-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(207, 179, 120, 0.16);
  color: #8a6d1f;
  font-size: 1.05rem;
}

.cs-dev-card__body {
  flex: 1;
  min-width: 0;
}

.cs-dev-card__title-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
  min-width: 0;
}

.cs-dev-card__name {
  flex: 1;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary-color, #222);
  white-space: nowrap;
  overflow: hidden;
  mask-image: linear-gradient(90deg, #000 72%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 72%, transparent 100%);
}

.cs-dev-card__meta {
  font-size: 0.74rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  mask-image: linear-gradient(90deg, #000 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 70%, transparent 100%);
}

.cs-dev-card__edit {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  align-items: center;
}

.cs-dev-card__edit[hidden] {
  display: none !important;
}

.cs-dev-card__input {
  flex: 1;
  min-width: 140px;
  min-height: 38px !important;
  padding: 8px 10px !important;
}

.cs-dev-card__actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  align-self: center;
}

.cs-dev-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  color: #666;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.cs-dev-icon-btn:hover {
  background: rgba(207, 179, 120, 0.12);
  color: #8a6d1f;
  border-color: rgba(207, 179, 120, 0.35);
}

.cs-dev-icon-btn--danger:hover {
  background: rgba(220, 53, 69, 0.1);
  color: #c0392b;
  border-color: rgba(220, 53, 69, 0.28);
}

body.dark-theme .cs-dev-card {
  background: #252525;
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .cs-dev-card--current {
  background: linear-gradient(165deg, rgba(207, 179, 120, 0.12), #252525);
}

body.dark-theme .cs-dev-card__name {
  color: #eee;
}

body.dark-theme .cs-dev-icon-btn {
  background: #1e1e1e;
  border-color: rgba(255, 255, 255, 0.1);
  color: #bbb;
}

body.dark-theme .cs-dev-reload {
  background: rgba(255, 255, 255, 0.06);
  color: #ccc;
}

body.dark-theme .cs-dev-head__count {
  color: #e8d5a3;
  background: linear-gradient(135deg, rgba(207, 179, 120, 0.2), rgba(207, 179, 120, 0.08));
  border-color: rgba(207, 179, 120, 0.35);
  box-shadow: none;
}
