body {
    background: linear-gradient(rgba(240, 244, 248, 0.92), rgba(240, 244, 248, 0.92));
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.settings-container {
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.settings-card {
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--cool-gray, #fafafa);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-label {
    font-weight: 500;
    color: var(--slate, #262626);
}

.settings-item--stacked {
    align-items: flex-start;
    gap: 12px;
}

.consent-switch {
    position: relative;
    display: inline-flex;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
}

.consent-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.consent-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbd5e1;
    border: 1px solid #bfccd8;
    transition: background 0.2s ease;
}

.consent-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease;
}

.consent-switch input:checked + .consent-slider {
    background: #0f766e;
    border-color: #16a34a;
}

.consent-switch input:checked + .consent-slider::before {
    transform: translateX(22px);
}

.consent-switch input:disabled + .consent-slider {
    opacity: 0.6;
}

.settings-language-content {
    flex: 1;
}

.settings-profile-photo-row {
    align-items: flex-start;
}

.user-profile-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 420px;
}

.user-profile-preview__image {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.14), rgba(13, 148, 136, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f766e;
    font-size: 1.5rem;
}

.user-profile-preview__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-profile-preview__meta {
    min-width: 0;
}

.user-profile-preview__name {
    display: block;
    font-size: 1rem;
    color: var(--slate, #262626);
}

.user-profile-preview__status {
    display: block;
    font-size: 0.82rem;
    color: #64748B;
    margin-top: 4px;
}

.settings-language-helper {
    margin: 6px 0 0;
    font-size: 0.74rem;
    line-height: 1.45;
    color: #64748B;
    max-width: 260px;
}

.logout-btn {
    background: var(--white, #fff);
    color: #DC2626;
    border: 1px solid var(--cool-gray, #efefef);
    padding: 14px;
    border-radius: 12px;
    width: 100%;
    font-weight: 700;
    cursor: pointer;
    margin-top: 20px;
}

.back-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.back-link {
    font-size: 1.5rem;
    color: var(--slate, #262626);
    text-decoration: none;
}

.settings-control {
    background: rgba(15, 118, 110, 0.08);
    border: 1px solid rgba(15, 118, 110, 0.2);
    color: #0F766E;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
    width: 140px;
}

.settings-control:hover, 
.settings-control:focus {
    background: rgba(15, 118, 110, 0.15);
    border-color: rgba(15, 118, 110, 0.4);
}

select.settings-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230095f6' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    text-align: left;
}

input.settings-control {
    text-align: left;
}

.mobile-top-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.back-btn-top {
    position: absolute;
    left: 16px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--slate, #262626);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white, white);
    padding: 32px;
    border-radius: 20px;
    max-width: 350px;
    text-align: center;
    border: 1px solid var(--cool-gray, #efefef);
}

.delete-btn-modal {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: #dc2626;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.cancel-btn-modal {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    font-weight: 600;
    cursor: pointer;
}

.settings-card {
    animation: settings-card-in 0.35s ease both;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

@keyframes settings-card-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.quick-action-btn {
    border: 1px solid rgba(15, 118, 110, 0.15);
    background: rgba(15, 118, 110, 0.06);
    color: var(--slate, #262626);
    border-radius: 12px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 84px;
    transition: all 0.2s ease;
}

.quick-action-btn i {
    color: #0F766E;
    font-size: 1rem;
}

.quick-action-btn:hover,
.quick-action-btn:focus-visible {
    background: rgba(15, 118, 110, 0.12);
    border-color: rgba(15, 118, 110, 0.3);
    transform: translateY(-1px);
    outline: none;
}

.danger-zone {
    margin-top: 16px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #fecaca;
    background: rgba(220, 38, 38, 0.04);
}

.danger-zone h4 {
    margin: 0;
    color: #DC2626;
    font-size: 0.86rem;
    font-weight: 700;
}

.danger-zone-warning {
    margin: 8px 0 12px;
    color: #b91c1c;
    font-size: 0.76rem;
    line-height: 1.5;
}

.danger-zone-btn {
    width: 100%;
    background: #fff;
    border: 1px solid #fecaca;
    color: #DC2626;
    padding: 10px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.danger-zone-btn:hover,
.danger-zone-btn:focus-visible {
    background: rgba(220, 38, 38, 0.08);
    border-color: #f2a5ac;
    outline: none;
}

.data-status-hint {
    margin: 10px 0 0;
    font-size: 0.74rem;
    color: #64748B;
}

.help-placeholder-btn {
    width: 100%;
    border: 1px dashed rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.02);
    color: #64748B;
    border-radius: 10px;
    padding: 11px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: not-allowed;
}

.danger-confirm-wrap {
    text-align: left;
    margin-bottom: 16px;
}

.danger-confirm-label {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 8px;
}

.danger-confirm-input {
    width: 100%;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.danger-confirm-input:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.danger-confirm-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.77rem;
    color: #64748b;
    line-height: 1.4;
}

.danger-confirm-error {
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: #DC2626;
    font-weight: 600;
}

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

.recovery-settings-card.recovery-priority-active {
    border: 1px solid rgba(20, 184, 166, 0.35);
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.18);
    transform: scale(1.01);
}

.recovery-protection-badge {
    margin-left: auto;
    font-size: 0.68rem;
    line-height: 1;
    padding: 5px 10px;
    border-radius: 999px;
    color: #0f766e;
    background: rgba(20, 184, 166, 0.13);
    border: 1px solid rgba(20, 184, 166, 0.26);
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.security-settings-card {
    scroll-margin-top: 90px;
}

.settings-section-title {
    font-size: 1rem;
    margin: 0 0 15px;
    color: #64748B;
}

.security-section-header {
    display: grid;
    gap: 6px;
}

.security-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: var(--slate, #262626);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.security-subtitle i {
    color: var(--mc-primary, #0f766e);
    font-size: 0.9rem;
}

.security-section-helper {
    margin: 0;
    color: #64748B;
    font-size: 0.78rem;
    line-height: 1.5;
}

.security-section-divider {
    margin: 14px 0 2px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.password-change-form {
    display: grid;
    gap: 16px;
    margin-top: 14px;
}

.password-field-group {
    display: grid;
    gap: 8px;
}

.password-input-wrap {
    position: relative;
}

.security-password-input {
    width: 100%;
    padding: 11px 44px 11px 14px;
    border-radius: 12px;
    border: 1px solid #dbe2ea;
    background: #ffffff;
    color: var(--slate, #262626);
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    cursor: text;
}

.security-password-input:hover,
.security-password-input:focus {
    background: #ffffff;
    border-color: rgba(124, 58, 237, 0.42);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14);
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #7b8aa0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus-visible {
    background: rgba(124, 58, 237, 0.1);
    color: var(--mc-primary, #0f766e);
    outline: none;
}

.password-strength-wrap {
    margin-top: 2px;
    display: grid;
    gap: 8px;
}

.password-strength-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.74rem;
}

.password-strength-title {
    color: #64748b;
    font-weight: 600;
}

.password-strength-label {
    font-weight: 700;
    transition: color 0.2s ease;
}

.password-strength-label.is-weak {
    color: #df5164;
}

.password-strength-label.is-medium {
    color: #B45309;
}

.password-strength-label.is-strong {
    color: #22a15d;
}

.password-strength-meter {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #edf2f7;
    overflow: hidden;
}

.password-strength-fill {
    display: block;
    width: 20%;
    height: 100%;
    border-radius: inherit;
    transition: width 0.25s ease, background-color 0.25s ease;
}

.password-strength-fill.is-weak {
    background: #ef4444;
}

.password-strength-fill.is-medium {
    background: #f59e0b;
}

.password-strength-fill.is-strong {
    background: #0f766e;
}

.password-helper-text {
    margin: 0;
    font-size: 0.74rem;
    color: #64748B;
    line-height: 1.45;
}

.field-error {
    min-height: 18px;
    margin: 0;
    font-size: 0.75rem;
    color: #e06774;
    font-weight: 600;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.field-error.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.password-status-message {
    margin: -2px 0 0;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 10px;
    padding: 0;
    border: 1px solid transparent;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, max-height 0.2s ease, padding 0.2s ease;
}

.password-status-message.is-visible {
    opacity: 1;
    max-height: 80px;
    padding: 10px 12px;
}

.password-status-message.is-success {
    color: #166534;
    background: #ecfdf3;
    border-color: #bbf7d0;
}

.password-status-message.is-error {
    color: #b91c1c;
    background: #fff1f2;
    border-color: #fecdd3;
}

.password-update-btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--mc-primary, #0f766e), #115e59);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(109, 40, 217, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.password-update-btn:hover:not(:disabled),
.password-update-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(109, 40, 217, 0.28);
    outline: none;
}

.password-update-btn:disabled {
    opacity: 0.78;
    cursor: not-allowed;
}

.password-btn-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.95);
    border-right-color: transparent;
    display: none;
}

.password-update-btn.is-loading .password-btn-spinner {
    display: inline-block;
    animation: settings-spin 0.7s linear infinite;
}

@keyframes settings-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 640px) {
    .password-change-form {
        gap: 14px;
    }

    .password-update-btn {
        width: 100%;
        position: sticky;
        bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        z-index: 3;
    }

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

    .quick-action-btn {
        flex-direction: row;
        justify-content: flex-start;
        min-height: 52px;
        padding: 12px;
    }

    .recovery-protection-badge {
        white-space: normal;
        text-align: center;
    }
}

.ec-pref-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ec-pref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  transition: background 0.2s;
}
.ec-pref-item:hover {
  background: rgba(255, 255, 255, 0.9);
}
.ec-pref-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 16px;
}
.ec-pref-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate, #262626);
}
.ec-pref-desc {
  font-size: 0.82rem;
  color: #64748B;
  line-height: 1.4;
}
.ec-pref-switch {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
}
.ec-pref-switch input { opacity: 0; width: 0; height: 0; }
.ec-pref-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 34px;
  border: 1px solid #bfccd8;
}
.ec-pref-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}
.ec-pref-switch input:checked + .ec-pref-slider { 
    background-color: #0f766e;
    border-color: #16a34a; 
}
.ec-pref-switch input:checked + .ec-pref-slider:before { transform: translateX(22px); }

