#sidebarContent {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: auto;
}

.sidebar-user-area {
  width: 100%;
  margin: 0;
  padding: 8px 0;
  border-top: 1px solid #d1d5db;
  background: rgba(245, 158, 11, 0.10);
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  align-items: stretch;
  overflow: visible;
  flex-shrink: 0;
}

body.user-not-auth .sidebar-user-area {
  background: transparent !important;
  border-top-color: transparent !important;
}

body.user-not-auth .sidebar-user-area .auth-open-btn {
  align-self: center;
}

.user-profile {
  position: relative;
  width: 100%;
}

.auth-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  align-self: center;

  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #f59e0b;
  color: #ffffff;

  padding: 10px 14px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease, font-weight 0.18s ease;
}

.auth-open-btn:hover {
  background: #fbbf24;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.auth-open-btn:active {
  background: #f59e0b;
}

.user-profile-trigger,
.user-dropdown button {
  width: 100%;
  border-radius: 14px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  padding: 10px 12px;
  font-size: 0.95rem;
  cursor: pointer;
}

.user-profile-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  width: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 8px 14px;
  cursor: pointer;
  justify-content: space-between;
}

.user-profile-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.quick-logout-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.quick-logout-btn:hover {
  background: rgba(0,0,0,0.08);
  color: #111827;
}

.user-profile-trigger:hover {
  background: rgba(255, 255, 255, 0.22);
}

.user-dropdown button:hover {
  background: #f9fafb;
}

.user-avatar-img {
  width: 30px;
  height: 30px;
  border-radius: 0;
  object-fit: contain;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-email {
  font-size: 0.84rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.user-plan {
  font-size: 0.72rem;
  color: #6b7280;
  line-height: 1.1;
}

.user-dropdown {
  position: absolute;
  /* left: 50%;
  transform: translateX(-50%);*/
  bottom: calc(100% + 8px);
  width: min(240px, calc(100% - 24px));
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 200;
}

.hidden {
  display: none !important;
}

/* мод алки */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.auth-modal-content {
  position: relative;
  z-index: 1;
  width: min(92vw, 560px);
  margin: 8vh auto 0;
  background: #fff;
  border-radius: 18px;
  padding: 28px 24px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 86vh;
  overflow-y: auto;
}

.profile-form-scroll {
  overflow-y: auto;
  padding-right: 6px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
}

.profile-field-full {
  grid-column: span 2;
}

.auth-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-modal-content h2 {
  margin: 0;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  color: #111827;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}


.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
}

.auth-modal-content input:not([type="checkbox"]):not([type="radio"]),
.auth-modal-content select,
.auth-modal-content textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
  /* Используем background-color, а не shorthand background:.
     Shorthand сбрасывает background-image, из-за чего у <select>
     внутри .auth-modal-content исчезала кастомная стрелка. */
  background-color: #ffffff;
}

.auth-modal-content .iti {
  width: 100%;
}

.auth-modal-content .iti__tel-input {
  width: 100% !important;
  height: 48px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  /* padding-left увеличен, чтобы цифры не наезжали на флаг и стрелку
     селектора страны (overlay .iti__country-container занимает заметную
     ширину в intl-tel-input v26). */
  padding: 12px 14px 12px 84px;
  font-size: 0.95rem;
  background: #ffffff;
  box-sizing: border-box;
}

.auth-modal-content .iti__country-container {
  width: auto;
}
.auth-modal-content .iti__selected-country-primary {
  height: 48px;
  display: flex;
  align-items: center;
}

.auth-modal-content .iti__selected-country {
  padding-left: 12px;
  border-radius: 12px 0 0 12px;
}

.auth-modal-content .iti__country-list {
  z-index: 4000;
}


#profile-modal .profile-field .iti__tel-input {
  width: 100% !important;
  height: 48px;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  /* padding-left увеличен до 110px — флаг + стрелка селектора в
     intl-tel-input v26 шире, поэтому цифры нуждаются в большем левом отступе. */
  padding: 12px 14px 12px 110px;
  font-size: 0.9rem;
  background: #ffffff;
  box-sizing: border-box;
  line-height: 1.4;
}

