/* Result tables and actions. Load after ui-refinement.css.
   Preserve the selected DOM representation and every native [hidden] state. */

.bath-result-view { min-width:0; max-width:100%; }
.bath-view-switch {
  display:flex; align-items:center; flex-wrap:wrap; gap:4px;
  width:fit-content; max-width:100%; margin:12px 0;
  padding:4px; border:1px solid var(--line); border-radius:8px;
  background:var(--sunk);
}
.bath-view-switch button[data-act="bathview"] {
  box-sizing:border-box; display:inline-flex; align-items:center; justify-content:center;
  min-width:88px; min-height:44px; max-width:100%; padding:8px 14px;
  border:1px solid transparent; border-radius:5px; background:transparent;
  color:var(--ink-2); font:inherit; font-size:.88rem; line-height:1.5;
  white-space:normal; overflow-wrap:anywhere; cursor:pointer;
}
.bath-view-switch button[data-act="bathview"][aria-pressed="true"] {
  border-color:var(--moss); background:var(--surface); color:var(--moss); font-weight:700;
}

.bath-result-table-wrap {
  box-sizing:border-box; min-width:0; max-width:100%; overflow-x:auto;
  overscroll-behavior-inline:contain; scrollbar-width:thin;
  margin:12px 0; border:1px solid var(--line); border-radius:8px;
  background:var(--surface);
}
.bath-result-table {
  width:100%; min-width:52rem; border-collapse:separate; border-spacing:0;
  table-layout:fixed; color:var(--ink); font-family:var(--f-body);
  font-size:.88rem; line-height:1.6;
}
.bath-result-table > caption {
  padding:12px; color:var(--ink-2); font-size:.82rem; line-height:1.6; text-align:left;
  overflow-wrap:anywhere;
}
.bath-result-table > thead > tr > th {
  padding:11px 12px; background:var(--sunk); color:var(--ink-2);
  border-block:1px solid var(--line); font-weight:600; text-align:left;
  vertical-align:bottom; overflow-wrap:anywhere;
}
.bath-result-table > thead > tr > :first-child { width:26%; }
.bath-result-table > thead > tr > :nth-child(2) { width:12%; }
.bath-result-table > thead > tr > :nth-child(3) { width:11%; }
.bath-result-table > thead > tr > :nth-child(4) { width:10%; }
.bath-result-table > thead > tr > :nth-child(5) { width:18%; }
.bath-result-table > thead > tr > :nth-child(6) { width:23%; }
.bath-result-table > tbody > tr > :is(th,td) {
  padding:12px; border-bottom:1px solid var(--line); vertical-align:top;
  text-align:left; font-weight:400; white-space:normal; overflow-wrap:anywhere;
}
.bath-result-table > tbody > tr:last-child > :is(th,td) { border-bottom:0; }
.bath-result-table > tbody > .bath-table-group > th {
  padding:10px 12px; background:var(--moss-l); color:var(--moss); font-weight:700;
}
.bath-result-table > tbody > tr[data-yu]:focus-within > :is(th,td) { background:var(--moss-l); }
.bath-result-table > tbody > tr:not(.bath-table-detail) :is(.bath-table-name,[data-act="bathtabletoggle"]) {
  box-sizing:border-box; display:block; width:100%; min-height:44px;
  padding:8px 0; border:0; border-radius:4px; background:none;
  color:var(--moss); font:inherit; font-size:1rem; font-weight:700; line-height:1.6;
  text-align:left; white-space:normal; overflow-wrap:anywhere;
  text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:4px;
  cursor:pointer;
}
.bath-result-table > tbody > tr:not(.bath-table-detail) :is(.bath-table-name,[data-act="bathtabletoggle"])[aria-expanded="true"] {
  color:var(--ink);
}
.bath-result-table .bath-table-subline {
  display:block; margin-top:2px; color:var(--ink-2); font-size:.8rem; line-height:1.6;
  font-weight:400; white-space:normal; overflow-wrap:anywhere;
}
.bath-result-table .bath-table-value { font-weight:700; font-variant-numeric:tabular-nums; }
.bath-result-table .bath-table-state { display:block; margin-top:4px; font-size:.8rem; line-height:1.6; }
.bath-result-table .bath-table-state .st {
  max-width:100%; white-space:normal; overflow-wrap:anywhere; align-items:flex-start;
  font-size:.76rem; line-height:1.5; padding:4px 6px;
}
.bath-result-table .bath-table-state .st::before { flex:none; margin-top:.35em; }

