/* =============================================================================
   ACCOUNT PAGE — UI redesign (scoped to #accountSection)
   ============================================================================= */
#accountSection.acc2 { --acc-label: #B7BDC6; --acc-muted: var(--text-tertiary); max-width: 1080px; margin: 0 auto; }
#accountSection .acc2-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }

/* Section menu */
#accountSection .acc2-nav { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 2px; }
#accountSection .acc2-nav-item {
    height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
    color: var(--text-secondary); font: inherit; font-size: 0.875rem; text-align: left; cursor: pointer;
}
#accountSection .acc2-nav-item:hover { color: var(--text-primary); }
#accountSection .acc2-nav-item.active { background: var(--bg-tertiary); color: var(--text-primary); font-weight: 500; }
#accountSection .acc2-nav-item--danger { color: var(--red); }

#accountSection .acc2-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* Cards */
#accountSection .acc2-card {
    background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 16px;
    padding: 24px; scroll-margin-top: 88px;
}
#accountSection .acc2-card--list { padding: 8px 24px 12px; }
#accountSection .acc2-card--list > .acc2-title { padding: 16px 0 8px; margin: 0; }
#accountSection .acc2-card--danger { border-color: rgba(246, 70, 93, 0.35); padding: 8px 24px; }
#accountSection .acc2-title { margin: 0 0 16px; font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); }
#accountSection .acc2-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
#accountSection .acc2-title-row .acc2-title { margin: 0; }
#accountSection .acc2-card-foot {
    display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap;
    margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-color);
}
#accountSection .acc2-card-foot--start { justify-content: flex-start; }
#accountSection .acc2-card-foot:empty { display: none; }

/* Identity */
#accountSection .acc2-ident { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
#accountSection .acc2-avatar {
    width: 52px; height: 52px; flex-shrink: 0; border-radius: 50%;
    background: rgba(240, 185, 11, 0.15); color: var(--accent);
    display: flex; align-items: center; justify-content: center; font-size: 1.125rem; font-weight: 600;
}
#accountSection .acc2-ident-text { min-width: 0; }
#accountSection .acc2-ident-name { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 600; color: var(--text-primary); }
#accountSection .acc2-ident-email { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 2px; overflow-wrap: anywhere; }
#accountSection .acc2-plan-pill { padding: 2px 8px; border-radius: 999px; font-size: 0.6875rem; font-weight: 600; background: var(--bg-tertiary); color: var(--acc-label); }
#accountSection .acc2-plan-pill.starter { background: rgba(59, 158, 255, 0.14); color: #3B9EFF; }
#accountSection .acc2-plan-pill.pro,
#accountSection .acc2-plan-pill.enterprise { background: rgba(240, 185, 11, 0.14); color: var(--accent); }

/* Form */
#accountSection .acc2-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#accountSection .acc2-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#accountSection .acc2-label { font-size: 0.75rem; font-weight: 500; color: var(--acc-label); }
#accountSection .acc2-label-note { color: var(--acc-muted); font-weight: 400; }
#accountSection .form-input {
    width: 100%; height: 44px; box-sizing: border-box; padding: 0 14px;
    background-color: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 10px;
    color: var(--text-primary); font-size: 0.875rem; font-family: inherit; color-scheme: dark;
}
#accountSection .form-input:focus-visible, #accountSection select.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.12); }
#accountSection #accountEmailInput { background: var(--bg-tertiary); border-color: var(--bg-tertiary); color: var(--text-secondary); cursor: default; }
#accountSection .acc2-inline { display: flex; gap: 8px; }
#accountSection .acc2-inline .form-input { flex: 1; min-width: 0; }
#accountSection .acc2-hint { font-size: 0.75rem; line-height: 1.5; color: var(--acc-muted); }
#accountSection .acc2-hint strong { color: var(--acc-label); font-weight: 500; }
#accountSection .acc2-hint button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
#accountSection .acc2-saved { font-size: 0.8125rem; color: var(--green); }

