/* ============================================================
   profile.css — экран профиля (profile.html)
   Только недостающие стили; базовые — в styles.css
   (заголовок шапки — единый .header-title из styles.css)
   ============================================================ */

/* --- Хиро профиля --- */
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 32px 8px;
}
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2FA7E9, #8341EF);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.profile-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.profile-email {
  margin-top: 5px;
  font-size: 14.5px;
  color: var(--text-3);
}
.profile-badges {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

/* --- Статистика 2×2 --- */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px;
}
.stat-tile {
  background: var(--surface);
  border-radius: 18px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.stat-label {
  font-size: 13px;
  color: var(--text-2);
}

/* --- Мои модели --- */
.profile-models {
  gap: 8px;
}
.profile-empty {
  display: none;
  padding: 14px 24px 4px;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-4);
}
.profile-empty--visible { display: block; }
.profile-all-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px auto 0;
  height: 42px;
  padding: 0 22px;
  border-radius: 21px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, transform .12s;
}
.profile-all-link:active { background: var(--surface-2); transform: scale(.97); }
.profile-all-link svg { color: var(--text-4); }

/* --- Настройки --- */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  background: var(--surface);
  border-radius: 18px;
  text-align: left;
  transition: background .15s, transform .12s;
}
.setting-row:active { background: var(--surface-2); transform: scale(.985); }
.setting-icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.setting-label {
  flex: 1;
  min-width: 0;
  font-size: 15.5px;
  font-weight: 500;
  color: var(--text);
}
.setting-value {
  font-size: 14px;
  color: var(--text-4);
}
.setting-value:not(:empty) { margin-right: 2px; }

/* --- Переключатель (iOS-style) --- */
.switch {
  flex: none;
  width: 46px;
  height: 28px;
  border-radius: 14px;
  background: var(--surface-2);
  position: relative;
  transition: background .2s;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
  transition: transform .2s cubic-bezier(.2, .8, .3, 1.2);
}
.switch[aria-checked="true"] {
  background: var(--blue);
}
.switch[aria-checked="true"] .switch-knob {
  transform: translateX(18px);
}

/* --- Выход --- */
.exit-btn {
  display: block;
  margin: 22px 16px 8px;
  height: 54px;
  border-radius: 27px;
  background: var(--surface);
  color: #FF6B81;
  font-size: 16.5px;
  font-weight: 500;
  transition: background .15s, transform .12s;
}
.exit-btn:active { background: var(--surface-2); transform: scale(.98); }

.profile-service-links{display:grid;gap:12px;padding:16px 20px 28px}.profile-service-links a{display:block;padding:16px;border-radius:14px;background:var(--surface);color:var(--blue);text-decoration:none}

/* Mobile profile: readable errors, stable fields and comfortable touch targets. */
.profile-load-status{margin:8px 16px 16px;padding:12px 16px;border-radius:18px;background:var(--surface);color:var(--text-2);font-size:14px;line-height:1.5}
.profile-load-status[hidden],.profile-load-status button[hidden]{display:none}
.profile-load-status p{margin:0}
.profile-load-status button{margin-top:8px;min-height:44px;padding:8px 14px;border-radius:16px;background:var(--surface-2);color:var(--blue)}
.profile-page .promo-input{font-size:16px}
.profile-page .ref-share,.profile-page .profile-all-link{min-height:44px}
.profile-page .ref-link{display:block;min-height:44px;line-height:44px}
.profile-page .profile-name,.profile-page .profile-email{max-width:100%;overflow-wrap:anywhere}
.profile-page .profile-badges{flex-wrap:wrap;justify-content:center}
.profile-page :is(button,a,input):focus-visible{outline:2px solid var(--blue);outline-offset:3px}
@media(max-width:350px){.profile-page .ref-card{flex-wrap:wrap}.profile-page .ref-link{flex-basis:100%}.profile-page .ref-share{width:100%}.profile-page .profile-hero{padding-left:20px;padding-right:20px}}