@media (max-width: 640px) {
  .ec-pref-item {
    padding: 12px 14px;
  }
}


/* Save feedback under a setting (name, email choices). */
.settings-status {
    margin: 8px 0 0;
    font-size: 0.82rem;
    font-weight: 600;
}

.settings-status.is-success {
    color: var(--mc-primary, #0f766e);
}

.settings-status.is-error {
    color: var(--mc-danger, #dc2626);
}

.settings-backup-state {
    color: var(--mc-primary, #0f766e);
    font-weight: 600;
    font-size: 0.85rem;
}

.help-contact-link {
    text-decoration: none;
    cursor: pointer;
    opacity: 1;
    border: 1px solid rgba(15, 118, 110, 0.25);
    background: var(--mc-primary-light, #f0fdfa);
    color: var(--mc-primary, #0f766e);
}

.help-contact-link:hover {
    background: var(--mc-primary-subtle, #ccfbf1);
}

/* Phones: tighter gutters so cards use the screen width. */
@media (max-width: 767px) {
    body .main-content {
        padding-top: 64px !important;
    }

    .settings-container {
        padding: 8px 0 24px !important;
    }

    .settings-card {
        margin-left: 0;
        margin-right: 0;
    }
}

.clear-data-list {
    margin: 0 0 12px;
    padding-left: 20px;
    text-align: left;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--mc-text-primary, #0f172a);
}
