/* WalkAtlas Stage 4B — owner Profile: Walked / Saved & Planned / Added.
   Load after profile-stage4a.css. Add hooks to the existing renderer.
   Scope is intentionally limited to the owner Profile's list content.
   Never apply these hooks to the map, visitor Profile or shared walk detail.
   Existing action attributes, visibility checks and expanded-state logic stay.
   CSS is presentation only: the thumbnail refresh bug requires a JS fix. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b {
  --p4b-ink: var(--p4-ink, #173c30);
  --p4b-text: var(--p4-text, #263d35);
  --p4b-muted: var(--p4-muted, #52665c);
  --p4b-green: var(--p4-green, #236b43);
  --p4b-dark: var(--p4-green-dark, #175333);
  --p4b-soft: var(--p4-soft, #edf5ed);
  --p4b-paper: var(--p4-paper, #fff);
  --p4b-bg: var(--p4-bg, #f5f7f3);
  --p4b-line: var(--p4-line, #dce5dc);
  --p4b-strong: var(--p4-strong-line, #849b89);
  --p4b-focus: var(--p4-focus, #176f9f);
  --p4b-danger: var(--p4-alert, #a51d35);
  --p4b-amber: var(--p4-amber, #805509);
  --p4b-amber-bg: var(--p4-amber-bg, #fff5db);
  --p4b-radius: var(--p4-radius, 14px);
  container-name: wa-profile-walklists;
  container-type: inline-size;
  min-inline-size: 0;
  max-inline-size: 100%;
  margin: 12px 0 0;
  color: var(--p4b-text);
  font-family: inherit;
  line-height: 1.45;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b,
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b *,
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b *::before,
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b *::after { box-sizing: border-box; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b[hidden],
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b [hidden] { display: none !important; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b :is(button,a,summary,input,select,textarea):focus-visible {
  outline: 3px solid var(--p4b-focus); outline-offset: 2px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b .wa-p4b-icon {
  inline-size: 18px; block-size: 18px; flex: 0 0 auto; color: inherit;
}
/* 1. One list heading, not a summary bar plus a duplicated title. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-heading {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 4px 12px; margin: 0 0 10px; padding: 2px 2px 0;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-title {
  margin: 0; color: var(--p4b-ink); font-size: 18px; font-weight: 780; line-height: 1.3;
  overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-count {
  color: var(--p4b-muted); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-section { min-inline-size: 0; margin: 0 0 16px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-subheading {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 4px 10px; margin: 0 0 8px; padding: 0 2px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-subtitle {
  margin: 0; font-size: 14px; font-weight: 750; color: var(--p4b-ink); overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-list {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; min-inline-size: 0;
  margin: 0; padding: 0; list-style: none;
}
/* 2. Shared route card. Category accents correspond to the existing map key. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card {
  --p4b-accent: #236b43; --p4b-tint: #edf5ed; --p4b-cat-text: #175333;
  min-inline-size: 0; margin: 0; padding: 0;
  border: 1px solid var(--p4b-line); border-inline-start: 3px solid var(--p4b-accent);
  border-radius: var(--p4b-radius); background: var(--p4b-paper); box-shadow: none;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card[data-kind="saved"],
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-badge[data-kind="saved"] {
  --p4b-accent: #087ba5; --p4b-tint: #e9f4f9; --p4b-cat-text: #175575;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card[data-kind="planned"],
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-badge[data-kind="planned"] {
  --p4b-accent: #7654bc; --p4b-tint: #f0ebfb; --p4b-cat-text: #54398c;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card[data-kind="added"],
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-badge[data-kind="added"] {
  --p4b-accent: #aa7a19; --p4b-tint: #faf2dd; --p4b-cat-text: #805509;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-badge[data-kind="completed"] {
  --p4b-tint: #edf5ed; --p4b-cat-text: #175333;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card[data-expanded="true"] {
  border-color: var(--p4b-strong); border-inline-start-color: var(--p4b-accent);
}
/* Attach to the EXISTING expand button. If it has sibling actions, do not
   nest them inside it: use a layout row and keep those actions separate. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-toggle {
  display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center;
  gap: 8px; inline-size: 100%; min-inline-size: 0; min-block-size: 72px;
  padding: 12px 10px 12px 12px; margin: 0; border: 0; border-radius: inherit;
  background: transparent; color: var(--p4b-text); box-shadow: none;
  font: inherit; text-align: start; white-space: normal; cursor: pointer;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-toggle[aria-expanded="true"] {
  background: var(--p4b-bg); border-end-start-radius: 0; border-end-end-radius: 0;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-route-main { min-inline-size: 0; display: grid; gap: 5px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-route-name {
  font-size: 15px; font-weight: 760; line-height: 1.35; color: var(--p4b-ink); overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] :is(.wa-p4b-meta,.wa-p4b-metrics,.wa-p4b-badges) {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-inline-size: 0;
}
#panel #accountWalkSections[data-wa-profile-4a] :is(.wa-p4b-meta,.wa-p4b-metrics) {
  color: var(--p4b-muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-metric {
  display: inline-flex; align-items: center; gap: 4px; min-inline-size: 0; max-inline-size: 100%;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-metric .wa-p4b-icon { inline-size: 14px; block-size: 14px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-badge {
  display: inline-flex; align-items: center; gap: 4px; max-inline-size: 100%;
  padding: 3px 8px; border-radius: 999px; background: var(--p4b-tint, var(--p4b-soft));
  color: var(--p4b-cat-text, var(--p4b-dark)); font-size: 11px; font-weight: 700;
  line-height: 1.4; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-badge[data-kind="visibility"] {
  background: var(--p4b-bg); color: var(--p4b-muted);
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-chevron {
  display: grid; place-items: center; inline-size: 40px; block-size: 40px; justify-self: end;
  border: 1px solid var(--p4b-line); border-radius: 10px; background: var(--p4b-paper); color: var(--p4b-dark);
  pointer-events: none;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-toggle[aria-expanded="true"] .wa-p4b-chevron {
  background: var(--p4b-soft); border-color: var(--p4b-strong);
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-toggle[aria-expanded="true"] .wa-p4b-chevron svg { transform: rotate(180deg); }
/* 3. Expanded records: the same article, not a second unrelated card.
   A heading for every logged completion, with existing record actions. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-detail {
  min-inline-size: 0; padding: 12px; border-block-start: 1px solid var(--p4b-line);
  background: var(--p4b-paper); border-radius: 0 0 calc(var(--p4b-radius) - 1px) calc(var(--p4b-radius) - 1px);
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-log + .wa-p4b-log {
  margin-block-start: 15px; padding-block-start: 15px; border-block-start: 1px solid var(--p4b-line);
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-log-title {
  margin: 0 0 9px; color: var(--p4b-ink); font-size: 14px; font-weight: 760;
  line-height: 1.4; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px;
  margin: 0 0 10px; padding: 0;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-fact {
  display: grid; align-content: start; gap: 3px; min-inline-size: 0; padding: 8px 9px;
  background: var(--p4b-bg); border-radius: 9px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-fact--wide { grid-column: 1 / -1; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-fact :is(dt,.wa-p4b-fact-label) { color: var(--p4b-muted); font-size: 11px; font-weight: 650; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-fact :is(dd,.wa-p4b-fact-value) {
  margin: 0; color: var(--p4b-ink); font-size: 13px; font-weight: 700; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-field { margin: 10px 0; min-inline-size: 0; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-field-label { display: block; font-size: 12px; font-weight: 750; color: var(--p4b-ink); margin-block-end: 3px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-field-value {
  margin: 0; font-size: 13px; color: var(--p4b-text); white-space: pre-wrap; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] :is(.wa-p4b-field-value,.wa-p4b-fact-value)[data-empty="true"] { color: var(--p4b-muted); font-weight: 400; }
/* Preview thumbnails reserve their own size. Do not mask an image reload
   with transitions or animation. Stable DOM and authorized delivery are JS tasks. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-previews {
  display: flex; flex-wrap: wrap; align-items: start; gap: 8px; margin: 6px 0 0; min-inline-size: 0;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-thumb {
  position: relative; display: grid; place-items: center; inline-size: 84px; block-size: 84px;
  max-inline-size: 100%; padding: 0; margin: 0; border: 1px solid var(--p4b-line); border-radius: 10px;
  background: var(--p4b-bg); color: var(--p4b-muted); box-shadow: none; overflow: hidden;
  font: inherit; text-align: center;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-thumb img {
  display: block; inline-size: 100%; block-size: 100%; object-fit: cover; border-radius: inherit;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-thumb-state { font-size: 11px; padding: 4px; overflow-wrap: anywhere; }
/* 4. Owner actions. Retain all original controls/confirmation handlers. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-actions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px;
  min-inline-size: 0; margin-block-start: 12px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-inline-size: 0; min-block-size: 44px; inline-size: 100%; padding: 8px;
  border: 1px solid var(--p4b-strong); border-radius: 9px; background: var(--p4b-paper);
  color: var(--p4b-dark); box-shadow: none; font: inherit; font-size: 12px; font-weight: 700;
  line-height: 1.35; text-align: center; text-decoration: none; white-space: normal; overflow-wrap: anywhere; cursor: pointer;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-action--primary {
  grid-column: 1 / -1; background: var(--p4b-green); border-color: var(--p4b-green); color: #fff;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-action--danger {
  grid-column: 1 / -1; color: var(--p4b-danger); border-color: #d6a5af; background: #fffafa;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-action--wide { grid-column: 1 / -1; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-action:is(:disabled,[aria-disabled="true"]) {
  cursor: not-allowed; opacity: .65;
}
/* 5. Overdue plans: a visible count and intentional disclosure.
   JS/HTML owns the expanded state; never conceal pending actions with CSS alone. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminders {
  min-inline-size: 0; margin-block-end: 14px; border: 1px solid #dbc38f; border-radius: var(--p4b-radius);
  background: var(--p4b-amber-bg); color: var(--p4b-amber);
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminders-toggle {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px;
  inline-size: 100%; min-inline-size: 0; min-block-size: 52px; padding: 10px 12px; margin: 0;
  border: 0; border-radius: inherit; background: transparent; color: var(--p4b-amber);
  box-shadow: none; text-align: start; font: inherit; cursor: pointer; white-space: normal;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder-heading { display: grid; gap: 2px; min-inline-size: 0; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder-heading strong { font-size: 14px; overflow-wrap: anywhere; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder-heading small { font-size: 12px; overflow-wrap: anywhere; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminders-toggle[aria-expanded="true"] .wa-p4b-reminder-chevron { transform: rotate(180deg); }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder-list { display: grid; gap: 8px; padding: 0 9px 9px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder {
  min-inline-size: 0; padding: 11px; border: 1px solid #e8d7b1; border-radius: 10px;
  background: var(--p4b-paper); color: var(--p4b-text);
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder .wa-p4b-title { font-size: 14px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder .wa-p4b-actions { margin-block-start: 8px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder .wa-p4b-action--primary,
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder .wa-p4b-action--danger { grid-column: auto; }
/* 6. Empty, loading and error surfaces remain distinct and meaningful. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-state {
  display: grid; justify-items: start; gap: 6px; min-inline-size: 0; padding: 14px;
  border: 1px solid var(--p4b-line); border-radius: var(--p4b-radius); background: var(--p4b-bg);
  color: var(--p4b-muted); font-size: 13px; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-state strong { color: var(--p4b-ink); font-size: 14px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-state[data-state="error"] { border-color: #d6a5af; color: var(--p4b-danger); }
@media (hover: hover) and (pointer: fine) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-toggle:hover { background: var(--p4b-bg); }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-action:not(:disabled):not([aria-disabled="true"]):hover { background: var(--p4b-soft); }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-action--primary:not(:disabled):not([aria-disabled="true"]):hover { background: var(--p4b-dark); }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-action--danger:not(:disabled):not([aria-disabled="true"]):hover { background: #fbecef; }
}
/* Panel width, not viewport width. Conservative two-column fallback. */
@container wa-profile-walklists (min-width: 460px) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-toggle { padding: 13px 14px; }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-detail { padding: 14px; }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder .wa-p4b-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-thumb { inline-size: 96px; block-size: 96px; }
}
@container wa-profile-walklists (max-width: 235px) {
  #panel #accountWalkSections[data-wa-profile-4a] :is(.wa-p4b-facts,.wa-p4b-actions,.wa-p4b-reminder .wa-p4b-actions) { grid-template-columns: minmax(0, 1fr); }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-toggle { gap: 4px; padding: 9px 6px; }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-detail { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b :is(.wa-p4b-chevron,.wa-p4b-reminder-chevron,.wa-p4b-toggle,.wa-p4b-action) { transition: none; animation: none; }
}