/* Buttons */
#accountSection .acc2-btn {
    height: 40px; padding: 0 16px; flex-shrink: 0; border: 1px solid var(--border-color); border-radius: 10px;
    background: transparent; color: var(--text-primary); font: inherit; font-size: 0.875rem; font-weight: 500;
    cursor: pointer; white-space: nowrap;
}
#accountSection .acc2-btn:hover { background: var(--bg-tertiary); }
#accountSection .acc2-btn:disabled { opacity: 0.55; cursor: not-allowed; }
#accountSection .acc2-btn--text-danger { border-color: transparent; color: var(--red); }
#accountSection .acc2-btn--text-danger:hover { background: rgba(246, 70, 93, 0.08); }
#accountSection .acc2-btn--danger { border-color: rgba(246, 70, 93, 0.5); color: var(--red); }
#accountSection .acc2-btn--danger:hover { background: rgba(246, 70, 93, 0.08); }
#accountSection .acc2-btn-primary {
    height: 40px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--accent); color: #0B0E11;
    font-size: 0.875rem; font-weight: 600; cursor: pointer;
}
#accountSection .acc2-btn-primary:hover { background: #FCD535; }
#accountSection .acc2-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Rows */
#accountSection .acc2-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 0; border-top: 1px solid var(--bg-tertiary);
}
#accountSection .acc2-card--danger .acc2-row { border-top: 0; }
#accountSection .acc2-row-text { flex: 1; min-width: 0; }
#accountSection .acc2-row-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
#accountSection .acc2-row-sub { margin-top: 2px; font-size: 0.8125rem; line-height: 1.45; color: var(--text-secondary); }
#accountSection .acc2-danger-text { color: var(--red); font-weight: 600; }
#accountSection .acc2-subhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0 10px; border-top: 1px solid var(--bg-tertiary); }
#accountSection .acc2-status {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600; background: var(--bg-tertiary); color: var(--text-secondary);
}
#accountSection .acc2-status.on { background: rgba(14, 203, 129, 0.12); color: var(--green); }
#accountSection .acc2-status.on::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
#accountSection .acc2-status.warn { background: rgba(240, 185, 11, 0.12); color: var(--accent); }
#accountSection .acc2-status.bad { background: rgba(246, 70, 93, 0.12); color: var(--red); }

/* Plan */
#accountSection .acc2-plan { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px; border-radius: 12px; background: var(--bg-tertiary); }
#accountSection .acc2-plan-main { flex: 1; min-width: 200px; }
#accountSection .acc2-plan-name { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 600; color: var(--text-primary); }
#accountSection .acc2-plan-meta { margin-top: 4px; font-size: 0.8125rem; color: var(--text-secondary); }
#accountSection .acc2-plan-price { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 1.375rem; font-weight: 600; color: var(--text-primary); }
#accountSection .acc2-benefits { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
#accountSection .acc2-benefit {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px;
    border: 1px solid var(--border-color); font-size: 0.8125rem; color: var(--acc-label);
}
#accountSection .acc2-benefit svg { color: var(--green); }
#accountSection .acc2-benefit--off { color: var(--acc-muted); border-style: dashed; }
#accountSection .acc2-benefit--off svg { color: var(--acc-muted); }
#accountSection .acc2-benefit button { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
#accountSection #accountBilling { margin-top: 16px; }
#accountSection #accountBilling .acc2-hint { padding-top: 10px; border-top: 1px solid var(--bg-tertiary); }
#accountSection .acc2-card-foot--start > div { display: contents; }

/* Exchanges */
#accountSection .acc2-exchanges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
#accountSection .acc2-ex { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--bg-tertiary); min-width: 0; }
#accountSection .acc2-ex-logo { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; }
#accountSection .acc2-ex-name { font-size: 0.8125rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#accountSection .acc2-ex-state { display: inline-flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--text-secondary); }
#accountSection .acc2-ex-state.on { color: var(--green); }
#accountSection .acc2-ex-state.on::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Devices */
#accountSection .acc2-devices { display: flex; flex-direction: column; gap: 8px; padding-bottom: 6px; }
#accountSection .acc2-device { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--bg-tertiary); }
#accountSection .acc2-device-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; background: var(--bg-secondary); color: var(--acc-label); display: flex; align-items: center; justify-content: center; }
#accountSection .acc2-device-text { flex: 1; min-width: 0; }
#accountSection .acc2-device-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
#accountSection .acc2-device-meta { margin-top: 2px; font-size: 0.75rem; color: var(--text-secondary); }
#accountSection .acc2-this { padding: 1px 8px; border-radius: 999px; background: rgba(14, 203, 129, 0.12); color: var(--green); font-size: 0.6875rem; font-weight: 600; }

