/* =============================================================================
   THE ACCOUNT WINDOW (Session 14b phase 2, Barney's Accounts 1 frames 4, 6 and 7;
   html/Accounts.dc.html .acs, .prw, .plc, .tgl). features/accountWindow.js, and the plan columns
   (features/plans.js) shared with the signed-out See plans window (account.js). Loaded in the head
   beside account.css, so the splash has it. The frame is the Papers window's: 1296 px at 1440,
   88 px down; the close 36 px, 16 px in; content 32 px in. Sizes from the window tokens
   (peelback-design-system.css), each with its value as the fallback (Session 15b phase 4).
   ============================================================================= */

dialog.acw {
    position: fixed; inset: 0; margin: 88px auto 24px;
    width: min(1296px, calc(100vw - 32px)); max-height: calc(100vh - 112px); height: fit-content;
    box-sizing: border-box; padding: 0; border: 0; border-radius: 14px; overflow: hidden;
    background: #fff; color: #1A1A2E; text-align: left;
    box-shadow: 0 30px 80px rgba(26,26,46,.3), 0 0 0 1px rgba(26,26,46,.08);
    font: 400 14px/20px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif;
}
dialog.acw[open] { display: flex; flex-direction: column; }
dialog.acw::backdrop { background: rgba(26,26,46,.42); }
@media (max-height: 720px) { dialog.acw { margin-top: 16px; max-height: calc(100vh - 32px); } }
.acw button { font: inherit; border: 0; margin: 0; background: none; color: inherit; cursor: pointer; padding: 0; }
.acw :focus-visible { outline: 2px solid #544FF0; outline-offset: 2px; }
.acw h2:focus, .acw h3:focus { outline: none; }

.acw .acs-hd { position: relative; flex: none; padding: 24px 68px 20px 32px; border-bottom: 1px solid rgba(26,26,46,.08); }
.acw .acs-hd h2 { font: 600 24px/30px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif; letter-spacing: -0.01em; margin: 0; }
.acw .acs-x {
    position: absolute; top: var(--pb-close-inset, 16px); right: var(--pb-close-inset, 16px); width: var(--pb-close, 36px); height: var(--pb-close, 36px); display: grid; place-items: center;
    color: #4B4B55; border-radius: var(--pb-win-btn-r, 6px); background: #fff;
    box-shadow: 0 0 0 1px rgba(26,26,46,.07), 0 1px 1px rgba(26,26,46,.06);
}
.acw .acs-bd { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 248px minmax(0, 1fr); }

/* The left column: avatar, name and email; Profile, Plan, Settings; Sign out at the foot */
.acw .acs-nav { display: flex; flex-direction: column; gap: 2px; min-height: 470px; box-sizing: border-box; padding: 24px 20px 32px; border-right: 1px solid rgba(26,26,46,.08); background: #FAFAFC; overflow-y: auto; }
.acw .acs-me { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 10px; align-items: center; padding: 0 12px 18px; margin-bottom: 10px; border-bottom: 1px solid rgba(26,26,46,.08); }
.acw .acs-av { grid-row: span 2; width: 40px; height: 40px; border-radius: 20px; background: #1A1A2E; color: #fff; display: grid; place-items: center; font: 700 13px/1 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif; }
.acw .acs-me b { font-weight: 700; font-size: 15px; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acw .acs-me small { font-size: 12px; line-height: 16px; color: #6B6B72; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the window's button height (Barney's 38 in the 13 November pack) */
.acw .acs-nb { display: flex; align-items: center; height: var(--pb-win-btn-h, 40px); box-sizing: border-box; padding: 0 12px; border-radius: var(--pb-win-btn-r, 6px); text-align: left; font: 600 15px/20px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif; color: #1A1A2E; }
.acw .acs-nb:hover { background: #F4F3FE; }
.acw .acs-nb.on { background: #F4F3FE; color: #544FF0; box-shadow: inset 3px 0 0 #544FF0; }
.acw .acs-nb.out { margin-top: auto; color: #6B6B72; font-weight: 400; }
.acw .acs-nb.out:hover { color: #1A1A2E; text-decoration: underline; }

/* The section */
.acw .acs-main { padding: 24px 32px 32px; overflow-y: auto; min-width: 0; }
.acw .pph { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.acw .acs-main h3 { font: 600 22px/28px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif; margin: 0; }
.acw .acs-main .s { margin: 0 0 22px; color: #6B6B72; font-size: 15px; line-height: 22px; }

/* Rows: Profile and Settings. A group (g1, g2) shares one label and drops the rule between its rows */
.acw .prf { display: flex; flex-direction: column; }
.acw .prw { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 16px; align-items: start; padding: 14px 0; border-bottom: 1px solid rgba(26,26,46,.08); font: 400 15px/22px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif; color: #1A1A2E; }
.acw .prw:first-child { border-top: 1px solid rgba(26,26,46,.08); }
.acw .prw.g1 { border-bottom: 0; padding-bottom: 6px; }
.acw .prw.g2 { padding-top: 6px; }
.acw .prl { font-weight: 700; padding-top: 1px; }
.acw .prv { min-width: 0; overflow-wrap: anywhere; }
.acw .prv b { font-weight: 700; }
.acw .prv p { margin: 3px 0 0; font-size: 13px; line-height: 18px; color: #6B6B72; }
.acw .pra { display: flex; justify-content: flex-end; }
/* 32 px in rows */
.acw .prb {
    display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; height: var(--pb-row-btn-h, 32px); padding: 0 12px;
    font: var(--pb-win-btn-font, 700 11px/14px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif); letter-spacing: var(--pb-btn-track, .08em); text-transform: uppercase;
    color: #544FF0; background: #fff; border-radius: var(--pb-row-btn-r, 6px); box-shadow: 0 0 0 1px rgba(26,26,46,.12); white-space: nowrap;
}
.acw .prb:hover { background: #F4F3FE; }
.acw .prb.pri { background: #544FF0; color: #fff; box-shadow: 0 1px 2px rgba(84,79,240,.3); }
.acw .prb.pri:hover { background: #4743D8; }
.acw .prb.del { color: #B3261E; }
.acw .prb.del:hover { background: #FDF0EF; }
.acw .prb[aria-busy="true"], .acw [data-act="resend"][aria-busy="true"] { cursor: progress; opacity: .7; }

/* A row in edit (not drawn): the field, then Save and Cancel */
.acw .acw-edit { display: flex; flex-direction: column; gap: 8px; max-width: 480px; }
.acw .acw-edit p { margin: 0; }
.acw input.acw-in {
    display: block; width: 100%; height: var(--pb-field-h, 40px); box-sizing: border-box; margin: 0; padding: 0 12px;
    border: 0; border-radius: var(--pb-field-r, 6px); box-shadow: inset 0 0 0 1.5px #8A8A94; background: #fff; color: #1A1A2E;
    font: 400 15px/22px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif;
}
.acw input.acw-in:focus, .acw input.acw-in:focus-visible { outline: none; box-shadow: inset 0 0 0 2px #544FF0, 0 0 0 3px #DCDAFD; }
.acw input.acw-in.bad { box-shadow: inset 0 0 0 2px #B42318; }
.acw .acw-acts { display: flex; gap: 8px; margin-top: 4px; }
.acw .acw-lbl { font-weight: 700; }
.acw .acw-unset { color: #6B6B72; }
.acw .acw-sent { color: #6B6B72; }
.acw .acw-sent b { color: #1A1A2E; }
.acw .acw-note { font-size: 13px; line-height: 18px; color: #6B6B72; }
.acw .aw-link { display: inline; font-weight: 700; color: #544FF0; white-space: nowrap; }
.acw .aw-link:hover { text-decoration: underline; }
.acw .aw-err { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0 0; font: 400 14px/20px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif; color: #B42318; }
.acw .aw-err[hidden] { display: none; }
.acw .aw-err svg { flex: none; margin-top: 2px; }

/* The switch: 40 x 24; off #8A8A94 (3.4:1 on white), on purple (5.2:1); the knob's side says which */
.acw .tgl { position: relative; display: block; width: 40px; height: 24px; box-sizing: border-box; border-radius: 12px; background: #8A8A94; margin-top: 1px; }
.acw .tgl i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(26,26,46,.3); transition: left .15s; }
.acw .tgl.on { background: #544FF0; }
.acw .tgl.on i { left: 19px; }
@media (prefers-reduced-motion: reduce) { .acw .tgl i { transition: none; } }

/* ── The plans (frame 6): here and in the signed-out See plans window ── */
.plg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
.plc { border-radius: 12px; padding: 20px 20px 18px; box-shadow: 0 0 0 1px rgba(26,26,46,.12); display: flex; flex-direction: column; gap: 10px; font: 400 14px/20px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif; color: #1A1A2E; min-width: 0; }
.plc.on { box-shadow: 0 0 0 2px #544FF0; background: #FBFBFE; }
.plh { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plh h4 { margin: 0; font: 600 20px/26px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif; }
.plp { display: inline-flex; align-items: center; box-sizing: border-box; height: var(--pb-pill-h, 24px); padding: 0 10px; border-radius: 999px; background: #544FF0; color: #fff; font: 600 12px/16px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif; white-space: nowrap; }
.plt { font: 600 13px/18px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif; color: #6B6B72; white-space: nowrap; }
.pls { margin: 0; color: #6B6B72; }
.plc ul { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.plc li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: start; }
.plc li svg { margin-top: 3px; }
.plu { margin: 4px 0 0; padding-top: 10px; border-top: 1px solid rgba(26,26,46,.08); color: #6B6B72; font-size: 13px; line-height: 18px; display: flex; flex-direction: column; gap: 6px; }
.plu i { display: block; height: 6px; border-radius: 3px; background: #ECEDF1; overflow: hidden; }
.plu i b { display: block; height: 100%; background: #544FF0; }
/* a window's button (Part 2: 40 px, 11 px capitals, 6 px corners), 10 px under the list: the card's own gap */
.plc .r6-ghost {
    align-self: flex-start; margin-top: 0; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; height: var(--pb-win-btn-h, 40px); padding: 0 16px;
    font: var(--pb-win-btn-font, 700 11px/14px 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif); letter-spacing: var(--pb-btn-track, .08em); text-transform: uppercase; text-decoration: none;
    color: #544FF0; background: #fff; border-radius: var(--pb-win-btn-r, 6px); box-shadow: 0 0 0 1px rgba(26,26,46,.14), 0 1px 2px rgba(26,26,46,.06);
}
.plc .r6-ghost:hover { background: #F4F3FE; text-decoration: none; }
.plc .r6-ghost:focus-visible { outline: 2px solid #544FF0; outline-offset: 2px; }

/* The signed-out See plans window (account.js): the sign-in window's frame, wide enough for three */
dialog.aw[data-view="plans"] { width: min(1000px, calc(100vw - 32px)); }
dialog.aw[data-view="plans"] .aw-sub { margin-bottom: 22px; }

/* Under 720 px (not drawn; the launch pass): stacked and scrolling, still usable */
@media (max-width: 719px) {
    dialog.acw { margin: 16px auto; max-height: calc(100vh - 32px); }
    .acw .acs-bd { grid-template-columns: 1fr; overflow-y: auto; }
    .acw .acs-nav { min-height: 0; border-right: 0; border-bottom: 1px solid rgba(26,26,46,.08); padding: 16px 20px; flex-direction: row; flex-wrap: wrap; }
    .acw .acs-me { flex-basis: 100%; }
    .acw .acs-nb.out { margin-top: 0; margin-left: auto; }
    .acw .acs-main { padding: 20px; overflow: visible; }
    .acw .prw { grid-template-columns: 1fr; gap: 8px; }
    .acw .pra { justify-content: flex-start; }
    .plg { grid-template-columns: 1fr; }
}
@media (min-width: 720px) and (max-width: 999px) {
    .plg { grid-template-columns: 1fr; }
}

/* Delete your account: Delete account stays red, paler, until the field says DELETE */
.aw .aw-btn.aw-btn--danger[aria-disabled="true"]:not([aria-busy="true"]) { background: #E3A39C; box-shadow: none; cursor: not-allowed; }