/* A map chooser grows within its own action cell; it never overlays another row. */
.bath-table-actions {
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:6px;
  min-width:0; max-width:100%;
}
.bath-table-actions > * { box-sizing:border-box; min-width:0; max-width:100%; margin:0; }
.bath-table-actions > :is(.saved-pick,.compare-pick),
.bath-table-actions > .facility-map > summary {
  box-sizing:border-box; position:static; display:flex; align-items:center; justify-content:center;
  gap:4px; width:100%; min-width:0; min-height:44px; padding:8px 5px;
  border:1px solid var(--line); border-radius:5px; background:var(--surface); color:var(--ink);
  font-family:var(--f-body); font-size:.84rem; font-weight:600; line-height:1.5;
  white-space:normal; overflow-wrap:anywhere; text-align:center; cursor:pointer; box-shadow:none;
}
.bath-table-actions > :is(.saved-pick,.compare-pick)[aria-pressed="true"] {
  border-color:var(--moss); background:var(--moss-l); color:var(--moss);
}
.bath-table-actions > .facility-map { width:100%; grid-column:1 / -1; }
.bath-table-actions > .facility-map > summary {
  border-color:var(--moss); background:var(--moss); color:var(--moss-ink);
}
.bath-table-actions > .facility-map[open] { grid-column:1 / -1; }
.bath-table-actions:has(> .facility-map[open]) { grid-template-columns:repeat(2,minmax(0,1fr)); }
.bath-table-actions > .facility-map > .place-options {
  position:static; box-sizing:border-box; width:100%; min-width:0; max-width:100%;
  margin:8px 0 0; padding:10px; border-radius:5px; box-shadow:none;
}
.bath-table-actions .place-providers { min-width:0; }
.bath-table-actions .place-query { font-family:var(--f-body); font-size:.88rem; }
.bath-table-actions :is(.place-provider,.place-copy,.place-routes a) {
  box-sizing:border-box; min-width:0; max-width:100%; min-height:44px;
  white-space:normal; overflow-wrap:anywhere;
}
.bath-table-actions > .note:only-child { grid-column:1 / -1; margin:0; }

/* The expanded body keeps the existing detailed card's typography and warnings. */
.bath-result-table > tbody > .bath-table-detail > td {
  padding:12px; background:var(--sunk);
}
.bath-table-detail > td > :is(ol,ul) { padding:0; margin:0; list-style:none; }
.bath-table-detail .oc {
  display:block; min-width:0; max-width:100%; margin:0; list-style:none;
}
.bath-table-detail .oc-table-detail { padding:0; }
.bath-table-detail .oc-table-detail > .ocb { border-top:0; }

.bath-result-view [hidden],
.bath-view-switch[hidden],
.bath-result-table-wrap[hidden],
.bath-result-table .bath-table-detail[hidden] { display:none!important; }
.bath-view-switch button:focus-visible,
.bath-result-table-wrap:focus-visible,
.bath-result-table :is(button,summary,a):focus-visible {
  outline:3px solid var(--moss); outline-offset:3px;
}

