/* The account settings panel.
 *
 * Loaded on top of style.css, which already carries the tokens, the page
 * background, the `.avatar`, `.tag` and `.acct-btn` rules — this file only
 * adds what a settings screen needs that a launcher does not: an overlay to
 * open it in, cards, and rows that turn into forms.
 *
 * It opens as a panel over the launcher (see account-panel.js), not a page of
 * its own — the rail and top bar stay put, so nothing about it reads as
 * leaving the app. The content column below is still one narrow column, not
 * a two-pane console: a settings screen is read far more often than it is
 * edited, and a single column is what makes it readable.
 */

/* ---------------------------------------------------------------- overlay */

.acct-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}

.acct-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(10 16 32 / .4);
  animation: acct-overlay-fade var(--base) var(--ease);
}
@keyframes acct-overlay-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.acct-panel {
  position: relative;
  width: min(760px, 100vw);
  height: 100%;
  overflow-y: auto;
  background: var(--bg);
  box-shadow: var(--shadow-pop);
  animation: acct-panel-in var(--base) var(--ease);
}
@keyframes acct-panel-in {
  from { transform: translateX(28px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.acct-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px var(--shell-pad);
  background: rgb(242 245 250 / .72);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--line-soft);
}

/* The panel's close button — a <button>, not a link, since it never
   navigates anywhere. Name kept from when this page had a real "back to
   apps" link of its own; a rename buys nothing now that it's a close icon. */
.acct-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgb(255 255 255 / .9);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
}
.acct-back:hover { background: #fff; color: var(--ink); }
.acct-back svg { width: 16px; height: 16px; }

.acct-top-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

/* ------------------------------------------------------------------ page */

.acct-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px var(--shell-pad) 72px;
}

.acct-title {
  margin: 0;
  font-size: 27px;
  font-weight: 680;
  letter-spacing: -.028em;
  background: linear-gradient(180deg, #16264a, var(--navy));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.acct-lede {
  margin: 6px 0 26px;
  color: var(--ink-3);
  font-size: 14px;
}

/* ------------------------------------------------------------------ card */

.card {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card h2 {
  margin: 0;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fff, var(--surface-2));
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* --------------------------------------------------------------- one row */

.row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px;
}
.row + .row { border-top: 1px solid var(--line-soft); }

.row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.row-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: .01em;
}
.row-value {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 15px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.row-help {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-3);
}

.row > .acct-btn { flex: 0 0 auto; margin-top: 14px; }
.row > a.acct-btn { text-decoration: none; display: inline-flex; align-items: center; }

/* --- a row while it is being edited --- */
.row-edit { margin-top: 8px; }
.row-input {
  width: 100%;
  max-width: 380px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.row-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--focus) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 14%, transparent);
}
.row-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.row-error {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: #b42318;
}

/* ---------------------------------------------------------------- avatar */

.row-avatar { align-items: center; }
.avatar-edit {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}
.avatar.xl {
  width: 72px; height: 72px;
  border-radius: 50%;
  font-size: 25px;
  overflow: hidden;
}
.avatar.xl img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ----------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  translate: -50% 0;
  z-index: 60;
  padding: 11px 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, #16234a, #0d1730);
  color: #fff;
  font-size: 13.5px;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .1), var(--shadow-pop);
}
.toast.error { background: linear-gradient(180deg, #7a1d15, #4a120d); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 620px) {
  .row { flex-direction: column; align-items: stretch; gap: 10px; }
  .row > .acct-btn { margin-top: 0; align-self: flex-start; }
  .row-avatar { align-items: flex-start; }
  .avatar-edit { flex-direction: row; }
  .acct-title { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- the recovery row while it still needs attention ---
   The launcher carries no banner about this: someone who came to open an app
   cannot finish a recovery address there. So the row itself is the warning —
   an amber rail and the consequence in words, directly above the button that
   fixes it. Amber, not red: nothing is broken yet, this is the "will be
   broken the day you forget your password" state. */

.row.row-attention {
  border-inline-start: 3px solid var(--warn);
  padding-inline-start: 17px;
  background: color-mix(in srgb, var(--warn-bg) 45%, transparent);
}

.row-note {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: #8a5a06;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}
.row-note::before { content: "!"; font-weight: 700; color: var(--warn); }