/* Compatibility for the existing route table, expanded row and delegated actions. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b { margin-inline: 12px; padding-block-end: 14px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b table.wa-p4b-list { inline-size: 100%; border: 0; background: transparent; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-list > .wa-p4b-card,
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card > tr,
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card > tr > td { display: block; min-inline-size: 0; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card > tr,
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card > tr > td {
  inline-size: 100%; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card > tr:first-child { border-radius: inherit; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-card > tr:first-child > td { border-radius: inherit; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-log .walkLogBody { font-size: 13px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b .walkLogPhotos { padding: 0; margin: 0 0 10px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b .wa-p4b-thumb { cursor: pointer; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b .wa-p4b-thumb-state:not([hidden]) {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--p4b-bg);
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b .wa-p4b-action--danger { margin-block-start: 4px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminder .wa-p4b-action--danger { margin-block-start: 0; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b .profileSavedActionCard {
  padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b :is(.wa-p4b-plan-fields,.wa-p4b-added-fields) { display: grid; gap: 8px; min-inline-size: 0; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b .plannedProfileEditForm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b .plannedProfileEditForm > :nth-child(n+3) { grid-column: 1 / -1; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b .plannedProfileEditForm :is(input:not([type="checkbox"]),textarea) { min-inline-size: 0; inline-size: 100%; min-block-size: 44px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-state .profileTabEmptyState { border: 0; padding: 0; background: transparent; box-shadow: none; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-state .profile-empty-action-button { min-block-size: 44px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminders-toggle { list-style: none; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4b-reminders-toggle::-webkit-details-marker { display: none; }
@container wa-profile-walklists (max-width: 235px) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b .plannedProfileEditForm { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4b { margin-inline: 6px; }
}
