/* ============================================================
   Profile page — ported from the design's page-scoped style blocks
   (docs/design/review/pages/profile.html), tokenised. Layout only;
   colours come from tokens.css, the card system from dashboard.css.
   ============================================================ */

/* ---- Identity header card ---- */
.identity-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.identity-card__avatar {
  width: 52px; height: 52px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-weight: 800; font-size: 22px;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.identity-card__main { flex: 1; min-width: 240px; }
body:not(.landing) .identity-card__name { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink); }
.identity-card__meta { margin: 3px 0 0; font-size: 13px; color: var(--ink2); }
.identity-card__actions { display: flex; gap: 14px; }

/* ---- 2-col grid; each card is a flex column with its actions at the
   bottom (margin-top:auto). The Team card ends in its invite row + note. ---- */
.profile-grid { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: stretch; margin-top: 16px; }
@media (min-width: 860px) { .profile-grid { grid-template-columns: 1fr 1fr; } }
.profile-grid > section { margin: 0; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; }
.profile-grid section > form { flex: 1; display: flex; flex-direction: column; }
.profile-grid section > form > .form-actions { margin-top: auto; padding-top: 10px; }
.profile-grid section > form > .k-card__note { margin-top: auto; }
.profile-grid section > .k-card__note:last-child { margin-top: auto; margin-bottom: 0; }
.profile-grid .form-actions { margin-bottom: 0; border-top: 0; padding-top: 0; }
.profile-grid .k-card__note { border-top: 0; padding-top: 0; margin: 18px 0 0; }
.profile-grid section > form > .form-actions + .k-card__note { margin-top: 18px; }
.profile-grid .form-actions button, .profile-grid .k-card__note--actions .btn-pill { margin-bottom: 0; }
.profile-grid section > .k-card__note--actions { margin-top: auto; margin-bottom: 0; padding-bottom: 0; }
.profile-grid [data-testid="notifications-card"] .form-actions { margin-bottom: 38px; }
.profile-grid .k-card form > div { margin-bottom: 12px; }

/* Invite row: label + input + submit on one line, right under the table. */
.profile-grid .inline-form { margin-top: 14px; display: flex; flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-grid .inline-form label { flex: 0 0 auto; margin: 0; }
.profile-grid .inline-form input[type="email"] { flex: 1 1 180px; min-width: 160px; box-sizing: border-box; }
.profile-grid .inline-form input[type="submit"] { flex: 0 0 auto; margin: 0; }

/* Row actions (Remove / Revoke) are DELETE forms styled as the design's
   .k-card__more links. Beats the global accent-button rule by specificity. */
.profile-grid td.numeric form { display: inline; margin: 0; }
body:not(.landing) .profile-grid td.numeric button.k-card__more {
  background: transparent; border: 0; padding: 0; border-radius: 0;
  font-size: 12.5px; font-weight: 600; color: var(--accent); white-space: nowrap;
}
body:not(.landing) .profile-grid td.numeric button.k-card__more:hover { background: transparent; box-shadow: none; text-decoration: underline; }
body:not(.landing) .profile-grid .k-card__note--actions form { display: inline; }

/* ---- Form grids ---- */
.form-grid { display: grid; gap: 12px 14px; grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
.profile-grid .k-card form > .form-grid > div { margin: 0; min-width: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid label { font-size: 12.5px; color: var(--ink2); display: block; margin-bottom: 4px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; box-sizing: border-box; }

/* ---- Preference lists ---- */
.pref-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 14px; }
.pref-list label { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.pref-list--inline { flex-direction: row; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.pref-list__label { font-size: 12.5px; color: var(--ink3); width: 100%; }
.notif-cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px 20px; align-items: start; }
.notif-cols .pref-list { margin: 0; }
.notif-tz { margin-top: 30px; }
.notif-tz label { font-size: 12.5px; color: var(--ink2); display: block; margin-bottom: 4px; }
.notif-tz select { width: 100%; box-sizing: border-box; }
@media (max-width: 640px) { .notif-cols { grid-template-columns: 1fr; } }

/* Wish-chains: the "Other…" input reveals CSS-only via :has(). */
.wish-chain { margin: 12px 0; }
.wish-chain > label { font-size: 12.5px; color: var(--ink2); display: block; margin-bottom: 4px; }
.wish-chain .pref-list__label { margin-bottom: 6px; display: block; width: auto; }
.wish-chain__other { display: none; margin-top: 8px; width: 100%; box-sizing: border-box; }
.wish-chain:has(.wish-other-toggle:checked) .wish-chain__other { display: block; }

/* ---- Danger zone: quiet at rest, red on hover ---- */
.profile-danger-wrap { margin-top: 16px; }
.profile-danger-wrap .k-card--danger { margin-top: 0; border-color: var(--line-10); }
.profile-danger-wrap .k-card--danger:hover { border-color: color-mix(in srgb, var(--err) 50%, transparent); }
.k-card--danger .k-card__label--danger { color: var(--err); }
.danger-grid { display: grid; gap: 26px; grid-template-columns: 1fr; margin-top: 4px; }
@media (min-width: 900px) { .danger-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.danger-title { margin: 0 0 8px; font-weight: 700; font-size: 15px; color: var(--ink); }
.danger-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--ink2); }
.danger-note { margin: 10px 0 0; font-size: 13px; font-weight: 700; color: var(--err); }
.danger-grid form { display: flex; flex-direction: column; gap: 8px; align-self: end; }
.danger-grid form label { font-size: 13px; }
.danger-grid input { width: 100%; box-sizing: border-box; }
.danger-grid .form-actions { margin: 2px 0 0; border-top: 0; padding-top: 0; }
.danger-grid .danger-owner-note { align-self: end; margin: 0; }
body:not(.landing) .k-card--danger button.btn-danger {
  background: color-mix(in srgb, var(--err) 10%, transparent);
  color: var(--err);
  border: 1px solid color-mix(in srgb, var(--err) 45%, transparent);
  transition: background-color .15s ease, color .15s ease;
}
body:not(.landing) .k-card--danger button.btn-danger:hover { background: var(--err); color: #fff; border-color: var(--err); box-shadow: none; }
body:not(.landing) .k-card--danger button.btn-danger:disabled { opacity: .55; cursor: not-allowed; }
body:not(.landing) .k-card--danger button.btn-danger:disabled:hover { background: color-mix(in srgb, var(--err) 10%, transparent); color: var(--err); }
