/* Account & settings layout.

   The page was a single column of stacked cards; everything from profile to
   account deletion sat on one scroll. This is the sidebar-and-panels structure
   from the agreed design, which gives each concern its own screen and — more
   usefully — gives every future setting an obvious home instead of another
   card on the pile.

   Loaded after auth.css and reuses its variables, so the page stays one theme. */

.page-intro { margin-bottom: 26px; }
.page-intro h1 { margin: 6px 0 5px; font-family: "Fraunces", Georgia, serif; font-size: clamp(34px, 4.4vw, 50px); font-weight: 400; letter-spacing: -.04em; line-height: 1.08; }
.page-intro > div > p:last-child { margin: 0; color: var(--muted); }

.settings-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 20px; align-items: start; }

.settings-sidebar { position: sticky; top: 22px; overflow: hidden; padding: 0; }
.sidebar-profile { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid var(--line); }
.sidebar-identity { min-width: 0; }
.sidebar-profile h2 { margin: 0; font-size: 16px; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile .plan-pill { grid-column: 1 / -1; justify-self: start; margin: 0; }

.settings-nav { display: grid; gap: 2px; padding: 10px; }
.nav-button, .sidebar-action {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px;
  padding: 9px 11px; border: 0; border-radius: 10px; background: transparent;
  color: var(--ink); font-size: 13.5px; font-weight: 650; text-align: left; cursor: pointer;
}
.nav-button:hover, .sidebar-action:hover { background: color-mix(in srgb, var(--mint) 55%, transparent); }
.nav-button.is-active { background: var(--mint); color: var(--green); font-weight: 800; }
.nav-glyph { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 7px; background: color-mix(in srgb, var(--mint) 70%, transparent); color: var(--green); font-size: 12.5px; font-weight: 900; }
.nav-button.is-active .nav-glyph { background: var(--paper); }
.sidebar-bottom { display: grid; gap: 2px; padding: 10px; border-top: 1px solid var(--line); }
.sidebar-action { color: var(--muted); }

.settings-content { min-width: 0; padding: 24px; }
.panel[hidden] { display: none !important; }
.panel-heading { margin-bottom: 20px; }
.panel-heading h2 { margin: 0 0 3px; font-size: 23px; letter-spacing: -.025em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; }

.identity-strip { display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.identity-strip .avatar { width: 46px; height: 46px; flex: none; margin: 0; font-size: 18px; }
.identity-copy { min-width: 0; }
.identity-copy h3 { margin: 0 0 2px; font-size: 16px; }
.identity-copy p { margin: 0; color: var(--muted); font-size: 12.5px; }
.identity-strip .button { margin-left: auto; }

.overview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.summary-card { display: flex; flex-direction: column; min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.card-label { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; color: var(--green); font-size: 13px; font-weight: 800; }
.card-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--mint); color: var(--green); font-size: 13px; }
.card-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.card-title-line h3 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.summary-lines { margin: 8px 0 16px; color: var(--muted); font-size: 12.5px; }
.summary-lines p { margin: 4px 0; }
.summary-card .button { margin-top: auto; align-self: flex-start; }
.status-pill { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; background: var(--mint); color: var(--green); font-size: 11px; font-weight: 800; }
.status-pill.neutral { background: #eef1ee; color: var(--muted); }

.support-strip { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.support-strip h3 { margin: 0 0 2px; font-size: 13.5px; }
.support-strip p { margin: 0; color: var(--muted); font-size: 12px; }
.support-actions { display: flex; gap: 8px; margin-left: auto; }

.settings-card { margin-top: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.settings-card:first-of-type { margin-top: 0; }
.settings-card > h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.015em; }
.settings-card > p { margin: 0 0 18px; color: var(--muted); font-size: 12.5px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.settings-card .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.settings-card .field label, .settings-card .field > span { font-size: 11.5px; font-weight: 800; margin: 0; }
.settings-card .field input, .settings-card .field select {
  width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #cbd4cd;
  border-radius: 9px; background: white; color: var(--ink); outline: none;
}
.settings-card .field input:disabled { background: #f2f4f2; color: var(--muted); }
.settings-card .field small { color: var(--muted); font-size: 11px; }
.field-submit { justify-content: flex-end; }
.field-submit .button { min-height: 42px; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }

.button { min-height: 38px; padding: 9px 14px; border: 1px solid var(--green); border-radius: 9px; background: white; color: var(--green); font-size: 12.5px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.button:hover { background: var(--mint); }
.button.primary, .button.button-primary { background: var(--green); color: white; }
.button.primary:hover { background: #17664d; }
.button.ghost { border-color: #cbd4cd; color: var(--ink); }
.button.small { min-height: 33px; padding: 7px 11px; font-size: 12px; }

.note { margin: 0 0 14px; padding: 12px 14px; border-left: 3px solid var(--green); border-radius: 7px; background: var(--mint); color: var(--muted); font-size: 12px; }

.plan-hero { display: flex; align-items: center; gap: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(120deg, white, var(--mint)); }
.plan-hero-copy { flex: 1; min-width: 0; }
.plan-hero h3 { margin: 2px 0 5px; font-size: 22px; }
.plan-hero p { margin: 0; color: var(--muted); font-size: 12.5px; }
.plan-hero .button { flex: none; }
.settings-content .term-list { margin-top: 14px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.settings-content table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 12.5px; }
.settings-content th, .settings-content td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.settings-content th { background: color-mix(in srgb, var(--mint) 42%, transparent); color: var(--muted); font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; }
.settings-content tr:last-child td { border-bottom: 0; }

.broker-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 15px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.broker-card + .broker-card { margin-top: 10px; }
.broker-logo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--mint); color: var(--green); font-weight: 900; }
.broker-card h3 { margin: 0 0 3px; font-size: 14px; }
.broker-card p { margin: 0; color: var(--muted); font-size: 11.5px; }

.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.help-card { padding: 17px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.help-card h3 { margin: 0 0 5px; font-size: 14px; }
.help-card p { margin: 0 0 13px; color: var(--muted); font-size: 12px; }

/* Deletion keeps its own visual quarantine — it is the one action here that
   cannot be undone. */
.settings-content .danger-zone { padding: 17px; border: 1px solid #e3b8ae; border-radius: 11px; background: #fdf6f4; }
.settings-content .danger-zone h3 { margin: 0 0 3px; color: #b04a3c; font-size: 15px; }
.settings-content .danger-zone p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.settings-content .danger-zone .field { max-width: 320px; margin-bottom: 12px; }
.button-danger { border-color: #b04a3c; background: #b04a3c; color: white; }
.button-danger:hover { background: #93382c; }

.account-status { margin: 0 0 12px; }
.empty-state { margin: 0; padding: 20px 0; color: var(--muted); font-size: 13px; }
.mobile-section-select { display: none; }

@media (max-width: 920px) {
  /* Seven stacked nav buttons would push the panel itself below the fold, so
     the sidebar collapses to a summary and a select. */
  .settings-layout { grid-template-columns: 1fr; }
  .settings-sidebar { position: static; }
  .settings-nav { display: none; }
  .mobile-section-select { display: block; padding: 12px; border-top: 1px solid var(--line); }
  .mobile-section-select .field { display: grid; gap: 6px; margin: 0; }
  .mobile-section-select select { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid #cbd4cd; border-radius: 9px; background: white; color: var(--ink); }
  .sidebar-bottom { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar-bottom .sidebar-action { justify-content: center; text-align: center; }
}

@media (max-width: 620px) {
  .account-nav-signout { min-height: 38px; display: inline-flex; align-items: center; padding: 7px 2px; }
  .settings-content { padding: 16px; }
  .identity-strip { flex-wrap: wrap; }
  .identity-strip .button { width: 100%; margin-left: 0; }
  .support-strip { flex-direction: column; align-items: flex-start; }
  .support-actions { margin-left: 0; width: 100%; }
  .support-actions .button { flex: 1; }
  .plan-hero { flex-direction: column; align-items: stretch; }
  .broker-card { grid-template-columns: auto minmax(0, 1fr); }
  .broker-actions { grid-column: 1 / -1; }
  .broker-actions .button { width: 100%; }
}