/* Reuse the existing dock and its measured height; favourite undo stays independent. */
.bath-action-bar {
  box-sizing:border-box; display:grid; grid-template-columns:repeat(3,minmax(0,1fr));
  align-items:stretch; gap:5px; min-width:0; width:100%; padding:5px;
  border:1px solid var(--line); border-radius:10px;
  background:var(--surface); color:var(--ink); box-shadow:var(--shadow-2);
}
.bath-action-bar[data-has-comparison="true"] {
  grid-template-columns:repeat(3,minmax(0,1fr)) 44px;
}
.bath-action-bar > button {
  box-sizing:border-box; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:1px;
  min-width:0; max-width:100%; min-height:44px; padding:7px 5px;
  border:1px solid transparent; border-radius:6px; background:transparent; color:var(--moss);
  font-family:var(--f-body); font-size:.9rem; font-weight:700; line-height:1.4;
  white-space:normal; overflow-wrap:anywhere; text-align:center; cursor:pointer;
}
.bath-action-bar > button small {
  display:block; max-width:100%; font-family:var(--f-body); font-size:.74rem;
  font-weight:400; line-height:1.45; white-space:normal; overflow-wrap:anywhere;
}
.bath-action-bar > button[aria-expanded="true"],
.bath-action-bar > button[aria-pressed="true"] {
  border-color:var(--moss); background:var(--moss-l); color:var(--moss);
}
.bath-action-bar > button[data-act="bathdockmap"][aria-pressed="true"],
.bath-action-bar[data-comparison-ready="true"] > button[data-act="compareopen"]:not(:disabled) {
  border-color:var(--moss); background:var(--moss); color:var(--moss-ink);
}
.bath-action-bar > button:disabled { opacity:.55; cursor:default; }
.bath-action-bar > .bath-dock-clear {
  width:44px; min-width:44px; min-height:44px; padding:0;
  color:var(--ink-2); font-size:1.35rem; font-weight:400;
}
.bath-action-bar > button:focus-visible { outline:3px solid var(--moss); outline-offset:2px; }

/* These later rules replace the old fixed comparing panel/toast offsets. */
body.external-maps .panel,
body[data-comparing="1"] .panel {
  padding-bottom:max(96px,calc(var(--action-dock-height,0px) + 32px + env(safe-area-inset-bottom,0px)));
}
body.external-maps .toast,
body[data-comparing="1"] .toast {
  bottom:calc(var(--action-dock-height,0px) + 28px + env(safe-area-inset-bottom,0px));
  max-width:calc(100% - 32px);
}
body.sheet-open #action-dock,
body.map-expanded-open #action-dock,
body:has(dialog[open]) #action-dock { visibility:hidden; pointer-events:none; }
#action-dock[hidden],#bath-action-bar[hidden],#compare-bar[hidden],#favorite-undo[hidden] {
  display:none!important;
}

/* JS must select cards and remove their hidden attribute when crossing 920px. */
@media screen and (max-width:919px) {
  .bath-view-switch,.bath-result-table-wrap { display:none; }
}
@media screen and (min-width:920px) {
  .bath-action-bar { display:none; }
}

