.profile-page { min-height: 100vh; background: #f2f5f2; }
.profile-topbar { position: sticky; top: 0; z-index: 20; }
.profile-topbar .notification-menu { margin-left: auto; }
.profile-topbar .notification-menu + .topbar-account-slot { margin-left: 0 !important; }
.profile-brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: #183f35; background: var(--mint); font-size: 1rem; }
.profile-button { text-decoration: none; }
.profile-shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 1.5rem 0 4rem; }
.profile-loading, .profile-auth-gate { min-height: 45vh; display: grid; place-items: center; align-content: center; gap: .75rem; text-align: center; color: var(--muted); }
.profile-auth-gate > span { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; color: var(--forest-800); background: var(--mint-pale); font-size: 1.6rem; }
.profile-auth-gate h1, .profile-auth-gate p { margin: 0; }
.profile-auth-gate h1 { color: var(--forest-950); }
.profile-hero { min-height: 260px; display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding: clamp(2rem, 5vw, 4rem); border-radius: 1.4rem; color: white; background: radial-gradient(circle at 84% 12%, rgba(137,226,181,.3), transparent 28%), linear-gradient(135deg, #0b3028, #155444); box-shadow: 0 24px 55px rgba(9,42,34,.16); }
.profile-hero h1 { margin: .6rem 0 .45rem; font-family: Georgia, serif; font-size: clamp(2.4rem, 5vw, 4.5rem); font-weight: 500; }
.profile-hero p { max-width: 640px; margin: 0; color: #c8d9d3; line-height: 1.65; }
.profile-hero .back-link { display: inline-flex; margin-bottom: 1.6rem; color: #d7e7e1; text-decoration: none; }
.profile-identity-summary { min-width: 240px; display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; border: 1px solid rgba(255,255,255,.15); border-radius: 1rem; background: rgba(255,255,255,.08); backdrop-filter: blur(8px); }
.profile-large-avatar { width: 64px; height: 64px; display: grid; place-items: center; flex: 0 0 64px; border-radius: 50%; color: var(--forest-950); background: var(--mint); font-size: 1.2rem; font-weight: 900; }
.profile-identity-summary small, .profile-identity-summary strong, .profile-identity-summary em { display: block; }
.profile-identity-summary small { color: #a9c2b9; font-size: .65rem; }
.profile-identity-summary strong { margin: .2rem 0; font-size: 1.05rem; }
.profile-identity-summary em { color: var(--gold); font-size: .66rem; font-style: normal; }
.profile-layout { display: grid; grid-template-columns: 215px minmax(0,1fr); gap: 1.25rem; margin-top: 1.25rem; align-items: start; }
.profile-side-nav { position: sticky; top: 92px; display: grid; gap: .35rem; padding: .65rem; border: 1px solid var(--line); border-radius: 1rem; background: white; box-shadow: 0 10px 30px rgba(16,52,43,.05); }
.profile-side-nav a { display: flex; align-items: center; gap: .7rem; padding: .8rem; border-radius: .7rem; color: var(--forest-800); text-decoration: none; font-size: .72rem; font-weight: 800; }
.profile-side-nav a:hover, .profile-side-nav a.active { color: var(--forest-950); background: var(--mint-pale); }
.profile-side-nav span { color: #8aa39a; font-size: .6rem; }
.profile-sections { display: grid; gap: 1.25rem; }
.profile-card { scroll-margin-top: 100px; padding: clamp(1.2rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: 1.1rem; background: white; box-shadow: 0 12px 35px rgba(16,52,43,.05); }
.profile-card-head { display: flex; justify-content: space-between; align-items: start; gap: 1.5rem; margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.profile-card-head h2 { margin: .2rem 0 .4rem; color: var(--forest-950); font-family: Georgia, serif; font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 500; }
.profile-card-head p { max-width: 670px; margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.65; }
.profile-state-chip { flex: 0 0 auto; padding: .35rem .6rem; border-radius: 999px; color: #356354; background: var(--mint-pale); font-size: .58rem; font-weight: 900; }
.profile-state-chip.secure { color: #755119; background: var(--gold-pale); }
.profile-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.profile-wide { grid-column: 1 / -1; }
.profile-actions { display: flex; justify-content: flex-end; gap: .7rem; }
.profile-message { margin-top: 1rem; padding: .8rem 1rem; border-radius: .7rem; color: #285d4b; background: var(--mint-pale); font-size: .72rem; line-height: 1.5; }
.profile-message.error { color: #8d302b; background: #fff0ee; }
.profile-dog-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem; }
.profile-dog-card { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .85rem; padding: 1rem; border: 1px solid var(--line); border-radius: .9rem; background: #fbfcfb; }
.profile-dog-media { position: relative; align-self: start; }
.profile-dog-icon { width: 72px; height: 72px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--gold-pale); }
button.profile-dog-icon { cursor: zoom-in; }
.profile-dog-icon { overflow: hidden; }
.profile-dog-icon img { width: 100%; height: 100%; object-fit: cover; }
.profile-dog-media-change { position: absolute; right: -.25rem; bottom: -.35rem; min-width: 32px; min-height: 32px; display: grid; place-items: center; padding: .25rem .45rem; border: 2px solid white; border-radius: 999px; color: white; background: var(--forest-700); box-shadow: 0 4px 12px rgba(7,39,31,.22); cursor: pointer; }
.profile-dog-media-change span { font-weight: 900; }
.profile-dog-media-change small { position: absolute; width: max-content; top: calc(100% + .2rem); right: 0; color: var(--forest-700); font-size: .5rem; font-weight: 900; opacity: 0; pointer-events: none; }
.profile-dog-media-change:hover small,.profile-dog-media-change:focus-within small { opacity: 1; }
.profile-dog-media-change input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.profile-dog-upload-status { min-height: .9rem; color: #28735d !important; }
.profile-dog-upload-status[data-phase="validating"],.profile-dog-upload-status[data-phase="reading"],.profile-dog-upload-status[data-phase="uploading"],.profile-media-message[data-phase="validating"],.profile-media-message[data-phase="reading"],.profile-media-message[data-phase="uploading"] { padding: .35rem .5rem; border-radius: .42rem; background: linear-gradient(90deg,rgba(113,204,169,.24) 0 var(--upload-progress,0%),rgba(240,247,244,.82) var(--upload-progress,0%) 100%); transition: background .18s ease; }
.profile-dog-upload-status[data-phase="complete"],.profile-media-message[data-phase="complete"] { padding: .35rem .5rem; border-radius: .42rem; color: #1f674f !important; background: #e9f7f1; }
.profile-dog-upload-status.error { color: #9a3333 !important; }
.profile-dog-card.uploading { border-color: #8ec9b4; box-shadow: 0 0 0 3px rgba(93,182,148,.1); }
.profile-dog-copy strong, .profile-dog-copy small { display: block; }
.profile-dog-copy strong { color: var(--forest-950); }
.profile-dog-copy small { margin-top: .2rem; color: var(--muted); font-size: .64rem; }
.profile-dog-copy p { margin: .65rem 0 0; color: #4d6b61; font-size: .72rem; line-height: 1.5; }
.profile-dog-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: .5rem; padding-top: .65rem; border-top: 1px solid var(--line); }
.profile-empty-dogs { grid-column: 1 / -1; padding: 2rem; border: 1px dashed #bfd0ca; border-radius: .9rem; text-align: center; color: var(--muted); background: #fafcfb; }
.profile-empty-dogs strong, .profile-empty-dogs span { display: block; }
.profile-empty-dogs strong { margin-bottom: .25rem; color: var(--forest-800); }
.dog-sharing-strip { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding: 1rem; border-radius: .85rem; color: #365d50; background: var(--mint-pale); }
.dog-sharing-strip > div { display: flex; align-items: center; gap: .75rem; }
.dog-sharing-strip > div > span:first-child { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: white; }
.dog-sharing-strip strong, .dog-sharing-strip small { display: block; }
.dog-sharing-strip small { margin-top: .15rem; font-size: .64rem; }
.profile-access-preview { margin-bottom: 0; }
.account-email-card { display: flex; align-items: center; gap: .8rem; padding: 1rem; border: 1px solid var(--line); border-radius: .85rem; background: #fbfcfb; }
.account-email-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: #6d4e1e; background: var(--gold-pale); }
.account-email-card small, .account-email-card strong { display: block; }
.account-email-card small { color: var(--muted); font-size: .62rem; }
.account-email-card strong { margin-top: .15rem; color: var(--forest-950); }
.email-change-form { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: .8rem; margin-top: 1rem; }
.email-code-panel { margin-top: 1rem; padding: 1rem; border: 1px solid #b9dccc; border-radius: .85rem; background: #f5fbf8; }
.email-code-panel h3 { margin: .2rem 0 1rem; color: var(--forest-950); }
.email-code-panel form { display: flex; align-items: end; gap: .8rem; }
.email-code-panel .field { flex: 1; }
.profile-preview-code { display: inline-flex; align-items: center; gap: .8rem; margin-bottom: .8rem; padding: .65rem .8rem; border-radius: .6rem; color: #604518; background: var(--gold-pale); }
.profile-preview-code small { font-size: .55rem; font-weight: 900; }
.profile-preview-code strong { letter-spacing: .18em; }
.account-actions { display: grid; gap: 1rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.account-actions > button { justify-self: start; }
.account-danger { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border: 1px solid #f0cbc7; border-radius: .8rem; background: #fff9f8; }
.account-danger strong, .account-danger small { display: block; }
.account-danger strong { color: #74332d; }
.account-danger small { max-width: 650px; margin-top: .2rem; color: #8b6a66; font-size: .62rem; line-height: 1.5; }
.account-danger.protected { border-color: #ead9ad; background: #fffaf0; }
.account-danger.protected strong { color: #6e511e; }
.profile-dog-dialog { width: min(680px,calc(100% - 2rem)); padding: 0; border: 0; border-radius: 1rem; box-shadow: 0 30px 90px rgba(6,31,25,.35); }
.profile-dog-dialog::backdrop { background: rgba(4,27,22,.72); backdrop-filter: blur(3px); }
.profile-dog-form { display: grid; gap: 1rem; padding: 1.5rem; }

@media (max-width: 900px) {
  .profile-hero { align-items: start; flex-direction: column; }
  .profile-identity-summary { width: 100%; }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-side-nav { position: static; grid-template-columns: repeat(3,1fr); }
  .profile-side-nav a { justify-content: center; text-align: center; }
  .profile-dog-list { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .profile-media-card,.pack-emblem-card { grid-template-columns: auto 1fr; }
  .media-file-button,.profile-media-message { grid-column: 1 / -1; }
  .profile-topbar .main-nav { display: none; }
  .profile-shell { width: min(100% - 1rem,1180px); padding-top: .5rem; }
  .profile-hero { min-height: auto; padding: 1.5rem; border-radius: 1rem; }
  .profile-form, .email-change-form { grid-template-columns: 1fr; }
  .profile-wide { grid-column: auto; }
  .profile-card-head, .dog-sharing-strip, .account-danger { align-items: stretch; flex-direction: column; }
  .profile-side-nav { overflow-x: auto; grid-template-columns: repeat(3,minmax(140px,1fr)); }
  .email-code-panel form { align-items: stretch; flex-direction: column; }
  .email-code-panel form button { width: 100%; }
}
.profile-media-card,.pack-emblem-card { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .9rem; margin: 0 0 1.1rem; padding: 1rem; border: 1px solid #d9e5df; border-radius: .9rem; background: #f7faf8; }
.profile-media-preview,.pack-emblem-preview { width: 74px; height: 74px; display: grid; place-items: center; overflow: hidden; padding: 0; border: 0; border-radius: 50%; color: #5d4318; background: var(--gold-pale); font-weight: 900; cursor: zoom-in; }
.pack-emblem-preview { border-radius: .9rem; }
.profile-media-preview:not([data-media-full]),.pack-emblem-preview:not([data-media-full]) { cursor: default; }
.profile-media-preview img,.pack-emblem-preview img { width: 100%; height: 100%; object-fit: cover; }
.pack-emblem-preview img { object-fit: contain; }
.profile-media-card strong,.profile-media-card small,.pack-emblem-card strong,.pack-emblem-card small { display: block; }
.profile-media-card strong,.pack-emblem-card strong { color: var(--forest-950); font-size: .8rem; }
.profile-media-card strong em,.pack-emblem-card strong em { color: #8a651f; font-size: .55rem; font-style: normal; text-transform: uppercase; }
.profile-media-card small,.pack-emblem-card small { margin-top: .25rem; color: var(--muted); font-size: .65rem; line-height: 1.45; }
.media-file-button { cursor: pointer; white-space: nowrap; }
.media-file-button.busy,.media-file-button[aria-busy="true"] { opacity: .65; pointer-events: none; }
.media-file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.profile-media-message { grid-column: 2 / -1; color: #25745d; font-size: .65rem; }
.profile-media-message.error { color: #9a3333; }