#profile-modal .profile-field .iti__country-container {
  left: 0;
}

#profile-modal .profile-field .iti__selected-country-primary {
  height: 48px;
  display: flex;
  align-items: center;
  padding-left: 12px !important;
  padding-right: 10px !important;
  background: transparent !important;
  border: none !important;
  border-radius: 24px 0 0 24px !important;
  cursor: pointer;
}

#profile-modal .profile-field .iti__selected-country {
  padding-left: 0;
  border-radius: 24px 0 0 24px;
}

#profile-modal .profile-field .iti__arrow {
  margin-left: 6px;
}

#profile-modal .profile-field .iti__dropdown-content {
  z-index: 7001 !important;
}

#profile-modal .profile-field .iti__country-list {
  z-index: 7002 !important;
  margin-top: 6px !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  border: 1px solid #d1d5db !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14) !important;
  max-height: 260px !important;
  overflow-y: auto !important;
}

.iti__country-container {
  z-index: 6000 !important;
}

.iti__country-list {
  z-index: 6001 !important;
  background: #ffffff !important;
  border: 1px solid #d1d5db !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14) !important;
  max-height: 260px !important;
  overflow-y: auto !important;
}

.iti__dropdown-content {
  z-index: 6001 !important;
  background: #ffffff !important;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  padding-right: 48px;
}

.password-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  padding: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6b7280;
  font-size: 16px;
  line-height: 1;
}

.password-toggle-btn:hover {
  color: #111827;
}

.password-toggle-btn.is-active {
  color: #111827;
}

.auth-note {
  font-size: 0.92rem;
  color: #6b7280;
  line-height: 1.45;
}

.auth-modal-content button {
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

#profile-modal .iti button,
#profile-modal .iti__selected-country-primary,
#profile-modal .iti__country-container button {
  padding: 0 !important;
  border-radius: 0 !important;
  min-width: auto !important;
  width: auto !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* reset для внутренних кнопок intl-tel-input внутри модалок */
.auth-modal-content .iti__selected-country-primary,
.auth-modal-content .iti__country-container button,
.auth-modal-content .iti button {
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  width: auto !important;
  min-width: auto !important;
}

/* явный курсор для клика по флагу */
.auth-modal-content .iti__selected-country-primary {
  cursor: pointer;
}


.auth-modal-close {
   position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  padding: 0;
  width: auto;
  height: auto;
  border-radius: 0;
  font-size: 1.45rem;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  /* Sticky h2 внутри .auth-modal-content стоит с z-index:10 и фоном white,
     поэтому без явного z-index крестик закрывается заголовком и визуально
     пропадает (хотя кликается). Поднимаем его выше шапки. */
  z-index: 20;
}

.auth-link-btn,
.secondary-btn {
  background: transparent;
  color: #2563eb;
text-decoration: underline;
  padding: 0;
  border: none;
}

.auth-link-btn:hover,
.secondary-btn:hover {
  color: #1d4ed8;
}

.auth-modal-close:hover {
  color: #111827;
}

.auth-switch-text {
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.45;
}

.auth-forgot-row {
  margin-top: -4px;
}

.collapsed-only {
  display: none;
}

.expanded-only {
  display: inline-flex;
}

.sidebar-collapsed .expanded-only {
  display: none !important;
}

.sidebar-collapsed #sidebarUserArea {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  margin: 0;
  padding: 0 0 8px 0;
  background: transparent;
  border-top: none;
  overflow: visible;
}

.sidebar-collapsed .user-profile {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
  overflow: visible;
}

.sidebar-collapsed .user-profile-trigger {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  margin: 0 auto;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}

.sidebar-collapsed .user-avatar-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.sidebar-collapsed .auth-open-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  margin: 0 auto 2px auto;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  background: #f59e0b;
  border: none;
  font-size: 0;
  line-height: 0;
}