.profile-favorite-row{display:flex;gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid #ffffff12;min-width:0}
.profile-favorite-link{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px;color:inherit;text-decoration:none;overflow-wrap:anywhere}
.profile-favorite-link small{color:#a7a7b3;line-height:1.4}
.profile-favorite-row button{flex:none;min-width:44px;min-height:44px;background:transparent;color:#ffda74;border:0;font-size:22px}
.profile-import-favorites{min-height:44px;white-space:normal;line-height:1.4;margin-top:12px}
#usageStatus{font-size:12px;line-height:1.5;text-align:left}
#usageStatus button{min-height:44px}

.cloud-draft-setting{display:flex;align-items:center;gap:12px;min-height:48px}.cloud-draft-setting input{width:22px;height:22px}#draftSyncStatus{font-size:13px;line-height:1.5;color:var(--text-secondary,#aaa)}
.cloud-draft-setting{margin:0 16px 8px;padding:14px;display:grid;grid-template-columns:22px minmax(0,1fr);background:#222226;border-radius:20px;font-size:15px;line-height:1.4}.cloud-draft-setting input{margin:0;accent-color:#2daae1}#draftSyncStatus{margin:0 16px 12px}

/* Compact account overview; payment controls stay in a focused native dialog. */
.profile-page .profile-hero{display:grid;grid-template-columns:56px minmax(0,1fr);gap:4px 14px;text-align:left;align-items:center;padding:12px 20px}
.profile-page .profile-avatar{grid-row:1/4;width:56px;height:56px;font-size:25px;margin:0}
.profile-page .profile-name{font-size:21px;line-height:1.25}
.profile-page .profile-email{margin:0;font-size:13px}
.profile-page .profile-badges{justify-content:flex-start;gap:4px;margin:3px 0 0}
.profile-page .profile-badges .mini-badge{font-size:11px}
.profile-page #walletBlock{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 14px;margin:16px;padding:16px 18px;border-radius:22px;background:var(--surface)}
.profile-page #walletBlock .block-title{grid-column:1/-1;margin:0;padding:0;font-size:15px;color:var(--text-2)}
.profile-page #walletBlock .wallet-card{margin:0;padding:0;align-items:flex-start;min-width:0;background:none}
.profile-page .wallet-balance{font-size:34px;overflow-wrap:anywhere;max-width:100%}
.wallet-open{align-self:center;min-height:46px;padding:0 18px;border-radius:24px;background:var(--blue);color:#fff;font-size:15px;font-weight:600}
.wallet-dialog{position:fixed;inset:auto;top:calc(var(--app-viewport-top,0px) + var(--app-viewport-height,100dvh)/2);left:50%;transform:translate(-50%,-50%);margin:0;width:min(440px,calc(100vw - 32px));max-height:calc(var(--app-viewport-height,100dvh) - 32px);padding:20px;border:1px solid #ffffff18;border-radius:24px;background:var(--bg,#161619);color:var(--text,#fff);overflow:auto;overscroll-behavior:contain;box-shadow:0 24px 80px #0008}
.wallet-dialog::backdrop{background:#0009;backdrop-filter:blur(5px)}
.wallet-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.wallet-dialog-heading h2{font-size:21px;line-height:1.3;margin:0}
.wallet-dialog-heading button{flex:none;min-height:44px;min-width:44px;border-radius:50%;font-size:28px;background:var(--surface);color:inherit}
.wallet-dialog-intro{font-size:14px;line-height:1.5;color:var(--text-2);margin:12px 0 16px}
.wallet-dialog .wallet-grid{padding:0;gap:10px}
.wallet-dialog .wallet-hint{line-height:1.5;margin:12px 0}
.wallet-dialog .promo-row{margin:16px 0 0;display:flex;gap:8px}
.wallet-dialog .promo-row[hidden]{display:none}
.wallet-dialog .promo-input{width:100%;min-width:0;flex:1;font-size:16px;min-height:44px}
.wallet-dialog .promo-apply{min-height:44px;flex:none}
.wallet-dialog .wallet-history{padding:8px 0}
.wallet-dialog .wallet-history-row{flex-wrap:wrap;padding:12px}
.wallet-dialog .wallet-history-date{white-space:normal}
.wallet-dialog .wallet-dev-btn{margin:12px 0}
.wallet-dialog :is(button,input,summary):focus-visible{outline:2px solid var(--blue);outline-offset:3px}
#walletDialogStatus:empty{display:none}
#walletDialogStatus{padding:12px;border-radius:14px;background:var(--surface);font-size:14px;line-height:1.5;margin:14px 0 0;overflow-wrap:anywhere}
.usage-summary{margin:0 20px 6px;font-size:15px;line-height:1.5;color:var(--text-2)}
.usage-details>summary,.wallet-payments>summary{min-height:44px;display:flex;align-items:center;gap:10px;font-size:14px;cursor:pointer;color:var(--blue);list-style:none}
.usage-details>summary{margin:0 20px}
.usage-details>summary::-webkit-details-marker,.wallet-payments>summary::-webkit-details-marker{display:none}
.usage-details>summary::after,.wallet-payments>summary::after{content:'⌄';margin-left:auto;font-size:20px}
.usage-details[open]>summary::after,.wallet-payments[open]>summary::after{transform:rotate(180deg)}
.profile-system-note{margin:12px 20px;color:var(--text-3);font-size:13px;line-height:1.7}
@media(max-width:350px){.wallet-dialog{padding:16px}.wallet-dialog .promo-row{flex-wrap:wrap}.wallet-dialog .promo-input{flex-basis:100%}.wallet-dialog .promo-apply{width:100%}.profile-page #walletBlock{padding:14px}.wallet-open{padding:0 14px}}

.wallet-activity-row{padding:14px 0;border-bottom:1px solid #ffffff18;display:grid;gap:6px;font-size:14px;overflow-wrap:anywhere}.wallet-activity-row p{margin:0}.wallet-activity-row small{color:var(--text-2)}.wallet-activity-row a{color:#acd9f5;min-height:44px;display:flex;align-items:center}#walletActivityMore{min-height:44px;padding:10px 16px;border-radius:18px;border:0;background:var(--surface);color:inherit}
.profile-page .ref-card{display:flex;flex-wrap:wrap;gap:8px}
.profile-page .ref-link{flex-basis:100%;min-width:0;line-height:1.5;overflow-wrap:anywhere;padding-block:8px}
.profile-page .ref-share{flex:1;min-width:120px}

/* Closed sections make the account overview a short list of clear entry points. */
.profile-page .profile-section{border:1px solid #ffffff0a;border-radius:24px;background:var(--surface);overflow:hidden}
.profile-page .profile-section--standalone,.profile-page #referralBlock{margin:10px 16px}
.profile-section>summary{display:grid;grid-template-columns:minmax(0,1fr) 20px;gap:4px 12px;align-items:center;min-height:72px;padding:14px 18px;box-sizing:border-box;cursor:pointer;list-style:none;font-size:16px;line-height:1.4;font-weight:500}
.profile-section>summary::-webkit-details-marker{display:none}
.profile-section>summary>span{grid-row:2;grid-column:1;font-size:12px;line-height:1.4;font-weight:400;color:var(--text-3)}
.profile-section>summary::after{content:'⌄';grid-column:2;grid-row:1/3;justify-self:center;color:var(--text-3);font-size:20px}
.profile-section[open]>summary::after{transform:rotate(180deg)}
.profile-section>summary:focus-visible{outline:2px solid var(--blue);outline-offset:-4px;border-radius:24px}
.profile-section-body{padding:4px 0 16px;border-top:1px solid #ffffff0a}
.profile-page .profile-section-body .block{margin-top:16px;margin-bottom:16px}
.profile-page .profile-section-body .block-title{font-size:15px}
.profile-page .profile-section-body .stat-grid{gap:8px}
.profile-page .profile-section-body .stat-tile{background:var(--surface-2);padding:12px}
.profile-page .profile-section-body .stat-value{font-size:22px}
.profile-page .profile-section-body .ref-card{background:var(--surface-2)}
.profile-page .profile-section-body .exit-btn{width:calc(100% - 32px);margin:16px 16px 0}
.profile-page .profile-section-body .profile-service-links{padding-bottom:0}
.profile-page .profile-section-body .wallet-hint{margin:12px 20px;line-height:1.5}
.profile-page .profile-section-body .profile-models{padding-inline:16px}
.profile-page .profile-section-body .profile-all-link{margin-inline:16px}
.profile-page .profile-section-body .profile-empty{padding-inline:16px}
