.side-account-popover {
  width: 250px;
}

.side-account-head {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: -2px 0 7px;
  padding: 4px 5px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.side-account-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #17340f;
  background: linear-gradient(135deg, #d7ed21, #55a62c);
  font-size: 17px;
  font-weight: 900;
}

.side-account-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.side-account-head strong,
.side-account-head small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-account-head strong {
  color: var(--text-primary);
  font-size: 14px;
}

.side-account-head small {
  color: var(--text-muted);
  font-size: 11px;
}

.side-account-logout {
  margin-top: 5px;
  border-top: 1px solid var(--border-subtle) !important;
  color: #d85464 !important;
}

.profile-page {
  min-height: calc(100vh - var(--header-height) - 40px);
  padding: 8px clamp(4px, 2vw, 22px) 44px;
  color: var(--text-primary);
}

.profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
  border: 1px solid var(--border-default);
  border-radius: 24px;
  background:
    radial-gradient(circle at 88% 8%, rgba(205, 232, 31, .18), transparent 34%),
    var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 18px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: #18370e;
  background: linear-gradient(135deg, #e0ef28, #54a431);
  box-shadow: 0 15px 35px rgba(94, 155, 39, .22);
  font-size: 30px;
  font-weight: 900;
}

.profile-identity > div {
  display: grid;
  gap: 3px;
}

.profile-identity h1 {
  margin: 0 0 3px;
  font-size: 24px;
}

.profile-identity strong {
  font-size: 16px;
}

.profile-identity span,
.profile-balance span,
.profile-balance small {
  color: var(--text-muted);
  font-size: 12px;
}

.profile-balance {
  min-width: 210px;
  display: grid;
  gap: 2px;
  padding: 17px 22px;
  border: 1px solid rgba(127, 174, 40, .22);
  border-radius: 18px;
  background: rgba(216, 237, 74, .1);
}

.profile-balance strong {
  color: #68a728;
  font-size: 28px;
  line-height: 1.2;
}

.profile-tabs {
  display: flex;
  gap: 8px;
  margin: 22px 0 14px;
}

.profile-tabs button,
.profile-refresh {
  border: 1px solid var(--border-default);
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  font-weight: 800;
}

.profile-tabs button {
  min-height: 42px;
  padding: 0 22px;
}

.profile-tabs button.active {
  border-color: #9dc932;
  color: #315e17;
  background: linear-gradient(135deg, #e4ef2d, #a8d431);
}

.profile-panel {
  min-height: 380px;
  padding: 26px 28px 30px;
  border: 1px solid var(--border-default);
  border-radius: 24px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.profile-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.profile-panel-head h2,
.profile-panel-head p {
  margin: 0;
}

.profile-panel-head h2 {
  font-size: 19px;
}

.profile-panel-head p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.profile-refresh {
  min-height: 36px;
  padding: 0 16px;
}

.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.profile-stat-grid > div {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: var(--bg-surface);
}

.profile-stat-grid span {
  color: var(--text-muted);
  font-size: 12px;
}

.profile-stat-grid strong {
  font-size: 23px;
}

.profile-ledger-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 15px;
}

.profile-ledger-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.profile-ledger-table th,
.profile-ledger-table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  font-size: 13px;
}

.profile-ledger-table th {
  color: var(--text-muted);
  background: var(--bg-surface);
  font-size: 12px;
}

.profile-ledger-table tbody tr:last-child td {
  border-bottom: 0;
}

.income {
  color: #3b9b52 !important;
  font-weight: 800;
}

.expense {
  color: #db5d68 !important;
  font-weight: 800;
}

.profile-loading,
.profile-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

.profile-security {
  max-width: 820px;
}

.profile-password-form {
  width: min(100%, 520px);
  display: grid;
  gap: 16px;
}

.profile-password-form label {
  display: grid;
  gap: 7px;
}

.profile-password-form label span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
}

.profile-password-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border-default);
  border-radius: 11px;
  color: var(--text-primary);
  background: var(--bg-input);
  outline: 0;
}

.profile-password-form input:focus {
  border-color: #8dbb35;
  box-shadow: 0 0 0 3px rgba(141, 187, 53, .12);
}

.profile-password-form > button {
  width: fit-content;
  min-width: 150px;
  min-height: 43px;
  margin-top: 4px;
  border: 0;
  border-radius: 11px;
  padding: 0 20px;
  color: #18340f;
  background: linear-gradient(135deg, #e4ed2b, #add635);
  cursor: pointer;
  font-weight: 900;
}

.profile-password-form > button:disabled {
  cursor: not-allowed;
  opacity: .65;
}

@media (max-width: 760px) {
  .profile-hero {
    align-items: stretch;
    flex-direction: column;
    padding: 22px;
  }

  .profile-balance {
    min-width: 0;
  }

  .profile-panel {
    padding: 22px 18px;
  }

  .profile-stat-grid {
    grid-template-columns: 1fr;
  }
}