.sidebar-collapsed .auth-open-btn .expanded-only {
  display: none !important;
}

.sidebar-collapsed .auth-open-btn::before {
  content: none;
  /*width: 32px;
  height: 32px;
  display: block;
  border-radius: 999px;*/
}

.sidebar-collapsed .auth-open-btn .collapsed-only {
  display: inline-flex !important;
  font-size: 18px;
  line-height: 1;
  color: #ffffff;
  align-items: center;
  justify-content: center;
}

.sidebar-collapsed .user-dropdown {
  left: calc(100% + 12px);
  bottom: 0;
  width: 220px;
  min-width: 220px;
  z-index: 500;
}

#auth-continue-submit,
#login-submit,
#register-submit,
#verify-submit,
#reset-request-submit,
#reset-confirm-submit,
#change-password-submit,
#delete-account-submit {
  background: #111827;
  color: #ffffff;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

#auth-continue-submit:hover,
#login-submit:hover,
#register-submit:hover,
#verify-submit:hover,
#reset-request-submit:hover,
#reset-confirm-submit:hover,
#change-password-submit:hover {
  background: #000000;
}

#delete-account-submit {
  background: #b91c1c;
}

#delete-account-submit:hover {
  background: #991b1b;
}

.cookie-banner {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 3000;
  display: flex;
  justify-content: center;
}

.cookie-banner__card {
  width: min(100%, 720px);
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  padding: 20px;
  border: 1px solid #e5e7eb;
}

.cookie-banner__text strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: #111827;
}

.cookie-banner__text p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #374151;
  margin-bottom: 16px;
}

.cookie-banner__btn {
  width: 100%;
  background: #111111;
  color: #ffffff;
  border-radius: 999px;
  padding: 14px 18px;
  cursor: pointer;
}

.cookie-banner__btn:hover {
  background: #000000;
}

.auth-modal-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 6px;
}

.auth-brand-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.auth-brand-name {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  color: #111827;
}

.auth-brand-subtitle {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.3;
  color: #6b7280;
}

.auth-header-divider {
  width: 100%;
  height: 1px;
  background: #e5e7eb;
}

.profile-modal-content {
  width: min(94vw, 980px);
  max-height: min(86vh, 860px);
  overflow-y: auto;
}

.profile-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}


.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
}


.profile-help-text {
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.4;
}


.profile-save-btn {
  background: #111827;
  color: #ffffff !important;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  min-width: 320px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease, font-weight 0.18s ease;
}

.profile-save-btn:hover {
  background: #000000;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.auth-inline-error {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: #c62828;
}

.auth-input-error {
  border: 1px solid #c62828 !important;
  box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.10);
}


@media (max-width: 860px) {
  .profile-modal-content {
    width: min(94vw, 620px);
  }


}


.profile-plan-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #f9fafb;
  padding: 14px;
}

.profile-plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-plan-switcher {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.plan-chip {
  font-size: 0.98rem;
  font-weight: 500;
  color: #6b7280;
  line-height: 1;
  display: block;
}

.plan-chip.active {
  font-size: 1.60rem;
  font-weight: 800;
  line-height: 1;
  display: block;
  transform: translateY(1px);
}

.plan-free.active {
  color: #95FFF7;
}

.plan-basic.active {
  color: #FF8D37;
}

.plan-pro.active {
  color: #FF8D37;
}

.plan-divider {
  color: #9ca3af;
  display: block;
  line-height: 1;
}

.profile-plan-btn {
  background: #f59e0b;
  color: #ffffff;
  border-radius: 12px;
  padding: 10px 14px;
  white-space: nowrap;
}

.profile-plan-btn:hover {
  background: #fbbf24;
}


.profile-field input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.95rem;
}

/* Стили для всех select элементов с классом tg-select - базовый набор */
.tg-select,
.profile-field select {
  width: 100%;
  padding: 10px 36px 10px 14px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 0.9rem;
  font-family: inherit;
  background-color: #ffffff;
  color: #2A2A2A;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.auth-note.auth-country-error,
.profile-help-text.profile-save-note {
  color: #b91c1c;
}

/* ===== Profile modal v2 ===== */


.profile-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}