@media print {
  .bath-view-switch,#action-dock { display:none!important; }
  .bath-result-table-wrap { overflow:visible; border-color:#999; border-radius:0; }
  .bath-result-table { min-width:0; width:100%; font-size:.8rem; table-layout:fixed; }
  .bath-result-table > thead { display:table-header-group; }
  .bath-result-table > thead > tr > th,
  .bath-result-table > tbody > tr > :is(th,td) { padding:6px; }
  .bath-table-actions { display:block; }
  .bath-table-actions > * { margin-bottom:4px; }
  .bath-table-actions > .facility-map > .place-options { border:0; padding:0; }
  .bath-result-table tr { break-inside:avoid; }
}

/* v217: secondary area guides stay below the primary day-bath results. */
.yamayu-area-badge{display:inline-flex;max-inline-size:100%;gap:.25rem;align-items:baseline;white-space:normal;overflow-wrap:anywhere;font-size:.875rem;line-height:1.45;color:var(--muted,#526159)}
.yamayu-area-help{margin:1.25rem 0;border:1px solid var(--line,#dce2dc);border-radius:12px;background:#fff}
.yamayu-area-help>summary{min-height:44px;padding:.9rem 1rem;font-weight:700;cursor:pointer;line-height:1.5;overflow-wrap:anywhere}
.yamayu-area-help-body{padding:0 1rem 1rem;min-width:0}
.yamayu-area-help details>summary{padding:.65rem .1rem;min-height:44px;cursor:pointer;line-height:1.5}
.yamayu-area-help ul{padding-inline-start:1.25rem}
.yamayu-area-help li{margin:.55rem 0;overflow-wrap:anywhere;line-height:1.7}
.yamayu-area-help p,.yamayu-area-help small{font-size:.875rem;line-height:1.7}
.yamayu-area-help a{overflow-wrap:anywhere}
.yamayu-area-help h3{font-size:1rem;margin:1rem 0 .5rem}
@media(max-width:480px){.yamayu-area-help>summary{padding:.8rem .75rem}.yamayu-area-help-body{padding:0 .75rem .75rem}}

/* v223: compact catalogue controls keep the first facility close to the heading. */
body[data-view="catalog"] .catalog-intro--compact {
  display:block; min-width:0; padding-bottom:8px!important;
}
body[data-view="catalog"] .catalog-intro--compact .h1 {
  margin:0; font-size:clamp(1.35rem,3.6vw,1.6rem); line-height:1.4;
  white-space:normal; overflow-wrap:anywhere;
}
.catalog-main-tools {
  position:sticky; top:var(--catalog-top,70px); z-index:30;
  display:grid; grid-template-columns:minmax(0,1fr); gap:8px;
  min-width:0; margin:0 0 6px; padding:6px 0;
  border-bottom:1px solid var(--line); background:var(--surface);
}
.catalog-bathing-picker {
  display:inline-flex; align-items:center; gap:8px; justify-self:start;
  min-width:0; max-width:100%; margin:0; color:var(--ink-2);
  font-family:var(--f-body); font-size:.875rem; line-height:1.5;
}
.catalog-bathing-picker select {
  box-sizing:border-box; width:auto; min-width:0; max-width:100%; min-height:44px;
  padding:8px 30px 8px 10px; border:1px solid var(--line); border-radius:6px;
  background:var(--surface); color:var(--ink); font:inherit; font-size:1rem;
}
.catalog-main-tools .catalog-toolbar {
  position:static; min-width:0; margin:0; padding:0; border:0;
  background:transparent;
}
.catalog-main-tools:not(:has(.catalog-bathing-picker)) { display:block; }
.catalog-main-tools .catalog-toolbar-row {
  display:grid; grid-template-columns:auto auto minmax(0,1fr);
  align-items:center; gap:8px; min-width:0;
}
.catalog-main-tools .catalog-toolbar-row h2 {
  min-width:0; margin:0; font-size:1.25rem; line-height:1.4;
}
.catalog-main-tools .catalog-toolbar-row h2 small { font-size:.8rem; }
.catalog-main-tools .catalog-toolbar-row > .btn {
  min-width:44px; min-height:44px; padding:7px 10px; font-size:.875rem;
}
.catalog-main-tools .catalog-sort {
  grid-column:auto; display:block; width:100%; max-width:none; min-width:0;
}
.catalog-main-tools .catalog-sort select {
  box-sizing:border-box; width:100%; max-width:100%; min-width:0; min-height:44px;
  border-radius:6px; font-size:.875rem; line-height:1.5;
}
body[data-view="catalog"] .catalog-active-filters { margin:6px 0; }
body[data-view="catalog"] .quick-bath-filters { margin:6px 0; gap:6px; }
body[data-view="catalog"] .catalog-result-note { margin:5px 0 9px; }
.catalog-result-utilities {
  display:grid; gap:4px; margin:18px 0 12px; padding-top:8px;
  border-top:1px solid var(--line);
}
.catalog-result-utilities .catalog-secondary-actions { margin:0; }
.catalog-result-utilities .catalog-purpose {
  min-width:0; margin:0; border-top:1px solid var(--line);
}
.catalog-result-utilities .catalog-purpose > summary {
  min-height:44px; padding:10px 0; font-size:.875rem; line-height:1.5;
  color:var(--ink-2); cursor:pointer; overflow-wrap:anywhere;
}

/* A search without a parking origin has three useful decision facts. */
.oc .bath-facts.bath-facts--3,
.oc.oc-compact .bath-facts.bath-facts--3 {
  grid-template-columns:repeat(3,minmax(0,1fr)); column-gap:10px;
}
.bath-result-table[data-has-drive="false"] { min-width:46rem; }
.bath-result-table[data-has-drive="false"] > thead > tr > :first-child { width:30%; }
.bath-result-table[data-has-drive="false"] > thead > tr > :nth-child(2) { width:13%; }
.bath-result-table[data-has-drive="false"] > thead > tr > :nth-child(3) { width:13%; }
.bath-result-table[data-has-drive="false"] > thead > tr > :nth-child(4) { width:20%; }
.bath-result-table[data-has-drive="false"] > thead > tr > :nth-child(5) { width:24%; }
.bath-result-table[data-has-receipt="true"] { min-width:60rem; }
.bath-result-table[data-has-receipt="true"] > thead > tr > :first-child { width:25%; }
.bath-result-table[data-has-receipt="true"] > thead > tr > :nth-child(2) { width:12%; }
.bath-result-table[data-has-receipt="true"] > thead > tr > :nth-child(3) { width:12%; }
.bath-result-table[data-has-receipt="true"] > thead > tr > :nth-child(4) { width:10%; }
.bath-result-table[data-has-receipt="true"] > thead > tr > :nth-child(5) { width:10%; }
.bath-result-table[data-has-receipt="true"] > thead > tr > :nth-child(6) { width:14%; }
.bath-result-table[data-has-receipt="true"] > thead > tr > :nth-child(7) { width:17%; }

/* Opening an external map is a choice alongside saving and comparing. */
.oc .card-quick-actions { grid-template-columns:1.65fr 1fr 1fr; }
.oc .card-quick-actions > .quick-facility-map > summary,
.bath-table-actions > .facility-map > summary {
  border-color:var(--line); background:var(--surface); color:var(--ink);
}
.oc .card-quick-actions > .quick-facility-map[open] > summary,
.bath-table-actions > .facility-map[open] > summary {
  border-color:var(--moss); background:var(--moss-l); color:var(--moss);
}
.catalog-bathing-picker select:focus-visible,
.catalog-main-tools :is(button,select):focus-visible {
  outline:3px solid var(--lake); outline-offset:2px;
}
body[data-view="yu"] .back {
  min-width:0; max-width:100%; white-space:normal; overflow-wrap:anywhere;
  text-align:left; line-height:1.5;
}
body[data-view="yu"] .back::before { flex:none; }
@media screen and (min-width:700px) {
  .catalog-main-tools {
    grid-template-columns:minmax(0,auto) minmax(0,1fr); align-items:center; gap:14px;
  }
  .catalog-main-tools .catalog-toolbar-row { grid-template-columns:auto auto minmax(170px,1fr); }
}
@media screen and (min-width:920px) {
  .catalog-main-tools { top:0; }
}
@media screen and (max-width:359px) {
  .catalog-main-tools .catalog-toolbar-row { grid-template-columns:minmax(0,1fr) auto; }
  .catalog-main-tools .catalog-sort { grid-column:1 / -1; }
  .oc .card-quick-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .oc .card-quick-actions > .quick-facility-map { grid-column:1 / -1; }
}
@media print {
  .catalog-main-tools { position:static; }
  .bath-result-table[data-has-drive="false"],
  .bath-result-table[data-has-receipt="true"] { min-width:0; }
}

/* A comparison decision opens the existing individual facility page. */
.comparison-facility-link { display:flex; align-items:center; min-height:44px; max-width:100%; color:var(--moss); font-weight:700; line-height:1.5; overflow-wrap:anywhere; text-decoration:underline; text-underline-offset:.18em; }
.comparison-facility-link:focus-visible { outline:3px solid var(--moss); outline-offset:3px; }