/* Notification switches (existing .toggle, restyled) */
#accountSection .acc2-switch {
    position: relative; width: 44px; height: 26px; flex-shrink: 0; padding: 0; border: 0; border-radius: 13px;
    background: var(--border-color); cursor: pointer; transition: background 0.2s;
}
#accountSection .acc2-switch .toggle-slider {
    position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: #848E9C; transition: transform 0.2s, background 0.2s;
}
#accountSection .acc2-switch.active { background: var(--green); }
#accountSection .acc2-switch.active .toggle-slider { transform: translateX(18px); background: #FFFFFF; }

/* Phone */
@media (max-width: 860px) {
    #accountSection .acc2-grid { grid-template-columns: minmax(0, 1fr); }
    #accountSection .acc2-nav { display: none; }
    #accountSection .acc2-exchanges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    #accountSection .acc2-card { padding: 20px 16px; }
    #accountSection .acc2-card--list,
    #accountSection .acc2-card--danger { padding: 4px 16px 10px; }
    #accountSection .acc2-form { grid-template-columns: minmax(0, 1fr); }
    #accountSection .acc2-row, #accountSection .acc2-subhead { flex-wrap: wrap; }
    #accountSection .acc2-row > .acc2-btn, #accountSection .acc2-subhead > .acc2-btn { width: 100%; }
    #accountSection .acc2-actions { width: 100%; justify-content: stretch; }
    #accountSection .acc2-actions > .acc2-btn { flex: 1; }
}

/* Phones: a button next to a title moves under it (fills the width) */
@media (max-width: 640px) {
    #accountSection .acc2-title-row { flex-direction: column; align-items: stretch; }
    #accountSection .acc2-card-foot { flex-wrap: wrap; }
    /* Signed-in devices: text beside the icon, Sign out full width below */
    #accountSection .acc2-device { flex-wrap: wrap; }
    #accountSection .acc2-device-text { flex-basis: calc(100% - 48px); }
    #accountSection .acc2-device > .acc2-btn { width: 100%; justify-content: center; }
    /* Email: Change full width under the field */
    #accountSection .acc2-inline { flex-wrap: wrap; }
    #accountSection .acc2-inline > button { width: 100%; justify-content: center; }
}

/* ── Two-factor and email popups (share the popups-v2 frame) ─────────── */
.tf-qr { display: flex; justify-content: center; padding: 12px; margin: 0 0 14px; border-radius: 12px; background: #FFFFFF; }
.tf-qr svg { width: 180px; height: 180px; display: block; }
.tf-secret {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 18px; padding: 10px 12px;
    border-radius: 10px; background: var(--bg-tertiary); font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 0.8125rem; color: var(--text-primary); letter-spacing: 0.5px; word-break: break-all;
}
.tf-secret button, .tf-link {
    flex-shrink: 0; padding: 0; border: 0; background: none; color: var(--accent);
    font-family: Inter, sans-serif; font-size: 0.75rem; cursor: pointer;
}
.tf-steps { margin: 0 0 14px; padding: 0 0 0 18px; font-size: 0.8125rem; line-height: 1.6; color: var(--text-secondary); }
.tf-code-input { letter-spacing: 6px; font-family: 'IBM Plex Mono', ui-monospace, monospace !important; font-size: 1.125rem !important; text-align: center; }
.tf-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; padding: 14px; border-radius: 12px; background: var(--bg-tertiary); }
.tf-codes span { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 0.875rem; color: var(--text-primary); text-align: center; }
.tf-codes-actions { display: flex; gap: 8px; margin: 0 0 18px; }
.tf-codes-actions .pm-btn { flex: 1; height: 38px !important; font-size: 0.8125rem !important; }

/* Apple HIG: every button and link can be tapped in a 44 × 44px area */
#accountSection .acc2-btn,
#accountSection .acc2-btn-primary,
#accountSection .acc2-nav-item { min-height: 44px; }
/* Switches keep their look; the tap area grows to 44px tall */
#accountSection .acc2-switch { position: relative; }
#accountSection .acc2-switch::before { content: ''; position: absolute; inset: -9px 0; }