.profile-tab-panels {
  min-width: 0;
}


.profile-limit-card-note {
  margin-top: 8px;
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.4;
}


.profile-danger-btn {
  color: #b91c1c;
}

.profile-danger-btn:hover {
  color: #991b1b;
}


@media (max-width: 760px) {

  .profile-header-actions {
    width: 100%;
  }

  .profile-save-btn--header {
    width: 100%;
  }

}

/* ===== Profile modal refinements v3 ===== */

.profile-modal-content {
  width: min(92vw, 720px);
  overflow: visible;
}

.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding-right: 58px;
  min-height: 48px;
}

.profile-modal-topline {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.profile-header-avatar {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 0;
  flex: 0 0 auto;
}

.profile-email-header {
  font-size: 0.94rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  word-break: break-word;
}

.profile-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.profile-save-btn--header {
  display: none;
  min-width: 0;
  padding: 10px 18px;
  border-radius: 16px;
  font-size: 0.96rem;
  line-height: 1.2;
}

#profile-modal.profile-dirty .profile-save-btn--header {
  display: inline-flex;
}

#profile-modal .auth-modal-close {
  width: 36px;
  height: 36px;
  font-size: 34px;
  line-height: 1;
  top: 22px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.profile-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 18px 0 0;
}

.profile-tab-btn {
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  border-radius: 16px 16px 0 0;
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.profile-tab-btn:hover {
  background: #f3f4f6;
}

.profile-tab-btn.active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
}

.profile-tab-panels {
  margin-top: -1px;
}

.profile-tab-panel {
  display: none;
}

.profile-tab-panel.active {
  display: block;
  border: 1px solid #d1d5db;
  border-radius: 0 18px 18px 18px;
  background: #fafafa;
  padding: 18px;
}

.profile-limits-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-limit-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  padding: 14px;
  min-width: 0;
}

.profile-limit-card-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 8px;
}

.profile-limit-card-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #111827;
}

.profile-limit-card-text {
  font-size: 0.96rem;
  color: #111827;
  line-height: 1.45;
}

.profile-limit-sep {
  color: #9ca3af;
}

.profile-block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-settings-block {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}


.profile-field.profile-field-full {
  align-items: flex-start;
}

.profile-setting-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 0;
  align-self: flex-start;
  cursor: pointer;
}

.profile-settings-check {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 4px;
  accent-color: #111827;
  flex: 0 0 18px;
}

.profile-setting-item__title {
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  min-width: 0;

  font-size: 0.9rem;          /* как у label */
  font-weight: 600;           /* как у label */
  color: #374151;             /* как у label */
  line-height: 1.2;

  white-space: nowrap;
}

.profile-setting-item__help {
  margin-top: 8px;
}


.profile-field > .profile-help-text {
  margin-top: 6px;
}

.profile-settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.profile-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  background: #f9fafb;
  color: #374151;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.profile-action-btn:hover {
  background: #f3f4f6;
}

.profile-action-btn.profile-danger-btn {
  color: #991b1b;
}

.profile-action-btn.profile-danger-btn:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}


/* intl-tel-input: dropdown поверх модалки */
#profile-modal {
  overflow: visible;
}

#profile-modal .auth-modal-content,
#profile-modal .profile-tab-panel,
#profile-modal .profile-block {
  overflow: visible;
}

#profile-modal .iti {
  width: 100%;
}

#profile-modal .profile-field .iti {
  width: 100%;
}

#profile-modal .profile-field .iti__dropdown-content,
#profile-modal .profile-field .iti__country-list {
  z-index: 10050 !important;
}

#profile-modal .profile-field .iti__country-list {
  max-height: min(280px, 42vh) !important;
}

