.profile-sheet {
  background: var(--cream);
  color: var(--ink);
}

.profile-sheet h2 {
  margin: 0 50px 18px 0;
  color: var(--berry);
  font-size: clamp(34px, 7vw, 52px);
}

.profile-layout {
  display: grid;
  gap: 12px;
  clear: both;
}

.profile-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
}

.water-hero {
  display: grid;
  grid-template-columns: minmax(75px, 30%) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 16px;
  background: #782f48;
  color: #fff7f1;
}
.water-hero svg { display: block; width: 100%; max-height: 165px; }
.water-hero .glass-outline { fill: #fff1; stroke: #ffe9e0; stroke-width: 2.4; }
.water-hero .glass-rim { fill: none; stroke: #ffe9e0; stroke-width: 2; }
.water-hero .glass-shadow { fill: #2d081433; }
.water-hero #carafe-wave, .water-hero #cup-wave { visibility: hidden; }
#water-log-count { margin: 4px 0; font-size: clamp(24px, 7vw, 42px); font-weight: 700; }
#water-goal, #water-achievement { margin: 4px 0; }
.water-hero #water-log-title,
.water-hero #water-log-count,
.water-hero #water-goal,
.water-hero #water-achievement { color: #fff7f1; }
#water-progress { display: block; width: 100%; margin-top: 8px; accent-color: #efaa8d; }
#water-log .water-log-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
#water-log button:not(.primary) {
  min-height: 44px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--berry);
  background: var(--paper);
}
#water-log button:disabled { opacity: .55; cursor: default; }
#water-custom, .water-history { margin: 12px 0; }
#water-custom button { margin: 8px 4px 0 0; }
.water-history summary { padding: 10px 0; cursor: pointer; }
.water-history ul, .water-entry-list { padding: 0; list-style: none; }
.water-history li, .water-entry-list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); }
.water-history li strong, .water-entry-list li span { margin-right: auto; }
.water-history li strong { margin-right: 0; margin-left: auto; }
.water-calendar { padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 16px; }
.water-calendar > summary { color: var(--berry); font-weight: 700; }
.water-calendar .water-calendar-period { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.water-calendar .water-calendar-period select { width: auto; min-height: 44px; margin: 0; }
.water-calendar-scroll { min-width: 0; overflow-x: auto; margin-top: 12px; padding: 3px 1px 6px; }
.water-calendar-scroll:focus-visible { outline: 2px solid #782f48; outline-offset: 2px; }
.water-calendar-chart { display: grid; grid-template-columns: repeat(var(--water-columns), minmax(40px, 1fr)); gap: 4px; padding-bottom: 6px; }
.water-calendar-column { display: grid; grid-template-rows: auto 95px auto; gap: 6px; text-align: center; font-size: 10px; white-space: nowrap; }
.water-calendar-compact { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.water-calendar-compact .water-calendar-column { grid-template-rows: minmax(2.4em, auto) 95px minmax(2.4em, auto); white-space: normal; }
.water-calendar-bar { display: flex; align-items: end; overflow: hidden; border-radius: 8px; background: #f5ede9; }
.water-calendar-bar i { width: 100%; background: #83b9bc; border-radius: 8px; }
.water-calendar-reached i { background: #91a070; }
.water-calendar-current .water-calendar-bar { box-shadow: inset 0 0 0 2px #efaa8d; }
.water-calendar-current > span:last-child { color: var(--berry); font-weight: 750; }
.water-calendar-week { margin-bottom: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 13px; }
.water-calendar-week summary span { float: right; margin-left: 6px; color: var(--muted); font-size: 11px; }
.water-calendar-week summary strong { color: var(--berry); font-size: 13px; }
#water-history-caption { margin: 6px 0 0; color: var(--muted); font-size: 12px; }

.profile-panel h3 {
  margin: 0 0 12px;
  color: var(--berry);
  font-size: 17px;
}

.profile-photo {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  clear: both;
  margin-bottom: 12px;
}

.profile-photo-preview {
  display: grid;
  place-items: center;
  width: clamp(56px, 16vw, 82px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f9dacb;
  color: var(--berry);
}

.profile-photo-preview svg { width: 52%; aspect-ratio: 1; fill: none; stroke: currentColor; stroke-width: 2; }

[data-profile-avatar], .lounge-post-avatar { overflow: hidden; }
[data-profile-avatar][data-has-photo] svg { display: none; }
[data-profile-avatar] img, .lounge-post-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.profile-photo h3 { margin-bottom: 3px; }
.profile-photo p { margin: 0 0 7px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.profile-photo p[role="status"] { margin: 4px 0 0; color: var(--berry); }
.profile-photo p[role="status"]:empty { margin: 0; }
.profile-photo-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-photo-actions button {
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  color: var(--berry);
  font-weight: 700;
}
.profile-photo [hidden] { display: none; }

.profile-fields {
  display: grid;
  gap: 11px;
}

.profile-panel label {
  display: block;
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
}

.profile-panel label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.profile-panel :is(input, select) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  margin-top: 5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 400;
}

.profile-sheet :focus-visible {
  outline: 2px solid var(--berry);
  outline-offset: 3px;
}

.profile-feedback,
.profile-plan p,
.profile-local-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.profile-feedback:empty {
  margin: 0;
}

.profile-plan dl {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  justify-content: space-between;
  margin: 0;
  font-size: 14px;
}

.profile-plan dd {
  margin: 0;
  color: var(--deep);
  font-weight: 650;
}

.profile-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 9px 14px;
  border: 1px solid var(--berry);
  border-radius: 13px;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
}

.profile-action[hidden] { display: none; }
.profile-action-outline { color: var(--berry); }
.profile-action-filled { background: var(--berry); color: var(--paper); }
.profile-plan .profile-action { margin-top: 16px; }

#subscription-dialog {
  align-items: center;
  padding: 16px;
  transition-property: opacity;
}

#subscription-dialog .subscription-sheet {
  width: min(100%, 490px);
  padding: clamp(20px, 5vw, 34px);
  border: 1px solid var(--line);
  border-radius: 25px;
  transform: translateY(24px);
}

#subscription-dialog.open .subscription-sheet { transform: none; }

.subscription-actions {
  display: grid;
  clear: both;
  gap: 12px;
}

.subscription-sheet .profile-local-note { margin-top: 12px; }

@media (min-width: 370px) {
  .profile-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 760px) {
  .profile-layout { grid-template-columns: minmax(0, 1fr) minmax(230px, .85fr); align-items: start; }
}