@media (max-width: 760px) {
  .profile-modal-content {
    width: min(94vw, 640px);
    padding: 22px 16px 18px;
  }


  .profile-email-header {
    font-size: 0.92rem;
  }

  .profile-save-btn--header {
    padding: 9px 14px;
    font-size: 0.9rem;
  }

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

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

.profile-static-value {
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 24px;
  background: #ffffff;
  color: #111827;
  font-size: 0.95rem;
}

@media (max-width: 760px) {
  #profile-modal .auth-modal-close {
    top: 18px;
    right: 14px;
  }

  .profile-modal-header {
    align-items: flex-start;
    padding-right: 40px;
    min-height: 0;
    margin-bottom: 10px;
  }


}

.profile-field .auth-note {
  margin-top: 6px;
}

#register-timezone,
#profile-timezone {
  background: #ffffff;
}

@media (max-width: 760px) {
  .profile-setting-item {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: auto;
    max-width: 100%;
    align-self: flex-start;
  }

  .profile-setting-item__title {
    flex: 0 0 auto;
    min-width: auto;
    line-height: 1.2;
    white-space: nowrap;
  }

  .profile-settings-check {
    margin-top: 0;
  }
}

/* Согласие с Privacy + ToS + возрастом при регистрации */
.auth-field--terms {
  margin-top: 12px;
  margin-bottom: 6px;
}

.auth-terms-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.35;
  color: #2b2b2b;
}

.auth-terms-label input[type="checkbox"] {
  flex: 0 0 auto;
  margin-top: 3px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.auth-terms-text {
  flex: 1 1 auto;
}

.auth-terms-links {
  margin: 6px 0 0 26px;
  font-size: 0.85rem;
  color: #555;
}

.auth-terms-links a {
  color: #0563c1;
  text-decoration: none;
}

.auth-terms-links a:hover {
  text-decoration: underline;
}

.auth-terms-sep {
  margin: 0 6px;
  color: #999;
}

#register-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ===== DROPDOWN ARROWS FIX =====
   Гарантированное отображение стрелочек во всех <select> в профиле.
   Несколько других правил (например, .auth-modal-content select с
   shorthand background:) ранее затирали background-image, из-за чего
   стрелка пропадала. Поэтому здесь всё с !important и максимальной
   спецификой по id модалки. */

#profile-modal select,
#profile-modal .profile-field select,
#profile-modal #profile-timezone,
#profile-modal #profile-language,
#profile-modal #profile-default-ai-model {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-color: #ffffff !important;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 5 6 8 9 5'/></svg>") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 12px 12px !important;
  padding-right: 36px !important;
}

/* ===== Feedback modal ===== */
#feedback-modal .feedback-modal-content {
  width: min(92vw, 560px);
}

#feedback-modal select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 5 6 8 9 5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
}

#feedback-modal textarea {
  resize: vertical;
  min-height: 110px;
  font-family: inherit;
  line-height: 1.45;
}

.feedback-attachments-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.feedback-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  width: auto !important;
}

.feedback-attach-btn:hover {
  background: #e5e7eb;
}

.feedback-attach-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.feedback-attach-hint {
  font-size: 0.82rem;
  color: #6b7280;
}

.feedback-files-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback-files-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 0.88rem;
  color: #374151;
}

.feedback-files-list .feedback-file-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-files-list .feedback-file-size {
  flex: 0 0 auto;
  color: #6b7280;
  font-size: 0.8rem;
}

.feedback-files-list .feedback-file-remove {
  background: transparent !important;
  border: none !important;
  padding: 0 4px !important;
  width: auto !important;
  color: #b91c1c !important;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.feedback-files-list .feedback-file-remove:hover {
  color: #7f1d1d !important;
}

.feedback-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.feedback-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.feedback-submit-btn {
  background: #f59e0b;
  color: #ffffff;
  border: 1px solid #f59e0b;
  font-weight: 600;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.feedback-submit-btn:hover {
  background: #fbbf24;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.feedback-submit-btn[disabled] {
  background: #fbbf24;
  opacity: 0.7;
  cursor: not-allowed;
}